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

@headlessui/react

Package Overview
Dependencies
Maintainers
4
Versions
727
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@headlessui/react - npm Package Compare versions

Comparing version 0.0.0-insiders.ef3e154 to 0.0.0-insiders.ef78d58

dist/components/button/button.d.ts

209

dist/components/combobox/combobox.d.ts

@@ -1,118 +0,135 @@

import React, { ElementType, Ref } from 'react';
import { ByComparator, EnsureArray, Expand, Props } from '../../types.js';
import { PropsForFeatures } from '../../utils/render.js';
import React, { type ElementType, type Ref } from 'react';
import { type ByComparator } from '../../hooks/use-by-comparator.js';
import { type AnchorProps } from '../../internal/floating.js';
import type { EnsureArray, Props } from '../../types.js';
import { type HasDisplayName, type PropsForFeatures, type RefProp } from '../../utils/render.js';
import { type _internal_ComponentLabel } from '../label/label.js';
declare let DEFAULT_COMBOBOX_TAG: React.ExoticComponent<{
children?: React.ReactNode;
}>;
interface ComboboxRenderPropArg<T> {
type ComboboxRenderPropArg<TValue, TActive = TValue> = {
open: boolean;
disabled: boolean;
activeIndex: number | null;
activeOption: T | null;
value: T;
}
declare type O = 'value' | 'defaultValue' | 'nullable' | 'multiple' | 'onChange' | 'by';
declare type ComboboxValueProps<TValue, TNullable extends boolean | undefined, TMultiple extends boolean | undefined, TTag extends ElementType> = Extract<({
value?: EnsureArray<TValue>;
defaultValue?: EnsureArray<TValue>;
nullable: true;
multiple: true;
onChange?(value: EnsureArray<TValue>): void;
by?: ByComparator<TValue>;
} & Props<TTag, ComboboxRenderPropArg<EnsureArray<TValue>>, O>) | ({
value?: TValue | null;
defaultValue?: TValue | null;
nullable: true;
multiple?: false;
onChange?(value: TValue | null): void;
by?: ByComparator<TValue | null>;
} & Expand<Props<TTag, ComboboxRenderPropArg<TValue | null>, O>>) | ({
value?: EnsureArray<TValue>;
defaultValue?: EnsureArray<TValue>;
nullable?: false;
multiple: true;
onChange?(value: EnsureArray<TValue>): void;
by?: ByComparator<TValue extends Array<infer U> ? U : TValue>;
} & Expand<Props<TTag, ComboboxRenderPropArg<EnsureArray<TValue>>, O>>) | ({
value?: TValue;
nullable?: false;
multiple?: false;
defaultValue?: TValue;
onChange?(value: TValue): void;
by?: ByComparator<TValue>;
} & Props<TTag, ComboboxRenderPropArg<TValue>, O>), {
nullable?: TNullable;
activeOption: TActive | null;
value: TValue;
};
export type ComboboxProps<TValue, TMultiple extends boolean | undefined, TTag extends ElementType = typeof DEFAULT_COMBOBOX_TAG> = Props<TTag, ComboboxRenderPropArg<NoInfer<TValue>>, 'value' | 'defaultValue' | 'multiple' | 'onChange' | 'by', {
value?: TMultiple extends true ? EnsureArray<TValue> : TValue;
defaultValue?: TMultiple extends true ? EnsureArray<NoInfer<TValue>> : NoInfer<TValue>;
onChange?(value: TMultiple extends true ? EnsureArray<NoInfer<TValue>> : NoInfer<TValue> | null): void;
by?: ByComparator<TMultiple extends true ? EnsureArray<NoInfer<TValue>>[number] : NoInfer<TValue>>;
/** @deprecated The `<Combobox />` is now nullable default */
nullable?: boolean;
multiple?: TMultiple;
}>;
declare type ComboboxProps<TValue, TNullable extends boolean | undefined, TMultiple extends boolean | undefined, TTag extends ElementType> = ComboboxValueProps<TValue, TNullable, TMultiple, TTag> & {
disabled?: boolean;
form?: string;
name?: string;
immediate?: boolean;
virtual?: {
options: TMultiple extends true ? EnsureArray<NoInfer<TValue>> : NoInfer<TValue>[];
disabled?: (value: TMultiple extends true ? EnsureArray<NoInfer<TValue>>[number] : NoInfer<TValue>) => boolean;
} | null;
onClose?(): void;
__demoMode?: boolean;
name?: string;
};
declare function ComboboxFn<TValue, TTag extends ElementType = typeof DEFAULT_COMBOBOX_TAG>(props: ComboboxProps<TValue, true, true, TTag>, ref: Ref<TTag>): JSX.Element;
declare function ComboboxFn<TValue, TTag extends ElementType = typeof DEFAULT_COMBOBOX_TAG>(props: ComboboxProps<TValue, true, false, TTag>, ref: Ref<TTag>): JSX.Element;
declare function ComboboxFn<TValue, TTag extends ElementType = typeof DEFAULT_COMBOBOX_TAG>(props: ComboboxProps<TValue, false, false, TTag>, ref: Ref<TTag>): JSX.Element;
declare function ComboboxFn<TValue, TTag extends ElementType = typeof DEFAULT_COMBOBOX_TAG>(props: ComboboxProps<TValue, false, true, TTag>, ref: Ref<TTag>): JSX.Element;
interface InputRenderPropArg {
}>;
declare function ComboboxFn<TValue, TTag extends ElementType = typeof DEFAULT_COMBOBOX_TAG>(props: ComboboxProps<TValue, boolean | undefined, TTag>, ref: Ref<HTMLElement>): React.JSX.Element;
declare let DEFAULT_INPUT_TAG: "input";
type InputRenderPropArg = {
open: boolean;
disabled: boolean;
}
declare type InputPropsWeControl = 'role' | 'aria-labelledby' | 'aria-expanded' | 'aria-activedescendant' | 'onKeyDown' | 'onChange' | 'displayValue';
interface ButtonRenderPropArg {
hover: boolean;
focus: boolean;
autofocus: boolean;
};
type InputPropsWeControl = 'aria-activedescendant' | 'aria-autocomplete' | 'aria-controls' | 'aria-expanded' | 'aria-labelledby' | 'disabled' | 'role';
export type ComboboxInputProps<TTag extends ElementType = typeof DEFAULT_INPUT_TAG, TType = string> = Props<TTag, InputRenderPropArg, InputPropsWeControl, {
defaultValue?: TType;
disabled?: boolean;
displayValue?(item: TType): string;
onChange?(event: React.ChangeEvent<HTMLInputElement>): void;
autoFocus?: boolean;
}>;
declare function InputFn<TTag extends ElementType = typeof DEFAULT_INPUT_TAG, TType = Parameters<typeof ComboboxRoot>[0]['value']>(props: ComboboxInputProps<TTag, TType>, ref: Ref<HTMLInputElement>): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
declare let DEFAULT_BUTTON_TAG: "button";
type ButtonRenderPropArg = {
open: boolean;
active: boolean;
disabled: boolean;
value: any;
}
declare type ButtonPropsWeControl = 'type' | 'tabIndex' | 'aria-haspopup' | 'aria-controls' | 'aria-expanded' | 'aria-labelledby' | 'disabled' | 'onClick' | 'onKeyDown';
interface LabelRenderPropArg {
focus: boolean;
hover: boolean;
};
type ButtonPropsWeControl = 'aria-controls' | 'aria-expanded' | 'aria-haspopup' | 'aria-labelledby' | 'disabled' | 'tabIndex';
export type ComboboxButtonProps<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG> = Props<TTag, ButtonRenderPropArg, ButtonPropsWeControl, {
autoFocus?: boolean;
disabled?: boolean;
}>;
declare function ButtonFn<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG>(props: ComboboxButtonProps<TTag>, ref: Ref<HTMLButtonElement>): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
declare let DEFAULT_OPTIONS_TAG: "div";
type OptionsRenderPropArg = {
open: boolean;
disabled: boolean;
}
declare type LabelPropsWeControl = 'ref' | 'onClick';
interface OptionsRenderPropArg {
open: boolean;
}
declare type OptionsPropsWeControl = 'aria-activedescendant' | 'aria-labelledby' | 'hold' | 'onKeyDown' | 'role' | 'tabIndex';
option: any;
};
type OptionsPropsWeControl = 'aria-labelledby' | 'aria-multiselectable' | 'role' | 'tabIndex';
declare let OptionsRenderFeatures: number;
interface OptionRenderPropArg {
export type ComboboxOptionsProps<TTag extends ElementType = typeof DEFAULT_OPTIONS_TAG> = Props<TTag, OptionsRenderPropArg, OptionsPropsWeControl, PropsForFeatures<typeof OptionsRenderFeatures> & {
hold?: boolean;
anchor?: AnchorProps;
portal?: boolean;
modal?: boolean;
transition?: boolean;
}>;
declare function OptionsFn<TTag extends ElementType = typeof DEFAULT_OPTIONS_TAG>(props: ComboboxOptionsProps<TTag>, ref: Ref<HTMLElement>): React.JSX.Element;
declare let DEFAULT_OPTION_TAG: "div";
type OptionRenderPropArg = {
focus: boolean;
/** @deprecated use `focus` instead */
active: boolean;
selected: boolean;
disabled: boolean;
};
type OptionPropsWeControl = 'role' | 'tabIndex' | 'aria-disabled' | 'aria-selected';
export type ComboboxOptionProps<TTag extends ElementType = typeof DEFAULT_OPTION_TAG, TType = string> = Props<TTag, OptionRenderPropArg, OptionPropsWeControl, {
disabled?: boolean;
value: TType;
order?: number;
}>;
declare function OptionFn<TTag extends ElementType = typeof DEFAULT_OPTION_TAG, TType = Parameters<typeof ComboboxRoot>[0]['value']>(props: ComboboxOptionProps<TTag, TType>, ref: Ref<HTMLElement>): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
export interface _internal_ComponentCombobox extends HasDisplayName {
<TValue, TMultiple extends boolean | undefined = false, TTag extends ElementType = typeof DEFAULT_COMBOBOX_TAG>(props: ComboboxProps<TValue, TMultiple, TTag> & RefProp<typeof ComboboxFn>): JSX.Element;
}
declare type ComboboxOptionPropsWeControl = 'role' | 'tabIndex' | 'aria-disabled' | 'aria-selected';
export declare let Combobox: typeof ComboboxFn & {
displayName: string;
} & {
Input: (<TTag extends React.ElementType<any> = "input", TType = {}[] | undefined>(props: Props<TTag, InputRenderPropArg, InputPropsWeControl> & {
displayValue?(item: TType): string;
onChange(event: React.ChangeEvent<HTMLInputElement>): void;
}, ref: Ref<HTMLInputElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
};
Button: (<TTag_1 extends React.ElementType<any> = "button">(props: Props<TTag_1, ButtonRenderPropArg, ButtonPropsWeControl>, ref: Ref<HTMLButtonElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
};
Label: (<TTag_2 extends React.ElementType<any> = "label">(props: Props<TTag_2, LabelRenderPropArg, LabelPropsWeControl>, ref: Ref<HTMLLabelElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
};
Options: (<TTag_3 extends React.ElementType<any> = "ul">(props: Props<TTag_3, OptionsRenderPropArg, OptionsPropsWeControl> & (({
static?: undefined;
} & {
unmount?: boolean | undefined;
}) | ({
unmount?: undefined;
} & {
static?: boolean | undefined;
})) & {
hold?: boolean | undefined;
}, ref: Ref<HTMLUListElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
};
Option: (<TTag_4 extends React.ElementType<any> = "li", TType_1 = {}[] | undefined>(props: Props<TTag_4, OptionRenderPropArg, "value" | ComboboxOptionPropsWeControl> & {
disabled?: boolean | undefined;
value: TType_1;
}, ref: Ref<HTMLLIElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
};
export interface _internal_ComponentComboboxButton extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG>(props: ComboboxButtonProps<TTag> & RefProp<typeof ButtonFn>): JSX.Element;
}
export interface _internal_ComponentComboboxInput extends HasDisplayName {
<TType, TTag extends ElementType = typeof DEFAULT_INPUT_TAG>(props: ComboboxInputProps<TTag, TType> & RefProp<typeof InputFn>): JSX.Element;
}
export interface _internal_ComponentComboboxLabel extends _internal_ComponentLabel {
}
export interface _internal_ComponentComboboxOptions extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_OPTIONS_TAG>(props: ComboboxOptionsProps<TTag> & RefProp<typeof OptionsFn>): JSX.Element;
}
export interface _internal_ComponentComboboxOption extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_OPTION_TAG, TType = Parameters<typeof ComboboxRoot>[0]['value']>(props: ComboboxOptionProps<TTag, TType> & RefProp<typeof OptionFn>): JSX.Element;
}
declare let ComboboxRoot: _internal_ComponentCombobox;
export declare let ComboboxButton: _internal_ComponentComboboxButton;
export declare let ComboboxInput: _internal_ComponentComboboxInput;
/** @deprecated use `<Label>` instead of `<ComboboxLabel>` */
export declare let ComboboxLabel: _internal_ComponentComboboxLabel;
export declare let ComboboxOptions: _internal_ComponentComboboxOptions;
export declare let ComboboxOption: _internal_ComponentComboboxOption;
export declare let Combobox: _internal_ComponentCombobox & {
/** @deprecated use `<ComboboxInput>` instead of `<Combobox.Input>` */
Input: _internal_ComponentComboboxInput;
/** @deprecated use `<ComboboxButton>` instead of `<Combobox.Button>` */
Button: _internal_ComponentComboboxButton;
/** @deprecated use `<Label>` instead of `<Combobox.Label>` */
Label: _internal_ComponentComboboxLabel;
/** @deprecated use `<ComboboxOptions>` instead of `<Combobox.Options>` */
Options: _internal_ComponentComboboxOptions;
/** @deprecated use `<ComboboxOption>` instead of `<Combobox.Option>` */
Option: _internal_ComponentComboboxOption;
};
export {};

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

import q,{Fragment as ce,createContext as le,createRef as fe,useCallback as me,useContext as ie,useMemo as L,useReducer as Te,useRef as I,useEffect as xe}from"react";import{useComputed as z}from'../../hooks/use-computed.js';import{useDisposables as ee}from'../../hooks/use-disposables.js';import{useEvent as g}from'../../hooks/use-event.js';import{useId as W}from'../../hooks/use-id.js';import{useIsoMorphicEffect as h}from'../../hooks/use-iso-morphic-effect.js';import{useLatestValue as ge}from'../../hooks/use-latest-value.js';import{useOutsideClick as Oe}from'../../hooks/use-outside-click.js';import{useResolveButtonType as Ce}from'../../hooks/use-resolve-button-type.js';import{useSyncRefs as X}from'../../hooks/use-sync-refs.js';import{useTreeWalker as Re}from'../../hooks/use-tree-walker.js';import{calculateActiveIndex as ye,Focus as y}from'../../utils/calculate-active-index.js';import{disposables as ue}from'../../utils/disposables.js';import{forwardRefWithAs as k,render as w,compact as ve,Features as pe}from'../../utils/render.js';import{isDisabledReactIssue7711 as Se}from'../../utils/bugs.js';import{match as B}from'../../utils/match.js';import{objectToFormEntries as Ae}from'../../utils/form.js';import{sortByDomNode as Pe}from'../../utils/focus-management.js';import{Hidden as Ie,Features as Ee}from'../../internal/hidden.js';import{useOpenClosed as Le,State as oe,OpenClosedProvider as De}from'../../internal/open-closed.js';import{Keys as v}from'../keyboard.js';import{useControllable as Ve}from'../../hooks/use-controllable.js';import{useWatch as he}from'../../hooks/use-watch.js';var Me=(n=>(n[n.Open=0]="Open",n[n.Closed=1]="Closed",n))(Me||{}),Fe=(n=>(n[n.Single=0]="Single",n[n.Multi=1]="Multi",n))(Fe||{}),_e=(n=>(n[n.Pointer=0]="Pointer",n[n.Other=1]="Other",n))(_e||{}),ke=(l=>(l[l.OpenCombobox=0]="OpenCombobox",l[l.CloseCombobox=1]="CloseCombobox",l[l.GoToOption=2]="GoToOption",l[l.RegisterOption=3]="RegisterOption",l[l.UnregisterOption=4]="UnregisterOption",l[l.RegisterLabel=5]="RegisterLabel",l))(ke||{});function te(t,r=n=>n){let n=t.activeOptionIndex!==null?t.options[t.activeOptionIndex]:null,o=Pe(r(t.options.slice()),i=>i.dataRef.current.domRef.current),a=n?o.indexOf(n):null;return a===-1&&(a=null),{options:o,activeOptionIndex:a}}let we={[1](t){return t.dataRef.current.disabled||t.comboboxState===1?t:{...t,activeOptionIndex:null,comboboxState:1}},[0](t){if(t.dataRef.current.disabled||t.comboboxState===0)return t;let r=t.activeOptionIndex,{isSelected:n}=t.dataRef.current,o=t.options.findIndex(a=>n(a.dataRef.current.value));return o!==-1&&(r=o),{...t,comboboxState:0,activeOptionIndex:r}},[2](t,r){var a;if(t.dataRef.current.disabled||t.dataRef.current.optionsRef.current&&!t.dataRef.current.optionsPropsRef.current.static&&t.comboboxState===1)return t;let n=te(t);if(n.activeOptionIndex===null){let i=n.options.findIndex(l=>!l.dataRef.current.disabled);i!==-1&&(n.activeOptionIndex=i)}let o=ye(r,{resolveItems:()=>n.options,resolveActiveIndex:()=>n.activeOptionIndex,resolveId:i=>i.id,resolveDisabled:i=>i.dataRef.current.disabled});return{...t,...n,activeOptionIndex:o,activationTrigger:(a=r.trigger)!=null?a:1}},[3]:(t,r)=>{let n={id:r.id,dataRef:r.dataRef},o=te(t,i=>[...i,n]);t.activeOptionIndex===null&&t.dataRef.current.isSelected(r.dataRef.current.value)&&(o.activeOptionIndex=o.options.indexOf(n));let a={...t,...o,activationTrigger:1};return t.dataRef.current.__demoMode&&t.dataRef.current.value===void 0&&(a.activeOptionIndex=0),a},[4]:(t,r)=>{let n=te(t,o=>{let a=o.findIndex(i=>i.id===r.id);return a!==-1&&o.splice(a,1),o});return{...t,...n,activationTrigger:1}},[5]:(t,r)=>({...t,labelId:r.id})},ne=le(null);ne.displayName="ComboboxActionsContext";function $(t){let r=ie(ne);if(r===null){let n=new Error(`<${t} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,$),n}return r}let re=le(null);re.displayName="ComboboxDataContext";function U(t){let r=ie(re);if(r===null){let n=new Error(`<${t} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,U),n}return r}function Be(t,r){return B(r.type,we,t,r)}let Ue=ce;function Ge(t,r){let{value:n,defaultValue:o,onChange:a,name:i,by:l=(b,T)=>b===T,disabled:s=!1,__demoMode:m=!1,nullable:e=!1,multiple:u=!1,...S}=t,[p=u?[]:void 0,C]=Ve(n,a,o),[R,c]=Te(Be,{dataRef:fe(),comboboxState:m?0:1,options:[],activeOptionIndex:null,activationTrigger:1,labelId:null}),x=I(!1),O=I({static:!1,hold:!1}),G=I(null),M=I(null),F=I(null),N=I(null),D=g(typeof l=="string"?(b,T)=>{let P=l;return(b==null?void 0:b[P])===(T==null?void 0:T[P])}:l),_=me(b=>B(f.mode,{[1]:()=>p.some(T=>D(T,b)),[0]:()=>D(p,b)}),[p]),f=L(()=>({...R,optionsPropsRef:O,labelRef:G,inputRef:M,buttonRef:F,optionsRef:N,value:p,defaultValue:o,disabled:s,mode:u?1:0,get activeOptionIndex(){if(x.current&&R.activeOptionIndex===null&&R.options.length>0){let b=R.options.findIndex(T=>!T.dataRef.current.disabled);if(b!==-1)return b}return R.activeOptionIndex},compare:D,isSelected:_,nullable:e,__demoMode:m}),[p,o,s,u,e,m,R]);h(()=>{R.dataRef.current=f},[f]),Oe([f.buttonRef,f.inputRef,f.optionsRef],()=>Z.closeCombobox(),f.comboboxState===0);let A=L(()=>({open:f.comboboxState===0,disabled:s,activeIndex:f.activeOptionIndex,activeOption:f.activeOptionIndex===null?null:f.options[f.activeOptionIndex].dataRef.current.value,value:p}),[f,s,p]),E=g(b=>{let T=f.options.find(P=>P.id===b);!T||j(T.dataRef.current.value)}),V=g(()=>{if(f.activeOptionIndex!==null){let{dataRef:b,id:T}=f.options[f.activeOptionIndex];j(b.current.value),Z.goToOption(y.Specific,T)}}),d=g(()=>{c({type:0}),x.current=!0}),H=g(()=>{c({type:1}),x.current=!1}),Q=g((b,T,P)=>(x.current=!1,b===y.Specific?c({type:2,focus:y.Specific,id:T,trigger:P}):c({type:2,focus:b,trigger:P}))),Y=g((b,T)=>(c({type:3,id:b,dataRef:T}),()=>c({type:4,id:b}))),se=g(b=>(c({type:5,id:b}),()=>c({type:5,id:null}))),j=g(b=>B(f.mode,{[0](){return C==null?void 0:C(b)},[1](){let T=f.value.slice(),P=T.findIndex(K=>D(K,b));return P===-1?T.push(b):T.splice(P,1),C==null?void 0:C(T)}})),Z=L(()=>({onChange:j,registerOption:Y,registerLabel:se,goToOption:Q,closeCombobox:H,openCombobox:d,selectActiveOption:V,selectOption:E}),[]),de=r===null?{}:{ref:r},J=I(null),be=ee();return xe(()=>{!J.current||o!==void 0&&be.addEventListener(J.current,"reset",()=>{j(o)})},[J,j]),q.createElement(ne.Provider,{value:Z},q.createElement(re.Provider,{value:f},q.createElement(De,{value:B(f.comboboxState,{[0]:oe.Open,[1]:oe.Closed})},i!=null&&p!=null&&Ae({[i]:p}).map(([b,T],P)=>q.createElement(Ie,{features:Ee.Hidden,ref:P===0?K=>{var ae;J.current=(ae=K==null?void 0:K.closest("form"))!=null?ae:null}:void 0,...ve({key:b,as:"input",type:"hidden",hidden:!0,readOnly:!0,name:b,value:T})})),w({ourProps:de,theirProps:S,slot:A,defaultTag:Ue,name:"Combobox"}))))}let Ne=k(Ge),He="input",je=k(function(r,n){var f,A,E,V;let o=W(),{id:a=`headlessui-combobox-input-${o}`,onChange:i,displayValue:l,type:s="text",...m}=r,e=U("Combobox.Input"),u=$("Combobox.Input"),S=X(e.inputRef,n),p=I(!1),C=ee(),R=L(()=>{var d;return typeof l=="function"?(d=l(e.value))!=null?d:"":typeof e.value=="string"?e.value:""},[e.value]);he(([d,H],[Q,Y])=>{p.current||!e.inputRef.current||(Y===0&&H===1||d!==Q)&&(e.inputRef.current.value=d)},[R,e.comboboxState]);let c=I(!1),x=g(()=>{c.current=!0}),O=g(()=>{setTimeout(()=>{c.current=!1})}),G=g(d=>{switch(p.current=!0,d.key){case v.Backspace:case v.Delete:if(e.mode!==0||!e.nullable)return;let H=d.currentTarget;C.requestAnimationFrame(()=>{H.value===""&&(u.onChange(null),e.optionsRef.current&&(e.optionsRef.current.scrollTop=0),u.goToOption(y.Nothing))});break;case v.Enter:if(p.current=!1,e.comboboxState!==0||c.current)return;if(d.preventDefault(),d.stopPropagation(),e.activeOptionIndex===null){u.closeCombobox();return}u.selectActiveOption(),e.mode===0&&u.closeCombobox();break;case v.ArrowDown:return p.current=!1,d.preventDefault(),d.stopPropagation(),B(e.comboboxState,{[0]:()=>{u.goToOption(y.Next)},[1]:()=>{u.openCombobox()}});case v.ArrowUp:return p.current=!1,d.preventDefault(),d.stopPropagation(),B(e.comboboxState,{[0]:()=>{u.goToOption(y.Previous)},[1]:()=>{u.openCombobox(),C.nextFrame(()=>{e.value||u.goToOption(y.Last)})}});case v.Home:if(d.shiftKey)break;return p.current=!1,d.preventDefault(),d.stopPropagation(),u.goToOption(y.First);case v.PageUp:return p.current=!1,d.preventDefault(),d.stopPropagation(),u.goToOption(y.First);case v.End:if(d.shiftKey)break;return p.current=!1,d.preventDefault(),d.stopPropagation(),u.goToOption(y.Last);case v.PageDown:return p.current=!1,d.preventDefault(),d.stopPropagation(),u.goToOption(y.Last);case v.Escape:return p.current=!1,e.comboboxState!==0?void 0:(d.preventDefault(),e.optionsRef.current&&!e.optionsPropsRef.current.static&&d.stopPropagation(),u.closeCombobox());case v.Tab:if(p.current=!1,e.comboboxState!==0)return;e.mode===0&&u.selectActiveOption(),u.closeCombobox();break}}),M=g(d=>{u.openCombobox(),i==null||i(d)}),F=g(()=>{p.current=!1}),N=z(()=>{if(!!e.labelId)return[e.labelId].join(" ")},[e.labelId]),D=L(()=>({open:e.comboboxState===0,disabled:e.disabled}),[e]),_={ref:S,id:a,role:"combobox",type:s,"aria-controls":(f=e.optionsRef.current)==null?void 0:f.id,"aria-expanded":e.disabled?void 0:e.comboboxState===0,"aria-activedescendant":e.activeOptionIndex===null||(A=e.options[e.activeOptionIndex])==null?void 0:A.id,"aria-multiselectable":e.mode===1?!0:void 0,"aria-labelledby":N,defaultValue:(V=(E=r.defaultValue)!=null?E:l==null?void 0:l(e.defaultValue))!=null?V:e.defaultValue,disabled:e.disabled,onCompositionStart:x,onCompositionEnd:O,onKeyDown:G,onChange:M,onBlur:F};return w({ourProps:_,theirProps:m,slot:D,defaultTag:He,name:"Combobox.Input"})}),Ke="button",We=k(function(r,n){var c;let o=U("Combobox.Button"),a=$("Combobox.Button"),i=X(o.buttonRef,n),l=W(),{id:s=`headlessui-combobox-button-${l}`,...m}=r,e=ee(),u=g(x=>{switch(x.key){case v.ArrowDown:return x.preventDefault(),x.stopPropagation(),o.comboboxState===1&&a.openCombobox(),e.nextFrame(()=>{var O;return(O=o.inputRef.current)==null?void 0:O.focus({preventScroll:!0})});case v.ArrowUp:return x.preventDefault(),x.stopPropagation(),o.comboboxState===1&&(a.openCombobox(),e.nextFrame(()=>{o.value||a.goToOption(y.Last)})),e.nextFrame(()=>{var O;return(O=o.inputRef.current)==null?void 0:O.focus({preventScroll:!0})});case v.Escape:return o.comboboxState!==0?void 0:(x.preventDefault(),o.optionsRef.current&&!o.optionsPropsRef.current.static&&x.stopPropagation(),a.closeCombobox(),e.nextFrame(()=>{var O;return(O=o.inputRef.current)==null?void 0:O.focus({preventScroll:!0})}));default:return}}),S=g(x=>{if(Se(x.currentTarget))return x.preventDefault();o.comboboxState===0?a.closeCombobox():(x.preventDefault(),a.openCombobox()),e.nextFrame(()=>{var O;return(O=o.inputRef.current)==null?void 0:O.focus({preventScroll:!0})})}),p=z(()=>{if(!!o.labelId)return[o.labelId,s].join(" ")},[o.labelId,s]),C=L(()=>({open:o.comboboxState===0,disabled:o.disabled,value:o.value}),[o]),R={ref:i,id:s,type:Ce(r,o.buttonRef),tabIndex:-1,"aria-haspopup":!0,"aria-controls":(c=o.optionsRef.current)==null?void 0:c.id,"aria-expanded":o.disabled?void 0:o.comboboxState===0,"aria-labelledby":p,disabled:o.disabled,onClick:S,onKeyDown:u};return w({ourProps:R,theirProps:m,slot:C,defaultTag:Ke,name:"Combobox.Button"})}),Xe="label",$e=k(function(r,n){let o=W(),{id:a=`headlessui-combobox-label-${o}`,...i}=r,l=U("Combobox.Label"),s=$("Combobox.Label"),m=X(l.labelRef,n);h(()=>s.registerLabel(a),[a]);let e=g(()=>{var p;return(p=l.inputRef.current)==null?void 0:p.focus({preventScroll:!0})}),u=L(()=>({open:l.comboboxState===0,disabled:l.disabled}),[l]);return w({ourProps:{ref:m,id:a,onClick:e},theirProps:i,slot:u,defaultTag:Xe,name:"Combobox.Label"})}),Je="ul",qe=pe.RenderStrategy|pe.Static,Qe=k(function(r,n){var R;let o=W(),{id:a=`headlessui-combobox-options-${o}`,hold:i=!1,...l}=r,s=U("Combobox.Options"),m=X(s.optionsRef,n),e=Le(),u=(()=>e!==null?e===oe.Open:s.comboboxState===0)();h(()=>{var c;s.optionsPropsRef.current.static=(c=r.static)!=null?c:!1},[s.optionsPropsRef,r.static]),h(()=>{s.optionsPropsRef.current.hold=i},[s.optionsPropsRef,i]),Re({container:s.optionsRef.current,enabled:s.comboboxState===0,accept(c){return c.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:c.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(c){c.setAttribute("role","none")}});let S=z(()=>{var c,x;return(x=s.labelId)!=null?x:(c=s.buttonRef.current)==null?void 0:c.id},[s.labelId,s.buttonRef.current]),p=L(()=>({open:s.comboboxState===0}),[s]),C={"aria-activedescendant":s.activeOptionIndex===null||(R=s.options[s.activeOptionIndex])==null?void 0:R.id,"aria-labelledby":S,role:"listbox",id:a,ref:m};return w({ourProps:C,theirProps:l,slot:p,defaultTag:Je,features:qe,visible:u,name:"Combobox.Options"})}),Ye="li",Ze=k(function(r,n){var _,f;let o=W(),{id:a=`headlessui-combobox-option-${o}`,disabled:i=!1,value:l,...s}=r,m=U("Combobox.Option"),e=$("Combobox.Option"),u=m.activeOptionIndex!==null?m.options[m.activeOptionIndex].id===a:!1,S=m.isSelected(l),p=I(null),C=ge({disabled:i,value:l,domRef:p,textValue:(f=(_=p.current)==null?void 0:_.textContent)==null?void 0:f.toLowerCase()}),R=X(n,p),c=g(()=>e.selectOption(a));h(()=>e.registerOption(a,C),[C,a]);let x=I(!m.__demoMode);h(()=>{if(!m.__demoMode)return;let A=ue();return A.requestAnimationFrame(()=>{x.current=!0}),A.dispose},[]),h(()=>{if(m.comboboxState!==0||!u||!x.current||m.activationTrigger===0)return;let A=ue();return A.requestAnimationFrame(()=>{var E,V;(V=(E=p.current)==null?void 0:E.scrollIntoView)==null||V.call(E,{block:"nearest"})}),A.dispose},[p,u,m.comboboxState,m.activationTrigger,m.activeOptionIndex]);let O=g(A=>{if(i)return A.preventDefault();c(),m.mode===0&&e.closeCombobox()}),G=g(()=>{if(i)return e.goToOption(y.Nothing);e.goToOption(y.Specific,a)}),M=g(()=>{i||u||e.goToOption(y.Specific,a,0)}),F=g(()=>{i||!u||m.optionsPropsRef.current.hold||e.goToOption(y.Nothing)}),N=L(()=>({active:u,selected:S,disabled:i}),[u,S,i]);return w({ourProps:{id:a,ref:R,role:"option",tabIndex:i===!0?void 0:-1,"aria-disabled":i===!0?!0:void 0,"aria-selected":S,disabled:void 0,onClick:O,onFocus:G,onPointerMove:M,onMouseMove:M,onPointerLeave:F,onMouseLeave:F},theirProps:s,slot:N,defaultTag:Ye,name:"Combobox.Option"})}),Fo=Object.assign(Ne,{Input:je,Button:We,Label:$e,Options:Qe,Option:Ze});export{Fo as Combobox};
"use client";import{useFocusRing as Ee}from"@react-aria/focus";import{useHover as Se}from"@react-aria/interactions";import{useVirtualizer as ke}from"@tanstack/react-virtual";import D,{Fragment as Ie,createContext as me,createRef as He,useCallback as ce,useContext as fe,useMemo as K,useReducer as Ue,useRef as Z,useState as Pe}from"react";import{flushSync as ee}from"react-dom";import{useActivePress as Ge}from'../../hooks/use-active-press.js';import{useByComparator as ze}from'../../hooks/use-by-comparator.js';import{useControllable as Ke}from'../../hooks/use-controllable.js';import{useDefaultValue as We}from'../../hooks/use-default-value.js';import{useDisposables as je}from'../../hooks/use-disposables.js';import{useElementSize as Ae}from'../../hooks/use-element-size.js';import{useEvent as c}from'../../hooks/use-event.js';import{useId as se}from'../../hooks/use-id.js';import{useInertOthers as $e}from'../../hooks/use-inert-others.js';import{useIsoMorphicEffect as J}from'../../hooks/use-iso-morphic-effect.js';import{useLatestValue as Xe}from'../../hooks/use-latest-value.js';import{useOnDisappear as Je}from'../../hooks/use-on-disappear.js';import{useOutsideClick as qe}from'../../hooks/use-outside-click.js';import{useOwnerDocument as Re}from'../../hooks/use-owner.js';import{useRefocusableInput as _e}from'../../hooks/use-refocusable-input.js';import{useResolveButtonType as Ye}from'../../hooks/use-resolve-button-type.js';import{useScrollLock as Qe}from'../../hooks/use-scroll-lock.js';import{useSyncRefs as de}from'../../hooks/use-sync-refs.js';import{useTrackedPointer as Ze}from'../../hooks/use-tracked-pointer.js';import{transitionDataAttributes as et,useTransition as tt}from'../../hooks/use-transition.js';import{useTreeWalker as ot}from'../../hooks/use-tree-walker.js';import{useWatch as he}from'../../hooks/use-watch.js';import{useDisabled as nt}from'../../internal/disabled.js';import{FloatingProvider as it,useFloatingPanel as rt,useFloatingPanelProps as lt,useFloatingReference as at,useResolvedAnchor as ut}from'../../internal/floating.js';import{FormFields as pt}from'../../internal/form-fields.js';import{Frozen as st,useFrozenData as Me}from'../../internal/frozen.js';import{useProvidedId as dt}from'../../internal/id.js';import{OpenClosedProvider as bt,State as be,useOpenClosed as mt}from'../../internal/open-closed.js';import{history as De}from'../../utils/active-element-history.js';import{isDisabledReactIssue7711 as ct}from'../../utils/bugs.js';import{Focus as P,calculateActiveIndex as Fe}from'../../utils/calculate-active-index.js';import{disposables as Ve}from'../../utils/disposables.js';import{sortByDomNode as ft}from'../../utils/focus-management.js';import{match as te}from'../../utils/match.js';import{isMobile as Tt}from'../../utils/platform.js';import{RenderFeatures as Le,forwardRefWithAs as ie,mergeProps as Te,render as re}from'../../utils/render.js';import{useDescribedBy as xt}from'../description/description.js';import{Keys as L}from'../keyboard.js';import{Label as gt,useLabelledBy as xe,useLabels as vt}from'../label/label.js';import{MouseButton as Be}from'../mouse.js';import{Portal as yt}from'../portal/portal.js';var Ot=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Ot||{}),Ct=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Ct||{}),Et=(o=>(o[o.Pointer=0]="Pointer",o[o.Focus=1]="Focus",o[o.Other=2]="Other",o))(Et||{}),St=(l=>(l[l.OpenCombobox=0]="OpenCombobox",l[l.CloseCombobox=1]="CloseCombobox",l[l.GoToOption=2]="GoToOption",l[l.SetTyping=3]="SetTyping",l[l.RegisterOption=4]="RegisterOption",l[l.UnregisterOption=5]="UnregisterOption",l[l.SetActivationTrigger=6]="SetActivationTrigger",l[l.UpdateVirtualConfiguration=7]="UpdateVirtualConfiguration",l[l.SetInputElement=8]="SetInputElement",l[l.SetButtonElement=9]="SetButtonElement",l[l.SetOptionsElement=10]="SetOptionsElement",l))(St||{});function ge(t,n=e=>e){let e=t.activeOptionIndex!==null?t.options[t.activeOptionIndex]:null,o=n(t.options.slice()),f=o.length>0&&o[0].dataRef.current.order!==null?o.sort((m,d)=>m.dataRef.current.order-d.dataRef.current.order):ft(o,m=>m.dataRef.current.domRef.current),b=e?f.indexOf(e):null;return b===-1&&(b=null),{options:f,activeOptionIndex:b}}let It={[1](t){var n;return(n=t.dataRef.current)!=null&&n.disabled||t.comboboxState===1?t:{...t,activeOptionIndex:null,comboboxState:1,isTyping:!1,activationTrigger:2,__demoMode:!1}},[0](t){var n,e;if((n=t.dataRef.current)!=null&&n.disabled||t.comboboxState===0)return t;if((e=t.dataRef.current)!=null&&e.value){let o=t.dataRef.current.calculateIndex(t.dataRef.current.value);if(o!==-1)return{...t,activeOptionIndex:o,comboboxState:0,__demoMode:!1}}return{...t,comboboxState:0,__demoMode:!1}},[3](t,n){return t.isTyping===n.isTyping?t:{...t,isTyping:n.isTyping}},[2](t,n){var b,m,d,T;if((b=t.dataRef.current)!=null&&b.disabled||t.optionsElement&&!((m=t.dataRef.current)!=null&&m.optionsPropsRef.current.static)&&t.comboboxState===1)return t;if(t.virtual){let{options:r,disabled:i}=t.virtual,l=n.focus===P.Specific?n.idx:Fe(n,{resolveItems:()=>r,resolveActiveIndex:()=>{var R,p;return(p=(R=t.activeOptionIndex)!=null?R:r.findIndex(F=>!i(F)))!=null?p:null},resolveDisabled:i,resolveId(){throw new Error("Function not implemented.")}}),E=(d=n.trigger)!=null?d:2;return t.activeOptionIndex===l&&t.activationTrigger===E?t:{...t,activeOptionIndex:l,activationTrigger:E,isTyping:!1,__demoMode:!1}}let e=ge(t);if(e.activeOptionIndex===null){let r=e.options.findIndex(i=>!i.dataRef.current.disabled);r!==-1&&(e.activeOptionIndex=r)}let o=n.focus===P.Specific?n.idx:Fe(n,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:r=>r.id,resolveDisabled:r=>r.dataRef.current.disabled}),f=(T=n.trigger)!=null?T:2;return t.activeOptionIndex===o&&t.activationTrigger===f?t:{...t,...e,isTyping:!1,activeOptionIndex:o,activationTrigger:f,__demoMode:!1}},[4]:(t,n)=>{var b,m,d;if((b=t.dataRef.current)!=null&&b.virtual)return{...t,options:[...t.options,n.payload]};let e=n.payload,o=ge(t,T=>(T.push(e),T));t.activeOptionIndex===null&&(m=t.dataRef.current)!=null&&m.isSelected(n.payload.dataRef.current.value)&&(o.activeOptionIndex=o.options.indexOf(e));let f={...t,...o,activationTrigger:2};return(d=t.dataRef.current)!=null&&d.__demoMode&&t.dataRef.current.value===void 0&&(f.activeOptionIndex=0),f},[5]:(t,n)=>{var o;if((o=t.dataRef.current)!=null&&o.virtual)return{...t,options:t.options.filter(f=>f.id!==n.id)};let e=ge(t,f=>{let b=f.findIndex(m=>m.id===n.id);return b!==-1&&f.splice(b,1),f});return{...t,...e,activationTrigger:2}},[6]:(t,n)=>t.activationTrigger===n.trigger?t:{...t,activationTrigger:n.trigger},[7]:(t,n)=>{var o,f;if(t.virtual===null)return{...t,virtual:{options:n.options,disabled:(o=n.disabled)!=null?o:()=>!1}};if(t.virtual.options===n.options&&t.virtual.disabled===n.disabled)return t;let e=t.activeOptionIndex;if(t.activeOptionIndex!==null){let b=n.options.indexOf(t.virtual.options[t.activeOptionIndex]);b!==-1?e=b:e=null}return{...t,activeOptionIndex:e,virtual:{options:n.options,disabled:(f=n.disabled)!=null?f:()=>!1}}},[8]:(t,n)=>t.inputElement===n.element?t:{...t,inputElement:n.element},[9]:(t,n)=>t.buttonElement===n.element?t:{...t,buttonElement:n.element},[10]:(t,n)=>t.optionsElement===n.element?t:{...t,optionsElement:n.element}},ve=me(null);ve.displayName="ComboboxActionsContext";function le(t){let n=fe(ve);if(n===null){let e=new Error(`<${t} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(e,le),e}return n}let we=me(null);function Pt(t){let n=oe("VirtualProvider"),{options:e}=n.virtual,[o,f]=K(()=>{let r=n.optionsElement;if(!r)return[0,0];let i=window.getComputedStyle(r);return[parseFloat(i.paddingBlockStart||i.paddingTop),parseFloat(i.paddingBlockEnd||i.paddingBottom)]},[n.optionsElement]),b=ke({enabled:e.length!==0,scrollPaddingStart:o,scrollPaddingEnd:f,count:e.length,estimateSize(){return 40},getScrollElement(){return n.optionsElement},overscan:12}),[m,d]=Pe(0);J(()=>{d(r=>r+1)},[e]);let T=b.getVirtualItems();return T.length===0?null:D.createElement(we.Provider,{value:b},D.createElement("div",{style:{position:"relative",width:"100%",height:`${b.getTotalSize()}px`},ref:r=>{if(r){if(typeof process!="undefined"&&process.env.JEST_WORKER_ID!==void 0||n.activationTrigger===0)return;n.activeOptionIndex!==null&&e.length>n.activeOptionIndex&&b.scrollToIndex(n.activeOptionIndex)}}},T.map(r=>{var i;return D.createElement(Ie,{key:r.key},D.cloneElement((i=t.children)==null?void 0:i.call(t,{...t.slot,option:e[r.index]}),{key:`${m}-${r.key}`,"data-index":r.index,"aria-setsize":e.length,"aria-posinset":r.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${r.start}px)`,overflowAnchor:"none"}}))})))}let ae=me(null);ae.displayName="ComboboxDataContext";function oe(t){let n=fe(ae);if(n===null){let e=new Error(`<${t} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(e,oe),e}return n}function At(t,n){return te(n.type,It,t,n)}let Rt=Ie;function _t(t,n){var ye,Oe;let e=nt(),{value:o,defaultValue:f,onChange:b,form:m,name:d,by:T,disabled:r=e||!1,onClose:i,__demoMode:l=!1,multiple:E=!1,immediate:R=!1,virtual:p=null,nullable:F,...N}=t,h=We(f),[S=E?[]:void 0,O]=Ke(o,b,h),[I,x]=Ue(At,{dataRef:He(),comboboxState:l?0:1,isTyping:!1,options:[],virtual:p?{options:p.options,disabled:(ye=p.disabled)!=null?ye:()=>!1}:null,activeOptionIndex:null,activationTrigger:2,inputElement:null,buttonElement:null,optionsElement:null,__demoMode:l}),M=Z(!1),y=Z({static:!1,hold:!1}),B=ze(T),W=c(u=>p?T===null?p.options.indexOf(u):p.options.findIndex(v=>B(v,u)):I.options.findIndex(v=>B(v.dataRef.current.value,u))),j=ce(u=>te(s.mode,{[1]:()=>S.some(v=>B(v,u)),[0]:()=>B(S,u)}),[S]),U=c(u=>I.activeOptionIndex===W(u)),s=K(()=>({...I,immediate:R,optionsPropsRef:y,value:S,defaultValue:h,disabled:r,mode:E?1:0,virtual:p?I.virtual:null,get activeOptionIndex(){if(M.current&&I.activeOptionIndex===null&&(p?p.options.length>0:I.options.length>0)){if(p){let v=p.options.findIndex(z=>{var pe,Ce;return!((Ce=(pe=p.disabled)==null?void 0:pe.call(p,z))!=null&&Ce)});if(v!==-1)return v}let u=I.options.findIndex(v=>!v.dataRef.current.disabled);if(u!==-1)return u}return I.activeOptionIndex},calculateIndex:W,compare:B,isSelected:j,isActive:U}),[S,h,r,E,l,I,p]);J(()=>{var u;p&&x({type:7,options:p.options,disabled:(u=p.disabled)!=null?u:null})},[p,p==null?void 0:p.options,p==null?void 0:p.disabled]),J(()=>{I.dataRef.current=s},[s]);let $=s.comboboxState===0;qe($,[s.buttonElement,s.inputElement,s.optionsElement],()=>V.closeCombobox());let k=K(()=>{var u,v,z;return{open:s.comboboxState===0,disabled:r,activeIndex:s.activeOptionIndex,activeOption:s.activeOptionIndex===null?null:s.virtual?s.virtual.options[(u=s.activeOptionIndex)!=null?u:0]:(z=(v=s.options[s.activeOptionIndex])==null?void 0:v.dataRef.current.value)!=null?z:null,value:S}},[s,r,S]),g=c(()=>{if(s.activeOptionIndex!==null){if(V.setIsTyping(!1),s.virtual)A(s.virtual.options[s.activeOptionIndex]);else{let{dataRef:u}=s.options[s.activeOptionIndex];A(u.current.value)}V.goToOption(P.Specific,s.activeOptionIndex)}}),G=c(()=>{x({type:0}),M.current=!0}),ne=c(()=>{x({type:1}),M.current=!1,i==null||i()}),q=c(u=>{x({type:3,isTyping:u})}),Y=c((u,v,z)=>(M.current=!1,u===P.Specific?x({type:2,focus:P.Specific,idx:v,trigger:z}):x({type:2,focus:u,trigger:z}))),Q=c((u,v)=>(x({type:4,payload:{id:u,dataRef:v}}),()=>{s.isActive(v.current.value)&&(M.current=!0),x({type:5,id:u})})),A=c(u=>te(s.mode,{[0](){return O==null?void 0:O(u)},[1](){let v=s.value.slice(),z=v.findIndex(pe=>B(pe,u));return z===-1?v.push(u):v.splice(z,1),O==null?void 0:O(v)}})),ue=c(u=>{x({type:6,trigger:u})}),a=c(u=>{x({type:8,element:u})}),H=c(u=>{x({type:9,element:u})}),_=c(u=>{x({type:10,element:u})}),V=K(()=>({onChange:A,registerOption:Q,goToOption:Y,setIsTyping:q,closeCombobox:ne,openCombobox:G,setActivationTrigger:ue,selectActiveOption:g,setInputElement:a,setButtonElement:H,setOptionsElement:_}),[]),[C,w]=vt(),X=n===null?{}:{ref:n},Ne=ce(()=>{if(h!==void 0)return O==null?void 0:O(h)},[O,h]);return D.createElement(w,{value:C,props:{htmlFor:(Oe=s.inputElement)==null?void 0:Oe.id},slot:{open:s.comboboxState===0,disabled:r}},D.createElement(it,null,D.createElement(ve.Provider,{value:V},D.createElement(ae.Provider,{value:s},D.createElement(bt,{value:te(s.comboboxState,{[0]:be.Open,[1]:be.Closed})},d!=null&&D.createElement(pt,{disabled:r,data:S!=null?{[d]:S}:{},form:m,onReset:Ne}),re({ourProps:X,theirProps:N,slot:k,defaultTag:Rt,name:"Combobox"}))))))}let ht="input";function Mt(t,n){var q,Y,Q,A,ue;let e=oe("Combobox.Input"),o=le("Combobox.Input"),f=se(),b=dt(),{id:m=b||`headlessui-combobox-input-${f}`,onChange:d,displayValue:T,disabled:r=e.disabled||!1,autoFocus:i=!1,type:l="text",...E}=t,R=Z(null),p=de(R,n,at(),o.setInputElement),F=Re(e.inputElement),N=je(),h=c(()=>{o.onChange(null),e.optionsElement&&(e.optionsElement.scrollTop=0),o.goToOption(P.Nothing)}),S=K(()=>{var a;return typeof T=="function"&&e.value!==void 0?(a=T(e.value))!=null?a:"":typeof e.value=="string"?e.value:""},[e.value,T]);he(([a,H],[_,V])=>{if(e.isTyping)return;let C=R.current;C&&((V===0&&H===1||a!==_)&&(C.value=a),requestAnimationFrame(()=>{if(e.isTyping||!C||(F==null?void 0:F.activeElement)!==C)return;let{selectionStart:w,selectionEnd:X}=C;Math.abs((X!=null?X:0)-(w!=null?w:0))===0&&w===0&&C.setSelectionRange(C.value.length,C.value.length)}))},[S,e.comboboxState,F,e.isTyping]),he(([a],[H])=>{if(a===0&&H===1){if(e.isTyping)return;let _=R.current;if(!_)return;let V=_.value,{selectionStart:C,selectionEnd:w,selectionDirection:X}=_;_.value="",_.value=V,X!==null?_.setSelectionRange(C,w,X):_.setSelectionRange(C,w)}},[e.comboboxState]);let O=Z(!1),I=c(()=>{O.current=!0}),x=c(()=>{N.nextFrame(()=>{O.current=!1})}),M=c(a=>{switch(o.setIsTyping(!0),a.key){case L.Enter:if(e.comboboxState!==0||O.current)return;if(a.preventDefault(),a.stopPropagation(),e.activeOptionIndex===null){o.closeCombobox();return}o.selectActiveOption(),e.mode===0&&o.closeCombobox();break;case L.ArrowDown:return a.preventDefault(),a.stopPropagation(),te(e.comboboxState,{[0]:()=>o.goToOption(P.Next),[1]:()=>o.openCombobox()});case L.ArrowUp:return a.preventDefault(),a.stopPropagation(),te(e.comboboxState,{[0]:()=>o.goToOption(P.Previous),[1]:()=>{ee(()=>o.openCombobox()),e.value||o.goToOption(P.Last)}});case L.Home:if(a.shiftKey)break;return a.preventDefault(),a.stopPropagation(),o.goToOption(P.First);case L.PageUp:return a.preventDefault(),a.stopPropagation(),o.goToOption(P.First);case L.End:if(a.shiftKey)break;return a.preventDefault(),a.stopPropagation(),o.goToOption(P.Last);case L.PageDown:return a.preventDefault(),a.stopPropagation(),o.goToOption(P.Last);case L.Escape:return e.comboboxState!==0?void 0:(a.preventDefault(),e.optionsElement&&!e.optionsPropsRef.current.static&&a.stopPropagation(),e.mode===0&&e.value===null&&h(),o.closeCombobox());case L.Tab:if(e.comboboxState!==0)return;e.mode===0&&e.activationTrigger!==1&&o.selectActiveOption(),o.closeCombobox();break}}),y=c(a=>{d==null||d(a),e.mode===0&&a.target.value===""&&h(),o.openCombobox()}),B=c(a=>{var _,V,C;let H=(_=a.relatedTarget)!=null?_:De.find(w=>w!==a.currentTarget);if(!((V=e.optionsElement)!=null&&V.contains(H))&&!((C=e.buttonElement)!=null&&C.contains(H))&&e.comboboxState===0)return a.preventDefault(),e.mode===0&&e.value===null&&h(),o.closeCombobox()}),W=c(a=>{var _,V,C;let H=(_=a.relatedTarget)!=null?_:De.find(w=>w!==a.currentTarget);(V=e.buttonElement)!=null&&V.contains(H)||(C=e.optionsElement)!=null&&C.contains(H)||e.disabled||e.immediate&&e.comboboxState!==0&&N.microTask(()=>{ee(()=>o.openCombobox()),o.setActivationTrigger(1)})}),j=xe(),U=xt(),{isFocused:s,focusProps:$}=Ee({autoFocus:i}),{isHovered:k,hoverProps:g}=Se({isDisabled:r}),G=K(()=>({open:e.comboboxState===0,disabled:r,hover:k,focus:s,autofocus:i}),[e,k,s,i,r]),ne=Te({ref:p,id:m,role:"combobox",type:l,"aria-controls":(q=e.optionsElement)==null?void 0:q.id,"aria-expanded":e.comboboxState===0,"aria-activedescendant":e.activeOptionIndex===null?void 0:e.virtual?(Y=e.options.find(a=>!a.dataRef.current.disabled&&e.compare(a.dataRef.current.value,e.virtual.options[e.activeOptionIndex])))==null?void 0:Y.id:(Q=e.options[e.activeOptionIndex])==null?void 0:Q.id,"aria-labelledby":j,"aria-describedby":U,"aria-autocomplete":"list",defaultValue:(ue=(A=t.defaultValue)!=null?A:e.defaultValue!==void 0?T==null?void 0:T(e.defaultValue):null)!=null?ue:e.defaultValue,disabled:r||void 0,autoFocus:i,onCompositionStart:I,onCompositionEnd:x,onKeyDown:M,onChange:y,onFocus:W,onBlur:B},$,g);return re({ourProps:ne,theirProps:E,slot:G,defaultTag:ht,name:"Combobox.Input"})}let Dt="button";function Ft(t,n){var M;let e=oe("Combobox.Button"),o=le("Combobox.Button"),f=de(n,o.setButtonElement),b=se(),{id:m=`headlessui-combobox-button-${b}`,disabled:d=e.disabled||!1,autoFocus:T=!1,...r}=t,i=_e(e.inputElement),l=c(y=>{switch(y.key){case L.Space:case L.Enter:y.preventDefault(),y.stopPropagation(),e.comboboxState===1&&ee(()=>o.openCombobox()),i();return;case L.ArrowDown:y.preventDefault(),y.stopPropagation(),e.comboboxState===1&&(ee(()=>o.openCombobox()),e.value||o.goToOption(P.First)),i();return;case L.ArrowUp:y.preventDefault(),y.stopPropagation(),e.comboboxState===1&&(ee(()=>o.openCombobox()),e.value||o.goToOption(P.Last)),i();return;case L.Escape:if(e.comboboxState!==0)return;y.preventDefault(),e.optionsElement&&!e.optionsPropsRef.current.static&&y.stopPropagation(),ee(()=>o.closeCombobox()),i();return;default:return}}),E=c(y=>{y.preventDefault(),!ct(y.currentTarget)&&(y.button===Be.Left&&(e.comboboxState===0?o.closeCombobox():o.openCombobox()),i())}),R=xe([m]),{isFocusVisible:p,focusProps:F}=Ee({autoFocus:T}),{isHovered:N,hoverProps:h}=Se({isDisabled:d}),{pressed:S,pressProps:O}=Ge({disabled:d}),I=K(()=>({open:e.comboboxState===0,active:S||e.comboboxState===0,disabled:d,value:e.value,hover:N,focus:p}),[e,N,p,S,d]),x=Te({ref:f,id:m,type:Ye(t,e.buttonElement),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":(M=e.optionsElement)==null?void 0:M.id,"aria-expanded":e.comboboxState===0,"aria-labelledby":R,disabled:d||void 0,autoFocus:T,onMouseDown:E,onKeyDown:l},F,h,O);return re({ourProps:x,theirProps:r,slot:I,defaultTag:Dt,name:"Combobox.Button"})}let Vt="div",Lt=Le.RenderStrategy|Le.Static;function Bt(t,n){var q,Y,Q;let e=se(),{id:o=`headlessui-combobox-options-${e}`,hold:f=!1,anchor:b,portal:m=!1,modal:d=!0,transition:T=!1,...r}=t,i=oe("Combobox.Options"),l=le("Combobox.Options"),E=ut(b);E&&(m=!0);let[R,p]=rt(E),[F,N]=Pe(null),h=lt(),S=de(n,E?R:null,l.setOptionsElement,N),O=Re(i.optionsElement),I=mt(),[x,M]=tt(T,F,I!==null?(I&be.Open)===be.Open:i.comboboxState===0);Je(x,i.inputElement,l.closeCombobox);let y=i.__demoMode?!1:d&&i.comboboxState===0;Qe(y,O);let B=i.__demoMode?!1:d&&i.comboboxState===0;$e(B,{allowed:ce(()=>[i.inputElement,i.buttonElement,i.optionsElement],[i.inputElement,i.buttonElement,i.optionsElement])}),J(()=>{var A;i.optionsPropsRef.current.static=(A=t.static)!=null?A:!1},[i.optionsPropsRef,t.static]),J(()=>{i.optionsPropsRef.current.hold=f},[i.optionsPropsRef,f]),ot(i.comboboxState===0,{container:i.optionsElement,accept(A){return A.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:A.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(A){A.setAttribute("role","none")}});let W=xe([(q=i.buttonElement)==null?void 0:q.id]),j=K(()=>({open:i.comboboxState===0,option:void 0}),[i.comboboxState]),U=c(()=>{l.setActivationTrigger(0)}),s=c(A=>{A.preventDefault(),l.setActivationTrigger(0)}),$=Te(E?h():{},{"aria-labelledby":W,role:"listbox","aria-multiselectable":i.mode===1?!0:void 0,id:o,ref:S,style:{...r.style,...p,"--input-width":Ae(i.inputElement,!0).width,"--button-width":Ae(i.buttonElement,!0).width},onWheel:i.activationTrigger===0?void 0:U,onMouseDown:s,...et(M)}),k=x&&i.comboboxState===1,g=Me(k,(Y=i.virtual)==null?void 0:Y.options),G=Me(k,i.value),ne=c(A=>i.compare(G,A));if(i.virtual){if(g===void 0)throw new Error("Missing `options` in virtual mode");Object.assign(r,{children:D.createElement(ae.Provider,{value:g!==i.virtual.options?{...i,virtual:{...i.virtual,options:g}}:i},D.createElement(Pt,{slot:j},r.children))})}return D.createElement(yt,{enabled:m?t.static||x:!1},D.createElement(ae.Provider,{value:i.mode===1?i:{...i,isSelected:ne}},re({ourProps:$,theirProps:{...r,children:D.createElement(st,{freeze:k},typeof r.children=="function"?(Q=r.children)==null?void 0:Q.call(r,j):r.children)},slot:j,defaultTag:Vt,features:Lt,visible:x,name:"Combobox.Options"})))}let wt="div";function Nt(t,n){var U,s,$,k;let e=oe("Combobox.Option"),o=le("Combobox.Option"),f=se(),{id:b=`headlessui-combobox-option-${f}`,value:m,disabled:d=($=(s=(U=e.virtual)==null?void 0:U.disabled)==null?void 0:s.call(U,m))!=null?$:!1,order:T=null,...r}=t,i=_e(e.inputElement),l=e.virtual?e.activeOptionIndex===e.calculateIndex(m):e.activeOptionIndex===null?!1:((k=e.options[e.activeOptionIndex])==null?void 0:k.id)===b,E=e.isSelected(m),R=Z(null),p=Xe({disabled:d,value:m,domRef:R,order:T}),F=fe(we),N=de(n,R,F?F.measureElement:null),h=c(()=>{o.setIsTyping(!1),o.onChange(m)});J(()=>o.registerOption(b,p),[p,b]);let S=Z(!(e.virtual||e.__demoMode));J(()=>{if(!e.virtual&&!e.__demoMode)return Ve().requestAnimationFrame(()=>{S.current=!0})},[e.virtual,e.__demoMode]),J(()=>{if(S.current&&e.comboboxState===0&&l&&e.activationTrigger!==0)return Ve().requestAnimationFrame(()=>{var g,G;(G=(g=R.current)==null?void 0:g.scrollIntoView)==null||G.call(g,{block:"nearest"})})},[R,l,e.comboboxState,e.activationTrigger,e.activeOptionIndex]);let O=c(g=>{g.preventDefault(),g.button===Be.Left&&(d||(h(),Tt()||requestAnimationFrame(()=>i()),e.mode===0&&o.closeCombobox()))}),I=c(()=>{if(d)return o.goToOption(P.Nothing);let g=e.calculateIndex(m);o.goToOption(P.Specific,g)}),x=Ze(),M=c(g=>x.update(g)),y=c(g=>{if(!x.wasMoved(g)||d||l)return;let G=e.calculateIndex(m);o.goToOption(P.Specific,G,0)}),B=c(g=>{x.wasMoved(g)&&(d||l&&(e.optionsPropsRef.current.hold||o.goToOption(P.Nothing)))}),W=K(()=>({active:l,focus:l,selected:E,disabled:d}),[l,E,d]);return re({ourProps:{id:b,ref:N,role:"option",tabIndex:d===!0?void 0:-1,"aria-disabled":d===!0?!0:void 0,"aria-selected":E,disabled:void 0,onMouseDown:O,onFocus:I,onPointerEnter:M,onMouseEnter:M,onPointerMove:y,onMouseMove:y,onPointerLeave:B,onMouseLeave:B},theirProps:r,slot:W,defaultTag:wt,name:"Combobox.Option"})}let kt=ie(_t),Ht=ie(Ft),Ut=ie(Mt),Gt=gt,zt=ie(Bt),Kt=ie(Nt),ko=Object.assign(kt,{Input:Ut,Button:Ht,Label:Gt,Options:zt,Option:Kt});export{ko as Combobox,Ht as ComboboxButton,Ut as ComboboxInput,Gt as ComboboxLabel,Kt as ComboboxOption,zt as ComboboxOptions};

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

import React, { ReactNode, Ref } from 'react';
import { Props } from '../../types.js';
import React, { type ElementType, type ReactNode, type Ref } from 'react';
import type { Props } from '../../types.js';
import { type HasDisplayName, type RefProp } from '../../utils/render.js';
interface SharedData {

@@ -8,4 +9,6 @@ slot?: {};

}
export declare function useDescribedBy(): string | undefined;
interface DescriptionProviderProps extends SharedData {
children: ReactNode;
value?: string | undefined;
}

@@ -16,5 +19,9 @@ export declare function useDescriptions(): [

];
export declare let Description: (<TTag extends React.ElementType<any> = "p">(props: Props<TTag, {}, "1D45E01E-AF44-47C4-988A-19A94EBAF55C">, ref: Ref<HTMLParagraphElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
};
declare let DEFAULT_DESCRIPTION_TAG: "p";
export type DescriptionProps<TTag extends ElementType = typeof DEFAULT_DESCRIPTION_TAG> = Props<TTag>;
declare function DescriptionFn<TTag extends ElementType = typeof DEFAULT_DESCRIPTION_TAG>(props: DescriptionProps<TTag>, ref: Ref<HTMLElement>): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
export interface _internal_ComponentDescription extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_DESCRIPTION_TAG>(props: DescriptionProps<TTag> & RefProp<typeof DescriptionFn>): JSX.Element;
}
export declare let Description: _internal_ComponentDescription;
export {};

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

import f,{createContext as m,useContext as D,useMemo as l,useState as P}from"react";import{useId as T}from'../../hooks/use-id.js';import{forwardRefWithAs as g,render as x}from'../../utils/render.js';import{useIsoMorphicEffect as E}from'../../hooks/use-iso-morphic-effect.js';import{useSyncRefs as h}from'../../hooks/use-sync-refs.js';import{useEvent as v}from'../../hooks/use-event.js';let d=m(null);function u(){let n=D(d);if(n===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,u),t}return n}function k(){let[n,t]=P([]);return[n.length>0?n.join(" "):void 0,l(()=>function(e){let i=v(r=>(t(o=>[...o,r]),()=>t(o=>{let s=o.slice(),p=s.indexOf(r);return p!==-1&&s.splice(p,1),s}))),a=l(()=>({register:i,slot:e.slot,name:e.name,props:e.props}),[i,e.slot,e.name,e.props]);return f.createElement(d.Provider,{value:a},e.children)},[t])]}let S="p",F=g(function(t,c){let e=T(),{id:i=`headlessui-description-${e}`,...a}=t,r=u(),o=h(c);E(()=>r.register(i),[i,r.register]);let s={ref:o,...r.props,id:i};return x({ourProps:s,theirProps:a,slot:r.slot||{},defaultTag:S,name:r.name||"Description"})});export{F as Description,k as useDescriptions};
"use client";import m,{createContext as T,useContext as u,useMemo as c,useState as P}from"react";import{useEvent as g}from'../../hooks/use-event.js';import{useId as x}from'../../hooks/use-id.js';import{useIsoMorphicEffect as y}from'../../hooks/use-iso-morphic-effect.js';import{useSyncRefs as E}from'../../hooks/use-sync-refs.js';import{useDisabled as v}from'../../internal/disabled.js';import{forwardRefWithAs as R,render as I}from'../../utils/render.js';let a=T(null);a.displayName="DescriptionContext";function f(){let r=u(a);if(r===null){let e=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,f),e}return r}function G(){var r,e;return(e=(r=u(a))==null?void 0:r.value)!=null?e:void 0}function U(){let[r,e]=P([]);return[r.length>0?r.join(" "):void 0,c(()=>function(t){let i=g(n=>(e(s=>[...s,n]),()=>e(s=>{let o=s.slice(),p=o.indexOf(n);return p!==-1&&o.splice(p,1),o}))),l=c(()=>({register:i,slot:t.slot,name:t.name,props:t.props,value:t.value}),[i,t.slot,t.name,t.props,t.value]);return m.createElement(a.Provider,{value:l},t.children)},[e])]}let S="p";function C(r,e){let d=x(),t=v(),{id:i=`headlessui-description-${d}`,...l}=r,n=f(),s=E(e);y(()=>n.register(i),[i,n.register]);let o=t||!1,p=c(()=>({...n.slot,disabled:o}),[n.slot,o]),D={ref:s,...n.props,id:i};return I({ourProps:D,theirProps:l,slot:p,defaultTag:S,name:n.name||"Description"})}let _=R(C),w=Object.assign(_,{});export{w as Description,G as useDescribedBy,U as useDescriptions};

@@ -1,55 +0,70 @@

import React, { MutableRefObject, Ref } from 'react';
import { Props } from '../../types.js';
import { PropsForFeatures } from '../../utils/render.js';
interface DialogRenderPropArg {
import React, { type ElementType, type MutableRefObject, type Ref } from 'react';
import type { Props } from '../../types.js';
import { type HasDisplayName, type PropsForFeatures, type RefProp } from '../../utils/render.js';
import { type _internal_ComponentDescription } from '../description/description.js';
declare let DEFAULT_DIALOG_TAG: "div";
type DialogRenderPropArg = {
open: boolean;
}
declare type DialogPropsWeControl = 'role' | 'aria-modal' | 'aria-describedby' | 'aria-labelledby';
};
type DialogPropsWeControl = 'aria-describedby' | 'aria-labelledby' | 'aria-modal';
declare let DialogRenderFeatures: number;
interface OverlayRenderPropArg {
export type DialogProps<TTag extends ElementType = typeof DEFAULT_DIALOG_TAG> = Props<TTag, DialogRenderPropArg, DialogPropsWeControl, PropsForFeatures<typeof DialogRenderFeatures> & {
open?: boolean;
onClose(value: boolean): void;
initialFocus?: MutableRefObject<HTMLElement | null>;
role?: 'dialog' | 'alertdialog';
autoFocus?: boolean;
transition?: boolean;
__demoMode?: boolean;
}>;
declare function DialogFn<TTag extends ElementType = typeof DEFAULT_DIALOG_TAG>(props: DialogProps<TTag>, ref: Ref<HTMLElement>): React.JSX.Element;
declare let DEFAULT_PANEL_TAG: "div";
type PanelRenderPropArg = {
open: boolean;
}
declare type OverlayPropsWeControl = 'aria-hidden' | 'onClick';
interface BackdropRenderPropArg {
};
export type DialogPanelProps<TTag extends ElementType = typeof DEFAULT_PANEL_TAG> = Props<TTag, PanelRenderPropArg, never, {
transition?: boolean;
}>;
declare function PanelFn<TTag extends ElementType = typeof DEFAULT_PANEL_TAG>(props: DialogPanelProps<TTag>, ref: Ref<HTMLElement>): React.JSX.Element;
declare let DEFAULT_BACKDROP_TAG: "div";
type BackdropRenderPropArg = {
open: boolean;
}
declare type BackdropPropsWeControl = 'aria-hidden' | 'onClick';
interface PanelRenderPropArg {
};
export type DialogBackdropProps<TTag extends ElementType = typeof DEFAULT_BACKDROP_TAG> = Props<TTag, BackdropRenderPropArg, never, {
transition?: boolean;
}>;
declare function BackdropFn<TTag extends ElementType = typeof DEFAULT_BACKDROP_TAG>(props: DialogBackdropProps<TTag>, ref: Ref<HTMLElement>): React.JSX.Element;
declare let DEFAULT_TITLE_TAG: "h2";
type TitleRenderPropArg = {
open: boolean;
};
export type DialogTitleProps<TTag extends ElementType = typeof DEFAULT_TITLE_TAG> = Props<TTag, TitleRenderPropArg>;
declare function TitleFn<TTag extends ElementType = typeof DEFAULT_TITLE_TAG>(props: DialogTitleProps<TTag>, ref: Ref<HTMLElement>): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
export interface _internal_ComponentDialog extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_DIALOG_TAG>(props: DialogProps<TTag> & RefProp<typeof DialogFn>): JSX.Element;
}
interface TitleRenderPropArg {
open: boolean;
export interface _internal_ComponentDialogPanel extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_PANEL_TAG>(props: DialogPanelProps<TTag> & RefProp<typeof PanelFn>): JSX.Element;
}
export declare let Dialog: (<TTag extends React.ElementType<any> = "div">(props: Props<TTag, DialogRenderPropArg, DialogPropsWeControl> & (({
static?: undefined;
} & {
unmount?: boolean | undefined;
}) | ({
unmount?: undefined;
} & {
static?: boolean | undefined;
})) & {
open?: boolean | undefined;
onClose(value: boolean): void;
initialFocus?: React.MutableRefObject<HTMLElement | null> | undefined;
__demoMode?: boolean | undefined;
}, ref: Ref<HTMLDivElement>) => JSX.Element) & {
displayName: string;
} & {
Backdrop: (<TTag_1 extends React.ElementType<any> = "div">(props: Props<TTag_1, BackdropRenderPropArg, BackdropPropsWeControl>, ref: Ref<HTMLDivElement>) => JSX.Element) & {
displayName: string;
};
Panel: (<TTag_2 extends React.ElementType<any> = "div">(props: Props<TTag_2, PanelRenderPropArg, "1D45E01E-AF44-47C4-988A-19A94EBAF55C">, ref: Ref<HTMLDivElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
};
Overlay: (<TTag_3 extends React.ElementType<any> = "div">(props: Props<TTag_3, OverlayRenderPropArg, OverlayPropsWeControl>, ref: Ref<HTMLDivElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
};
Title: (<TTag_4 extends React.ElementType<any> = "h2">(props: Props<TTag_4, TitleRenderPropArg, "1D45E01E-AF44-47C4-988A-19A94EBAF55C">, ref: Ref<HTMLHeadingElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
};
Description: (<TTag_5 extends React.ElementType<any> = "p">(props: Props<TTag_5, {}, "1D45E01E-AF44-47C4-988A-19A94EBAF55C">, ref: React.Ref<HTMLParagraphElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
};
export interface _internal_ComponentDialogBackdrop extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_BACKDROP_TAG>(props: DialogBackdropProps<TTag> & RefProp<typeof BackdropFn>): JSX.Element;
}
export interface _internal_ComponentDialogTitle extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_TITLE_TAG>(props: DialogTitleProps<TTag> & RefProp<typeof TitleFn>): JSX.Element;
}
export interface _internal_ComponentDialogDescription extends _internal_ComponentDescription {
}
export declare let DialogPanel: _internal_ComponentDialogPanel;
export declare let DialogBackdrop: _internal_ComponentDialogBackdrop;
export declare let DialogTitle: _internal_ComponentDialogTitle;
/** @deprecated use `<Description>` instead of `<DialogDescription>` */
export declare let DialogDescription: _internal_ComponentDialogDescription;
export declare let Dialog: _internal_ComponentDialog & {
/** @deprecated use `<DialogPanel>` instead of `<Dialog.Panel>` */
Panel: _internal_ComponentDialogPanel;
/** @deprecated use `<DialogTitle>` instead of `<Dialog.Title>` */
Title: _internal_ComponentDialogTitle;
/** @deprecated use `<Description>` instead of `<Dialog.Description>` */
Description: _internal_ComponentDialogDescription;
};
export {};

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

import c,{createContext as re,createRef as le,useContext as N,useEffect as k,useMemo as A,useReducer as ne,useRef as H,useState as ie}from"react";import{match as I}from'../../utils/match.js';import{forwardRefWithAs as E,render as v,Features as V}from'../../utils/render.js';import{useSyncRefs as O}from'../../hooks/use-sync-refs.js';import{Keys as ae}from'../keyboard.js';import{isDisabledReactIssue7711 as se}from'../../utils/bugs.js';import{useId as C}from'../../hooks/use-id.js';import{FocusTrap as S}from'../../components/focus-trap/focus-trap.js';import{useInertOthers as de}from'../../hooks/use-inert-others.js';import{Portal as W}from'../../components/portal/portal.js';import{ForcePortalRoot as B}from'../../internal/portal-force-root.js';import{Description as pe,useDescriptions as ue}from'../description/description.js';import{useOpenClosed as fe,State as K}from'../../internal/open-closed.js';import{useServerHandoffComplete as ce}from'../../hooks/use-server-handoff-complete.js';import{StackProvider as ge,StackMessage as q}from'../../internal/stack-context.js';import{useOutsideClick as Te}from'../../hooks/use-outside-click.js';import{useOwnerDocument as me}from'../../hooks/use-owner.js';import{useEventListener as De}from'../../hooks/use-event-listener.js';import{Hidden as Pe,Features as ye}from'../../internal/hidden.js';import{useEvent as L}from'../../hooks/use-event.js';import{disposables as Re}from'../../utils/disposables.js';import{isIOS as he}from'../../utils/platform.js';var be=(t=>(t[t.Open=0]="Open",t[t.Closed=1]="Closed",t))(be||{}),Ae=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(Ae||{});let Ee={[0](n,e){return n.titleId===e.id?n:{...n,titleId:e.id}}},M=re(null);M.displayName="DialogContext";function w(n){let e=N(M);if(e===null){let t=new Error(`<${n} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,w),t}return e}function ve(n,e){k(()=>{var a;if(!e||!n)return;let t=Re();function i(l,s,T){let y=l.style.getPropertyValue(s);return Object.assign(l.style,{[s]:T}),t.add(()=>{Object.assign(l.style,{[s]:y})})}let o=n.documentElement,r=((a=n.defaultView)!=null?a:window).innerWidth-o.clientWidth;if(i(o,"overflow","hidden"),r>0){let l=o.clientWidth-o.offsetWidth,s=r-l;i(o,"paddingRight",`${s}px`)}if(he()){let l=window.pageYOffset;i(o,"position","fixed"),i(o,"marginTop",`-${l}px`),i(o,"width","100%"),t.add(()=>window.scrollTo(0,l))}return t.dispose},[n,e])}function Oe(n,e){return I(e.type,Ee,n,e)}let Ce="div",Se=V.RenderStrategy|V.Static,Le=E(function(e,t){let i=C(),{id:o=`headlessui-dialog-${i}`,open:d,onClose:r,initialFocus:a,__demoMode:l=!1,...s}=e,[T,y]=ie(0),p=fe();d===void 0&&p!==null&&(d=I(p,{[K.Open]:!0,[K.Closed]:!1}));let _=H(new Set),m=H(null),z=O(m,t),G=H(null),D=me(m),U=e.hasOwnProperty("open")||p!==null,$=e.hasOwnProperty("onClose");if(!U&&!$)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!U)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!$)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(typeof d!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${d}`);if(typeof r!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${r}`);let u=d?0:1,[R,J]=ne(Oe,{titleId:null,descriptionId:null,panelRef:le()}),h=L(()=>r(!1)),Y=L(f=>J({type:0,id:f})),x=ce()?l?!1:u===0:!1,F=T>1,Q=N(M)!==null,X=F?"parent":"leaf";de(m,F?x:!1),Te(()=>{var b,g;return[...Array.from((b=D==null?void 0:D.querySelectorAll("body > *, [data-headlessui-portal]"))!=null?b:[]).filter(P=>!(!(P instanceof HTMLElement)||P.contains(G.current)||R.panelRef.current&&P.contains(R.panelRef.current))),(g=R.panelRef.current)!=null?g:m.current]},h,x&&!F),De(D==null?void 0:D.defaultView,"keydown",f=>{f.defaultPrevented||f.key===ae.Escape&&u===0&&(F||(f.preventDefault(),f.stopPropagation(),h()))}),ve(D,u===0&&!Q),k(()=>{if(u!==0||!m.current)return;let f=new IntersectionObserver(b=>{for(let g of b)g.boundingClientRect.x===0&&g.boundingClientRect.y===0&&g.boundingClientRect.width===0&&g.boundingClientRect.height===0&&h()});return f.observe(m.current),()=>f.disconnect()},[u,m,h]);let[Z,ee]=ue(),te=A(()=>[{dialogState:u,close:h,setTitleId:Y},R],[u,R,h,Y]),j=A(()=>({open:u===0}),[u]),oe={ref:z,id:o,role:"dialog","aria-modal":u===0?!0:void 0,"aria-labelledby":R.titleId,"aria-describedby":Z};return c.createElement(ge,{type:"Dialog",enabled:u===0,element:m,onUpdate:L((f,b,g)=>{b==="Dialog"&&I(f,{[q.Add](){_.current.add(g),y(P=>P+1)},[q.Remove](){_.current.add(g),y(P=>P-1)}})})},c.createElement(B,{force:!0},c.createElement(W,null,c.createElement(M.Provider,{value:te},c.createElement(W.Group,{target:m},c.createElement(B,{force:!1},c.createElement(ee,{slot:j,name:"Dialog.Description"},c.createElement(S,{initialFocus:a,containers:_,features:x?I(X,{parent:S.features.RestoreFocus,leaf:S.features.All&~S.features.FocusLock}):S.features.None},v({ourProps:oe,theirProps:s,slot:j,defaultTag:Ce,features:Se,visible:u===0,name:"Dialog"})))))))),c.createElement(Pe,{features:ye.Hidden,ref:G}))}),we="div",Fe=E(function(e,t){let i=C(),{id:o=`headlessui-dialog-overlay-${i}`,...d}=e,[{dialogState:r,close:a}]=w("Dialog.Overlay"),l=O(t),s=L(p=>{if(p.target===p.currentTarget){if(se(p.currentTarget))return p.preventDefault();p.preventDefault(),p.stopPropagation(),a()}}),T=A(()=>({open:r===0}),[r]);return v({ourProps:{ref:l,id:o,"aria-hidden":!0,onClick:s},theirProps:d,slot:T,defaultTag:we,name:"Dialog.Overlay"})}),ke="div",Ie=E(function(e,t){let i=C(),{id:o=`headlessui-dialog-backdrop-${i}`,...d}=e,[{dialogState:r},a]=w("Dialog.Backdrop"),l=O(t);k(()=>{if(a.panelRef.current===null)throw new Error("A <Dialog.Backdrop /> component is being used, but a <Dialog.Panel /> component is missing.")},[a.panelRef]);let s=A(()=>({open:r===0}),[r]);return c.createElement(B,{force:!0},c.createElement(W,null,v({ourProps:{ref:l,id:o,"aria-hidden":!0},theirProps:d,slot:s,defaultTag:ke,name:"Dialog.Backdrop"})))}),Me="div",_e=E(function(e,t){let i=C(),{id:o=`headlessui-dialog-panel-${i}`,...d}=e,[{dialogState:r},a]=w("Dialog.Panel"),l=O(t,a.panelRef),s=A(()=>({open:r===0}),[r]),T=L(p=>{p.stopPropagation()});return v({ourProps:{ref:l,id:o,onClick:T},theirProps:d,slot:s,defaultTag:Me,name:"Dialog.Panel"})}),xe="h2",He=E(function(e,t){let i=C(),{id:o=`headlessui-dialog-title-${i}`,...d}=e,[{dialogState:r,setTitleId:a}]=w("Dialog.Title"),l=O(t);k(()=>(a(o),()=>a(null)),[o,a]);let s=A(()=>({open:r===0}),[r]);return v({ourProps:{ref:l,id:o},theirProps:d,slot:s,defaultTag:xe,name:"Dialog.Title"})}),Tt=Object.assign(Le,{Backdrop:Ie,Panel:_e,Overlay:Fe,Title:He,Description:pe});export{Tt as Dialog};
"use client";import n,{Fragment as H,createContext as le,createRef as ae,useContext as ie,useEffect as pe,useMemo as E,useReducer as se,useRef as N}from"react";import{useEscape as de}from'../../hooks/use-escape.js';import{useEvent as A}from'../../hooks/use-event.js';import{useId as I}from'../../hooks/use-id.js';import{useInertOthers as ue}from'../../hooks/use-inert-others.js';import{useIsTouchDevice as Te}from'../../hooks/use-is-touch-device.js';import{useOnDisappear as fe}from'../../hooks/use-on-disappear.js';import{useOutsideClick as ge}from'../../hooks/use-outside-click.js';import{useOwnerDocument as me}from'../../hooks/use-owner.js';import{MainTreeProvider as W,useMainTreeNode as ce,useRootContainers as De}from'../../hooks/use-root-containers.js';import{useScrollLock as Pe}from'../../hooks/use-scroll-lock.js';import{useServerHandoffComplete as ye}from'../../hooks/use-server-handoff-complete.js';import{useSyncRefs as M}from'../../hooks/use-sync-refs.js';import{CloseProvider as Ee}from'../../internal/close-provider.js';import{ResetOpenClosedProvider as Ae,State as R,useOpenClosed as $}from'../../internal/open-closed.js';import{ForcePortalRoot as j}from'../../internal/portal-force-root.js';import{match as _e}from'../../utils/match.js';import{RenderFeatures as Y,forwardRefWithAs as _,render as x}from'../../utils/render.js';import{Description as J,useDescriptions as Ce}from'../description/description.js';import{FocusTrap as Fe,FocusTrapFeatures as C}from'../focus-trap/focus-trap.js';import{Portal as be,PortalGroup as ve,useNestedPortals as Re}from'../portal/portal.js';import{Transition as xe,TransitionChild as K}from'../transition/transition.js';var Le=(o=>(o[o.Open=0]="Open",o[o.Closed=1]="Closed",o))(Le||{}),Oe=(t=>(t[t.SetTitleId=0]="SetTitleId",t))(Oe||{});let he={[0](e,t){return e.titleId===t.id?e:{...e,titleId:t.id}}},w=le(null);w.displayName="DialogContext";function L(e){let t=ie(w);if(t===null){let o=new Error(`<${e} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(o,L),o}return t}function Se(e,t){return _e(t.type,he,e,t)}let X=_(function(t,o){let a=I(),{id:l=`headlessui-dialog-${a}`,open:i,onClose:p,initialFocus:d,role:s="dialog",autoFocus:c=!0,__demoMode:f=!1,unmount:D=!1,...O}=t,h=N(!1);s=function(){return s==="dialog"||s==="alertdialog"?s:(h.current||(h.current=!0,console.warn(`Invalid role [${s}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")}();let P=$();i===void 0&&P!==null&&(i=(P&R.Open)===R.Open);let u=N(null),V=M(u,o),F=me(u),T=i?0:1,[b,q]=se(Se,{titleId:null,descriptionId:null,panelRef:ae()}),g=A(()=>p(!1)),G=A(r=>q({type:0,id:r})),m=ye()?T===0:!1,[z,Q]=Re(),Z={get current(){var r;return(r=b.panelRef.current)!=null?r:u.current}},v=ce(),{resolveContainers:S}=De({mainTreeNode:v,portals:z,defaultContainers:[Z]}),k=P!==null?(P&R.Closing)===R.Closing:!1;ue(f||k?!1:m,{allowed:A(()=>{var r,U;return[(U=(r=u.current)==null?void 0:r.closest("[data-headlessui-portal]"))!=null?U:null]}),disallowed:A(()=>{var r;return[(r=v==null?void 0:v.closest("body > *:not(#headlessui-portal-root)"))!=null?r:null]})}),ge(m,S,r=>{r.preventDefault(),g()}),de(m,F==null?void 0:F.defaultView,r=>{r.preventDefault(),r.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),g()}),Pe(f||k?!1:m,F,S),fe(m,u,g);let[ee,te]=Ce(),oe=E(()=>[{dialogState:T,close:g,setTitleId:G,unmount:D},b],[T,b,g,G,D]),B=E(()=>({open:T===0}),[T]),ne={ref:V,id:l,role:s,tabIndex:-1,"aria-modal":f?void 0:T===0?!0:void 0,"aria-labelledby":b.titleId,"aria-describedby":ee,unmount:D},re=!Te(),y=C.None;return m&&!f&&(y|=C.RestoreFocus,y|=C.TabLock,c&&(y|=C.AutoFocus),re&&(y|=C.InitialFocus)),n.createElement(Ae,null,n.createElement(j,{force:!0},n.createElement(be,null,n.createElement(w.Provider,{value:oe},n.createElement(ve,{target:u},n.createElement(j,{force:!1},n.createElement(te,{slot:B},n.createElement(Q,null,n.createElement(Fe,{initialFocus:d,initialFocusFallback:u,containers:S,features:y},n.createElement(Ee,{value:g},x({ourProps:ne,theirProps:O,slot:B,defaultTag:Ie,features:Me,visible:T===0,name:"Dialog"})))))))))))}),Ie="div",Me=Y.RenderStrategy|Y.Static;function we(e,t){let{transition:o=!1,open:a,...l}=e,i=$(),p=e.hasOwnProperty("open")||i!==null,d=e.hasOwnProperty("onClose");if(!p&&!d)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!p)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!d)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!i&&typeof e.open!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${e.open}`);if(typeof e.onClose!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${e.onClose}`);return(a!==void 0||o)&&!l.static?n.createElement(W,null,n.createElement(xe,{show:a,transition:o,unmount:l.unmount},n.createElement(X,{ref:t,...l}))):n.createElement(W,null,n.createElement(X,{ref:t,open:a,...l}))}let Ge="div";function ke(e,t){let o=I(),{id:a=`headlessui-dialog-panel-${o}`,transition:l=!1,...i}=e,[{dialogState:p,unmount:d},s]=L("Dialog.Panel"),c=M(t,s.panelRef),f=E(()=>({open:p===0}),[p]),D=A(u=>{u.stopPropagation()}),O={ref:c,id:a,onClick:D};return n.createElement(l?K:H,{...l?{unmount:d}:{}},x({ourProps:O,theirProps:i,slot:f,defaultTag:Ge,name:"Dialog.Panel"}))}let Be="div";function Ue(e,t){let{transition:o=!1,...a}=e,[{dialogState:l,unmount:i}]=L("Dialog.Backdrop"),p=E(()=>({open:l===0}),[l]),d={ref:t,"aria-hidden":!0};return n.createElement(o?K:H,{...o?{unmount:i}:{}},x({ourProps:d,theirProps:a,slot:p,defaultTag:Be,name:"Dialog.Backdrop"}))}let He="h2";function Ne(e,t){let o=I(),{id:a=`headlessui-dialog-title-${o}`,...l}=e,[{dialogState:i,setTitleId:p}]=L("Dialog.Title"),d=M(t);pe(()=>(p(a),()=>p(null)),[a,p]);let s=E(()=>({open:i===0}),[i]);return x({ourProps:{ref:d,id:a},theirProps:l,slot:s,defaultTag:He,name:"Dialog.Title"})}let We=_(we),$e=_(ke),ct=_(Ue),je=_(Ne),Dt=J,Pt=Object.assign(We,{Panel:$e,Title:je,Description:J});export{Pt as Dialog,ct as DialogBackdrop,Dt as DialogDescription,$e as DialogPanel,je as DialogTitle};

@@ -1,51 +0,59 @@

import React, { MutableRefObject, Ref } from 'react';
import { Props } from '../../types.js';
import { PropsForFeatures } from '../../utils/render.js';
interface DisclosureRenderPropArg {
import React, { type ElementType, type MutableRefObject, type Ref } from 'react';
import type { Props } from '../../types.js';
import { type HasDisplayName, type PropsForFeatures, type RefProp } from '../../utils/render.js';
declare let DEFAULT_DISCLOSURE_TAG: React.ExoticComponent<{
children?: React.ReactNode;
}>;
type DisclosureRenderPropArg = {
open: boolean;
close(focusableElement?: HTMLElement | MutableRefObject<HTMLElement | null>): void;
}
interface ButtonRenderPropArg {
};
type DisclosurePropsWeControl = never;
export type DisclosureProps<TTag extends ElementType = typeof DEFAULT_DISCLOSURE_TAG> = Props<TTag, DisclosureRenderPropArg, DisclosurePropsWeControl, {
defaultOpen?: boolean;
}>;
declare function DisclosureFn<TTag extends ElementType = typeof DEFAULT_DISCLOSURE_TAG>(props: DisclosureProps<TTag>, ref: Ref<HTMLElement>): React.JSX.Element;
declare let DEFAULT_BUTTON_TAG: "button";
type ButtonRenderPropArg = {
open: boolean;
}
declare type ButtonPropsWeControl = 'type' | 'aria-expanded' | 'aria-controls' | 'onKeyDown' | 'onClick';
interface PanelRenderPropArg {
hover: boolean;
active: boolean;
disabled: boolean;
focus: boolean;
autofocus: boolean;
};
type ButtonPropsWeControl = 'aria-controls' | 'aria-expanded';
export type DisclosureButtonProps<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG> = Props<TTag, ButtonRenderPropArg, ButtonPropsWeControl, {
disabled?: boolean;
autoFocus?: boolean;
}>;
declare function ButtonFn<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG>(props: DisclosureButtonProps<TTag>, ref: Ref<HTMLButtonElement>): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
declare let DEFAULT_PANEL_TAG: "div";
type PanelRenderPropArg = {
open: boolean;
close: (focusableElement?: HTMLElement | MutableRefObject<HTMLElement | null>) => void;
};
type DisclosurePanelPropsWeControl = never;
declare let PanelRenderFeatures: number;
export type DisclosurePanelProps<TTag extends ElementType = typeof DEFAULT_PANEL_TAG> = Props<TTag, PanelRenderPropArg, DisclosurePanelPropsWeControl, {
transition?: boolean;
} & PropsForFeatures<typeof PanelRenderFeatures>>;
declare function PanelFn<TTag extends ElementType = typeof DEFAULT_PANEL_TAG>(props: DisclosurePanelProps<TTag>, ref: Ref<HTMLElement>): React.JSX.Element;
export interface _internal_ComponentDisclosure extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_DISCLOSURE_TAG>(props: DisclosureProps<TTag> & RefProp<typeof DisclosureFn>): JSX.Element;
}
declare let PanelRenderFeatures: number;
export declare let Disclosure: (<TTag extends React.ElementType<any> = React.ExoticComponent<{
children?: React.ReactNode;
}>>(props: Omit<import('../../types.js').PropsOf<TTag>, "as" | "children" | "refName" | "className"> & {
as?: TTag | undefined;
children?: React.ReactNode | ((bag: DisclosureRenderPropArg) => React.ReactElement<any, string | React.JSXElementConstructor<any>>);
refName?: string | undefined;
} & (true extends (import('../../types.js').PropsOf<TTag> extends never ? never : "className" extends keyof import('../../types.js').PropsOf<TTag> ? true : never) ? {
className?: import('../../types.js').PropsOf<TTag>["className"] | ((bag: DisclosureRenderPropArg) => string) | undefined;
} : {}) & {
defaultOpen?: boolean | undefined;
}, ref: React.Ref<TTag>) => JSX.Element) & {
displayName: string;
} & {
Button: (<TTag_1 extends React.ElementType<any> = "button">(props: Props<TTag_1, ButtonRenderPropArg, ButtonPropsWeControl>, ref: Ref<HTMLButtonElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
};
Panel: (<TTag_2 extends React.ElementType<any> = "div">(props: Omit<import('../../types.js').PropsOf<TTag_2>, "as" | "children" | "refName" | "className"> & {
as?: TTag_2 | undefined;
children?: React.ReactNode | ((bag: PanelRenderPropArg) => React.ReactElement<any, string | React.JSXElementConstructor<any>>);
refName?: string | undefined;
} & (true extends (import('../../types.js').PropsOf<TTag_2> extends never ? never : "className" extends keyof import('../../types.js').PropsOf<TTag_2> ? true : never) ? {
className?: import('../../types.js').PropsOf<TTag_2>["className"] | ((bag: PanelRenderPropArg) => string) | undefined;
} : {}) & (({
static?: undefined;
} & {
unmount?: boolean | undefined;
}) | ({
unmount?: undefined;
} & {
static?: boolean | undefined;
})), ref: Ref<HTMLDivElement>) => JSX.Element) & {
displayName: string;
};
export interface _internal_ComponentDisclosureButton extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG>(props: DisclosureButtonProps<TTag> & RefProp<typeof ButtonFn>): JSX.Element;
}
export interface _internal_ComponentDisclosurePanel extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_PANEL_TAG>(props: DisclosurePanelProps<TTag> & RefProp<typeof PanelFn>): JSX.Element;
}
export declare let DisclosureButton: _internal_ComponentDisclosureButton;
export declare let DisclosurePanel: _internal_ComponentDisclosurePanel;
export declare let Disclosure: _internal_ComponentDisclosure & {
/** @deprecated use `<DisclosureButton>` instead of `<Disclosure.Button>` */
Button: _internal_ComponentDisclosureButton;
/** @deprecated use `<DisclosurePanel>` instead of `<Disclosure.Panel>` */
Panel: _internal_ComponentDisclosurePanel;
};
export {};

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

import g,{Fragment as U,createContext as I,useContext as C,useEffect as w,useMemo as E,useReducer as j,useRef as R}from"react";import{match as L}from'../../utils/match.js';import{forwardRefWithAs as O,render as k,Features as F}from'../../utils/render.js';import{optionalRef as N,useSyncRefs as M}from'../../hooks/use-sync-refs.js';import{useId as _}from'../../hooks/use-id.js';import{Keys as m}from'../keyboard.js';import{isDisabledReactIssue7711 as G}from'../../utils/bugs.js';import{OpenClosedProvider as W,State as x,useOpenClosed as $}from'../../internal/open-closed.js';import{useResolveButtonType as q}from'../../hooks/use-resolve-button-type.js';import{getOwnerDocument as z}from'../../utils/owner.js';import{useEvent as b}from'../../hooks/use-event.js';var J=(l=>(l[l.Open=0]="Open",l[l.Closed=1]="Closed",l))(J||{}),Q=(t=>(t[t.ToggleDisclosure=0]="ToggleDisclosure",t[t.CloseDisclosure=1]="CloseDisclosure",t[t.SetButtonId=2]="SetButtonId",t[t.SetPanelId=3]="SetPanelId",t[t.LinkPanel=4]="LinkPanel",t[t.UnlinkPanel=5]="UnlinkPanel",t))(Q||{});let V={[0]:e=>({...e,disclosureState:L(e.disclosureState,{[0]:1,[1]:0})}),[1]:e=>e.disclosureState===1?e:{...e,disclosureState:1},[4](e){return e.linkedPanel===!0?e:{...e,linkedPanel:!0}},[5](e){return e.linkedPanel===!1?e:{...e,linkedPanel:!1}},[2](e,n){return e.buttonId===n.buttonId?e:{...e,buttonId:n.buttonId}},[3](e,n){return e.panelId===n.panelId?e:{...e,panelId:n.panelId}}},B=I(null);B.displayName="DisclosureContext";function v(e){let n=C(B);if(n===null){let l=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(l,v),l}return n}let h=I(null);h.displayName="DisclosureAPIContext";function K(e){let n=C(h);if(n===null){let l=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(l,K),l}return n}let H=I(null);H.displayName="DisclosurePanelContext";function X(){return C(H)}function Y(e,n){return L(n.type,V,e,n)}let Z=U,ee=O(function(n,l){let{defaultOpen:y=!1,...u}=n,T=R(null),t=M(l,N(a=>{T.current=a},n.as===void 0||n.as===U)),o=R(null),f=R(null),s=j(Y,{disclosureState:y?0:1,linkedPanel:!1,buttonRef:f,panelRef:o,buttonId:null,panelId:null}),[{disclosureState:i,buttonId:p},D]=s,d=b(a=>{D({type:1});let r=z(T);if(!r||!p)return;let c=(()=>a?a instanceof HTMLElement?a:a.current instanceof HTMLElement?a.current:r.getElementById(p):r.getElementById(p))();c==null||c.focus()}),P=E(()=>({close:d}),[d]),A=E(()=>({open:i===0,close:d}),[i,d]),S={ref:t};return g.createElement(B.Provider,{value:s},g.createElement(h.Provider,{value:P},g.createElement(W,{value:L(i,{[0]:x.Open,[1]:x.Closed})},k({ourProps:S,theirProps:u,slot:A,defaultTag:Z,name:"Disclosure"}))))}),te="button",ne=O(function(n,l){let y=_(),{id:u=`headlessui-disclosure-button-${y}`,...T}=n,[t,o]=v("Disclosure.Button"),f=X(),s=f===null?!1:f===t.panelId,i=R(null),p=M(i,l,s?null:t.buttonRef);w(()=>{if(!s)return o({type:2,buttonId:u}),()=>{o({type:2,buttonId:null})}},[u,o,s]);let D=b(r=>{var c;if(s){if(t.disclosureState===1)return;switch(r.key){case m.Space:case m.Enter:r.preventDefault(),r.stopPropagation(),o({type:0}),(c=t.buttonRef.current)==null||c.focus();break}}else switch(r.key){case m.Space:case m.Enter:r.preventDefault(),r.stopPropagation(),o({type:0});break}}),d=b(r=>{switch(r.key){case m.Space:r.preventDefault();break}}),P=b(r=>{var c;G(r.currentTarget)||n.disabled||(s?(o({type:0}),(c=t.buttonRef.current)==null||c.focus()):o({type:0}))}),A=E(()=>({open:t.disclosureState===0}),[t]),S=q(n,i),a=s?{ref:p,type:S,onKeyDown:D,onClick:P}:{ref:p,id:u,type:S,"aria-expanded":n.disabled?void 0:t.disclosureState===0,"aria-controls":t.linkedPanel?t.panelId:void 0,onKeyDown:D,onKeyUp:d,onClick:P};return k({ourProps:a,theirProps:T,slot:A,defaultTag:te,name:"Disclosure.Button"})}),le="div",re=F.RenderStrategy|F.Static,oe=O(function(n,l){let y=_(),{id:u=`headlessui-disclosure-panel-${y}`,...T}=n,[t,o]=v("Disclosure.Panel"),{close:f}=K("Disclosure.Panel"),s=M(l,t.panelRef,P=>{o({type:P?4:5})});w(()=>(o({type:3,panelId:u}),()=>{o({type:3,panelId:null})}),[u,o]);let i=$(),p=(()=>i!==null?i===x.Open:t.disclosureState===0)(),D=E(()=>({open:t.disclosureState===0,close:f}),[t,f]),d={ref:s,id:u};return g.createElement(H.Provider,{value:t.panelId},k({ourProps:d,theirProps:T,slot:D,defaultTag:le,features:re,visible:p,name:"Disclosure.Panel"}))}),Le=Object.assign(ee,{Button:ne,Panel:oe});export{Le as Disclosure};
"use client";import{useFocusRing as Q}from"@react-aria/focus";import{useHover as Y}from"@react-aria/interactions";import y,{Fragment as G,createContext as I,useContext as x,useEffect as K,useMemo as C,useReducer as Z,useRef as W,useState as ee}from"react";import{useActivePress as te}from'../../hooks/use-active-press.js';import{useEvent as P}from'../../hooks/use-event.js';import{useId as j}from'../../hooks/use-id.js';import{useResolveButtonType as ne}from'../../hooks/use-resolve-button-type.js';import{optionalRef as oe,useSyncRefs as L}from'../../hooks/use-sync-refs.js';import{transitionDataAttributes as le,useTransition as re}from'../../hooks/use-transition.js';import{CloseProvider as se}from'../../internal/close-provider.js';import{OpenClosedProvider as ue,ResetOpenClosedProvider as ie,State as R,useOpenClosed as ae}from'../../internal/open-closed.js';import{isDisabledReactIssue7711 as pe}from'../../utils/bugs.js';import{match as B}from'../../utils/match.js';import{getOwnerDocument as ce}from'../../utils/owner.js';import{RenderFeatures as $,forwardRefWithAs as v,mergeProps as J,render as O,useMergeRefsFn as X}from'../../utils/render.js';import{startTransition as de}from'../../utils/start-transition.js';import{Keys as g}from'../keyboard.js';var Te=(l=>(l[l.Open=0]="Open",l[l.Closed=1]="Closed",l))(Te||{}),fe=(n=>(n[n.ToggleDisclosure=0]="ToggleDisclosure",n[n.CloseDisclosure=1]="CloseDisclosure",n[n.SetButtonId=2]="SetButtonId",n[n.SetPanelId=3]="SetPanelId",n[n.SetButtonElement=4]="SetButtonElement",n[n.SetPanelElement=5]="SetPanelElement",n))(fe||{});let me={[0]:e=>({...e,disclosureState:B(e.disclosureState,{[0]:1,[1]:0})}),[1]:e=>e.disclosureState===1?e:{...e,disclosureState:1},[2](e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},[3](e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}},[4](e,t){return e.buttonElement===t.element?e:{...e,buttonElement:t.element}},[5](e,t){return e.panelElement===t.element?e:{...e,panelElement:t.element}}},_=I(null);_.displayName="DisclosureContext";function M(e){let t=x(_);if(t===null){let l=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(l,M),l}return t}let F=I(null);F.displayName="DisclosureAPIContext";function V(e){let t=x(F);if(t===null){let l=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(l,V),l}return t}let H=I(null);H.displayName="DisclosurePanelContext";function De(){return x(H)}function ye(e,t){return B(t.type,me,e,t)}let Pe=G;function Ee(e,t){let{defaultOpen:l=!1,...p}=e,i=W(null),c=L(t,oe(a=>{i.current=a},e.as===void 0||e.as===G)),n=Z(ye,{disclosureState:l?0:1,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:o,buttonId:r},f]=n,s=P(a=>{f({type:1});let T=ce(i);if(!T||!r)return;let d=(()=>a?a instanceof HTMLElement?a:a.current instanceof HTMLElement?a.current:T.getElementById(r):T.getElementById(r))();d==null||d.focus()}),E=C(()=>({close:s}),[s]),m=C(()=>({open:o===0,close:s}),[o,s]),D={ref:c};return y.createElement(_.Provider,{value:n},y.createElement(F.Provider,{value:E},y.createElement(se,{value:s},y.createElement(ue,{value:B(o,{[0]:R.Open,[1]:R.Closed})},O({ourProps:D,theirProps:p,slot:m,defaultTag:Pe,name:"Disclosure"})))))}let Se="button";function ge(e,t){let l=j(),{id:p=`headlessui-disclosure-button-${l}`,disabled:i=!1,autoFocus:c=!1,...n}=e,[o,r]=M("Disclosure.Button"),f=De(),s=f===null?!1:f===o.panelId,E=W(null),m=L(E,t,P(u=>{if(!s)return r({type:4,element:u})})),D=X();K(()=>{if(!s)return r({type:2,buttonId:p}),()=>{r({type:2,buttonId:null})}},[p,r,s]);let a=P(u=>{var S;if(s){if(o.disclosureState===1)return;switch(u.key){case g.Space:case g.Enter:u.preventDefault(),u.stopPropagation(),r({type:0}),(S=o.buttonElement)==null||S.focus();break}}else switch(u.key){case g.Space:case g.Enter:u.preventDefault(),u.stopPropagation(),r({type:0});break}}),T=P(u=>{switch(u.key){case g.Space:u.preventDefault();break}}),d=P(u=>{var S;pe(u.currentTarget)||i||(s?(r({type:0}),(S=o.buttonElement)==null||S.focus()):r({type:0}))}),{isFocusVisible:A,focusProps:b}=Q({autoFocus:c}),{isHovered:h,hoverProps:U}=Y({isDisabled:i}),{pressed:N,pressProps:k}=te({disabled:i}),q=C(()=>({open:o.disclosureState===0,hover:h,active:N,disabled:i,focus:A,autofocus:c}),[o,h,N,A,i,c]),w=ne(e,o.buttonElement),z=s?J({ref:m,type:w,disabled:i||void 0,autoFocus:c,onKeyDown:a,onClick:d},b,U,k):J({ref:m,id:p,type:w,"aria-expanded":o.disclosureState===0,"aria-controls":o.panelElement?o.panelId:void 0,disabled:i||void 0,autoFocus:c,onKeyDown:a,onKeyUp:T,onClick:d},b,U,k);return O({mergeRefs:D,ourProps:z,theirProps:n,slot:q,defaultTag:Se,name:"Disclosure.Button"})}let Ae="div",be=$.RenderStrategy|$.Static;function Ce(e,t){let l=j(),{id:p=`headlessui-disclosure-panel-${l}`,transition:i=!1,...c}=e,[n,o]=M("Disclosure.Panel"),{close:r}=V("Disclosure.Panel"),f=X(),[s,E]=ee(null),m=L(t,P(b=>{de(()=>o({type:5,element:b}))}),E);K(()=>(o({type:3,panelId:p}),()=>{o({type:3,panelId:null})}),[p,o]);let D=ae(),[a,T]=re(i,s,D!==null?(D&R.Open)===R.Open:n.disclosureState===0),d=C(()=>({open:n.disclosureState===0,close:r}),[n.disclosureState,r]),A={ref:m,id:p,...le(T)};return y.createElement(ie,null,y.createElement(H.Provider,{value:n.panelId},O({mergeRefs:f,ourProps:A,theirProps:c,slot:d,defaultTag:Ae,features:be,visible:a,name:"Disclosure.Panel"})))}let Re=v(Ee),Ie=v(ge),xe=v(Ce),$e=Object.assign(Re,{Button:Ie,Panel:xe});export{$e as Disclosure,Ie as DisclosureButton,xe as DisclosurePanel};

@@ -1,32 +0,36 @@

import React, { MutableRefObject, Ref } from 'react';
import { Props } from '../../types.js';
declare enum Features {
import React, { type ElementType, type MutableRefObject, type Ref } from 'react';
import type { Props } from '../../types.js';
import { type HasDisplayName, type RefProp } from '../../utils/render.js';
type Containers = (() => Iterable<HTMLElement>) | MutableRefObject<Set<MutableRefObject<HTMLElement | null>>>;
declare let DEFAULT_FOCUS_TRAP_TAG: "div";
export declare enum FocusTrapFeatures {
/** No features enabled for the focus trap. */
None = 1,
None = 0,
/** Ensure that we move focus initially into the container. */
InitialFocus = 2,
InitialFocus = 1,
/** Ensure that pressing `Tab` and `Shift+Tab` is trapped within the container. */
TabLock = 4,
TabLock = 2,
/** Ensure that programmatically moving focus outside of the container is disallowed. */
FocusLock = 8,
FocusLock = 4,
/** Ensure that we restore the focus when unmounting the focus trap. */
RestoreFocus = 16,
/** Enable all features. */
All = 30
RestoreFocus = 8,
/** Initial focus should look for the `data-autofocus` */
AutoFocus = 16
}
export declare let FocusTrap: (<TTag extends React.ElementType<any> = "div">(props: Omit<import('../../types.js').PropsOf<TTag>, "as" | "children" | "refName" | "className"> & {
as?: TTag | undefined;
children?: React.ReactNode | ((bag: {}) => React.ReactElement<any, string | React.JSXElementConstructor<any>>);
refName?: string | undefined;
} & (true extends (import('../../types.js').PropsOf<TTag> extends never ? never : "className" extends keyof import('../../types.js').PropsOf<TTag> ? true : never) ? {
className?: import('../../types.js').PropsOf<TTag>["className"] | ((bag: {}) => string) | undefined;
} : {}) & {
initialFocus?: React.MutableRefObject<HTMLElement | null> | undefined;
features?: Features | undefined;
containers?: React.MutableRefObject<Set<React.MutableRefObject<HTMLElement | null>>> | undefined;
}, ref: Ref<HTMLDivElement>) => JSX.Element) & {
displayName: string;
} & {
features: typeof Features;
type FocusTrapRenderPropArg = {};
type FocusTrapPropsWeControl = never;
export type FocusTrapProps<TTag extends ElementType = typeof DEFAULT_FOCUS_TRAP_TAG> = Props<TTag, FocusTrapRenderPropArg, FocusTrapPropsWeControl, {
initialFocus?: MutableRefObject<HTMLElement | null>;
initialFocusFallback?: MutableRefObject<HTMLElement | null>;
features?: FocusTrapFeatures;
containers?: Containers;
}>;
declare function FocusTrapFn<TTag extends ElementType = typeof DEFAULT_FOCUS_TRAP_TAG>(props: FocusTrapProps<TTag>, ref: Ref<HTMLElement>): React.JSX.Element;
export interface _internal_ComponentFocusTrap extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_FOCUS_TRAP_TAG>(props: FocusTrapProps<TTag> & RefProp<typeof FocusTrapFn>): JSX.Element;
}
export declare let FocusTrap: _internal_ComponentFocusTrap & {
/** @deprecated use `FocusTrapFeatures` instead of `FocusTrap.features` */
features: typeof FocusTrapFeatures;
};
export {};

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

import i,{useEffect as h,useRef as m}from"react";import{forwardRefWithAs as y,render as S}from'../../utils/render.js';import{useServerHandoffComplete as g}from'../../hooks/use-server-handoff-complete.js';import{useSyncRefs as B}from'../../hooks/use-sync-refs.js';import{Features as M,Hidden as L}from'../../internal/hidden.js';import{focusElement as f,focusIn as b,Focus as E,FocusResult as I}from'../../utils/focus-management.js';import{match as P}from'../../utils/match.js';import{useEvent as _}from'../../hooks/use-event.js';import{useTabDirection as U,Direction as d}from'../../hooks/use-tab-direction.js';import{useIsMounted as H}from'../../hooks/use-is-mounted.js';import{useOwnerDocument as C}from'../../hooks/use-owner.js';import{useEventListener as R}from'../../hooks/use-event-listener.js';import{microTask as F}from'../../utils/micro-task.js';import{useWatch as O}from'../../hooks/use-watch.js';let N="div";var v=(r=>(r[r.None=1]="None",r[r.InitialFocus=2]="InitialFocus",r[r.TabLock=4]="TabLock",r[r.FocusLock=8]="FocusLock",r[r.RestoreFocus=16]="RestoreFocus",r[r.All=30]="All",r))(v||{});let fe=Object.assign(y(function(u,e){let l=m(null),o=B(l,e),{initialFocus:a,containers:r,features:n=30,...c}=u;g()||(n=1);let s=C(l);V({ownerDocument:s},Boolean(n&16));let j=x({ownerDocument:s,container:l,initialFocus:a},Boolean(n&2));G({ownerDocument:s,container:l,containers:r,previousActiveElement:j},Boolean(n&8));let k=U(),p=_(()=>{let T=l.current;!T||P(k.current,{[d.Forwards]:()=>b(T,E.First),[d.Backwards]:()=>b(T,E.Last)})}),A={ref:o};return i.createElement(i.Fragment,null,Boolean(n&4)&&i.createElement(L,{as:"button",type:"button",onFocus:p,features:M.Focusable}),S({ourProps:A,theirProps:c,defaultTag:N,name:"FocusTrap"}),Boolean(n&4)&&i.createElement(L,{as:"button",type:"button",onFocus:p,features:M.Focusable}))}),{features:v});function V({ownerDocument:t},u){let e=m(null);R(t==null?void 0:t.defaultView,"focusout",o=>{!u||e.current||(e.current=o.target)},!0),O(()=>{u||((t==null?void 0:t.activeElement)===(t==null?void 0:t.body)&&f(e.current),e.current=null)},[u]);let l=m(!1);h(()=>(l.current=!1,()=>{l.current=!0,F(()=>{!l.current||(f(e.current),e.current=null)})}),[])}function x({ownerDocument:t,container:u,initialFocus:e},l){let o=m(null),a=H();return O(()=>{if(!l)return;let r=u.current;!r||F(()=>{if(!a.current)return;let n=t==null?void 0:t.activeElement;if(e!=null&&e.current){if((e==null?void 0:e.current)===n){o.current=n;return}}else if(r.contains(n)){o.current=n;return}e!=null&&e.current?f(e.current):b(r,E.First)===I.Error&&console.warn("There are no focusable elements inside the <FocusTrap />"),o.current=t==null?void 0:t.activeElement})},[l]),o}function G({ownerDocument:t,container:u,containers:e,previousActiveElement:l},o){let a=H();R(t==null?void 0:t.defaultView,"focus",r=>{if(!o||!a.current)return;let n=new Set(e==null?void 0:e.current);n.add(u);let c=l.current;if(!c)return;let s=r.target;s&&s instanceof HTMLElement?W(n,s)?(l.current=s,f(s)):(r.preventDefault(),r.stopPropagation(),f(c)):f(l.current)},!0)}function W(t,u){var e;for(let l of t)if((e=l.current)!=null&&e.contains(u))return!0;return!1}export{fe as FocusTrap};
"use client";import L,{useRef as M}from"react";import{useDisposables as G}from'../../hooks/use-disposables.js';import{useEvent as A}from'../../hooks/use-event.js';import{useEventListener as W}from'../../hooks/use-event-listener.js';import{useIsMounted as P}from'../../hooks/use-is-mounted.js';import{useIsTopLayer as O}from'../../hooks/use-is-top-layer.js';import{useOnUnmount as K}from'../../hooks/use-on-unmount.js';import{useOwnerDocument as V}from'../../hooks/use-owner.js';import{useServerHandoffComplete as q}from'../../hooks/use-server-handoff-complete.js';import{useSyncRefs as J}from'../../hooks/use-sync-refs.js';import{Direction as H,useTabDirection as X}from'../../hooks/use-tab-direction.js';import{useWatch as y}from'../../hooks/use-watch.js';import{Hidden as C,HiddenFeatures as _}from'../../internal/hidden.js';import{history as b}from'../../utils/active-element-history.js';import{Focus as T,FocusResult as S,focusElement as p,focusIn as E}from'../../utils/focus-management.js';import{match as h}from'../../utils/match.js';import{microTask as j}from'../../utils/micro-task.js';import{forwardRefWithAs as z,render as Q}from'../../utils/render.js';function U(o){if(!o)return new Set;if(typeof o=="function")return new Set(o());let e=new Set;for(let t of o.current)t.current instanceof HTMLElement&&e.add(t.current);return e}let Y="div";var x=(n=>(n[n.None=0]="None",n[n.InitialFocus=1]="InitialFocus",n[n.TabLock=2]="TabLock",n[n.FocusLock=4]="FocusLock",n[n.RestoreFocus=8]="RestoreFocus",n[n.AutoFocus=16]="AutoFocus",n))(x||{});function Z(o,e){let t=M(null),r=J(t,e),{initialFocus:s,initialFocusFallback:a,containers:n,features:u=15,...f}=o;q()||(u=0);let l=V(t);w(u,{ownerDocument:l});let i=ee(u,{ownerDocument:l,container:t,initialFocus:s,initialFocusFallback:a});te(u,{ownerDocument:l,container:t,containers:n,previousActiveElement:i});let R=X(),g=A(c=>{let m=t.current;if(!m)return;(B=>B())(()=>{h(R.current,{[H.Forwards]:()=>{E(m,T.First,{skipElements:[c.relatedTarget,a]})},[H.Backwards]:()=>{E(m,T.Last,{skipElements:[c.relatedTarget,a]})}})})}),v=O(!!(u&2),"focus-trap#tab-lock"),N=G(),F=M(!1),k={ref:r,onKeyDown(c){c.key=="Tab"&&(F.current=!0,N.requestAnimationFrame(()=>{F.current=!1}))},onBlur(c){if(!(u&4))return;let m=U(n);t.current instanceof HTMLElement&&m.add(t.current);let d=c.relatedTarget;d instanceof HTMLElement&&d.dataset.headlessuiFocusGuard!=="true"&&(I(m,d)||(F.current?E(t.current,h(R.current,{[H.Forwards]:()=>T.Next,[H.Backwards]:()=>T.Previous})|T.WrapAround,{relativeTo:c.target}):c.target instanceof HTMLElement&&p(c.target)))}};return L.createElement(L.Fragment,null,v&&L.createElement(C,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:g,features:_.Focusable}),Q({ourProps:k,theirProps:f,defaultTag:Y,name:"FocusTrap"}),v&&L.createElement(C,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:g,features:_.Focusable}))}let $=z(Z),Fe=Object.assign($,{features:x});function D(o=!0){let e=M(b.slice());return y(([t],[r])=>{r===!0&&t===!1&&j(()=>{e.current.splice(0)}),r===!1&&t===!0&&(e.current=b.slice())},[o,b,e]),A(()=>{var t;return(t=e.current.find(r=>r!=null&&r.isConnected))!=null?t:null})}function w(o,{ownerDocument:e}){let t=!!(o&8),r=D(t);y(()=>{t||(e==null?void 0:e.activeElement)===(e==null?void 0:e.body)&&p(r())},[t]),K(()=>{t&&p(r())})}function ee(o,{ownerDocument:e,container:t,initialFocus:r,initialFocusFallback:s}){let a=M(null),n=O(!!(o&1),"focus-trap#initial-focus"),u=P();return y(()=>{if(o===0)return;if(!n){s!=null&&s.current&&p(s.current);return}let f=t.current;f&&j(()=>{if(!u.current)return;let l=e==null?void 0:e.activeElement;if(r!=null&&r.current){if((r==null?void 0:r.current)===l){a.current=l;return}}else if(f.contains(l)){a.current=l;return}if(r!=null&&r.current)p(r.current);else{if(o&16){if(E(f,T.First|T.AutoFocus)!==S.Error)return}else if(E(f,T.First)!==S.Error)return;if(s!=null&&s.current&&(p(s.current),(e==null?void 0:e.activeElement)===s.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}a.current=e==null?void 0:e.activeElement})},[s,n,o]),a}function te(o,{ownerDocument:e,container:t,containers:r,previousActiveElement:s}){let a=P(),n=!!(o&4);W(e==null?void 0:e.defaultView,"focus",u=>{if(!n||!a.current)return;let f=U(r);t.current instanceof HTMLElement&&f.add(t.current);let l=s.current;if(!l)return;let i=u.target;i&&i instanceof HTMLElement?I(f,i)?(s.current=i,p(i)):(u.preventDefault(),u.stopPropagation(),p(l)):p(s.current)},!0)}function I(o,e){for(let t of o)if(t.contains(e))return!0;return!1}export{Fe as FocusTrap,x as FocusTrapFeatures};

@@ -1,23 +0,36 @@

import React, { ReactNode, Ref } from 'react';
import { Props } from '../../types.js';
import React, { type ElementType, type ReactNode, type Ref } from 'react';
import type { Props } from '../../types.js';
import { type HasDisplayName, type RefProp } from '../../utils/render.js';
interface SharedData {
slot?: {};
name?: string;
props?: {};
props?: Record<string, any>;
}
export declare function useLabelContext(): {
value: string | undefined;
register(value: string): () => void;
} & SharedData;
export declare function useLabelledBy(alwaysAvailableIds?: (string | undefined | null)[]): string | undefined;
interface LabelProviderProps extends SharedData {
children: ReactNode;
value?: string | undefined;
}
export declare function useLabels(): [string | undefined, (props: LabelProviderProps) => JSX.Element];
export declare let Label: (<TTag extends React.ElementType<any> = "label">(props: Omit<import('../../types.js').PropsOf<TTag>, "as" | "children" | "refName" | "className"> & {
as?: TTag | undefined;
children?: React.ReactNode | ((bag: {}) => React.ReactElement<any, string | React.JSXElementConstructor<any>>);
refName?: string | undefined;
} & (true extends (import('../../types.js').PropsOf<TTag> extends never ? never : "className" extends keyof import('../../types.js').PropsOf<TTag> ? true : never) ? {
className?: import('../../types.js').PropsOf<TTag>["className"] | ((bag: {}) => string) | undefined;
} : {}) & {
passive?: boolean | undefined;
}, ref: Ref<HTMLLabelElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
export declare function useLabels({ inherit }?: {
inherit?: boolean | undefined;
}): [
string | undefined,
(props: LabelProviderProps & {
inherit?: boolean;
}) => JSX.Element
];
declare let DEFAULT_LABEL_TAG: "label";
export type LabelProps<TTag extends ElementType = typeof DEFAULT_LABEL_TAG> = Props<TTag> & {
passive?: boolean;
htmlFor?: string;
};
declare function LabelFn<TTag extends ElementType = typeof DEFAULT_LABEL_TAG>(props: LabelProps<TTag>, ref: Ref<HTMLLabelElement>): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
export interface _internal_ComponentLabel extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_LABEL_TAG>(props: LabelProps<TTag> & RefProp<typeof LabelFn>): JSX.Element;
}
export declare let Label: _internal_ComponentLabel;
export {};

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

import p,{createContext as m,useContext as L,useMemo as f,useState as b}from"react";import{useId as g}from'../../hooks/use-id.js';import{forwardRefWithAs as x,render as T}from'../../utils/render.js';import{useIsoMorphicEffect as E}from'../../hooks/use-iso-morphic-effect.js';import{useSyncRefs as P}from'../../hooks/use-sync-refs.js';import{useEvent as v}from'../../hooks/use-event.js';let u=m(null);function c(){let n=L(u);if(n===null){let r=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(r,c),r}return n}function M(){let[n,r]=b([]);return[n.length>0?n.join(" "):void 0,f(()=>function(e){let o=v(l=>(r(t=>[...t,l]),()=>r(t=>{let i=t.slice(),a=i.indexOf(l);return a!==-1&&i.splice(a,1),i}))),s=f(()=>({register:o,slot:e.slot,name:e.name,props:e.props}),[o,e.slot,e.name,e.props]);return p.createElement(u.Provider,{value:s},e.children)},[r])]}let h="label",F=x(function(r,d){let e=g(),{id:o=`headlessui-label-${e}`,passive:s=!1,...l}=r,t=c(),i=P(d);E(()=>t.register(o),[o,t.register]);let a={ref:i,...t.props,id:o};return s&&("onClick"in a&&delete a.onClick,"onClick"in l&&delete l.onClick),T({ourProps:a,theirProps:l,slot:t.slot||{},defaultTag:h,name:t.name||"Label"})});export{F as Label,M as useLabels};
"use client";import k,{createContext as D,useContext as h,useMemo as T,useState as R}from"react";import{useEvent as v}from'../../hooks/use-event.js';import{useId as _}from'../../hooks/use-id.js';import{useIsoMorphicEffect as A}from'../../hooks/use-iso-morphic-effect.js';import{useSyncRefs as B}from'../../hooks/use-sync-refs.js';import{useDisabled as F}from'../../internal/disabled.js';import{useProvidedId as S}from'../../internal/id.js';import{forwardRefWithAs as M,render as H}from'../../utils/render.js';let c=D(null);c.displayName="LabelContext";function P(){let r=h(c);if(r===null){let l=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(l,P),l}return r}function I(r){var a,e,o;let l=(e=(a=h(c))==null?void 0:a.value)!=null?e:void 0;return((o=r==null?void 0:r.length)!=null?o:0)>0?[l,...r].filter(Boolean).join(" "):l}function z({inherit:r=!1}={}){let l=I(),[a,e]=R([]),o=r?[l,...a].filter(Boolean):a;return[o.length>0?o.join(" "):void 0,T(()=>function(t){let s=v(i=>(e(p=>[...p,i]),()=>e(p=>{let u=p.slice(),d=u.indexOf(i);return d!==-1&&u.splice(d,1),u}))),m=T(()=>({register:s,slot:t.slot,name:t.name,props:t.props,value:t.value}),[s,t.slot,t.name,t.props,t.value]);return k.createElement(c.Provider,{value:m},t.children)},[e])]}let N="label";function G(r,l){var y;let a=_(),e=P(),o=S(),g=F(),{id:t=`headlessui-label-${a}`,htmlFor:s=o!=null?o:(y=e.props)==null?void 0:y.htmlFor,passive:m=!1,...i}=r,p=B(l);A(()=>e.register(t),[t,e.register]);let u=v(L=>{let b=L.currentTarget;if(b instanceof HTMLLabelElement&&L.preventDefault(),e.props&&"onClick"in e.props&&typeof e.props.onClick=="function"&&e.props.onClick(L),b instanceof HTMLLabelElement){let n=document.getElementById(b.htmlFor);if(n){let E=n.getAttribute("disabled");if(E==="true"||E==="")return;let x=n.getAttribute("aria-disabled");if(x==="true"||x==="")return;(n instanceof HTMLInputElement&&(n.type==="radio"||n.type==="checkbox")||n.role==="radio"||n.role==="checkbox"||n.role==="switch")&&n.click(),n.focus({preventScroll:!0})}}}),d=g||!1,C=T(()=>({...e.slot,disabled:d}),[e.slot,d]),f={ref:p,...e.props,id:t,htmlFor:s,onClick:u};return m&&("onClick"in f&&(delete f.htmlFor,delete f.onClick),"onClick"in i&&delete i.onClick),H({ourProps:f,theirProps:i,slot:C,defaultTag:s?N:"div",name:e.name||"Label"})}let U=M(G),K=Object.assign(U,{});export{K as Label,P as useLabelContext,I as useLabelledBy,z as useLabels};

@@ -1,69 +0,121 @@

import React, { Ref } from 'react';
import { Props } from '../../types.js';
import { PropsForFeatures } from '../../utils/render.js';
interface ListboxRenderPropArg<T> {
import React, { type ElementType, type Ref } from 'react';
import { type ByComparator } from '../../hooks/use-by-comparator.js';
import { type AnchorPropsWithSelection } from '../../internal/floating.js';
import type { Props } from '../../types.js';
import { type HasDisplayName, type PropsForFeatures, type RefProp } from '../../utils/render.js';
import { type _internal_ComponentLabel } from '../label/label.js';
declare let DEFAULT_LISTBOX_TAG: React.ExoticComponent<{
children?: React.ReactNode;
}>;
type ListboxRenderPropArg<T> = {
open: boolean;
disabled: boolean;
invalid: boolean;
value: T;
}
interface ButtonRenderPropArg {
};
export type ListboxProps<TTag extends ElementType = typeof DEFAULT_LISTBOX_TAG, TType = string, TActualType = TType> = Props<TTag, ListboxRenderPropArg<TType>, 'value' | 'defaultValue' | 'onChange' | 'by' | 'disabled' | 'horizontal' | 'name' | 'multiple', {
value?: TType;
defaultValue?: TType;
onChange?(value: TType): void;
by?: ByComparator<TActualType>;
disabled?: boolean;
invalid?: boolean;
horizontal?: boolean;
form?: string;
name?: string;
multiple?: boolean;
__demoMode?: boolean;
}>;
declare function ListboxFn<TTag extends ElementType = typeof DEFAULT_LISTBOX_TAG, TType = string, TActualType = TType extends (infer U)[] ? U : TType>(props: ListboxProps<TTag, TType, TActualType>, ref: Ref<HTMLElement>): React.JSX.Element;
declare let DEFAULT_BUTTON_TAG: "button";
type ButtonRenderPropArg = {
disabled: boolean;
invalid: boolean;
hover: boolean;
focus: boolean;
autofocus: boolean;
open: boolean;
disabled: boolean;
active: boolean;
value: any;
}
declare type ButtonPropsWeControl = 'type' | 'aria-haspopup' | 'aria-controls' | 'aria-expanded' | 'aria-labelledby' | 'disabled' | 'onKeyDown' | 'onClick';
interface LabelRenderPropArg {
};
type ButtonPropsWeControl = 'aria-controls' | 'aria-expanded' | 'aria-haspopup' | 'aria-labelledby' | 'disabled';
export type ListboxButtonProps<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG> = Props<TTag, ButtonRenderPropArg, ButtonPropsWeControl, {
autoFocus?: boolean;
disabled?: boolean;
}>;
declare function ButtonFn<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG>(props: ListboxButtonProps<TTag>, ref: Ref<HTMLButtonElement>): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
declare let DEFAULT_OPTIONS_TAG: "div";
type OptionsRenderPropArg = {
open: boolean;
disabled: boolean;
}
declare type LabelPropsWeControl = 'ref' | 'onClick';
interface OptionsRenderPropArg {
open: boolean;
}
declare type OptionsPropsWeControl = 'aria-activedescendant' | 'aria-labelledby' | 'aria-orientation' | 'onKeyDown' | 'role' | 'tabIndex';
};
type OptionsPropsWeControl = 'aria-activedescendant' | 'aria-labelledby' | 'aria-multiselectable' | 'aria-orientation' | 'role' | 'tabIndex';
declare let OptionsRenderFeatures: number;
interface OptionRenderPropArg {
export type ListboxOptionsProps<TTag extends ElementType = typeof DEFAULT_OPTIONS_TAG> = Props<TTag, OptionsRenderPropArg, OptionsPropsWeControl, {
anchor?: AnchorPropsWithSelection;
portal?: boolean;
modal?: boolean;
transition?: boolean;
} & PropsForFeatures<typeof OptionsRenderFeatures>>;
declare function OptionsFn<TTag extends ElementType = typeof DEFAULT_OPTIONS_TAG>(props: ListboxOptionsProps<TTag>, ref: Ref<HTMLElement>): React.JSX.Element;
declare let DEFAULT_OPTION_TAG: "div";
type OptionRenderPropArg = {
/** @deprecated use `focus` instead */
active: boolean;
focus: boolean;
selected: boolean;
disabled: boolean;
selectedOption: boolean;
};
type OptionPropsWeControl = 'aria-disabled' | 'aria-selected' | 'role' | 'tabIndex';
export type ListboxOptionProps<TTag extends ElementType = typeof DEFAULT_OPTION_TAG, TType = string> = Props<TTag, OptionRenderPropArg, OptionPropsWeControl, {
disabled?: boolean;
value: TType;
}>;
declare function OptionFn<TTag extends ElementType = typeof DEFAULT_OPTION_TAG, TType = Parameters<typeof ListboxRoot>[0]['value']>(props: ListboxOptionProps<TTag, TType>, ref: Ref<HTMLElement>): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
declare let DEFAULT_SELECTED_OPTION_TAG: React.ExoticComponent<{
children?: React.ReactNode;
}>;
type SelectedOptionRenderPropArg = {};
type SelectedOptionPropsWeControl = never;
export type ListboxSelectedOptionProps<TTag extends ElementType = typeof DEFAULT_SELECTED_OPTION_TAG> = Props<TTag, SelectedOptionRenderPropArg, SelectedOptionPropsWeControl, {
options: React.ReactNode;
placeholder?: React.ReactNode;
}>;
declare function SelectedFn<TTag extends ElementType = typeof DEFAULT_SELECTED_OPTION_TAG>(props: ListboxSelectedOptionProps<TTag>, ref: Ref<HTMLElement>): React.JSX.Element;
export interface _internal_ComponentListbox extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_LISTBOX_TAG, TType = string, TActualType = TType extends (infer U)[] ? U : TType>(props: ListboxProps<TTag, TType, TActualType> & RefProp<typeof ListboxFn>): JSX.Element;
}
declare type ListboxOptionPropsWeControl = 'role' | 'tabIndex' | 'aria-disabled' | 'aria-selected' | 'onPointerLeave' | 'onMouseLeave' | 'onPointerMove' | 'onMouseMove' | 'onFocus';
export declare let Listbox: (<TTag extends React.ElementType<any> = React.ExoticComponent<{
children?: React.ReactNode;
}>, TType = string, TActualType = TType extends (infer U)[] ? U : TType>(props: Props<TTag, ListboxRenderPropArg<TType>, "value" | "name" | "disabled" | "defaultValue" | "multiple" | "onChange" | "by" | "horizontal"> & {
value?: TType | undefined;
defaultValue?: TType | undefined;
onChange?(value: TType): void;
by?: (keyof TActualType & string) | ((a: TActualType, z: TActualType) => boolean) | undefined;
disabled?: boolean | undefined;
horizontal?: boolean | undefined;
name?: string | undefined;
multiple?: boolean | undefined;
}, ref: React.Ref<TTag>) => JSX.Element) & {
displayName: string;
} & {
Button: (<TTag_1 extends React.ElementType<any> = "button">(props: Props<TTag_1, ButtonRenderPropArg, ButtonPropsWeControl>, ref: Ref<HTMLButtonElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
};
Label: (<TTag_2 extends React.ElementType<any> = "label">(props: Props<TTag_2, LabelRenderPropArg, LabelPropsWeControl>, ref: Ref<HTMLElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
};
Options: (<TTag_3 extends React.ElementType<any> = "ul">(props: Props<TTag_3, OptionsRenderPropArg, OptionsPropsWeControl> & (({
static?: undefined;
} & {
unmount?: boolean | undefined;
}) | ({
unmount?: undefined;
} & {
static?: boolean | undefined;
})), ref: Ref<HTMLElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
};
Option: (<TTag_4 extends React.ElementType<any> = "li", TType_1 = unknown>(props: Props<TTag_4, OptionRenderPropArg, "value" | ListboxOptionPropsWeControl> & {
disabled?: boolean | undefined;
value: TType_1;
}, ref: Ref<HTMLElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
};
export interface _internal_ComponentListboxButton extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG>(props: ListboxButtonProps<TTag> & RefProp<typeof ButtonFn>): JSX.Element;
}
export interface _internal_ComponentListboxLabel extends _internal_ComponentLabel {
}
export interface _internal_ComponentListboxOptions extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_OPTIONS_TAG>(props: ListboxOptionsProps<TTag> & RefProp<typeof OptionsFn>): JSX.Element;
}
export interface _internal_ComponentListboxOption extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_OPTION_TAG, TType = Parameters<typeof ListboxRoot>[0]['value']>(props: ListboxOptionProps<TTag, TType> & RefProp<typeof OptionFn>): JSX.Element;
}
export interface _internal_ComponentListboxSelectedOption extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_SELECTED_OPTION_TAG>(props: ListboxSelectedOptionProps<TTag> & RefProp<typeof SelectedFn>): JSX.Element;
}
declare let ListboxRoot: _internal_ComponentListbox;
export declare let ListboxButton: _internal_ComponentListboxButton;
/** @deprecated use `<Label>` instead of `<ListboxLabel>` */
export declare let ListboxLabel: _internal_ComponentListboxLabel;
export declare let ListboxOptions: _internal_ComponentListboxOptions;
export declare let ListboxOption: _internal_ComponentListboxOption;
export declare let ListboxSelectedOption: _internal_ComponentListboxSelectedOption;
export declare let Listbox: _internal_ComponentListbox & {
/** @deprecated use `<ListboxButton>` instead of `<Listbox.Button>` */
Button: _internal_ComponentListboxButton;
/** @deprecated use `<Label>` instead of `<Listbox.Label>` */
Label: _internal_ComponentListboxLabel;
/** @deprecated use `<ListboxOptions>` instead of `<Listbox.Options>` */
Options: _internal_ComponentListboxOptions;
/** @deprecated use `<ListboxOption>` instead of `<Listbox.Option>` */
Option: _internal_ComponentListboxOption;
/** @deprecated use `<ListboxSelectedOption>` instead of `<Listbox.SelectedOption>` */
SelectedOption: _internal_ComponentListboxSelectedOption;
};
export {};

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

import K,{Fragment as xe,createContext as Y,createRef as ge,useCallback as Oe,useContext as Z,useEffect as ee,useMemo as I,useReducer as ye,useRef as E}from"react";import{useDisposables as V}from'../../hooks/use-disposables.js';import{useId as N}from'../../hooks/use-id.js';import{useIsoMorphicEffect as W}from'../../hooks/use-iso-morphic-effect.js';import{useComputed as te}from'../../hooks/use-computed.js';import{useSyncRefs as w}from'../../hooks/use-sync-refs.js';import{Features as oe,forwardRefWithAs as _,render as U,compact as Le}from'../../utils/render.js';import{match as C}from'../../utils/match.js';import{disposables as Q}from'../../utils/disposables.js';import{Keys as O}from'../keyboard.js';import{Focus as m,calculateActiveIndex as ve}from'../../utils/calculate-active-index.js';import{isDisabledReactIssue7711 as Re}from'../../utils/bugs.js';import{isFocusableElement as me,FocusableMode as Se,sortByDomNode as Ae}from'../../utils/focus-management.js';import{useOpenClosed as he,State as $,OpenClosedProvider as Pe}from'../../internal/open-closed.js';import{useResolveButtonType as De}from'../../hooks/use-resolve-button-type.js';import{useOutsideClick as Ie}from'../../hooks/use-outside-click.js';import{Hidden as Ee,Features as Ce}from'../../internal/hidden.js';import{objectToFormEntries as Me}from'../../utils/form.js';import{getOwnerDocument as Fe}from'../../utils/owner.js';import{useEvent as b}from'../../hooks/use-event.js';import{useControllable as ke}from'../../hooks/use-controllable.js';import{useLatestValue as we}from'../../hooks/use-latest-value.js';var _e=(o=>(o[o.Open=0]="Open",o[o.Closed=1]="Closed",o))(_e||{}),Ue=(o=>(o[o.Single=0]="Single",o[o.Multi=1]="Multi",o))(Ue||{}),Be=(o=>(o[o.Pointer=0]="Pointer",o[o.Other=1]="Other",o))(Be||{}),He=(n=>(n[n.OpenListbox=0]="OpenListbox",n[n.CloseListbox=1]="CloseListbox",n[n.GoToOption=2]="GoToOption",n[n.Search=3]="Search",n[n.ClearSearch=4]="ClearSearch",n[n.RegisterOption=5]="RegisterOption",n[n.UnregisterOption=6]="UnregisterOption",n[n.RegisterLabel=7]="RegisterLabel",n))(He||{});function z(e,r=o=>o){let o=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,p=Ae(r(e.options.slice()),d=>d.dataRef.current.domRef.current),i=o?p.indexOf(o):null;return i===-1&&(i=null),{options:p,activeOptionIndex:i}}let Ge={[1](e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,listboxState:1}},[0](e){if(e.dataRef.current.disabled||e.listboxState===0)return e;let r=e.activeOptionIndex,{isSelected:o}=e.dataRef.current,p=e.options.findIndex(i=>o(i.dataRef.current.value));return p!==-1&&(r=p),{...e,listboxState:0,activeOptionIndex:r}},[2](e,r){var i;if(e.dataRef.current.disabled||e.listboxState===1)return e;let o=z(e),p=ve(r,{resolveItems:()=>o.options,resolveActiveIndex:()=>o.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});return{...e,...o,searchQuery:"",activeOptionIndex:p,activationTrigger:(i=r.trigger)!=null?i:1}},[3]:(e,r)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let p=e.searchQuery!==""?0:1,i=e.searchQuery+r.value.toLowerCase(),t=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+p).concat(e.options.slice(0,e.activeOptionIndex+p)):e.options).find(n=>{var f;return!n.dataRef.current.disabled&&((f=n.dataRef.current.textValue)==null?void 0:f.startsWith(i))}),s=t?e.options.indexOf(t):-1;return s===-1||s===e.activeOptionIndex?{...e,searchQuery:i}:{...e,searchQuery:i,activeOptionIndex:s,activationTrigger:1}},[4](e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},[5]:(e,r)=>{let o={id:r.id,dataRef:r.dataRef},p=z(e,i=>[...i,o]);return e.activeOptionIndex===null&&e.dataRef.current.isSelected(r.dataRef.current.value)&&(p.activeOptionIndex=p.options.indexOf(o)),{...e,...p}},[6]:(e,r)=>{let o=z(e,p=>{let i=p.findIndex(d=>d.id===r.id);return i!==-1&&p.splice(i,1),p});return{...e,...o,activationTrigger:1}},[7]:(e,r)=>({...e,labelId:r.id})},q=Y(null);q.displayName="ListboxActionsContext";function B(e){let r=Z(q);if(r===null){let o=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(o,B),o}return r}let X=Y(null);X.displayName="ListboxDataContext";function H(e){let r=Z(X);if(r===null){let o=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(o,H),o}return r}function je(e,r){return C(r.type,Ge,e,r)}let Ke=xe,Ve=_(function(r,o){let{value:p,defaultValue:i,name:d,onChange:t,by:s=(l,c)=>l===c,disabled:n=!1,horizontal:f=!1,multiple:T=!1,...A}=r;const R=f?"horizontal":"vertical";let D=w(o),[y=T?[]:void 0,S]=ke(p,t,i),[h,u]=ye(je,{dataRef:ge(),listboxState:1,options:[],searchQuery:"",labelId:null,activeOptionIndex:null,activationTrigger:1}),a=E({static:!1,hold:!1}),x=E(null),M=E(null),P=E(null),L=b(typeof s=="string"?(l,c)=>{let v=s;return(l==null?void 0:l[v])===(c==null?void 0:c[v])}:s),G=Oe(l=>C(g.mode,{[1]:()=>y.some(c=>L(c,l)),[0]:()=>L(y,l)}),[y]),g=I(()=>({...h,value:y,disabled:n,mode:T?1:0,orientation:R,compare:L,isSelected:G,optionsPropsRef:a,labelRef:x,buttonRef:M,optionsRef:P}),[y,n,T,h]);W(()=>{h.dataRef.current=g},[g]),Ie([g.buttonRef,g.optionsRef],(l,c)=>{var v;u({type:1}),me(c,Se.Loose)||(l.preventDefault(),(v=g.buttonRef.current)==null||v.focus())},g.listboxState===0);let ne=I(()=>({open:g.listboxState===0,disabled:n,value:y}),[g,n,y]),ie=b(l=>{let c=g.options.find(v=>v.id===l);!c||F(c.dataRef.current.value)}),re=b(()=>{if(g.activeOptionIndex!==null){let{dataRef:l,id:c}=g.options[g.activeOptionIndex];F(l.current.value),u({type:2,focus:m.Specific,id:c})}}),ae=b(()=>u({type:0})),le=b(()=>u({type:1})),se=b((l,c,v)=>l===m.Specific?u({type:2,focus:m.Specific,id:c,trigger:v}):u({type:2,focus:l,trigger:v})),ue=b((l,c)=>(u({type:5,id:l,dataRef:c}),()=>u({type:6,id:l}))),pe=b(l=>(u({type:7,id:l}),()=>u({type:7,id:null}))),F=b(l=>C(g.mode,{[0](){return S==null?void 0:S(l)},[1](){let c=g.value.slice(),v=c.findIndex(k=>L(k,l));return v===-1?c.push(l):c.splice(v,1),S==null?void 0:S(c)}})),de=b(l=>u({type:3,value:l})),ce=b(()=>u({type:4})),fe=I(()=>({onChange:F,registerOption:ue,registerLabel:pe,goToOption:se,closeListbox:le,openListbox:ae,selectActiveOption:re,selectOption:ie,search:de,clearSearch:ce}),[]),be={ref:D},j=E(null),Te=V();return ee(()=>{!j.current||i!==void 0&&Te.addEventListener(j.current,"reset",()=>{F(i)})},[j,F]),K.createElement(q.Provider,{value:fe},K.createElement(X.Provider,{value:g},K.createElement(Pe,{value:C(g.listboxState,{[0]:$.Open,[1]:$.Closed})},d!=null&&y!=null&&Me({[d]:y}).map(([l,c],v)=>K.createElement(Ee,{features:Ce.Hidden,ref:v===0?k=>{var J;j.current=(J=k==null?void 0:k.closest("form"))!=null?J:null}:void 0,...Le({key:l,as:"input",type:"hidden",hidden:!0,readOnly:!0,name:l,value:c})})),U({ourProps:be,theirProps:A,slot:ne,defaultTag:Ke,name:"Listbox"}))))}),Ne="button",We=_(function(r,o){var h;let p=N(),{id:i=`headlessui-listbox-button-${p}`,...d}=r,t=H("Listbox.Button"),s=B("Listbox.Button"),n=w(t.buttonRef,o),f=V(),T=b(u=>{switch(u.key){case O.Space:case O.Enter:case O.ArrowDown:u.preventDefault(),s.openListbox(),f.nextFrame(()=>{t.value||s.goToOption(m.First)});break;case O.ArrowUp:u.preventDefault(),s.openListbox(),f.nextFrame(()=>{t.value||s.goToOption(m.Last)});break}}),A=b(u=>{switch(u.key){case O.Space:u.preventDefault();break}}),R=b(u=>{if(Re(u.currentTarget))return u.preventDefault();t.listboxState===0?(s.closeListbox(),f.nextFrame(()=>{var a;return(a=t.buttonRef.current)==null?void 0:a.focus({preventScroll:!0})})):(u.preventDefault(),s.openListbox())}),D=te(()=>{if(!!t.labelId)return[t.labelId,i].join(" ")},[t.labelId,i]),y=I(()=>({open:t.listboxState===0,disabled:t.disabled,value:t.value}),[t]),S={ref:n,id:i,type:De(r,t.buttonRef),"aria-haspopup":!0,"aria-controls":(h=t.optionsRef.current)==null?void 0:h.id,"aria-expanded":t.disabled?void 0:t.listboxState===0,"aria-labelledby":D,disabled:t.disabled,onKeyDown:T,onKeyUp:A,onClick:R};return U({ourProps:S,theirProps:d,slot:y,defaultTag:Ne,name:"Listbox.Button"})}),Qe="label",$e=_(function(r,o){let p=N(),{id:i=`headlessui-listbox-label-${p}`,...d}=r,t=H("Listbox.Label"),s=B("Listbox.Label"),n=w(t.labelRef,o);W(()=>s.registerLabel(i),[i]);let f=b(()=>{var R;return(R=t.buttonRef.current)==null?void 0:R.focus({preventScroll:!0})}),T=I(()=>({open:t.listboxState===0,disabled:t.disabled}),[t]);return U({ourProps:{ref:n,id:i,onClick:f},theirProps:d,slot:T,defaultTag:Qe,name:"Listbox.Label"})}),ze="ul",qe=oe.RenderStrategy|oe.Static,Xe=_(function(r,o){var u;let p=N(),{id:i=`headlessui-listbox-options-${p}`,...d}=r,t=H("Listbox.Options"),s=B("Listbox.Options"),n=w(t.optionsRef,o),f=V(),T=V(),A=he(),R=(()=>A!==null?A===$.Open:t.listboxState===0)();ee(()=>{var x;let a=t.optionsRef.current;!a||t.listboxState===0&&a!==((x=Fe(a))==null?void 0:x.activeElement)&&a.focus({preventScroll:!0})},[t.listboxState,t.optionsRef]);let D=b(a=>{switch(T.dispose(),a.key){case O.Space:if(t.searchQuery!=="")return a.preventDefault(),a.stopPropagation(),s.search(a.key);case O.Enter:if(a.preventDefault(),a.stopPropagation(),t.activeOptionIndex!==null){let{dataRef:x}=t.options[t.activeOptionIndex];s.onChange(x.current.value)}t.mode===0&&(s.closeListbox(),Q().nextFrame(()=>{var x;return(x=t.buttonRef.current)==null?void 0:x.focus({preventScroll:!0})}));break;case C(t.orientation,{vertical:O.ArrowDown,horizontal:O.ArrowRight}):return a.preventDefault(),a.stopPropagation(),s.goToOption(m.Next);case C(t.orientation,{vertical:O.ArrowUp,horizontal:O.ArrowLeft}):return a.preventDefault(),a.stopPropagation(),s.goToOption(m.Previous);case O.Home:case O.PageUp:return a.preventDefault(),a.stopPropagation(),s.goToOption(m.First);case O.End:case O.PageDown:return a.preventDefault(),a.stopPropagation(),s.goToOption(m.Last);case O.Escape:return a.preventDefault(),a.stopPropagation(),s.closeListbox(),f.nextFrame(()=>{var x;return(x=t.buttonRef.current)==null?void 0:x.focus({preventScroll:!0})});case O.Tab:a.preventDefault(),a.stopPropagation();break;default:a.key.length===1&&(s.search(a.key),T.setTimeout(()=>s.clearSearch(),350));break}}),y=te(()=>{var a,x,M;return(M=(a=t.labelRef.current)==null?void 0:a.id)!=null?M:(x=t.buttonRef.current)==null?void 0:x.id},[t.labelRef.current,t.buttonRef.current]),S=I(()=>({open:t.listboxState===0}),[t]),h={"aria-activedescendant":t.activeOptionIndex===null||(u=t.options[t.activeOptionIndex])==null?void 0:u.id,"aria-multiselectable":t.mode===1?!0:void 0,"aria-labelledby":y,"aria-orientation":t.orientation,id:i,onKeyDown:D,role:"listbox",tabIndex:0,ref:n};return U({ourProps:h,theirProps:d,slot:S,defaultTag:ze,features:qe,visible:R,name:"Listbox.Options"})}),Je="li",Ye=_(function(r,o){let p=N(),{id:i=`headlessui-listbox-option-${p}`,disabled:d=!1,value:t,...s}=r,n=H("Listbox.Option"),f=B("Listbox.Option"),T=n.activeOptionIndex!==null?n.options[n.activeOptionIndex].id===i:!1,A=n.isSelected(t),R=E(null),D=we({disabled:d,value:t,domRef:R,get textValue(){var P,L;return(L=(P=R.current)==null?void 0:P.textContent)==null?void 0:L.toLowerCase()}}),y=w(o,R);W(()=>{if(n.listboxState!==0||!T||n.activationTrigger===0)return;let P=Q();return P.requestAnimationFrame(()=>{var L,G;(G=(L=R.current)==null?void 0:L.scrollIntoView)==null||G.call(L,{block:"nearest"})}),P.dispose},[R,T,n.listboxState,n.activationTrigger,n.activeOptionIndex]),W(()=>f.registerOption(i,D),[D,i]);let S=b(P=>{if(d)return P.preventDefault();f.onChange(t),n.mode===0&&(f.closeListbox(),Q().nextFrame(()=>{var L;return(L=n.buttonRef.current)==null?void 0:L.focus({preventScroll:!0})}))}),h=b(()=>{if(d)return f.goToOption(m.Nothing);f.goToOption(m.Specific,i)}),u=b(()=>{d||T||f.goToOption(m.Specific,i,0)}),a=b(()=>{d||!T||f.goToOption(m.Nothing)}),x=I(()=>({active:T,selected:A,disabled:d}),[T,A,d]);return U({ourProps:{id:i,ref:y,role:"option",tabIndex:d===!0?void 0:-1,"aria-disabled":d===!0?!0:void 0,"aria-selected":A,disabled:void 0,onClick:S,onFocus:h,onPointerMove:u,onMouseMove:u,onPointerLeave:a,onMouseLeave:a},theirProps:s,slot:x,defaultTag:Je,name:"Listbox.Option"})}),Et=Object.assign(Ve,{Button:We,Label:$e,Options:Xe,Option:Ye});export{Et as Listbox};
"use client";import{useFocusRing as Ae}from"@react-aria/focus";import{useHover as Re}from"@react-aria/interactions";import h,{Fragment as me,createContext as le,createRef as he,useCallback as ae,useContext as se,useEffect as De,useMemo as k,useReducer as _e,useRef as pe,useState as Ie}from"react";import{flushSync as U}from"react-dom";import{useActivePress as Ce}from'../../hooks/use-active-press.js';import{useByComparator as Fe}from'../../hooks/use-by-comparator.js';import{useControllable as Me}from'../../hooks/use-controllable.js';import{useDefaultValue as Be}from'../../hooks/use-default-value.js';import{useDidElementMove as we}from'../../hooks/use-did-element-move.js';import{useDisposables as xe}from'../../hooks/use-disposables.js';import{useElementSize as ke}from'../../hooks/use-element-size.js';import{useEvent as T}from'../../hooks/use-event.js';import{useId as ue}from'../../hooks/use-id.js';import{useInertOthers as Ue}from'../../hooks/use-inert-others.js';import{useIsoMorphicEffect as de}from'../../hooks/use-iso-morphic-effect.js';import{useLatestValue as Ne}from'../../hooks/use-latest-value.js';import{useOnDisappear as He}from'../../hooks/use-on-disappear.js';import{useOutsideClick as Ge}from'../../hooks/use-outside-click.js';import{useOwnerDocument as Ve}from'../../hooks/use-owner.js';import{useResolveButtonType as Ke}from'../../hooks/use-resolve-button-type.js';import{useScrollLock as je}from'../../hooks/use-scroll-lock.js';import{useSyncRefs as K}from'../../hooks/use-sync-refs.js';import{useTextValue as ze}from'../../hooks/use-text-value.js';import{useTrackedPointer as We}from'../../hooks/use-tracked-pointer.js';import{transitionDataAttributes as Qe,useTransition as Xe}from'../../hooks/use-transition.js';import{useDisabled as Je}from'../../internal/disabled.js';import{FloatingProvider as $e,useFloatingPanel as qe,useFloatingPanelProps as Ye,useFloatingReference as Ze,useFloatingReferenceProps as et,useResolvedAnchor as tt}from'../../internal/floating.js';import{FormFields as ot}from'../../internal/form-fields.js';import{useFrozenData as nt}from'../../internal/frozen.js';import{useProvidedId as it}from'../../internal/id.js';import{OpenClosedProvider as rt,State as q,useOpenClosed as lt}from'../../internal/open-closed.js';import{isDisabledReactIssue7711 as at}from'../../utils/bugs.js';import{Focus as v,calculateActiveIndex as ce}from'../../utils/calculate-active-index.js';import{disposables as st}from'../../utils/disposables.js';import{Focus as Oe,FocusableMode as pt,focusFrom as ut,isFocusableElement as dt,sortByDomNode as ct}from'../../utils/focus-management.js';import{attemptSubmit as ft}from'../../utils/form.js';import{match as G}from'../../utils/match.js';import{getOwnerDocument as bt}from'../../utils/owner.js';import{RenderFeatures as ye,forwardRefWithAs as j,mergeProps as ve,render as z}from'../../utils/render.js';import{useDescribedBy as Tt}from'../description/description.js';import{Keys as E}from'../keyboard.js';import{Label as mt,useLabelledBy as xt,useLabels as Ot}from'../label/label.js';import{Portal as yt}from'../portal/portal.js';var vt=(o=>(o[o.Open=0]="Open",o[o.Closed=1]="Closed",o))(vt||{}),gt=(o=>(o[o.Single=0]="Single",o[o.Multi=1]="Multi",o))(gt||{}),Lt=(o=>(o[o.Pointer=0]="Pointer",o[o.Other=1]="Other",o))(Lt||{}),St=(n=>(n[n.OpenListbox=0]="OpenListbox",n[n.CloseListbox=1]="CloseListbox",n[n.GoToOption=2]="GoToOption",n[n.Search=3]="Search",n[n.ClearSearch=4]="ClearSearch",n[n.RegisterOption=5]="RegisterOption",n[n.UnregisterOption=6]="UnregisterOption",n[n.SetButtonElement=7]="SetButtonElement",n[n.SetOptionsElement=8]="SetOptionsElement",n))(St||{});function fe(e,i=o=>o){let o=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=ct(i(e.options.slice()),m=>m.dataRef.current.domRef.current),a=o?r.indexOf(o):null;return a===-1&&(a=null),{options:r,activeOptionIndex:a}}let Et={[1](e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,listboxState:1,__demoMode:!1}},[0](e){if(e.dataRef.current.disabled||e.listboxState===0)return e;let i=e.activeOptionIndex,{isSelected:o}=e.dataRef.current,r=e.options.findIndex(a=>o(a.dataRef.current.value));return r!==-1&&(i=r),{...e,listboxState:0,activeOptionIndex:i,__demoMode:!1}},[2](e,i){var m,x,d,p,n;if(e.dataRef.current.disabled||e.listboxState===1)return e;let o={...e,searchQuery:"",activationTrigger:(m=i.trigger)!=null?m:1,__demoMode:!1};if(i.focus===v.Nothing)return{...o,activeOptionIndex:null};if(i.focus===v.Specific)return{...o,activeOptionIndex:e.options.findIndex(u=>u.id===i.id)};if(i.focus===v.Previous){let u=e.activeOptionIndex;if(u!==null){let P=e.options[u].dataRef.current.domRef,t=ce(i,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:s=>s.id,resolveDisabled:s=>s.dataRef.current.disabled});if(t!==null){let s=e.options[t].dataRef.current.domRef;if(((x=P.current)==null?void 0:x.previousElementSibling)===s.current||((d=s.current)==null?void 0:d.previousElementSibling)===null)return{...o,activeOptionIndex:t}}}}else if(i.focus===v.Next){let u=e.activeOptionIndex;if(u!==null){let P=e.options[u].dataRef.current.domRef,t=ce(i,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:s=>s.id,resolveDisabled:s=>s.dataRef.current.disabled});if(t!==null){let s=e.options[t].dataRef.current.domRef;if(((p=P.current)==null?void 0:p.nextElementSibling)===s.current||((n=s.current)==null?void 0:n.nextElementSibling)===null)return{...o,activeOptionIndex:t}}}}let r=fe(e),a=ce(i,{resolveItems:()=>r.options,resolveActiveIndex:()=>r.activeOptionIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled});return{...o,...r,activeOptionIndex:a}},[3]:(e,i)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let r=e.searchQuery!==""?0:1,a=e.searchQuery+i.value.toLowerCase(),x=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+r).concat(e.options.slice(0,e.activeOptionIndex+r)):e.options).find(p=>{var n;return!p.dataRef.current.disabled&&((n=p.dataRef.current.textValue)==null?void 0:n.startsWith(a))}),d=x?e.options.indexOf(x):-1;return d===-1||d===e.activeOptionIndex?{...e,searchQuery:a}:{...e,searchQuery:a,activeOptionIndex:d,activationTrigger:1}},[4](e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},[5]:(e,i)=>{let o={id:i.id,dataRef:i.dataRef},r=fe(e,a=>[...a,o]);return e.activeOptionIndex===null&&e.dataRef.current.isSelected(i.dataRef.current.value)&&(r.activeOptionIndex=r.options.indexOf(o)),{...e,...r}},[6]:(e,i)=>{let o=fe(e,r=>{let a=r.findIndex(m=>m.id===i.id);return a!==-1&&r.splice(a,1),r});return{...e,...o,activationTrigger:1}},[7]:(e,i)=>e.buttonElement===i.element?e:{...e,buttonElement:i.element},[8]:(e,i)=>e.optionsElement===i.element?e:{...e,optionsElement:i.element}},be=le(null);be.displayName="ListboxActionsContext";function Y(e){let i=se(be);if(i===null){let o=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(o,Y),o}return i}let Z=le(null);Z.displayName="ListboxDataContext";function W(e){let i=se(Z);if(i===null){let o=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(o,W),o}return i}function Pt(e,i){return G(i.type,Et,e,i)}let At=me;function Rt(e,i){var Te;let o=Je(),{value:r,defaultValue:a,form:m,name:x,onChange:d,by:p,invalid:n=!1,disabled:u=o||!1,horizontal:P=!1,multiple:t=!1,__demoMode:s=!1,...F}=e;const M=P?"horizontal":"vertical";let D=K(i),_=Be(a),[O=t?[]:void 0,g]=Me(r,d,_),[R,y]=_e(Pt,{dataRef:he(),listboxState:s?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,optionsVisible:!1,buttonElement:null,optionsElement:null,__demoMode:s}),B=pe({static:!1,hold:!1}),w=pe(new Map),f=Fe(p),A=ae(b=>G(c.mode,{[1]:()=>O.some(S=>f(S,b)),[0]:()=>f(O,b)}),[O]),c=k(()=>({...R,value:O,disabled:u,invalid:n,mode:t?1:0,orientation:M,compare:f,isSelected:A,optionsPropsRef:B,listRef:w}),[O,u,n,t,R,w]);de(()=>{R.dataRef.current=c},[c]);let L=c.listboxState===0;Ge(L,[c.buttonElement,c.optionsElement],(b,S)=>{var C;y({type:1}),dt(S,pt.Loose)||(b.preventDefault(),(C=c.buttonElement)==null||C.focus())});let N=k(()=>({open:c.listboxState===0,disabled:u,invalid:n,value:O}),[c,u,O,n]),ee=T(b=>{let S=c.options.find(C=>C.id===b);S&&V(S.dataRef.current.value)}),te=T(()=>{if(c.activeOptionIndex!==null){let{dataRef:b,id:S}=c.options[c.activeOptionIndex];V(b.current.value),y({type:2,focus:v.Specific,id:S})}}),oe=T(()=>y({type:0})),Q=T(()=>y({type:1})),X=xe(),ne=T((b,S,C)=>{X.dispose(),X.microTask(()=>b===v.Specific?y({type:2,focus:v.Specific,id:S,trigger:C}):y({type:2,focus:b,trigger:C}))}),ie=T((b,S)=>(y({type:5,id:b,dataRef:S}),()=>y({type:6,id:b}))),V=T(b=>G(c.mode,{[0](){return g==null?void 0:g(b)},[1](){let S=c.value.slice(),C=S.findIndex(Pe=>f(Pe,b));return C===-1?S.push(b):S.splice(C,1),g==null?void 0:g(S)}})),J=T(b=>y({type:3,value:b})),$=T(()=>y({type:4})),l=T(b=>{y({type:7,element:b})}),I=T(b=>{y({type:8,element:b})}),H=k(()=>({onChange:V,registerOption:ie,goToOption:ne,closeListbox:Q,openListbox:oe,selectActiveOption:te,selectOption:ee,search:J,clearSearch:$,setButtonElement:l,setOptionsElement:I}),[]),[re,Le]=Ot({inherit:!0}),Se={ref:D},Ee=ae(()=>{if(_!==void 0)return g==null?void 0:g(_)},[g,_]);return h.createElement(Le,{value:re,props:{htmlFor:(Te=c.buttonElement)==null?void 0:Te.id},slot:{open:c.listboxState===0,disabled:u}},h.createElement($e,null,h.createElement(be.Provider,{value:H},h.createElement(Z.Provider,{value:c},h.createElement(rt,{value:G(c.listboxState,{[0]:q.Open,[1]:q.Closed})},x!=null&&O!=null&&h.createElement(ot,{disabled:u,data:{[x]:O},form:m,onReset:Ee}),z({ourProps:Se,theirProps:F,slot:N,defaultTag:At,name:"Listbox"}))))))}let ht="button";function Dt(e,i){var c;let o=W("Listbox.Button"),r=Y("Listbox.Button"),a=ue(),m=it(),{id:x=m||`headlessui-listbox-button-${a}`,disabled:d=o.disabled||!1,autoFocus:p=!1,...n}=e,u=K(i,Ze(),r.setButtonElement),P=et(),t=T(L=>{switch(L.key){case E.Enter:ft(L.currentTarget);break;case E.Space:case E.ArrowDown:L.preventDefault(),U(()=>r.openListbox()),o.value||r.goToOption(v.First);break;case E.ArrowUp:L.preventDefault(),U(()=>r.openListbox()),o.value||r.goToOption(v.Last);break}}),s=T(L=>{switch(L.key){case E.Space:L.preventDefault();break}}),F=T(L=>{var N;if(at(L.currentTarget))return L.preventDefault();o.listboxState===0?(U(()=>r.closeListbox()),(N=o.buttonElement)==null||N.focus({preventScroll:!0})):(L.preventDefault(),r.openListbox())}),M=T(L=>L.preventDefault()),D=xt([x]),_=Tt(),{isFocusVisible:O,focusProps:g}=Ae({autoFocus:p}),{isHovered:R,hoverProps:y}=Re({isDisabled:d}),{pressed:B,pressProps:w}=Ce({disabled:d}),f=k(()=>({open:o.listboxState===0,active:B||o.listboxState===0,disabled:d,invalid:o.invalid,value:o.value,hover:R,focus:O,autofocus:p}),[o.listboxState,o.value,d,R,O,B,o.invalid,p]),A=ve(P(),{ref:u,id:x,type:Ke(e,o.buttonElement),"aria-haspopup":"listbox","aria-controls":(c=o.optionsElement)==null?void 0:c.id,"aria-expanded":o.listboxState===0,"aria-labelledby":D,"aria-describedby":_,disabled:d||void 0,autoFocus:p,onKeyDown:t,onKeyUp:s,onKeyPress:M,onClick:F},g,y,w);return z({ourProps:A,theirProps:n,slot:f,defaultTag:ht,name:"Listbox.Button"})}let ge=le(!1),_t="div",It=ye.RenderStrategy|ye.Static;function Ct(e,i){var J,$;let o=ue(),{id:r=`headlessui-listbox-options-${o}`,anchor:a,portal:m=!1,modal:x=!0,transition:d=!1,...p}=e,n=tt(a),[u,P]=Ie(null);n&&(m=!0);let t=W("Listbox.Options"),s=Y("Listbox.Options"),F=Ve(t.optionsElement),M=lt(),[D,_]=Xe(d,u,M!==null?(M&q.Open)===q.Open:t.listboxState===0);He(D,t.buttonElement,s.closeListbox);let O=t.__demoMode?!1:x&&t.listboxState===0;je(O,F);let g=t.__demoMode?!1:x&&t.listboxState===0;Ue(g,{allowed:ae(()=>[t.buttonElement,t.optionsElement],[t.buttonElement,t.optionsElement])});let R=t.listboxState!==0,B=we(R,t.buttonElement)?!1:D,w=D&&t.listboxState===1,f=nt(w,t.value),A=T(l=>t.compare(f,l)),c=k(()=>{var I;if(n==null||!((I=n==null?void 0:n.to)!=null&&I.includes("selection")))return null;let l=t.options.findIndex(H=>A(H.dataRef.current.value));return l===-1&&(l=0),l},[n,t.options]),L=(()=>{if(n==null)return;if(c===null)return{...n,inner:void 0};let l=Array.from(t.listRef.current.values());return{...n,inner:{listRef:{current:l},index:c}}})(),[N,ee]=qe(L),te=Ye(),oe=K(i,n?N:null,s.setOptionsElement,P),Q=xe();De(()=>{var I;let l=t.optionsElement;l&&t.listboxState===0&&l!==((I=bt(l))==null?void 0:I.activeElement)&&(l==null||l.focus({preventScroll:!0}))},[t.listboxState,t.optionsElement]);let X=T(l=>{var I,H;switch(Q.dispose(),l.key){case E.Space:if(t.searchQuery!=="")return l.preventDefault(),l.stopPropagation(),s.search(l.key);case E.Enter:if(l.preventDefault(),l.stopPropagation(),t.activeOptionIndex!==null){let{dataRef:re}=t.options[t.activeOptionIndex];s.onChange(re.current.value)}t.mode===0&&(U(()=>s.closeListbox()),(I=t.buttonElement)==null||I.focus({preventScroll:!0}));break;case G(t.orientation,{vertical:E.ArrowDown,horizontal:E.ArrowRight}):return l.preventDefault(),l.stopPropagation(),s.goToOption(v.Next);case G(t.orientation,{vertical:E.ArrowUp,horizontal:E.ArrowLeft}):return l.preventDefault(),l.stopPropagation(),s.goToOption(v.Previous);case E.Home:case E.PageUp:return l.preventDefault(),l.stopPropagation(),s.goToOption(v.First);case E.End:case E.PageDown:return l.preventDefault(),l.stopPropagation(),s.goToOption(v.Last);case E.Escape:l.preventDefault(),l.stopPropagation(),U(()=>s.closeListbox()),(H=t.buttonElement)==null||H.focus({preventScroll:!0});return;case E.Tab:l.preventDefault(),l.stopPropagation(),U(()=>s.closeListbox()),ut(t.buttonElement,l.shiftKey?Oe.Previous:Oe.Next);break;default:l.key.length===1&&(s.search(l.key),Q.setTimeout(()=>s.clearSearch(),350));break}}),ne=(J=t.buttonElement)==null?void 0:J.id,ie=k(()=>({open:t.listboxState===0}),[t.listboxState]),V=ve(n?te():{},{id:r,ref:oe,"aria-activedescendant":t.activeOptionIndex===null||($=t.options[t.activeOptionIndex])==null?void 0:$.id,"aria-multiselectable":t.mode===1?!0:void 0,"aria-labelledby":ne,"aria-orientation":t.orientation,onKeyDown:X,role:"listbox",tabIndex:t.listboxState===0?0:void 0,style:{...p.style,...ee,"--button-width":ke(t.buttonElement,!0).width},...Qe(_)});return h.createElement(yt,{enabled:m?e.static||D:!1},h.createElement(Z.Provider,{value:t.mode===1?t:{...t,isSelected:A}},z({ourProps:V,theirProps:p,slot:ie,defaultTag:_t,features:It,visible:B,name:"Listbox.Options"})))}let Ft="div";function Mt(e,i){let o=ue(),{id:r=`headlessui-listbox-option-${o}`,disabled:a=!1,value:m,...x}=e,d=se(ge)===!0,p=W("Listbox.Option"),n=Y("Listbox.Option"),u=p.activeOptionIndex!==null?p.options[p.activeOptionIndex].id===r:!1,P=p.isSelected(m),t=pe(null),s=ze(t),F=Ne({disabled:a,value:m,domRef:t,get textValue(){return s()}}),M=K(i,t,f=>{f?p.listRef.current.set(r,f):p.listRef.current.delete(r)});de(()=>{if(!p.__demoMode&&p.listboxState===0&&u&&p.activationTrigger!==0)return st().requestAnimationFrame(()=>{var f,A;(A=(f=t.current)==null?void 0:f.scrollIntoView)==null||A.call(f,{block:"nearest"})})},[t,u,p.__demoMode,p.listboxState,p.activationTrigger,p.activeOptionIndex]),de(()=>{if(!d)return n.registerOption(r,F)},[F,r,d]);let D=T(f=>{var A;if(a)return f.preventDefault();n.onChange(m),p.mode===0&&(U(()=>n.closeListbox()),(A=p.buttonElement)==null||A.focus({preventScroll:!0}))}),_=T(()=>{if(a)return n.goToOption(v.Nothing);n.goToOption(v.Specific,r)}),O=We(),g=T(f=>{O.update(f),!a&&(u||n.goToOption(v.Specific,r,0))}),R=T(f=>{O.wasMoved(f)&&(a||u||n.goToOption(v.Specific,r,0))}),y=T(f=>{O.wasMoved(f)&&(a||u&&n.goToOption(v.Nothing))}),B=k(()=>({active:u,focus:u,selected:P,disabled:a,selectedOption:P&&d}),[u,P,a,d]),w=d?{}:{id:r,ref:M,role:"option",tabIndex:a===!0?void 0:-1,"aria-disabled":a===!0?!0:void 0,"aria-selected":P,disabled:void 0,onClick:D,onFocus:_,onPointerEnter:g,onMouseEnter:g,onPointerMove:R,onMouseMove:R,onPointerLeave:y,onMouseLeave:y};return!P&&d?null:z({ourProps:w,theirProps:x,slot:B,defaultTag:Ft,name:"Listbox.Option"})}let Bt=me;function wt(e,i){let{options:o,placeholder:r,...a}=e,x={ref:K(i)},d=W("ListboxSelectedOption"),p=k(()=>({}),[]),n=d.value===void 0||d.value===null||d.mode===1&&Array.isArray(d.value)&&d.value.length===0;return h.createElement(ge.Provider,{value:!0},z({ourProps:x,theirProps:{...a,children:h.createElement(h.Fragment,null,r&&n?r:o)},slot:p,defaultTag:Bt,name:"ListboxSelectedOption"}))}let kt=j(Rt),Ut=j(Dt),Nt=mt,Ht=j(Ct),Gt=j(Mt),Vt=j(wt),Fo=Object.assign(kt,{Button:Ut,Label:Nt,Options:Ht,Option:Gt,SelectedOption:Vt});export{Fo as Listbox,Ut as ListboxButton,Nt as ListboxLabel,Gt as ListboxOption,Ht as ListboxOptions,Vt as ListboxSelectedOption};

@@ -1,50 +0,117 @@

import React, { Ref } from 'react';
import { Props } from '../../types.js';
import { PropsForFeatures } from '../../utils/render.js';
interface MenuRenderPropArg {
import React, { type ElementType, type Ref } from 'react';
import { type AnchorProps } from '../../internal/floating.js';
import type { Props } from '../../types.js';
import { type HasDisplayName, type RefProp } from '../../utils/render.js';
declare let DEFAULT_MENU_TAG: React.ExoticComponent<{
children?: React.ReactNode;
}>;
type MenuRenderPropArg = {
open: boolean;
close: () => void;
}
interface ButtonRenderPropArg {
};
type MenuPropsWeControl = never;
export type MenuProps<TTag extends ElementType = typeof DEFAULT_MENU_TAG> = Props<TTag, MenuRenderPropArg, MenuPropsWeControl, {
__demoMode?: boolean;
}>;
declare function MenuFn<TTag extends ElementType = typeof DEFAULT_MENU_TAG>(props: MenuProps<TTag>, ref: Ref<HTMLElement>): React.JSX.Element;
declare let DEFAULT_BUTTON_TAG: "button";
type ButtonRenderPropArg = {
open: boolean;
}
declare type ButtonPropsWeControl = 'type' | 'aria-haspopup' | 'aria-controls' | 'aria-expanded' | 'onKeyDown' | 'onClick';
interface ItemsRenderPropArg {
active: boolean;
hover: boolean;
focus: boolean;
disabled: boolean;
autofocus: boolean;
};
type ButtonPropsWeControl = 'aria-controls' | 'aria-expanded' | 'aria-haspopup';
export type MenuButtonProps<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG> = Props<TTag, ButtonRenderPropArg, ButtonPropsWeControl, {
disabled?: boolean;
autoFocus?: boolean;
}>;
declare function ButtonFn<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG>(props: MenuButtonProps<TTag>, ref: Ref<HTMLButtonElement>): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
declare let DEFAULT_ITEMS_TAG: "div";
type ItemsRenderPropArg = {
open: boolean;
}
declare type ItemsPropsWeControl = 'aria-activedescendant' | 'aria-labelledby' | 'onKeyDown' | 'role' | 'tabIndex';
declare let ItemsRenderFeatures: number;
interface ItemRenderPropArg {
};
type ItemsPropsWeControl = 'aria-activedescendant' | 'aria-labelledby' | 'role' | 'tabIndex';
export type MenuItemsProps<TTag extends ElementType = typeof DEFAULT_ITEMS_TAG> = Props<TTag, ItemsRenderPropArg, ItemsPropsWeControl, {
anchor?: AnchorProps;
portal?: boolean;
modal?: boolean;
transition?: boolean;
static?: boolean;
unmount?: boolean;
}>;
declare function ItemsFn<TTag extends ElementType = typeof DEFAULT_ITEMS_TAG>(props: MenuItemsProps<TTag>, ref: Ref<HTMLElement>): React.JSX.Element;
declare let DEFAULT_ITEM_TAG: React.ExoticComponent<{
children?: React.ReactNode;
}>;
type ItemRenderPropArg = {
/** @deprecated use `focus` instead */
active: boolean;
focus: boolean;
disabled: boolean;
close: () => void;
};
type ItemPropsWeControl = 'aria-describedby' | 'aria-disabled' | 'aria-labelledby' | 'role' | 'tabIndex';
export type MenuItemProps<TTag extends ElementType = typeof DEFAULT_ITEM_TAG> = Props<TTag, ItemRenderPropArg, ItemPropsWeControl, {
disabled?: boolean;
}>;
declare function ItemFn<TTag extends ElementType = typeof DEFAULT_ITEM_TAG>(props: MenuItemProps<TTag>, ref: Ref<HTMLElement>): React.JSX.Element;
declare let DEFAULT_SECTION_TAG: "div";
type SectionRenderPropArg = {};
type SectionPropsWeControl = 'role' | 'aria-labelledby';
export type MenuSectionProps<TTag extends ElementType = typeof DEFAULT_SECTION_TAG> = Props<TTag, SectionRenderPropArg, SectionPropsWeControl>;
declare function SectionFn<TTag extends ElementType = typeof DEFAULT_SECTION_TAG>(props: MenuSectionProps<TTag>, ref: Ref<HTMLElement>): React.JSX.Element;
declare let DEFAULT_HEADING_TAG: "header";
type HeadingRenderPropArg = {};
type HeadingPropsWeControl = 'role';
export type MenuHeadingProps<TTag extends ElementType = typeof DEFAULT_HEADING_TAG> = Props<TTag, HeadingRenderPropArg, HeadingPropsWeControl>;
declare function HeadingFn<TTag extends ElementType = typeof DEFAULT_HEADING_TAG>(props: MenuHeadingProps<TTag>, ref: Ref<HTMLElement>): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
declare let DEFAULT_SEPARATOR_TAG: "div";
type SeparatorRenderPropArg = {};
type SeparatorPropsWeControl = 'role';
export type MenuSeparatorProps<TTag extends ElementType = typeof DEFAULT_SEPARATOR_TAG> = Props<TTag, SeparatorRenderPropArg, SeparatorPropsWeControl>;
declare function SeparatorFn<TTag extends ElementType = typeof DEFAULT_SEPARATOR_TAG>(props: MenuSeparatorProps<TTag>, ref: Ref<HTMLElement>): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
export interface _internal_ComponentMenu extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_MENU_TAG>(props: MenuProps<TTag> & RefProp<typeof MenuFn>): JSX.Element;
}
declare type MenuItemPropsWeControl = 'role' | 'tabIndex' | 'aria-disabled' | 'onPointerLeave' | 'onPointerMove' | 'onMouseLeave' | 'onMouseMove' | 'onFocus';
export declare let Menu: (<TTag extends React.ElementType<any> = React.ExoticComponent<{
children?: React.ReactNode;
}>>(props: Props<TTag, MenuRenderPropArg, "1D45E01E-AF44-47C4-988A-19A94EBAF55C">, ref: Ref<HTMLElement>) => JSX.Element) & {
displayName: string;
} & {
Button: (<TTag_1 extends React.ElementType<any> = "button">(props: Props<TTag_1, ButtonRenderPropArg, ButtonPropsWeControl>, ref: Ref<HTMLButtonElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
};
Items: (<TTag_2 extends React.ElementType<any> = "div">(props: Props<TTag_2, ItemsRenderPropArg, ItemsPropsWeControl> & (({
static?: undefined;
} & {
unmount?: boolean | undefined;
}) | ({
unmount?: undefined;
} & {
static?: boolean | undefined;
})), ref: Ref<HTMLDivElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
};
Item: (<TTag_3 extends React.ElementType<any> = React.ExoticComponent<{
children?: React.ReactNode;
}>>(props: Props<TTag_3, ItemRenderPropArg, MenuItemPropsWeControl> & {
disabled?: boolean | undefined;
}, ref: Ref<HTMLElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
};
export interface _internal_ComponentMenuButton extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG>(props: MenuButtonProps<TTag> & RefProp<typeof ButtonFn>): JSX.Element;
}
export interface _internal_ComponentMenuItems extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_ITEMS_TAG>(props: MenuItemsProps<TTag> & RefProp<typeof ItemsFn>): JSX.Element;
}
export interface _internal_ComponentMenuItem extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_ITEM_TAG>(props: MenuItemProps<TTag> & RefProp<typeof ItemFn>): JSX.Element;
}
export interface _internal_ComponentMenuSection extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_SECTION_TAG>(props: MenuSectionProps<TTag> & RefProp<typeof SectionFn>): JSX.Element;
}
export interface _internal_ComponentMenuHeading extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_HEADING_TAG>(props: MenuHeadingProps<TTag> & RefProp<typeof HeadingFn>): JSX.Element;
}
export interface _internal_ComponentMenuSeparator extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_SEPARATOR_TAG>(props: MenuSeparatorProps<TTag> & RefProp<typeof SeparatorFn>): JSX.Element;
}
export declare let MenuButton: _internal_ComponentMenuButton;
export declare let MenuItems: _internal_ComponentMenuItems;
export declare let MenuItem: _internal_ComponentMenuItem;
export declare let MenuSection: _internal_ComponentMenuSection;
export declare let MenuHeading: _internal_ComponentMenuHeading;
export declare let MenuSeparator: _internal_ComponentMenuSeparator;
export declare let Menu: _internal_ComponentMenu & {
/** @deprecated use `<MenuButton>` instead of `<Menu.Button>` */
Button: _internal_ComponentMenuButton;
/** @deprecated use `<MenuItems>` instead of `<Menu.Items>` */
Items: _internal_ComponentMenuItems;
/** @deprecated use `<MenuItem>` instead of `<Menu.Item>` */
Item: _internal_ComponentMenuItem;
/** @deprecated use `<MenuSection>` instead of `<Menu.Section>` */
Section: _internal_ComponentMenuSection;
/** @deprecated use `<MenuHeading>` instead of `<Menu.Heading>` */
Heading: _internal_ComponentMenuHeading;
/** @deprecated use `<MenuSeparator>` instead of `<Menu.Separator>` */
Separator: _internal_ComponentMenuSeparator;
};
export {};

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

import G,{Fragment as B,createContext as V,createRef as K,useContext as $,useEffect as q,useMemo as P,useReducer as J,useRef as _}from"react";import{match as N}from'../../utils/match.js';import{forwardRefWithAs as E,render as x,Features as H}from'../../utils/render.js';import{disposables as F}from'../../utils/disposables.js';import{useDisposables as j}from'../../hooks/use-disposables.js';import{useIsoMorphicEffect as D}from'../../hooks/use-iso-morphic-effect.js';import{useSyncRefs as C}from'../../hooks/use-sync-refs.js';import{useId as L}from'../../hooks/use-id.js';import{Keys as d}from'../keyboard.js';import{Focus as g,calculateActiveIndex as z}from'../../utils/calculate-active-index.js';import{isDisabledReactIssue7711 as X}from'../../utils/bugs.js';import{isFocusableElement as Y,FocusableMode as Z,sortByDomNode as ee,Focus as Q,focusFrom as te,restoreFocusIfNecessary as W}from'../../utils/focus-management.js';import{useOutsideClick as ne}from'../../hooks/use-outside-click.js';import{useTreeWalker as re}from'../../hooks/use-tree-walker.js';import{useOpenClosed as oe,State as k,OpenClosedProvider as ae}from'../../internal/open-closed.js';import{useResolveButtonType as ie}from'../../hooks/use-resolve-button-type.js';import{useOwnerDocument as ue}from'../../hooks/use-owner.js';import{useEvent as T}from'../../hooks/use-event.js';var se=(r=>(r[r.Open=0]="Open",r[r.Closed=1]="Closed",r))(se||{}),le=(r=>(r[r.Pointer=0]="Pointer",r[r.Other=1]="Other",r))(le||{}),ce=(e=>(e[e.OpenMenu=0]="OpenMenu",e[e.CloseMenu=1]="CloseMenu",e[e.GoToItem=2]="GoToItem",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterItem=5]="RegisterItem",e[e.UnregisterItem=6]="UnregisterItem",e))(ce||{});function w(t,i=r=>r){let r=t.activeItemIndex!==null?t.items[t.activeItemIndex]:null,s=ee(i(t.items.slice()),u=>u.dataRef.current.domRef.current),a=r?s.indexOf(r):null;return a===-1&&(a=null),{items:s,activeItemIndex:a}}let pe={[1](t){return t.menuState===1?t:{...t,activeItemIndex:null,menuState:1}},[0](t){return t.menuState===0?t:{...t,menuState:0}},[2]:(t,i)=>{var a;let r=w(t),s=z(i,{resolveItems:()=>r.items,resolveActiveIndex:()=>r.activeItemIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled});return{...t,...r,searchQuery:"",activeItemIndex:s,activationTrigger:(a=i.trigger)!=null?a:1}},[3]:(t,i)=>{let s=t.searchQuery!==""?0:1,a=t.searchQuery+i.value.toLowerCase(),n=(t.activeItemIndex!==null?t.items.slice(t.activeItemIndex+s).concat(t.items.slice(0,t.activeItemIndex+s)):t.items).find(c=>{var l;return((l=c.dataRef.current.textValue)==null?void 0:l.startsWith(a))&&!c.dataRef.current.disabled}),e=n?t.items.indexOf(n):-1;return e===-1||e===t.activeItemIndex?{...t,searchQuery:a}:{...t,searchQuery:a,activeItemIndex:e,activationTrigger:1}},[4](t){return t.searchQuery===""?t:{...t,searchQuery:"",searchActiveItemIndex:null}},[5]:(t,i)=>{let r=w(t,s=>[...s,{id:i.id,dataRef:i.dataRef}]);return{...t,...r}},[6]:(t,i)=>{let r=w(t,s=>{let a=s.findIndex(u=>u.id===i.id);return a!==-1&&s.splice(a,1),s});return{...t,...r,activationTrigger:1}}},U=V(null);U.displayName="MenuContext";function O(t){let i=$(U);if(i===null){let r=new Error(`<${t} /> is missing a parent <Menu /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,O),r}return i}function de(t,i){return N(i.type,pe,t,i)}let me=B,fe=E(function(i,r){let s=J(de,{menuState:1,buttonRef:K(),itemsRef:K(),items:[],searchQuery:"",activeItemIndex:null,activationTrigger:1}),[{menuState:a,itemsRef:u,buttonRef:n},e]=s,c=C(r);ne([n,u],(b,v)=>{var M;e({type:1}),Y(v,Z.Loose)||(b.preventDefault(),(M=n.current)==null||M.focus())},a===0);let l=T(()=>{e({type:1})}),m=P(()=>({open:a===0,close:l}),[a,l]),R=i,f={ref:c};return G.createElement(U.Provider,{value:s},G.createElement(ae,{value:N(a,{[0]:k.Open,[1]:k.Closed})},x({ourProps:f,theirProps:R,slot:m,defaultTag:me,name:"Menu"})))}),Te="button",ye=E(function(i,r){var M;let s=L(),{id:a=`headlessui-menu-button-${s}`,...u}=i,[n,e]=O("Menu.Button"),c=C(n.buttonRef,r),l=j(),m=T(p=>{switch(p.key){case d.Space:case d.Enter:case d.ArrowDown:p.preventDefault(),p.stopPropagation(),e({type:0}),l.nextFrame(()=>e({type:2,focus:g.First}));break;case d.ArrowUp:p.preventDefault(),p.stopPropagation(),e({type:0}),l.nextFrame(()=>e({type:2,focus:g.Last}));break}}),R=T(p=>{switch(p.key){case d.Space:p.preventDefault();break}}),f=T(p=>{if(X(p.currentTarget))return p.preventDefault();i.disabled||(n.menuState===0?(e({type:1}),l.nextFrame(()=>{var A;return(A=n.buttonRef.current)==null?void 0:A.focus({preventScroll:!0})})):(p.preventDefault(),e({type:0})))}),b=P(()=>({open:n.menuState===0}),[n]),v={ref:c,id:a,type:ie(i,n.buttonRef),"aria-haspopup":!0,"aria-controls":(M=n.itemsRef.current)==null?void 0:M.id,"aria-expanded":i.disabled?void 0:n.menuState===0,onKeyDown:m,onKeyUp:R,onClick:f};return x({ourProps:v,theirProps:u,slot:b,defaultTag:Te,name:"Menu.Button"})}),Ie="div",ge=H.RenderStrategy|H.Static,Me=E(function(i,r){var A,h;let s=L(),{id:a=`headlessui-menu-items-${s}`,...u}=i,[n,e]=O("Menu.Items"),c=C(n.itemsRef,r),l=ue(n.itemsRef),m=j(),R=oe(),f=(()=>R!==null?R===k.Open:n.menuState===0)();q(()=>{let o=n.itemsRef.current;!o||n.menuState===0&&o!==(l==null?void 0:l.activeElement)&&o.focus({preventScroll:!0})},[n.menuState,n.itemsRef,l]),re({container:n.itemsRef.current,enabled:n.menuState===0,accept(o){return o.getAttribute("role")==="menuitem"?NodeFilter.FILTER_REJECT:o.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(o){o.setAttribute("role","none")}});let b=T(o=>{var y,I;switch(m.dispose(),o.key){case d.Space:if(n.searchQuery!=="")return o.preventDefault(),o.stopPropagation(),e({type:3,value:o.key});case d.Enter:if(o.preventDefault(),o.stopPropagation(),e({type:1}),n.activeItemIndex!==null){let{dataRef:S}=n.items[n.activeItemIndex];(I=(y=S.current)==null?void 0:y.domRef.current)==null||I.click()}W(n.buttonRef.current);break;case d.ArrowDown:return o.preventDefault(),o.stopPropagation(),e({type:2,focus:g.Next});case d.ArrowUp:return o.preventDefault(),o.stopPropagation(),e({type:2,focus:g.Previous});case d.Home:case d.PageUp:return o.preventDefault(),o.stopPropagation(),e({type:2,focus:g.First});case d.End:case d.PageDown:return o.preventDefault(),o.stopPropagation(),e({type:2,focus:g.Last});case d.Escape:o.preventDefault(),o.stopPropagation(),e({type:1}),F().nextFrame(()=>{var S;return(S=n.buttonRef.current)==null?void 0:S.focus({preventScroll:!0})});break;case d.Tab:o.preventDefault(),o.stopPropagation(),e({type:1}),F().nextFrame(()=>{te(n.buttonRef.current,o.shiftKey?Q.Previous:Q.Next)});break;default:o.key.length===1&&(e({type:3,value:o.key}),m.setTimeout(()=>e({type:4}),350));break}}),v=T(o=>{switch(o.key){case d.Space:o.preventDefault();break}}),M=P(()=>({open:n.menuState===0}),[n]),p={"aria-activedescendant":n.activeItemIndex===null||(A=n.items[n.activeItemIndex])==null?void 0:A.id,"aria-labelledby":(h=n.buttonRef.current)==null?void 0:h.id,id:a,onKeyDown:b,onKeyUp:v,role:"menu",tabIndex:0,ref:c};return x({ourProps:p,theirProps:u,slot:M,defaultTag:Ie,features:ge,visible:f,name:"Menu.Items"})}),Re=B,be=E(function(i,r){let s=L(),{id:a=`headlessui-menu-item-${s}`,disabled:u=!1,...n}=i,[e,c]=O("Menu.Item"),l=e.activeItemIndex!==null?e.items[e.activeItemIndex].id===a:!1,m=_(null),R=C(r,m);D(()=>{if(e.menuState!==0||!l||e.activationTrigger===0)return;let y=F();return y.requestAnimationFrame(()=>{var I,S;(S=(I=m.current)==null?void 0:I.scrollIntoView)==null||S.call(I,{block:"nearest"})}),y.dispose},[m,l,e.menuState,e.activationTrigger,e.activeItemIndex]);let f=_({disabled:u,domRef:m});D(()=>{f.current.disabled=u},[f,u]),D(()=>{var y,I;f.current.textValue=(I=(y=m.current)==null?void 0:y.textContent)==null?void 0:I.toLowerCase()},[f,m]),D(()=>(c({type:5,id:a,dataRef:f}),()=>c({type:6,id:a})),[f,a]);let b=T(()=>{c({type:1})}),v=T(y=>{if(u)return y.preventDefault();c({type:1}),W(e.buttonRef.current)}),M=T(()=>{if(u)return c({type:2,focus:g.Nothing});c({type:2,focus:g.Specific,id:a})}),p=T(()=>{u||l||c({type:2,focus:g.Specific,id:a,trigger:0})}),A=T(()=>{u||!l||c({type:2,focus:g.Nothing})}),h=P(()=>({active:l,disabled:u,close:b}),[l,u,b]);return x({ourProps:{id:a,ref:R,role:"menuitem",tabIndex:u===!0?void 0:-1,"aria-disabled":u===!0?!0:void 0,disabled:void 0,onClick:v,onFocus:M,onPointerMove:p,onMouseMove:p,onPointerLeave:A,onMouseLeave:A},theirProps:n,slot:h,defaultTag:Re,name:"Menu.Item"})}),Je=Object.assign(fe,{Button:ye,Items:Me,Item:be});export{Je as Menu};
"use client";import{useFocusRing as ue}from"@react-aria/focus";import{useHover as pe}from"@react-aria/interactions";import x,{Fragment as $,createContext as me,useCallback as de,useContext as ce,useEffect as fe,useMemo as G,useReducer as Te,useRef as q,useState as ye}from"react";import{flushSync as O}from"react-dom";import{useActivePress as Ie}from'../../hooks/use-active-press.js';import{useDidElementMove as ge}from'../../hooks/use-did-element-move.js';import{useDisposables as Ee}from'../../hooks/use-disposables.js';import{useElementSize as Me}from'../../hooks/use-element-size.js';import{useEvent as E}from'../../hooks/use-event.js';import{useId as H}from'../../hooks/use-id.js';import{useInertOthers as Se}from'../../hooks/use-inert-others.js';import{useIsoMorphicEffect as U}from'../../hooks/use-iso-morphic-effect.js';import{useOnDisappear as Ae}from'../../hooks/use-on-disappear.js';import{useOutsideClick as Pe}from'../../hooks/use-outside-click.js';import{useOwnerDocument as be}from'../../hooks/use-owner.js';import{useResolveButtonType as ve}from'../../hooks/use-resolve-button-type.js';import{useScrollLock as xe}from'../../hooks/use-scroll-lock.js';import{useSyncRefs as B}from'../../hooks/use-sync-refs.js';import{useTextValue as _e}from'../../hooks/use-text-value.js';import{useTrackedPointer as Re}from'../../hooks/use-tracked-pointer.js';import{transitionDataAttributes as De,useTransition as he}from'../../hooks/use-transition.js';import{useTreeWalker as Ce}from'../../hooks/use-tree-walker.js';import{FloatingProvider as Fe,useFloatingPanel as Le,useFloatingPanelProps as Oe,useFloatingReference as Ge,useFloatingReferenceProps as He,useResolvedAnchor as Ue}from'../../internal/floating.js';import{OpenClosedProvider as Be,State as N,useOpenClosed as Ne}from'../../internal/open-closed.js';import{isDisabledReactIssue7711 as ke}from'../../utils/bugs.js';import{Focus as I,calculateActiveIndex as w}from'../../utils/calculate-active-index.js';import{disposables as we}from'../../utils/disposables.js';import{Focus as z,FocusableMode as Ke,focusFrom as We,isFocusableElement as je,restoreFocusIfNecessary as Y,sortByDomNode as Qe}from'../../utils/focus-management.js';import{match as Z}from'../../utils/match.js';import{RenderFeatures as ee,forwardRefWithAs as _,mergeProps as te,render as R}from'../../utils/render.js';import{useDescriptions as Je}from'../description/description.js';import{Keys as y}from'../keyboard.js';import{useLabelContext as Ve,useLabels as ne}from'../label/label.js';import{Portal as Xe}from'../portal/portal.js';var $e=(r=>(r[r.Open=0]="Open",r[r.Closed=1]="Closed",r))($e||{}),qe=(r=>(r[r.Pointer=0]="Pointer",r[r.Other=1]="Other",r))(qe||{}),ze=(a=>(a[a.OpenMenu=0]="OpenMenu",a[a.CloseMenu=1]="CloseMenu",a[a.GoToItem=2]="GoToItem",a[a.Search=3]="Search",a[a.ClearSearch=4]="ClearSearch",a[a.RegisterItem=5]="RegisterItem",a[a.UnregisterItem=6]="UnregisterItem",a[a.SetButtonElement=7]="SetButtonElement",a[a.SetItemsElement=8]="SetItemsElement",a))(ze||{});function K(e,n=r=>r){let r=e.activeItemIndex!==null?e.items[e.activeItemIndex]:null,i=Qe(n(e.items.slice()),p=>p.dataRef.current.domRef.current),o=r?i.indexOf(r):null;return o===-1&&(o=null),{items:i,activeItemIndex:o}}let Ye={[1](e){return e.menuState===1?e:{...e,activeItemIndex:null,menuState:1}},[0](e){return e.menuState===0?e:{...e,__demoMode:!1,menuState:0}},[2]:(e,n)=>{var p,m,s,u,a;if(e.menuState===1)return e;let r={...e,searchQuery:"",activationTrigger:(p=n.trigger)!=null?p:1,__demoMode:!1};if(n.focus===I.Nothing)return{...r,activeItemIndex:null};if(n.focus===I.Specific)return{...r,activeItemIndex:e.items.findIndex(t=>t.id===n.id)};if(n.focus===I.Previous){let t=e.activeItemIndex;if(t!==null){let d=e.items[t].dataRef.current.domRef,f=w(n,{resolveItems:()=>e.items,resolveActiveIndex:()=>e.activeItemIndex,resolveId:c=>c.id,resolveDisabled:c=>c.dataRef.current.disabled});if(f!==null){let c=e.items[f].dataRef.current.domRef;if(((m=d.current)==null?void 0:m.previousElementSibling)===c.current||((s=c.current)==null?void 0:s.previousElementSibling)===null)return{...r,activeItemIndex:f}}}}else if(n.focus===I.Next){let t=e.activeItemIndex;if(t!==null){let d=e.items[t].dataRef.current.domRef,f=w(n,{resolveItems:()=>e.items,resolveActiveIndex:()=>e.activeItemIndex,resolveId:c=>c.id,resolveDisabled:c=>c.dataRef.current.disabled});if(f!==null){let c=e.items[f].dataRef.current.domRef;if(((u=d.current)==null?void 0:u.nextElementSibling)===c.current||((a=c.current)==null?void 0:a.nextElementSibling)===null)return{...r,activeItemIndex:f}}}}let i=K(e),o=w(n,{resolveItems:()=>i.items,resolveActiveIndex:()=>i.activeItemIndex,resolveId:t=>t.id,resolveDisabled:t=>t.dataRef.current.disabled});return{...r,...i,activeItemIndex:o}},[3]:(e,n)=>{let i=e.searchQuery!==""?0:1,o=e.searchQuery+n.value.toLowerCase(),m=(e.activeItemIndex!==null?e.items.slice(e.activeItemIndex+i).concat(e.items.slice(0,e.activeItemIndex+i)):e.items).find(u=>{var a;return((a=u.dataRef.current.textValue)==null?void 0:a.startsWith(o))&&!u.dataRef.current.disabled}),s=m?e.items.indexOf(m):-1;return s===-1||s===e.activeItemIndex?{...e,searchQuery:o}:{...e,searchQuery:o,activeItemIndex:s,activationTrigger:1}},[4](e){return e.searchQuery===""?e:{...e,searchQuery:"",searchActiveItemIndex:null}},[5]:(e,n)=>{let r=K(e,i=>[...i,{id:n.id,dataRef:n.dataRef}]);return{...e,...r}},[6]:(e,n)=>{let r=K(e,i=>{let o=i.findIndex(p=>p.id===n.id);return o!==-1&&i.splice(o,1),i});return{...e,...r,activationTrigger:1}},[7]:(e,n)=>e.buttonElement===n.element?e:{...e,buttonElement:n.element},[8]:(e,n)=>e.itemsElement===n.element?e:{...e,itemsElement:n.element}},W=me(null);W.displayName="MenuContext";function k(e){let n=ce(W);if(n===null){let r=new Error(`<${e} /> is missing a parent <Menu /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,k),r}return n}function Ze(e,n){return Z(n.type,Ye,e,n)}let et=$;function tt(e,n){let{__demoMode:r=!1,...i}=e,o=Te(Ze,{__demoMode:r,menuState:r?0:1,buttonElement:null,itemsElement:null,items:[],searchQuery:"",activeItemIndex:null,activationTrigger:1}),[{menuState:p,itemsElement:m,buttonElement:s},u]=o,a=B(n);Pe(p===0,[s,m],(S,P)=>{u({type:1}),je(P,Ke.Loose)||(S.preventDefault(),s==null||s.focus())});let d=E(()=>{u({type:1})}),f=G(()=>({open:p===0,close:d}),[p,d]),c={ref:a};return x.createElement(Fe,null,x.createElement(W.Provider,{value:o},x.createElement(Be,{value:Z(p,{[0]:N.Open,[1]:N.Closed})},R({ourProps:c,theirProps:i,slot:f,defaultTag:et,name:"Menu"}))))}let nt="button";function rt(e,n){var h;let r=H(),{id:i=`headlessui-menu-button-${r}`,disabled:o=!1,autoFocus:p=!1,...m}=e,[s,u]=k("Menu.Button"),a=He(),t=B(n,Ge(),E(T=>u({type:7,element:T}))),d=E(T=>{switch(T.key){case y.Space:case y.Enter:case y.ArrowDown:T.preventDefault(),T.stopPropagation(),O(()=>u({type:0})),u({type:2,focus:I.First});break;case y.ArrowUp:T.preventDefault(),T.stopPropagation(),O(()=>u({type:0})),u({type:2,focus:I.Last});break}}),f=E(T=>{switch(T.key){case y.Space:T.preventDefault();break}}),c=E(T=>{var C;if(ke(T.currentTarget))return T.preventDefault();o||(s.menuState===0?(O(()=>u({type:1})),(C=s.buttonElement)==null||C.focus({preventScroll:!0})):(T.preventDefault(),u({type:0})))}),{isFocusVisible:S,focusProps:P}=ue({autoFocus:p}),{isHovered:A,hoverProps:D}=pe({isDisabled:o}),{pressed:M,pressProps:b}=Ie({disabled:o}),v=G(()=>({open:s.menuState===0,active:M||s.menuState===0,disabled:o,hover:A,focus:S,autofocus:p}),[s,A,S,M,o,p]),F=te(a(),{ref:t,id:i,type:ve(e,s.buttonElement),"aria-haspopup":"menu","aria-controls":(h=s.itemsElement)==null?void 0:h.id,"aria-expanded":s.menuState===0,disabled:o||void 0,autoFocus:p,onKeyDown:d,onKeyUp:f,onClick:c},P,D,b);return R({ourProps:F,theirProps:m,slot:v,defaultTag:nt,name:"Menu.Button"})}let ot="div",at=ee.RenderStrategy|ee.Static;function it(e,n){var j,Q;let r=H(),{id:i=`headlessui-menu-items-${r}`,anchor:o,portal:p=!1,modal:m=!0,transition:s=!1,...u}=e,a=Ue(o),[t,d]=k("Menu.Items"),[f,c]=Le(a),S=Oe(),[P,A]=ye(null),D=B(n,a?f:null,E(l=>d({type:8,element:l})),A),M=be(t.itemsElement);a&&(p=!0);let b=Ne(),[v,F]=he(s,P,b!==null?(b&N.Open)===N.Open:t.menuState===0);Ae(v,t.buttonElement,()=>{d({type:1})});let h=t.__demoMode?!1:m&&t.menuState===0;xe(h,M);let T=t.__demoMode?!1:m&&t.menuState===0;Se(T,{allowed:de(()=>[t.buttonElement,t.itemsElement],[t.buttonElement,t.itemsElement])});let C=t.menuState!==0,g=ge(C,t.buttonElement)?!1:v;fe(()=>{let l=t.itemsElement;l&&t.menuState===0&&l!==(M==null?void 0:M.activeElement)&&l.focus({preventScroll:!0})},[t.menuState,t.itemsElement,M]),Ce(t.menuState===0,{container:t.itemsElement,accept(l){return l.getAttribute("role")==="menuitem"?NodeFilter.FILTER_REJECT:l.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(l){l.setAttribute("role","none")}});let L=Ee(),oe=E(l=>{var J,V,X;switch(L.dispose(),l.key){case y.Space:if(t.searchQuery!=="")return l.preventDefault(),l.stopPropagation(),d({type:3,value:l.key});case y.Enter:if(l.preventDefault(),l.stopPropagation(),d({type:1}),t.activeItemIndex!==null){let{dataRef:se}=t.items[t.activeItemIndex];(V=(J=se.current)==null?void 0:J.domRef.current)==null||V.click()}Y(t.buttonElement);break;case y.ArrowDown:return l.preventDefault(),l.stopPropagation(),d({type:2,focus:I.Next});case y.ArrowUp:return l.preventDefault(),l.stopPropagation(),d({type:2,focus:I.Previous});case y.Home:case y.PageUp:return l.preventDefault(),l.stopPropagation(),d({type:2,focus:I.First});case y.End:case y.PageDown:return l.preventDefault(),l.stopPropagation(),d({type:2,focus:I.Last});case y.Escape:l.preventDefault(),l.stopPropagation(),O(()=>d({type:1})),(X=t.buttonElement)==null||X.focus({preventScroll:!0});break;case y.Tab:l.preventDefault(),l.stopPropagation(),O(()=>d({type:1})),We(t.buttonElement,l.shiftKey?z.Previous:z.Next);break;default:l.key.length===1&&(d({type:3,value:l.key}),L.setTimeout(()=>d({type:4}),350));break}}),ae=E(l=>{switch(l.key){case y.Space:l.preventDefault();break}}),ie=G(()=>({open:t.menuState===0}),[t.menuState]),le=te(a?S():{},{"aria-activedescendant":t.activeItemIndex===null||(j=t.items[t.activeItemIndex])==null?void 0:j.id,"aria-labelledby":(Q=t.buttonElement)==null?void 0:Q.id,id:i,onKeyDown:oe,onKeyUp:ae,role:"menu",tabIndex:t.menuState===0?0:void 0,ref:D,style:{...u.style,...c,"--button-width":Me(t.buttonElement,!0).width},...De(F)});return x.createElement(Xe,{enabled:p?e.static||v:!1},R({ourProps:le,theirProps:u,slot:ie,defaultTag:ot,features:at,visible:g,name:"Menu.Items"}))}let lt=$;function st(e,n){let r=H(),{id:i=`headlessui-menu-item-${r}`,disabled:o=!1,...p}=e,[m,s]=k("Menu.Item"),u=m.activeItemIndex!==null?m.items[m.activeItemIndex].id===i:!1,a=q(null),t=B(n,a);U(()=>{if(!m.__demoMode&&m.menuState===0&&u&&m.activationTrigger!==0)return we().requestAnimationFrame(()=>{var g,L;(L=(g=a.current)==null?void 0:g.scrollIntoView)==null||L.call(g,{block:"nearest"})})},[m.__demoMode,a,u,m.menuState,m.activationTrigger,m.activeItemIndex]);let d=_e(a),f=q({disabled:o,domRef:a,get textValue(){return d()}});U(()=>{f.current.disabled=o},[f,o]),U(()=>(s({type:5,id:i,dataRef:f}),()=>s({type:6,id:i})),[f,i]);let c=E(()=>{s({type:1})}),S=E(g=>{if(o)return g.preventDefault();s({type:1}),Y(m.buttonElement)}),P=E(()=>{if(o)return s({type:2,focus:I.Nothing});s({type:2,focus:I.Specific,id:i})}),A=Re(),D=E(g=>{A.update(g),!o&&(u||s({type:2,focus:I.Specific,id:i,trigger:0}))}),M=E(g=>{A.wasMoved(g)&&(o||u||s({type:2,focus:I.Specific,id:i,trigger:0}))}),b=E(g=>{A.wasMoved(g)&&(o||u&&s({type:2,focus:I.Nothing}))}),[v,F]=ne(),[h,T]=Je(),C=G(()=>({active:u,focus:u,disabled:o,close:c}),[u,o,c]);return x.createElement(F,null,x.createElement(T,null,R({ourProps:{id:i,ref:t,role:"menuitem",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-labelledby":v,"aria-describedby":h,disabled:void 0,onClick:S,onFocus:P,onPointerEnter:D,onMouseEnter:D,onPointerMove:M,onMouseMove:M,onPointerLeave:b,onMouseLeave:b},theirProps:p,slot:C,defaultTag:lt,name:"Menu.Item"})))}let ut="div";function pt(e,n){let[r,i]=ne();return x.createElement(i,null,R({ourProps:{ref:n,"aria-labelledby":r,role:"group"},theirProps:e,slot:{},defaultTag:ut,name:"Menu.Section"}))}let mt="header";function dt(e,n){let r=H(),{id:i=`headlessui-menu-heading-${r}`,...o}=e,p=Ve();U(()=>p.register(i),[i,p.register]);let m={id:i,ref:n,role:"presentation",...p.props};return R({ourProps:m,theirProps:o,slot:{},defaultTag:mt,name:"Menu.Heading"})}let ct="div";function ft(e,n){return R({ourProps:{ref:n,role:"separator"},theirProps:e,slot:{},defaultTag:ct,name:"Menu.Separator"})}let Tt=_(tt),yt=_(rt),It=_(it),gt=_(st),Et=_(pt),Mt=_(dt),St=_(ft),nn=Object.assign(Tt,{Button:yt,Items:It,Item:gt,Section:Et,Heading:Mt,Separator:St});export{nn as Menu,yt as MenuButton,Mt as MenuHeading,gt as MenuItem,It as MenuItems,Et as MenuSection,St as MenuSeparator};

@@ -1,66 +0,96 @@

import React, { MutableRefObject, Ref, MouseEventHandler } from 'react';
import { Props } from '../../types.js';
import { PropsForFeatures } from '../../utils/render.js';
declare type MouseEvent<T> = Parameters<MouseEventHandler<T>>[0];
interface PopoverRenderPropArg {
import React, { type ElementType, type MouseEventHandler, type MutableRefObject, type Ref } from 'react';
import { type AnchorProps } from '../../internal/floating.js';
import type { Props } from '../../types.js';
import { type HasDisplayName, type PropsForFeatures, type RefProp } from '../../utils/render.js';
type MouseEvent<T> = Parameters<MouseEventHandler<T>>[0];
declare let DEFAULT_POPOVER_TAG: "div";
type PopoverRenderPropArg = {
open: boolean;
close(focusableElement?: HTMLElement | MutableRefObject<HTMLElement | null> | MouseEvent<HTMLElement>): void;
}
interface ButtonRenderPropArg {
};
type PopoverPropsWeControl = never;
export type PopoverProps<TTag extends ElementType = typeof DEFAULT_POPOVER_TAG> = Props<TTag, PopoverRenderPropArg, PopoverPropsWeControl, {
__demoMode?: boolean;
}>;
declare function PopoverFn<TTag extends ElementType = typeof DEFAULT_POPOVER_TAG>(props: PopoverProps<TTag>, ref: Ref<HTMLElement>): React.JSX.Element;
declare let DEFAULT_BUTTON_TAG: "button";
type ButtonRenderPropArg = {
open: boolean;
}
declare type ButtonPropsWeControl = 'type' | 'aria-expanded' | 'aria-controls' | 'onKeyDown' | 'onClick';
interface OverlayRenderPropArg {
active: boolean;
hover: boolean;
focus: boolean;
disabled: boolean;
autofocus: boolean;
};
type ButtonPropsWeControl = 'aria-controls' | 'aria-expanded';
export type PopoverButtonProps<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG> = Props<TTag, ButtonRenderPropArg, ButtonPropsWeControl, {
disabled?: boolean;
autoFocus?: boolean;
}>;
declare function ButtonFn<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG>(props: PopoverButtonProps<TTag>, ref: Ref<HTMLButtonElement>): React.JSX.Element;
declare let DEFAULT_BACKDROP_TAG: "div";
type BackdropRenderPropArg = {
open: boolean;
}
declare type OverlayPropsWeControl = 'aria-hidden' | 'onClick';
declare let OverlayRenderFeatures: number;
interface PanelRenderPropArg {
};
type BackdropPropsWeControl = 'aria-hidden';
declare let BackdropRenderFeatures: number;
export type PopoverBackdropProps<TTag extends ElementType = typeof DEFAULT_BACKDROP_TAG> = Props<TTag, BackdropRenderPropArg, BackdropPropsWeControl, {
transition?: boolean;
} & PropsForFeatures<typeof BackdropRenderFeatures>>;
export type PopoverOverlayProps<TTag extends ElementType = typeof DEFAULT_BACKDROP_TAG> = PopoverBackdropProps<TTag>;
declare function BackdropFn<TTag extends ElementType = typeof DEFAULT_BACKDROP_TAG>(props: PopoverBackdropProps<TTag>, ref: Ref<HTMLElement>): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
declare let DEFAULT_PANEL_TAG: "div";
type PanelRenderPropArg = {
open: boolean;
close: (focusableElement?: HTMLElement | MutableRefObject<HTMLElement | null>) => void;
};
type PanelPropsWeControl = 'tabIndex';
export type PopoverPanelProps<TTag extends ElementType = typeof DEFAULT_PANEL_TAG> = Props<TTag, PanelRenderPropArg, PanelPropsWeControl, {
focus?: boolean;
anchor?: AnchorProps;
portal?: boolean;
modal?: boolean;
transition?: boolean;
static?: boolean;
unmount?: boolean;
}>;
declare function PanelFn<TTag extends ElementType = typeof DEFAULT_PANEL_TAG>(props: PopoverPanelProps<TTag>, ref: Ref<HTMLElement>): React.JSX.Element;
declare let DEFAULT_GROUP_TAG: "div";
type GroupRenderPropArg = {};
type GroupPropsWeControl = never;
export type PopoverGroupProps<TTag extends ElementType = typeof DEFAULT_GROUP_TAG> = Props<TTag, GroupRenderPropArg, GroupPropsWeControl>;
declare function GroupFn<TTag extends ElementType = typeof DEFAULT_GROUP_TAG>(props: PopoverGroupProps<TTag>, ref: Ref<HTMLElement>): React.JSX.Element;
export interface _internal_ComponentPopover extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_POPOVER_TAG>(props: PopoverProps<TTag> & RefProp<typeof PopoverFn>): JSX.Element;
}
declare type PanelPropsWeControl = 'onKeyDown';
declare let PanelRenderFeatures: number;
interface GroupRenderPropArg {
export interface _internal_ComponentPopoverButton extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG>(props: PopoverButtonProps<TTag> & RefProp<typeof ButtonFn>): JSX.Element;
}
export declare let Popover: (<TTag extends React.ElementType<any> = "div">(props: Props<TTag, PopoverRenderPropArg, "1D45E01E-AF44-47C4-988A-19A94EBAF55C">, ref: Ref<HTMLElement>) => JSX.Element) & {
displayName: string;
} & {
Button: (<TTag_1 extends React.ElementType<any> = "button">(props: Props<TTag_1, ButtonRenderPropArg, ButtonPropsWeControl>, ref: Ref<HTMLButtonElement>) => JSX.Element) & {
displayName: string;
};
Overlay: (<TTag_2 extends React.ElementType<any> = "div">(props: Props<TTag_2, OverlayRenderPropArg, OverlayPropsWeControl> & (({
static?: undefined;
} & {
unmount?: boolean | undefined;
}) | ({
unmount?: undefined;
} & {
static?: boolean | undefined;
})), ref: Ref<HTMLDivElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
};
Panel: (<TTag_3 extends React.ElementType<any> = "div">(props: Omit<import('../../types.js').PropsOf<TTag_3>, ("as" | "children" | "refName" | "className") | "onKeyDown"> & {
as?: TTag_3 | undefined;
children?: React.ReactNode | ((bag: PanelRenderPropArg) => React.ReactElement<any, string | React.JSXElementConstructor<any>>);
refName?: string | undefined;
} & (true extends (import('../../types.js').PropsOf<TTag_3> extends never ? never : "className" extends keyof import('../../types.js').PropsOf<TTag_3> ? true : never) ? {
className?: import('../../types.js').PropsOf<TTag_3>["className"] | ((bag: PanelRenderPropArg) => string) | undefined;
} : {}) & (({
static?: undefined;
} & {
unmount?: boolean | undefined;
}) | ({
unmount?: undefined;
} & {
static?: boolean | undefined;
})) & {
focus?: boolean | undefined;
}, ref: Ref<HTMLDivElement>) => JSX.Element) & {
displayName: string;
};
Group: (<TTag_4 extends React.ElementType<any> = "div">(props: Props<TTag_4, GroupRenderPropArg, "1D45E01E-AF44-47C4-988A-19A94EBAF55C">, ref: Ref<HTMLElement>) => JSX.Element) & {
displayName: string;
};
export interface _internal_ComponentPopoverBackdrop extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_BACKDROP_TAG>(props: PopoverBackdropProps<TTag> & RefProp<typeof BackdropFn>): JSX.Element;
}
export interface _internal_ComponentPopoverPanel extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_PANEL_TAG>(props: PopoverPanelProps<TTag> & RefProp<typeof PanelFn>): JSX.Element;
}
export interface _internal_ComponentPopoverGroup extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_GROUP_TAG>(props: PopoverGroupProps<TTag> & RefProp<typeof GroupFn>): JSX.Element;
}
export declare let PopoverButton: _internal_ComponentPopoverButton;
/** @deprecated use `<PopoverBackdrop>` instead of `<PopoverOverlay>` */
export declare let PopoverOverlay: _internal_ComponentPopoverBackdrop;
export declare let PopoverBackdrop: _internal_ComponentPopoverBackdrop;
export declare let PopoverPanel: _internal_ComponentPopoverPanel;
export declare let PopoverGroup: _internal_ComponentPopoverGroup;
export declare let Popover: _internal_ComponentPopover & {
/** @deprecated use `<PopoverButton>` instead of `<Popover.Button>` */
Button: _internal_ComponentPopoverButton;
/** @deprecated use `<PopoverBackdrop>` instead of `<Popover.Backdrop>` */
Backdrop: _internal_ComponentPopoverBackdrop;
/** @deprecated use `<PopoverOverlay>` instead of `<Popover.Overlay>` */
Overlay: _internal_ComponentPopoverBackdrop;
/** @deprecated use `<PopoverPanel>` instead of `<Popover.Panel>` */
Panel: _internal_ComponentPopoverPanel;
/** @deprecated use `<PopoverGroup>` instead of `<Popover.Group>` */
Group: _internal_ComponentPopoverGroup;
};
export {};

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

import h,{createContext as q,createRef as se,useContext as z,useEffect as j,useMemo as x,useReducer as Te,useRef as J,useState as me}from"react";import{match as G}from'../../utils/match.js';import{forwardRefWithAs as V,render as $,Features as Q}from'../../utils/render.js';import{optionalRef as ye,useSyncRefs as w}from'../../hooks/use-sync-refs.js';import{useId as _}from'../../hooks/use-id.js';import{Keys as H}from'../keyboard.js';import{isDisabledReactIssue7711 as ie}from'../../utils/bugs.js';import{getFocusableElements as fe,Focus as N,focusIn as K,isFocusableElement as Ee,FocusableMode as be}from'../../utils/focus-management.js';import{OpenClosedProvider as Se,State as X,useOpenClosed as ce}from'../../internal/open-closed.js';import{useResolveButtonType as ge}from'../../hooks/use-resolve-button-type.js';import{useOutsideClick as Ae}from'../../hooks/use-outside-click.js';import{getOwnerDocument as Re}from'../../utils/owner.js';import{useOwnerDocument as ee}from'../../hooks/use-owner.js';import{useEventListener as Ie}from'../../hooks/use-event-listener.js';import{Hidden as te,Features as oe}from'../../internal/hidden.js';import{useEvent as y}from'../../hooks/use-event.js';import{useTabDirection as de,Direction as U}from'../../hooks/use-tab-direction.js';import'../../utils/micro-task.js';import{useLatestValue as Pe}from'../../hooks/use-latest-value.js';var Ce=(f=>(f[f.Open=0]="Open",f[f.Closed=1]="Closed",f))(Ce||{}),Oe=(o=>(o[o.TogglePopover=0]="TogglePopover",o[o.ClosePopover=1]="ClosePopover",o[o.SetButton=2]="SetButton",o[o.SetButtonId=3]="SetButtonId",o[o.SetPanel=4]="SetPanel",o[o.SetPanelId=5]="SetPanelId",o))(Oe||{});let Me={[0]:r=>({...r,popoverState:G(r.popoverState,{[0]:1,[1]:0})}),[1](r){return r.popoverState===1?r:{...r,popoverState:1}},[2](r,n){return r.button===n.button?r:{...r,button:n.button}},[3](r,n){return r.buttonId===n.buttonId?r:{...r,buttonId:n.buttonId}},[4](r,n){return r.panel===n.panel?r:{...r,panel:n.panel}},[5](r,n){return r.panelId===n.panelId?r:{...r,panelId:n.panelId}}},ne=q(null);ne.displayName="PopoverContext";function Z(r){let n=z(ne);if(n===null){let f=new Error(`<${r} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(f,Z),f}return n}let re=q(null);re.displayName="PopoverAPIContext";function le(r){let n=z(re);if(n===null){let f=new Error(`<${r} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(f,le),f}return n}let ae=q(null);ae.displayName="PopoverGroupContext";function ve(){return z(ae)}let ue=q(null);ue.displayName="PopoverPanelContext";function Le(){return z(ue)}function Fe(r,n){return G(n.type,Me,r,n)}let Be="div",he=V(function(n,f){var O;let I=J(null),b=w(f,ye(e=>{I.current=e})),S=Te(Fe,{popoverState:1,buttons:[],button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:se(),afterPanelSentinel:se()}),[{popoverState:o,button:t,buttonId:P,panel:a,panelId:L,beforePanelSentinel:F,afterPanelSentinel:v},u]=S,s=ee((O=I.current)!=null?O:t),p=x(()=>{if(!t||!a)return!1;for(let M of document.querySelectorAll("body > *"))if(Number(M==null?void 0:M.contains(t))^Number(M==null?void 0:M.contains(a)))return!0;let e=fe(),l=e.indexOf(t),d=(l+e.length-1)%e.length,E=(l+1)%e.length,D=e[d],Y=e[E];return!a.contains(D)&&!a.contains(Y)},[t,a]),c=Pe(P),T=Pe(L),g=x(()=>({buttonId:c,panelId:T,close:()=>u({type:1})}),[c,T,u]),A=ve(),C=A==null?void 0:A.registerPopover,k=y(()=>{var e;return(e=A==null?void 0:A.isFocusWithinPopoverGroup())!=null?e:(s==null?void 0:s.activeElement)&&((t==null?void 0:t.contains(s.activeElement))||(a==null?void 0:a.contains(s.activeElement)))});j(()=>C==null?void 0:C(g),[C,g]),Ie(s==null?void 0:s.defaultView,"focus",e=>{var l,d,E,D;o===0&&(k()||!t||!a||e.target!==window&&((d=(l=F.current)==null?void 0:l.contains)!=null&&d.call(l,e.target)||(D=(E=v.current)==null?void 0:E.contains)!=null&&D.call(E,e.target)||u({type:1})))},!0),Ae([t,a],(e,l)=>{u({type:1}),Ee(l,be.Loose)||(e.preventDefault(),t==null||t.focus())},o===0);let B=y(e=>{u({type:1});let l=(()=>e?e instanceof HTMLElement?e:"current"in e&&e.current instanceof HTMLElement?e.current:t:t)();l==null||l.focus()}),W=x(()=>({close:B,isPortalled:p}),[B,p]),i=x(()=>({open:o===0,close:B}),[o,B]),m=n,R={ref:b};return h.createElement(ne.Provider,{value:S},h.createElement(re.Provider,{value:W},h.createElement(Se,{value:G(o,{[0]:X.Open,[1]:X.Closed})},$({ourProps:R,theirProps:m,slot:i,defaultTag:Be,name:"Popover"}))))}),xe="button",De=V(function(n,f){let I=_(),{id:b=`headlessui-popover-button-${I}`,...S}=n,[o,t]=Z("Popover.Button"),{isPortalled:P}=le("Popover.Button"),a=J(null),L=`headlessui-focus-sentinel-${_()}`,F=ve(),v=F==null?void 0:F.closeOthers,u=Le(),s=u===null?!1:u===o.panelId;j(()=>{if(!s)return t({type:3,buttonId:b}),()=>{t({type:3,buttonId:null})}},[b,t]);let p=w(a,f,s?null:e=>{if(e)o.buttons.push(b);else{let l=o.buttons.indexOf(b);l!==-1&&o.buttons.splice(l,1)}o.buttons.length>1&&console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."),e&&t({type:2,button:e})}),c=w(a,f),T=ee(a),g=y(e=>{var l,d,E;if(s){if(o.popoverState===1)return;switch(e.key){case H.Space:case H.Enter:e.preventDefault(),(d=(l=e.target).click)==null||d.call(l),t({type:1}),(E=o.button)==null||E.focus();break}}else switch(e.key){case H.Space:case H.Enter:e.preventDefault(),e.stopPropagation(),o.popoverState===1&&(v==null||v(o.buttonId)),t({type:0});break;case H.Escape:if(o.popoverState!==0)return v==null?void 0:v(o.buttonId);if(!a.current||(T==null?void 0:T.activeElement)&&!a.current.contains(T.activeElement))return;e.preventDefault(),e.stopPropagation(),t({type:1});break}}),A=y(e=>{s||e.key===H.Space&&e.preventDefault()}),C=y(e=>{var l,d;ie(e.currentTarget)||n.disabled||(s?(t({type:1}),(l=o.button)==null||l.focus()):(e.preventDefault(),e.stopPropagation(),o.popoverState===1&&(v==null||v(o.buttonId)),t({type:0}),(d=o.button)==null||d.focus()))}),k=y(e=>{e.preventDefault(),e.stopPropagation()}),B=o.popoverState===0,W=x(()=>({open:B}),[B]),i=ge(n,a),m=s?{ref:c,type:i,onKeyDown:g,onClick:C}:{ref:p,id:o.buttonId,type:i,"aria-expanded":n.disabled?void 0:o.popoverState===0,"aria-controls":o.panel?o.panelId:void 0,onKeyDown:g,onKeyUp:A,onClick:C,onMouseDown:k},R=de(),O=y(()=>{let e=o.panel;if(!e)return;function l(){G(R.current,{[U.Forwards]:()=>K(e,N.First),[U.Backwards]:()=>K(e,N.Last)})}l()});return h.createElement(h.Fragment,null,$({ourProps:m,theirProps:S,slot:W,defaultTag:xe,name:"Popover.Button"}),B&&!s&&P&&h.createElement(te,{id:L,features:oe.Focusable,as:"button",type:"button",onFocus:O}))}),He="div",ke=Q.RenderStrategy|Q.Static,Ge=V(function(n,f){let I=_(),{id:b=`headlessui-popover-overlay-${I}`,...S}=n,[{popoverState:o},t]=Z("Popover.Overlay"),P=w(f),a=ce(),L=(()=>a!==null?a===X.Open:o===0)(),F=y(s=>{if(ie(s.currentTarget))return s.preventDefault();t({type:1})}),v=x(()=>({open:o===0}),[o]);return $({ourProps:{ref:P,id:b,"aria-hidden":!0,onClick:F},theirProps:S,slot:v,defaultTag:He,features:ke,visible:L,name:"Popover.Overlay"})}),we="div",_e=Q.RenderStrategy|Q.Static,Ne=V(function(n,f){let I=_(),{id:b=`headlessui-popover-panel-${I}`,focus:S=!1,...o}=n,[t,P]=Z("Popover.Panel"),{close:a,isPortalled:L}=le("Popover.Panel"),F=`headlessui-focus-sentinel-before-${_()}`,v=`headlessui-focus-sentinel-after-${_()}`,u=J(null),s=w(u,f,i=>{P({type:4,panel:i})}),p=ee(u);j(()=>(P({type:5,panelId:b}),()=>{P({type:5,panelId:null})}),[b,P]);let c=ce(),T=(()=>c!==null?c===X.Open:t.popoverState===0)(),g=y(i=>{var m;switch(i.key){case H.Escape:if(t.popoverState!==0||!u.current||(p==null?void 0:p.activeElement)&&!u.current.contains(p.activeElement))return;i.preventDefault(),i.stopPropagation(),P({type:1}),(m=t.button)==null||m.focus();break}});j(()=>{var i;n.static||t.popoverState===1&&((i=n.unmount)!=null?i:!0)&&P({type:4,panel:null})},[t.popoverState,n.unmount,n.static,P]),j(()=>{if(!S||t.popoverState!==0||!u.current)return;let i=p==null?void 0:p.activeElement;u.current.contains(i)||K(u.current,N.First)},[S,u,t.popoverState]);let A=x(()=>({open:t.popoverState===0,close:a}),[t,a]),C={ref:s,id:t.panelId,onKeyDown:g,onBlur:S&&t.popoverState===0?i=>{var R,O,e,l,d;let m=i.relatedTarget;!m||!u.current||(R=u.current)!=null&&R.contains(m)||(P({type:1}),(((e=(O=t.beforePanelSentinel.current)==null?void 0:O.contains)==null?void 0:e.call(O,m))||((d=(l=t.afterPanelSentinel.current)==null?void 0:l.contains)==null?void 0:d.call(l,m)))&&m.focus({preventScroll:!0}))}:void 0,tabIndex:-1},k=de(),B=y(()=>{let i=u.current;if(!i)return;function m(){G(k.current,{[U.Forwards]:()=>{K(i,N.First)},[U.Backwards]:()=>{var R;(R=t.button)==null||R.focus({preventScroll:!0})}})}m()}),W=y(()=>{let i=u.current;if(!i)return;function m(){G(k.current,{[U.Forwards]:()=>{var E,D,Y;if(!t.button)return;let R=fe(),O=R.indexOf(t.button),e=R.slice(0,O+1),d=[...R.slice(O+1),...e];for(let M of d.slice())if(((D=(E=M==null?void 0:M.id)==null?void 0:E.startsWith)==null?void 0:D.call(E,"headlessui-focus-sentinel-"))||((Y=t.panel)==null?void 0:Y.contains(M))){let pe=d.indexOf(M);pe!==-1&&d.splice(pe,1)}K(d,N.First,!1)},[U.Backwards]:()=>K(i,N.Last)})}m()});return h.createElement(ue.Provider,{value:t.panelId},T&&L&&h.createElement(te,{id:F,ref:t.beforePanelSentinel,features:oe.Focusable,as:"button",type:"button",onFocus:B}),$({ourProps:C,theirProps:o,slot:A,defaultTag:we,features:_e,visible:T,name:"Popover.Panel"}),T&&L&&h.createElement(te,{id:v,ref:t.afterPanelSentinel,features:oe.Focusable,as:"button",type:"button",onFocus:W}))}),Ke="div",Ue=V(function(n,f){let I=J(null),b=w(I,f),[S,o]=me([]),t=y(p=>{o(c=>{let T=c.indexOf(p);if(T!==-1){let g=c.slice();return g.splice(T,1),g}return c})}),P=y(p=>(o(c=>[...c,p]),()=>t(p))),a=y(()=>{var T;let p=Re(I);if(!p)return!1;let c=p.activeElement;return(T=I.current)!=null&&T.contains(c)?!0:S.some(g=>{var A,C;return((A=p.getElementById(g.buttonId.current))==null?void 0:A.contains(c))||((C=p.getElementById(g.panelId.current))==null?void 0:C.contains(c))})}),L=y(p=>{for(let c of S)c.buttonId.current!==p&&c.close()}),F=x(()=>({registerPopover:P,unregisterPopover:t,isFocusWithinPopoverGroup:a,closeOthers:L}),[P,t,a,L]),v=x(()=>({}),[]),u=n,s={ref:b};return h.createElement(ae.Provider,{value:F},$({ourProps:s,theirProps:u,slot:v,defaultTag:Ke,name:"Popover.Group"}))}),St=Object.assign(he,{Button:De,Overlay:Ge,Panel:Ne,Group:Ue});export{St as Popover};
"use client";import{useFocusRing as Le}from"@react-aria/focus";import{useHover as Ie}from"@react-aria/interactions";import E,{createContext as oe,createRef as Pe,useContext as re,useEffect as ne,useMemo as D,useReducer as De,useRef as ee,useState as le}from"react";import{useActivePress as he}from'../../hooks/use-active-press.js';import{useElementSize as ke}from'../../hooks/use-element-size.js';import{useEvent as g}from'../../hooks/use-event.js';import{useEventListener as Ge}from'../../hooks/use-event-listener.js';import{useId as ae}from'../../hooks/use-id.js';import{useIsoMorphicEffect as He}from'../../hooks/use-iso-morphic-effect.js';import{useLatestValue as Ae}from'../../hooks/use-latest-value.js';import{useOnDisappear as Ue}from'../../hooks/use-on-disappear.js';import{useOutsideClick as Ne}from'../../hooks/use-outside-click.js';import{useOwnerDocument as fe}from'../../hooks/use-owner.js';import{useResolveButtonType as we}from'../../hooks/use-resolve-button-type.js';import{MainTreeProvider as Ce,useMainTreeNode as Ke,useRootContainers as We}from'../../hooks/use-root-containers.js';import{useScrollLock as je}from'../../hooks/use-scroll-lock.js';import{optionalRef as Ve,useSyncRefs as q}from'../../hooks/use-sync-refs.js';import{Direction as k,useTabDirection as Be}from'../../hooks/use-tab-direction.js';import{transitionDataAttributes as Re,useTransition as _e}from'../../hooks/use-transition.js';import{CloseProvider as $e}from'../../internal/close-provider.js';import{FloatingProvider as Je,useFloatingPanel as Xe,useFloatingPanelProps as qe,useFloatingReference as ze,useResolvedAnchor as Ye}from'../../internal/floating.js';import{Hidden as ce,HiddenFeatures as ve}from'../../internal/hidden.js';import{OpenClosedProvider as Qe,ResetOpenClosedProvider as Ze,State as z,useOpenClosed as Fe}from'../../internal/open-closed.js';import{isDisabledReactIssue7711 as xe}from'../../utils/bugs.js';import{Focus as G,FocusResult as Te,FocusableMode as et,focusIn as W,getFocusableElements as me,isFocusableElement as tt}from'../../utils/focus-management.js';import{match as j}from'../../utils/match.js';import'../../utils/micro-task.js';import{getOwnerDocument as ot}from'../../utils/owner.js';import{RenderFeatures as pe,forwardRefWithAs as Y,mergeProps as ye,render as te,useMergeRefsFn as rt}from'../../utils/render.js';import{Keys as V}from'../keyboard.js';import{Portal as nt,useNestedPortals as lt}from'../portal/portal.js';var at=(P=>(P[P.Open=0]="Open",P[P.Closed=1]="Closed",P))(at||{}),pt=(s=>(s[s.TogglePopover=0]="TogglePopover",s[s.ClosePopover=1]="ClosePopover",s[s.SetButton=2]="SetButton",s[s.SetButtonId=3]="SetButtonId",s[s.SetPanel=4]="SetPanel",s[s.SetPanelId=5]="SetPanelId",s))(pt||{});let st={[0]:t=>({...t,popoverState:j(t.popoverState,{[0]:1,[1]:0}),__demoMode:!1}),[1](t){return t.popoverState===1?t:{...t,popoverState:1,__demoMode:!1}},[2](t,n){return t.button===n.button?t:{...t,button:n.button}},[3](t,n){return t.buttonId===n.buttonId?t:{...t,buttonId:n.buttonId}},[4](t,n){return t.panel===n.panel?t:{...t,panel:n.panel}},[5](t,n){return t.panelId===n.panelId?t:{...t,panelId:n.panelId}}},Ee=oe(null);Ee.displayName="PopoverContext";function se(t){let n=re(Ee);if(n===null){let P=new Error(`<${t} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(P,se),P}return n}let ue=oe(null);ue.displayName="PopoverAPIContext";function be(t){let n=re(ue);if(n===null){let P=new Error(`<${t} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(P,be),P}return n}let ge=oe(null);ge.displayName="PopoverGroupContext";function Me(){return re(ge)}let ie=oe(null);ie.displayName="PopoverPanelContext";function ut(){return re(ie)}function it(t,n){return j(n.type,st,t,n)}let dt="div";function Pt(t,n){var w;let{__demoMode:P=!1,...C}=t,m=ee(null),A=q(n,Ve(l=>{m.current=l})),s=ee([]),r=De(it,{__demoMode:P,popoverState:P?0:1,buttons:s,button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:Pe(),afterPanelSentinel:Pe(),afterButtonSentinel:Pe()}),[{popoverState:T,button:d,buttonId:o,panel:u,panelId:B,beforePanelSentinel:y,afterPanelSentinel:b,afterButtonSentinel:i},a]=r,c=fe((w=m.current)!=null?w:d),L=D(()=>{if(!d||!u)return!1;for(let S of document.querySelectorAll("body > *"))if(Number(S==null?void 0:S.contains(d))^Number(S==null?void 0:S.contains(u)))return!0;let l=me(),e=l.indexOf(d),p=(e+l.length-1)%l.length,f=(e+1)%l.length,v=l[p],O=l[f];return!u.contains(v)&&!u.contains(O)},[d,u]),_=Ae(o),H=Ae(B),I=D(()=>({buttonId:_,panelId:H,close:()=>a({type:1})}),[_,H,a]),M=Me(),h=M==null?void 0:M.registerPopover,R=g(()=>{var l;return(l=M==null?void 0:M.isFocusWithinPopoverGroup())!=null?l:(c==null?void 0:c.activeElement)&&((d==null?void 0:d.contains(c.activeElement))||(u==null?void 0:u.contains(c.activeElement)))});ne(()=>h==null?void 0:h(I),[h,I]);let[$,U]=lt(),F=Ke(d),N=We({mainTreeNode:F,portals:$,defaultContainers:[d,u]});Ge(c==null?void 0:c.defaultView,"focus",l=>{var e,p,f,v,O,S;l.target!==window&&l.target instanceof HTMLElement&&T===0&&(R()||d&&u&&(N.contains(l.target)||(p=(e=y.current)==null?void 0:e.contains)!=null&&p.call(e,l.target)||(v=(f=b.current)==null?void 0:f.contains)!=null&&v.call(f,l.target)||(S=(O=i.current)==null?void 0:O.contains)!=null&&S.call(O,l.target)||a({type:1})))},!0),Ne(T===0,N.resolveContainers,(l,e)=>{a({type:1}),tt(e,et.Loose)||(l.preventDefault(),d==null||d.focus())});let x=g(l=>{a({type:1});let e=(()=>l?l instanceof HTMLElement?l:"current"in l&&l.current instanceof HTMLElement?l.current:d:d)();e==null||e.focus()}),Z=D(()=>({close:x,isPortalled:L}),[x,L]),J=D(()=>({open:T===0,close:x}),[T,x]),X={ref:A};return E.createElement(Ce,{node:F},E.createElement(Je,null,E.createElement(ie.Provider,{value:null},E.createElement(Ee.Provider,{value:r},E.createElement(ue.Provider,{value:Z},E.createElement($e,{value:x},E.createElement(Qe,{value:j(T,{[0]:z.Open,[1]:z.Closed})},E.createElement(U,null,te({ourProps:X,theirProps:C,slot:J,defaultTag:dt,name:"Popover"})))))))))}let ft="button";function ct(t,n){let P=ae(),{id:C=`headlessui-popover-button-${P}`,disabled:m=!1,autoFocus:A=!1,...s}=t,[r,T]=se("Popover.Button"),{isPortalled:d}=be("Popover.Button"),o=ee(null),u=`headlessui-focus-sentinel-${ae()}`,B=Me(),y=B==null?void 0:B.closeOthers,i=ut()!==null;ne(()=>{if(!i)return T({type:3,buttonId:C}),()=>{T({type:3,buttonId:null})}},[i,C,T]);let[a]=le(()=>Symbol()),c=q(o,n,ze(),g(e=>{if(!i){if(e)r.buttons.current.push(a);else{let p=r.buttons.current.indexOf(a);p!==-1&&r.buttons.current.splice(p,1)}r.buttons.current.length>1&&console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."),e&&T({type:2,button:e})}})),L=q(o,n),_=fe(o),H=g(e=>{var p,f,v;if(i){if(r.popoverState===1)return;switch(e.key){case V.Space:case V.Enter:e.preventDefault(),(f=(p=e.target).click)==null||f.call(p),T({type:1}),(v=r.button)==null||v.focus();break}}else switch(e.key){case V.Space:case V.Enter:e.preventDefault(),e.stopPropagation(),r.popoverState===1&&(y==null||y(r.buttonId)),T({type:0});break;case V.Escape:if(r.popoverState!==0)return y==null?void 0:y(r.buttonId);if(!o.current||_!=null&&_.activeElement&&!o.current.contains(_.activeElement))return;e.preventDefault(),e.stopPropagation(),T({type:1});break}}),I=g(e=>{i||e.key===V.Space&&e.preventDefault()}),M=g(e=>{var p,f;xe(e.currentTarget)||m||(i?(T({type:1}),(p=r.button)==null||p.focus()):(e.preventDefault(),e.stopPropagation(),r.popoverState===1&&(y==null||y(r.buttonId)),T({type:0}),(f=r.button)==null||f.focus()))}),h=g(e=>{e.preventDefault(),e.stopPropagation()}),{isFocusVisible:R,focusProps:$}=Le({autoFocus:A}),{isHovered:U,hoverProps:F}=Ie({isDisabled:m}),{pressed:N,pressProps:Q}=he({disabled:m}),x=r.popoverState===0,Z=D(()=>({open:x,active:N||x,disabled:m,hover:U,focus:R,autofocus:A}),[x,U,R,N,m,A]),J=we(t,r.button),X=i?ye({ref:L,type:J,onKeyDown:H,onClick:M,disabled:m||void 0,autoFocus:A},$,F,Q):ye({ref:c,id:r.buttonId,type:J,"aria-expanded":r.popoverState===0,"aria-controls":r.panel?r.panelId:void 0,disabled:m||void 0,autoFocus:A,onKeyDown:H,onKeyUp:I,onClick:M,onMouseDown:h},$,F,Q),w=Be(),l=g(()=>{let e=r.panel;if(!e)return;function p(){j(w.current,{[k.Forwards]:()=>W(e,G.First),[k.Backwards]:()=>W(e,G.Last)})===Te.Error&&W(me().filter(v=>v.dataset.headlessuiFocusGuard!=="true"),j(w.current,{[k.Forwards]:G.Next,[k.Backwards]:G.Previous}),{relativeTo:r.button})}p()});return E.createElement(E.Fragment,null,te({ourProps:X,theirProps:s,slot:Z,defaultTag:ft,name:"Popover.Button"}),x&&!i&&d&&E.createElement(ce,{id:u,ref:r.afterButtonSentinel,features:ve.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:l}))}let vt="div",Tt=pe.RenderStrategy|pe.Static;function Oe(t,n){let P=ae(),{id:C=`headlessui-popover-backdrop-${P}`,transition:m=!1,...A}=t,[{popoverState:s},r]=se("Popover.Backdrop"),[T,d]=le(null),o=q(n,d),u=Fe(),[B,y]=_e(m,T,u!==null?(u&z.Open)===z.Open:s===0),b=g(c=>{if(xe(c.currentTarget))return c.preventDefault();r({type:1})}),i=D(()=>({open:s===0}),[s]),a={ref:o,id:C,"aria-hidden":!0,onClick:b,...Re(y)};return te({ourProps:a,theirProps:A,slot:i,defaultTag:vt,features:Tt,visible:B,name:"Popover.Backdrop"})}let mt="div",yt=pe.RenderStrategy|pe.Static;function Et(t,n){let P=ae(),{id:C=`headlessui-popover-panel-${P}`,focus:m=!1,anchor:A,portal:s=!1,modal:r=!1,transition:T=!1,...d}=t,[o,u]=se("Popover.Panel"),{close:B,isPortalled:y}=be("Popover.Panel"),b=`headlessui-focus-sentinel-before-${P}`,i=`headlessui-focus-sentinel-after-${P}`,a=ee(null),c=Ye(A),[L,_]=Xe(c),H=qe();c&&(s=!0);let[I,M]=le(null),h=q(a,n,c?L:null,g(e=>u({type:4,panel:e})),M),R=fe(a),$=rt();He(()=>(u({type:5,panelId:C}),()=>{u({type:5,panelId:null})}),[C,u]);let U=Fe(),[F,N]=_e(T,I,U!==null?(U&z.Open)===z.Open:o.popoverState===0);Ue(F,o.button,()=>{u({type:1})});let Q=o.__demoMode?!1:r&&F;je(Q,R);let x=g(e=>{var p;switch(e.key){case V.Escape:if(o.popoverState!==0||!a.current||R!=null&&R.activeElement&&!a.current.contains(R.activeElement))return;e.preventDefault(),e.stopPropagation(),u({type:1}),(p=o.button)==null||p.focus();break}});ne(()=>{var e;t.static||o.popoverState===1&&((e=t.unmount)==null||e)&&u({type:4,panel:null})},[o.popoverState,t.unmount,t.static,u]),ne(()=>{if(o.__demoMode||!m||o.popoverState!==0||!a.current)return;let e=R==null?void 0:R.activeElement;a.current.contains(e)||W(a.current,G.First)},[o.__demoMode,m,a.current,o.popoverState]);let Z=D(()=>({open:o.popoverState===0,close:B}),[o.popoverState,B]),J=ye(c?H():{},{ref:h,id:C,onKeyDown:x,onBlur:m&&o.popoverState===0?e=>{var f,v,O,S,K;let p=e.relatedTarget;p&&a.current&&((f=a.current)!=null&&f.contains(p)||(u({type:1}),((O=(v=o.beforePanelSentinel.current)==null?void 0:v.contains)!=null&&O.call(v,p)||(K=(S=o.afterPanelSentinel.current)==null?void 0:S.contains)!=null&&K.call(S,p))&&p.focus({preventScroll:!0})))}:void 0,tabIndex:-1,style:{...d.style,..._,"--button-width":ke(o.button,!0).width},...Re(N)}),X=Be(),w=g(()=>{let e=a.current;if(!e)return;function p(){j(X.current,{[k.Forwards]:()=>{var v;W(e,G.First)===Te.Error&&((v=o.afterPanelSentinel.current)==null||v.focus())},[k.Backwards]:()=>{var f;(f=o.button)==null||f.focus({preventScroll:!0})}})}p()}),l=g(()=>{let e=a.current;if(!e)return;function p(){j(X.current,{[k.Forwards]:()=>{if(!o.button)return;let f=me(),v=f.indexOf(o.button),O=f.slice(0,v+1),K=[...f.slice(v+1),...O];for(let de of K.slice())if(de.dataset.headlessuiFocusGuard==="true"||I!=null&&I.contains(de)){let Se=K.indexOf(de);Se!==-1&&K.splice(Se,1)}W(K,G.First,{sorted:!1})},[k.Backwards]:()=>{var v;W(e,G.Previous)===Te.Error&&((v=o.button)==null||v.focus())}})}p()});return E.createElement(Ze,null,E.createElement(ie.Provider,{value:C},E.createElement(ue.Provider,{value:{close:B,isPortalled:y}},E.createElement(nt,{enabled:s?t.static||F:!1},F&&y&&E.createElement(ce,{id:b,ref:o.beforePanelSentinel,features:ve.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:w}),te({mergeRefs:$,ourProps:J,theirProps:d,slot:Z,defaultTag:mt,features:yt,visible:F,name:"Popover.Panel"}),F&&y&&E.createElement(ce,{id:i,ref:o.afterPanelSentinel,features:ve.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:l})))))}let bt="div";function gt(t,n){let P=ee(null),C=q(P,n),[m,A]=le([]),s=g(b=>{A(i=>{let a=i.indexOf(b);if(a!==-1){let c=i.slice();return c.splice(a,1),c}return i})}),r=g(b=>(A(i=>[...i,b]),()=>s(b))),T=g(()=>{var a;let b=ot(P);if(!b)return!1;let i=b.activeElement;return(a=P.current)!=null&&a.contains(i)?!0:m.some(c=>{var L,_;return((L=b.getElementById(c.buttonId.current))==null?void 0:L.contains(i))||((_=b.getElementById(c.panelId.current))==null?void 0:_.contains(i))})}),d=g(b=>{for(let i of m)i.buttonId.current!==b&&i.close()}),o=D(()=>({registerPopover:r,unregisterPopover:s,isFocusWithinPopoverGroup:T,closeOthers:d}),[r,s,T,d]),u=D(()=>({}),[]),B=t,y={ref:C};return E.createElement(Ce,null,E.createElement(ge.Provider,{value:o},te({ourProps:y,theirProps:B,slot:u,defaultTag:bt,name:"Popover.Group"})))}let St=Y(Pt),At=Y(ct),Ct=Y(Oe),Bt=Y(Oe),Rt=Y(Et),_t=Y(gt),ao=Object.assign(St,{Button:At,Backdrop:Bt,Overlay:Ct,Panel:Rt,Group:_t});export{ao as Popover,Bt as PopoverBackdrop,At as PopoverButton,_t as PopoverGroup,Ct as PopoverOverlay,Rt as PopoverPanel};

@@ -1,26 +0,36 @@

import React, { MutableRefObject, Ref } from 'react';
import { Props } from '../../types.js';
interface PortalRenderPropArg {
import React, { type ElementType, type MutableRefObject, type Ref } from 'react';
import type { Props } from '../../types.js';
import { type HasDisplayName, type RefProp } from '../../utils/render.js';
declare let DEFAULT_PORTAL_TAG: React.ExoticComponent<{
children?: React.ReactNode;
}>;
type PortalRenderPropArg = {};
type PortalPropsWeControl = never;
export type PortalProps<TTag extends ElementType = typeof DEFAULT_PORTAL_TAG> = Props<TTag, PortalRenderPropArg, PortalPropsWeControl, {
enabled?: boolean;
}>;
declare function PortalFn<TTag extends ElementType = typeof DEFAULT_PORTAL_TAG>(props: PortalProps<TTag>, ref: Ref<HTMLElement>): React.JSX.Element | null;
declare let DEFAULT_GROUP_TAG: React.ExoticComponent<{
children?: React.ReactNode;
}>;
type GroupRenderPropArg = {};
type GroupPropsWeControl = never;
export type PortalGroupProps<TTag extends ElementType = typeof DEFAULT_GROUP_TAG> = Props<TTag, GroupRenderPropArg, GroupPropsWeControl, {
target: MutableRefObject<HTMLElement | null>;
}>;
declare function GroupFn<TTag extends ElementType = typeof DEFAULT_GROUP_TAG>(props: PortalGroupProps<TTag>, ref: Ref<HTMLElement>): React.JSX.Element;
export declare function useNestedPortals(): readonly [React.MutableRefObject<HTMLElement[]>, ({ children }: {
children: React.ReactNode;
}) => React.JSX.Element];
export interface _internal_ComponentPortal extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_PORTAL_TAG>(props: PortalProps<TTag> & RefProp<typeof PortalFn>): JSX.Element;
}
interface GroupRenderPropArg {
export interface _internal_ComponentPortalGroup extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_GROUP_TAG>(props: PortalGroupProps<TTag> & RefProp<typeof GroupFn>): JSX.Element;
}
export declare let Portal: (<TTag extends React.ElementType<any> = React.ExoticComponent<{
children?: React.ReactNode;
}>>(props: Props<TTag, PortalRenderPropArg, "1D45E01E-AF44-47C4-988A-19A94EBAF55C">, ref: Ref<HTMLElement>) => React.ReactPortal | null) & {
displayName: string;
} & {
Group: (<TTag_1 extends React.ElementType<any> = React.ExoticComponent<{
children?: React.ReactNode;
}>>(props: Omit<import('../../types.js').PropsOf<TTag_1>, "as" | "children" | "refName" | "className"> & {
as?: TTag_1 | undefined;
children?: React.ReactNode | ((bag: GroupRenderPropArg) => React.ReactElement<any, string | React.JSXElementConstructor<any>>);
refName?: string | undefined;
} & (true extends (import('../../types.js').PropsOf<TTag_1> extends never ? never : "className" extends keyof import('../../types.js').PropsOf<TTag_1> ? true : never) ? {
className?: import('../../types.js').PropsOf<TTag_1>["className"] | ((bag: GroupRenderPropArg) => string) | undefined;
} : {}) & {
target: MutableRefObject<HTMLElement | null>;
}, ref: Ref<HTMLElement>) => JSX.Element) & {
displayName: string;
};
export declare let PortalGroup: _internal_ComponentPortalGroup;
export declare let Portal: _internal_ComponentPortal & {
/** @deprecated use `<PortalGroup>` instead of `<Portal.Group>` */
Group: _internal_ComponentPortalGroup;
};
export {};

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

import h,{Fragment as s,createContext as L,useContext as y,useEffect as m,useRef as d,useState as T}from"react";import{createPortal as G}from"react-dom";import{forwardRefWithAs as P,render as R}from'../../utils/render.js';import{useIsoMorphicEffect as M}from'../../hooks/use-iso-morphic-effect.js';import{usePortalRoot as v}from'../../internal/portal-force-root.js';import{useServerHandoffComplete as C}from'../../hooks/use-server-handoff-complete.js';import{optionalRef as O,useSyncRefs as g}from'../../hooks/use-sync-refs.js';import{useOwnerDocument as c}from'../../hooks/use-owner.js';import{microTask as H}from'../../utils/micro-task.js';import{isServer as E}from'../../utils/ssr.js';function x(i){let u=v(),o=y(A),e=c(i),[r,f]=T(()=>{if(!u&&o!==null||E)return null;let n=e==null?void 0:e.getElementById("headlessui-portal-root");if(n)return n;if(e===null)return null;let t=e.createElement("div");return t.setAttribute("id","headlessui-portal-root"),e.body.appendChild(t)});return m(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),m(()=>{u||o!==null&&f(o.current)},[o,f,u]),r}let _=s,U=P(function(u,o){let e=u,r=d(null),f=g(O(a=>{r.current=a}),o),n=c(r),t=x(r),[l]=T(()=>{var a;return E?null:(a=n==null?void 0:n.createElement("div"))!=null?a:null}),b=C(),p=d(!1);return M(()=>{if(p.current=!1,!(!t||!l))return t.contains(l)||(l.setAttribute("data-headlessui-portal",""),t.appendChild(l)),()=>{p.current=!0,H(()=>{var a;!p.current||!t||!l||(t.removeChild(l),t.childNodes.length<=0&&((a=t.parentElement)==null||a.removeChild(t)))})}},[t,l]),b?!t||!l?null:G(R({ourProps:{ref:f},theirProps:e,defaultTag:_,name:"Portal"}),l):null}),j=s,A=L(null),F=P(function(u,o){let{target:e,...r}=u,n={ref:g(o)};return h.createElement(A.Provider,{value:e},R({ourProps:n,theirProps:r,defaultTag:j,name:"Popover.Group"}))}),$=Object.assign(U,{Group:F});export{$ as Portal};
"use client";import f,{Fragment as g,createContext as E,useContext as T,useEffect as R,useMemo as c,useRef as A,useState as G}from"react";import{createPortal as H}from"react-dom";import{useEvent as L}from'../../hooks/use-event.js';import{useIsoMorphicEffect as x}from'../../hooks/use-iso-morphic-effect.js';import{useOnUnmount as O}from'../../hooks/use-on-unmount.js';import{useOwnerDocument as _}from'../../hooks/use-owner.js';import{useServerHandoffComplete as h}from'../../hooks/use-server-handoff-complete.js';import{optionalRef as F,useSyncRefs as P}from'../../hooks/use-sync-refs.js';import{usePortalRoot as U}from'../../internal/portal-force-root.js';import{env as C}from'../../utils/env.js';import{forwardRefWithAs as m,render as d}from'../../utils/render.js';function D(p){let r=U(),l=T(v),e=_(p),[o,n]=G(()=>{var t;if(!r&&l!==null)return(t=l.current)!=null?t:null;if(C.isServer)return null;let u=e==null?void 0:e.getElementById("headlessui-portal-root");if(u)return u;if(e===null)return null;let a=e.createElement("div");return a.setAttribute("id","headlessui-portal-root"),e.body.appendChild(a)});return R(()=>{o!==null&&(e!=null&&e.body.contains(o)||e==null||e.body.appendChild(o))},[o,e]),R(()=>{r||l!==null&&n(l.current)},[l,n,r]),o}let M=g,N=m(function(r,l){let e=r,o=A(null),n=P(F(i=>{o.current=i}),l),u=_(o),a=D(o),[t]=G(()=>{var i;return C.isServer?null:(i=u==null?void 0:u.createElement("div"))!=null?i:null}),s=T(y),b=h();return x(()=>{!a||!t||a.contains(t)||(t.setAttribute("data-headlessui-portal",""),a.appendChild(t))},[a,t]),x(()=>{if(t&&s)return s.register(t)},[s,t]),O(()=>{var i;!a||!t||(t instanceof Node&&a.contains(t)&&a.removeChild(t),a.childNodes.length<=0&&((i=a.parentElement)==null||i.removeChild(a)))}),b?!a||!t?null:H(d({ourProps:{ref:n},theirProps:e,slot:{},defaultTag:M,name:"Portal"}),t):null});function S(p,r){let l=P(r),{enabled:e=!0,...o}=p;return e?f.createElement(N,{...o,ref:l}):d({ourProps:{ref:l},theirProps:o,slot:{},defaultTag:M,name:"Portal"})}let j=g,v=E(null);function W(p,r){let{target:l,...e}=p,n={ref:P(r)};return f.createElement(v.Provider,{value:l},d({ourProps:n,theirProps:e,defaultTag:j,name:"Popover.Group"}))}let y=E(null);function ee(){let p=T(y),r=A([]),l=L(n=>(r.current.push(n),p&&p.register(n),()=>e(n))),e=L(n=>{let u=r.current.indexOf(n);u!==-1&&r.current.splice(u,1),p&&p.unregister(n)}),o=c(()=>({register:l,unregister:e,portals:r}),[l,e,r]);return[r,c(()=>function({children:u}){return f.createElement(y.Provider,{value:o},u)},[o])]}let I=m(S),J=m(W),te=Object.assign(I,{Group:J});export{te as Portal,J as PortalGroup,ee as useNestedPortals};

@@ -1,44 +0,85 @@

import React, { Ref } from 'react';
import { Props } from '../../types.js';
interface RadioGroupRenderPropArg<TType> {
import React, { type ElementType, type Ref } from 'react';
import { type ByComparator } from '../../hooks/use-by-comparator.js';
import type { Props } from '../../types.js';
import { type HasDisplayName, type RefProp } from '../../utils/render.js';
import { type _internal_ComponentDescription } from '../description/description.js';
import { type _internal_ComponentLabel } from '../label/label.js';
declare let DEFAULT_RADIO_GROUP_TAG: "div";
type RadioGroupRenderPropArg<TType> = {
value: TType;
}
declare type RadioGroupPropsWeControl = 'role' | 'aria-labelledby' | 'aria-describedby';
interface OptionRenderPropArg {
};
type RadioGroupPropsWeControl = 'role' | 'aria-labelledby' | 'aria-describedby';
export type RadioGroupProps<TTag extends ElementType = typeof DEFAULT_RADIO_GROUP_TAG, TType = string> = Props<TTag, RadioGroupRenderPropArg<TType>, RadioGroupPropsWeControl, {
value?: TType;
defaultValue?: TType;
onChange?(value: TType): void;
by?: ByComparator<TType>;
disabled?: boolean;
form?: string;
name?: string;
}>;
declare function RadioGroupFn<TTag extends ElementType = typeof DEFAULT_RADIO_GROUP_TAG, TType = string>(props: RadioGroupProps<TTag, TType>, ref: Ref<HTMLElement>): React.JSX.Element;
declare let DEFAULT_OPTION_TAG: "div";
type OptionRenderPropArg = {
checked: boolean;
/** @deprecated use `focus` instead */
active: boolean;
hover: boolean;
focus: boolean;
autofocus: boolean;
disabled: boolean;
};
type OptionPropsWeControl = 'aria-checked' | 'aria-describedby' | 'aria-labelledby' | 'role' | 'tabIndex';
export type RadioOptionProps<TTag extends ElementType, TType> = Props<TTag, OptionRenderPropArg, OptionPropsWeControl, {
value: TType;
disabled?: boolean;
autoFocus?: boolean;
}>;
declare function OptionFn<TTag extends ElementType = typeof DEFAULT_OPTION_TAG, TType = Parameters<typeof RadioGroupRoot>[0]['value']>(props: RadioOptionProps<TTag, TType>, ref: Ref<HTMLElement>): React.JSX.Element;
declare let DEFAULT_RADIO_TAG: "span";
type RadioRenderPropArg = {
checked: boolean;
hover: boolean;
focus: boolean;
autofocus: boolean;
disabled: boolean;
};
type RadioPropsWeControl = 'aria-checked' | 'aria-describedby' | 'aria-labelledby' | 'role' | 'tabIndex';
export type RadioProps<TTag extends ElementType = typeof DEFAULT_RADIO_TAG, TType = string> = Props<TTag, RadioRenderPropArg, RadioPropsWeControl, {
value: TType;
disabled?: boolean;
autoFocus?: boolean;
}>;
declare function RadioFn<TTag extends ElementType = typeof DEFAULT_RADIO_TAG, TType = Parameters<typeof RadioGroupRoot>[0]['value']>(props: RadioProps<TTag, TType>, ref: Ref<HTMLElement>): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
export interface _internal_ComponentRadioGroup extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_RADIO_GROUP_TAG, TType = string>(props: RadioGroupProps<TTag, TType> & RefProp<typeof RadioGroupFn>): JSX.Element;
}
declare type RadioPropsWeControl = 'aria-checked' | 'onBlur' | 'onClick' | 'onFocus' | 'ref' | 'role' | 'tabIndex';
export declare let RadioGroup: (<TTag extends React.ElementType<any> = "div", TType = string>(props: Props<TTag, RadioGroupRenderPropArg<TType>, "value" | "name" | "disabled" | "defaultValue" | "onChange" | "by" | RadioGroupPropsWeControl> & {
value?: TType | undefined;
defaultValue?: TType | undefined;
onChange?(value: TType): void;
by?: (keyof TType & string) | ((a: TType, z: TType) => boolean) | undefined;
disabled?: boolean | undefined;
name?: string | undefined;
}, ref: Ref<HTMLElement>) => JSX.Element) & {
displayName: string;
} & {
Option: (<TTag_1 extends React.ElementType<any> = "div", TType_1 = unknown>(props: Props<TTag_1, OptionRenderPropArg, "value" | "disabled" | RadioPropsWeControl> & {
value: TType_1;
disabled?: boolean | undefined;
}, ref: Ref<HTMLElement>) => JSX.Element) & {
displayName: string;
};
Label: (<TTag_2 extends React.ElementType<any> = "label">(props: Omit<import('../../types.js').PropsOf<TTag_2>, "as" | "children" | "refName" | "className"> & {
as?: TTag_2 | undefined;
children?: React.ReactNode | ((bag: {}) => React.ReactElement<any, string | React.JSXElementConstructor<any>>);
refName?: string | undefined;
} & (true extends (import('../../types.js').PropsOf<TTag_2> extends never ? never : "className" extends keyof import('../../types.js').PropsOf<TTag_2> ? true : never) ? {
className?: import('../../types.js').PropsOf<TTag_2>["className"] | ((bag: {}) => string) | undefined;
} : {}) & {
passive?: boolean | undefined;
}, ref: React.Ref<HTMLLabelElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
};
Description: (<TTag_3 extends React.ElementType<any> = "p">(props: Props<TTag_3, {}, "1D45E01E-AF44-47C4-988A-19A94EBAF55C">, ref: React.Ref<HTMLParagraphElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
};
export interface _internal_ComponentRadioOption extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_OPTION_TAG, TType = string>(props: RadioOptionProps<TTag, TType> & RefProp<typeof OptionFn>): JSX.Element;
}
export interface _internal_ComponentRadio extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_RADIO_TAG, TType = string>(props: RadioProps<TTag, TType> & RefProp<typeof RadioFn>): JSX.Element;
}
export interface _internal_ComponentRadioLabel extends _internal_ComponentLabel {
}
export interface _internal_ComponentRadioDescription extends _internal_ComponentDescription {
}
declare let RadioGroupRoot: _internal_ComponentRadioGroup;
/** @deprecated use `<Radio>` instead of `<RadioGroupOption>` */
export declare let RadioGroupOption: _internal_ComponentRadioOption;
export declare let Radio: _internal_ComponentRadio;
/** @deprecated use `<Label>` instead of `<RadioGroupLabel>` */
export declare let RadioGroupLabel: _internal_ComponentRadioLabel;
/** @deprecated use `<Description>` instead of `<RadioGroupDescription>` */
export declare let RadioGroupDescription: _internal_ComponentRadioDescription;
export declare let RadioGroup: _internal_ComponentRadioGroup & {
/** @deprecated use `<Radio>` instead of `<RadioGroup.Option>` */
Option: _internal_ComponentRadioOption;
/** @deprecated use `<Radio>` instead of `<RadioGroup.Radio>` */
Radio: _internal_ComponentRadio;
/** @deprecated use `<Label>` instead of `<RadioGroup.Label>` */
Label: _internal_ComponentRadioLabel;
/** @deprecated use `<Description>` instead of `<RadioGroup.Description>` */
Description: _internal_ComponentRadioDescription;
};
export {};

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

import g,{createContext as J,useContext as q,useMemo as A,useReducer as se,useRef as B,useEffect as ue}from"react";import{forwardRefWithAs as Q,render as X,compact as de}from'../../utils/render.js';import{useId as Y}from'../../hooks/use-id.js';import{match as ce}from'../../utils/match.js';import{useIsoMorphicEffect as fe}from'../../hooks/use-iso-morphic-effect.js';import{Keys as P}from'../../components/keyboard.js';import{focusIn as Z,Focus as H,FocusResult as z,sortByDomNode as Te}from'../../utils/focus-management.js';import{useFlags as me}from'../../hooks/use-flags.js';import{Label as be,useLabels as ee}from'../../components/label/label.js';import{Description as Re,useDescriptions as te}from'../../components/description/description.js';import{useTreeWalker as ye}from'../../hooks/use-tree-walker.js';import{useSyncRefs as re}from'../../hooks/use-sync-refs.js';import{Hidden as ge,Features as ve}from'../../internal/hidden.js';import{attemptSubmit as Oe,objectToFormEntries as Ee}from'../../utils/form.js';import{getOwnerDocument as Ae}from'../../utils/owner.js';import{useEvent as v}from'../../hooks/use-event.js';import{useControllable as Pe}from'../../hooks/use-controllable.js';import{isDisabledReactIssue7711 as oe}from'../../utils/bugs.js';import{useLatestValue as De}from'../../hooks/use-latest-value.js';import{useDisposables as Ge}from'../../hooks/use-disposables.js';var he=(t=>(t[t.RegisterOption=0]="RegisterOption",t[t.UnregisterOption=1]="UnregisterOption",t))(he||{});let ke={[0](n,r){let t=[...n.options,{id:r.id,element:r.element,propsRef:r.propsRef}];return{...n,options:Te(t,d=>d.element.current)}},[1](n,r){let t=n.options.slice(),d=n.options.findIndex(c=>c.id===r.id);return d===-1?n:(t.splice(d,1),{...n,options:t})}},$=J(null);$.displayName="RadioGroupDataContext";function ne(n){let r=q($);if(r===null){let t=new Error(`<${n} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,ne),t}return r}let V=J(null);V.displayName="RadioGroupActionsContext";function ie(n){let r=q(V);if(r===null){let t=new Error(`<${n} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,ie),t}return r}function Fe(n,r){return ce(r.type,ke,n,r)}let Le="div",Ce=Q(function(r,t){let d=Y(),{id:c=`headlessui-radiogroup-${d}`,value:D,defaultValue:O,name:I,onChange:E,by:G=(e,i)=>e===i,disabled:h=!1,...U}=r,T=v(typeof G=="string"?(e,i)=>{let o=G;return(e==null?void 0:e[o])===(i==null?void 0:i[o])}:G),[k,F]=se(Fe,{options:[]}),a=k.options,[M,N]=ee(),[m,L]=te(),C=B(null),W=re(C,t),[l,x]=Pe(D,E,O),s=A(()=>a.find(e=>!e.propsRef.current.disabled),[a]),b=A(()=>a.some(e=>T(e.propsRef.current.value,l)),[a,l]),u=v(e=>{var o;if(h||T(e,l))return!1;let i=(o=a.find(f=>T(f.propsRef.current.value,e)))==null?void 0:o.propsRef.current;return i!=null&&i.disabled?!1:(x==null||x(e),!0)});ye({container:C.current,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")}});let K=v(e=>{let i=C.current;if(!i)return;let o=Ae(i),f=a.filter(p=>p.propsRef.current.disabled===!1).map(p=>p.element.current);switch(e.key){case P.Enter:Oe(e.currentTarget);break;case P.ArrowLeft:case P.ArrowUp:if(e.preventDefault(),e.stopPropagation(),Z(f,H.Previous|H.WrapAround)===z.Success){let y=a.find(j=>j.element.current===(o==null?void 0:o.activeElement));y&&u(y.propsRef.current.value)}break;case P.ArrowRight:case P.ArrowDown:if(e.preventDefault(),e.stopPropagation(),Z(f,H.Next|H.WrapAround)===z.Success){let y=a.find(j=>j.element.current===(o==null?void 0:o.activeElement));y&&u(y.propsRef.current.value)}break;case P.Space:{e.preventDefault(),e.stopPropagation();let p=a.find(y=>y.element.current===(o==null?void 0:o.activeElement));p&&u(p.propsRef.current.value)}break}}),w=v(e=>(F({type:0,...e}),()=>F({type:1,id:e.id}))),R=A(()=>({value:l,firstOption:s,containsCheckedOption:b,disabled:h,compare:T,...k}),[l,s,b,h,T,k]),S=A(()=>({registerOption:w,change:u}),[w,u]),ae={ref:W,id:c,role:"radiogroup","aria-labelledby":M,"aria-describedby":m,onKeyDown:K},le=A(()=>({value:l}),[l]),_=B(null),pe=Ge();return ue(()=>{!_.current||O!==void 0&&pe.addEventListener(_.current,"reset",()=>{u(O)})},[_,u]),g.createElement(L,{name:"RadioGroup.Description"},g.createElement(N,{name:"RadioGroup.Label"},g.createElement(V.Provider,{value:S},g.createElement($.Provider,{value:R},I!=null&&l!=null&&Ee({[I]:l}).map(([e,i],o)=>g.createElement(ge,{features:ve.Hidden,ref:o===0?f=>{var p;_.current=(p=f==null?void 0:f.closest("form"))!=null?p:null}:void 0,...de({key:e,as:"input",type:"radio",checked:i!=null,hidden:!0,readOnly:!0,name:e,value:i})})),X({ourProps:ae,theirProps:U,slot:le,defaultTag:Le,name:"RadioGroup"})))))});var xe=(t=>(t[t.Empty=1]="Empty",t[t.Active=2]="Active",t))(xe||{});let we="div",Ie=Q(function(r,t){var w;let d=Y(),{id:c=`headlessui-radiogroup-option-${d}`,value:D,disabled:O=!1,...I}=r,E=B(null),G=re(E,t),[h,U]=ee(),[T,k]=te(),{addFlag:F,removeFlag:a,hasFlag:M}=me(1),N=De({value:D,disabled:O}),m=ne("RadioGroup.Option"),L=ie("RadioGroup.Option");fe(()=>L.registerOption({id:c,element:E,propsRef:N}),[c,L,E,r]);let C=v(R=>{var S;if(oe(R.currentTarget))return R.preventDefault();!L.change(D)||(F(2),(S=E.current)==null||S.focus())}),W=v(R=>{if(oe(R.currentTarget))return R.preventDefault();F(2)}),l=v(()=>a(2)),x=((w=m.firstOption)==null?void 0:w.id)===c,s=m.disabled||O,b=m.compare(m.value,D),u={ref:G,id:c,role:"radio","aria-checked":b?"true":"false","aria-labelledby":h,"aria-describedby":T,"aria-disabled":s?!0:void 0,tabIndex:(()=>s?-1:b||!m.containsCheckedOption&&x?0:-1)(),onClick:s?void 0:C,onFocus:s?void 0:W,onBlur:s?void 0:l},K=A(()=>({checked:b,disabled:s,active:M(2)}),[b,s,M]);return g.createElement(k,{name:"RadioGroup.Description"},g.createElement(U,{name:"RadioGroup.Label"},X({ourProps:u,theirProps:I,slot:K,defaultTag:we,name:"RadioGroup.Option"})))}),ut=Object.assign(Ce,{Option:Ie,Label:be,Description:Re});export{ut as RadioGroup};
"use client";import{useFocusRing as Q}from"@react-aria/focus";import{useHover as Y}from"@react-aria/interactions";import G,{createContext as Z,useCallback as ye,useContext as ee,useMemo as x,useReducer as Re,useRef as W}from"react";import{useByComparator as be}from'../../hooks/use-by-comparator.js';import{useControllable as ge}from'../../hooks/use-controllable.js';import{useDefaultValue as Oe}from'../../hooks/use-default-value.js';import{useEvent as S}from'../../hooks/use-event.js';import{useId as B}from'../../hooks/use-id.js';import{useIsoMorphicEffect as te}from'../../hooks/use-iso-morphic-effect.js';import{useLatestValue as oe}from'../../hooks/use-latest-value.js';import{useSyncRefs as V}from'../../hooks/use-sync-refs.js';import{useDisabled as re}from'../../internal/disabled.js';import{FormFields as Pe}from'../../internal/form-fields.js';import{useProvidedId as ve}from'../../internal/id.js';import{isDisabledReactIssue7711 as ie}from'../../utils/bugs.js';import{Focus as w,FocusResult as ne,focusIn as ae,sortByDomNode as De}from'../../utils/focus-management.js';import{attemptSubmit as Ae}from'../../utils/form.js';import{match as _e}from'../../utils/match.js';import{getOwnerDocument as Ee}from'../../utils/owner.js';import{forwardRefWithAs as K,mergeProps as pe,render as $}from'../../utils/render.js';import{Description as Ge,useDescribedBy as xe,useDescriptions as le}from'../description/description.js';import{Keys as F}from'../keyboard.js';import{Label as Ce,useLabelledBy as he,useLabels as se}from'../label/label.js';var Le=(e=>(e[e.RegisterOption=0]="RegisterOption",e[e.UnregisterOption=1]="UnregisterOption",e))(Le||{});let ke={[0](o,t){let e=[...o.options,{id:t.id,element:t.element,propsRef:t.propsRef}];return{...o,options:De(e,a=>a.element.current)}},[1](o,t){let e=o.options.slice(),a=o.options.findIndex(O=>O.id===t.id);return a===-1?o:(e.splice(a,1),{...o,options:e})}},j=Z(null);j.displayName="RadioGroupDataContext";function J(o){let t=ee(j);if(t===null){let e=new Error(`<${o} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(e,J),e}return t}let X=Z(null);X.displayName="RadioGroupActionsContext";function z(o){let t=ee(X);if(t===null){let e=new Error(`<${o} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(e,z),e}return t}function Fe(o,t){return _e(t.type,ke,o,t)}let Ie="div";function Ue(o,t){let e=B(),a=re(),{id:O=`headlessui-radiogroup-${e}`,value:m,form:P,name:i,onChange:f,by:c,disabled:p=a||!1,defaultValue:I,...y}=o,T=be(c),[v,C]=Re(Fe,{options:[]}),n=v.options,[U,h]=se(),[D,L]=le(),A=W(null),M=V(A,t),l=Oe(I),[s,_]=ge(m,f,l),R=x(()=>n.find(r=>!r.propsRef.current.disabled),[n]),b=x(()=>n.some(r=>T(r.propsRef.current.value,s)),[n,s]),d=S(r=>{var u;if(p||T(r,s))return!1;let k=(u=n.find(H=>T(H.propsRef.current.value,r)))==null?void 0:u.propsRef.current;return k!=null&&k.disabled?!1:(_==null||_(r),!0)}),de=S(r=>{let k=A.current;if(!k)return;let u=Ee(k),H=n.filter(g=>g.propsRef.current.disabled===!1).map(g=>g.element.current);switch(r.key){case F.Enter:Ae(r.currentTarget);break;case F.ArrowLeft:case F.ArrowUp:if(r.preventDefault(),r.stopPropagation(),ae(H,w.Previous|w.WrapAround)===ne.Success){let E=n.find(N=>N.element.current===(u==null?void 0:u.activeElement));E&&d(E.propsRef.current.value)}break;case F.ArrowRight:case F.ArrowDown:if(r.preventDefault(),r.stopPropagation(),ae(H,w.Next|w.WrapAround)===ne.Success){let E=n.find(N=>N.element.current===(u==null?void 0:u.activeElement));E&&d(E.propsRef.current.value)}break;case F.Space:{r.preventDefault(),r.stopPropagation();let g=n.find(E=>E.element.current===(u==null?void 0:u.activeElement));g&&d(g.propsRef.current.value)}break}}),q=S(r=>(C({type:0,...r}),()=>C({type:1,id:r.id}))),ue=x(()=>({value:s,firstOption:R,containsCheckedOption:b,disabled:p,compare:T,...v}),[s,R,b,p,T,v]),ce=x(()=>({registerOption:q,change:d}),[q,d]),fe={ref:M,id:O,role:"radiogroup","aria-labelledby":U,"aria-describedby":D,onKeyDown:de},Te=x(()=>({value:s}),[s]),me=ye(()=>{if(l!==void 0)return d(l)},[d,l]);return G.createElement(L,{name:"RadioGroup.Description"},G.createElement(h,{name:"RadioGroup.Label"},G.createElement(X.Provider,{value:ce},G.createElement(j.Provider,{value:ue},i!=null&&G.createElement(Pe,{disabled:p,data:{[i]:s||"on"},overrides:{type:"radio",checked:s!=null},form:P,onReset:me}),$({ourProps:fe,theirProps:y,slot:Te,defaultTag:Ie,name:"RadioGroup"})))))}let Me="div";function Se(o,t){var R;let e=J("RadioGroup.Option"),a=z("RadioGroup.Option"),O=B(),{id:m=`headlessui-radiogroup-option-${O}`,value:P,disabled:i=e.disabled||!1,autoFocus:f=!1,...c}=o,p=W(null),I=V(p,t),[y,T]=se(),[v,C]=le(),n=oe({value:P,disabled:i});te(()=>a.registerOption({id:m,element:p,propsRef:n}),[m,a,p,n]);let U=S(b=>{var d;if(ie(b.currentTarget))return b.preventDefault();a.change(P)&&((d=p.current)==null||d.focus())}),h=((R=e.firstOption)==null?void 0:R.id)===m,{isFocusVisible:D,focusProps:L}=Q({autoFocus:f}),{isHovered:A,hoverProps:M}=Y({isDisabled:i}),l=e.compare(e.value,P),s=pe({ref:I,id:m,role:"radio","aria-checked":l?"true":"false","aria-labelledby":y,"aria-describedby":v,"aria-disabled":i?!0:void 0,tabIndex:(()=>i?-1:l||!e.containsCheckedOption&&h?0:-1)(),onClick:i?void 0:U,autoFocus:f},L,M),_=x(()=>({checked:l,disabled:i,active:D,hover:A,focus:D,autofocus:f}),[l,i,A,D,f]);return G.createElement(C,{name:"RadioGroup.Description"},G.createElement(T,{name:"RadioGroup.Label"},$({ourProps:s,theirProps:c,slot:_,defaultTag:Me,name:"RadioGroup.Option"})))}let He="span";function we(o,t){var R;let e=J("Radio"),a=z("Radio"),O=B(),m=ve(),P=re(),{id:i=m||`headlessui-radio-${O}`,value:f,disabled:c=e.disabled||P||!1,autoFocus:p=!1,...I}=o,y=W(null),T=V(y,t),v=he(),C=xe(),n=oe({value:f,disabled:c});te(()=>a.registerOption({id:i,element:y,propsRef:n}),[i,a,y,n]);let U=S(b=>{var d;if(ie(b.currentTarget))return b.preventDefault();a.change(f)&&((d=y.current)==null||d.focus())}),{isFocusVisible:h,focusProps:D}=Q({autoFocus:p}),{isHovered:L,hoverProps:A}=Y({isDisabled:c}),M=((R=e.firstOption)==null?void 0:R.id)===i,l=e.compare(e.value,f),s=pe({ref:T,id:i,role:"radio","aria-checked":l?"true":"false","aria-labelledby":v,"aria-describedby":C,"aria-disabled":c?!0:void 0,tabIndex:(()=>c?-1:l||!e.containsCheckedOption&&M?0:-1)(),autoFocus:p,onClick:c?void 0:U},D,A),_=x(()=>({checked:l,disabled:c,hover:L,focus:h,autofocus:p}),[l,c,L,h,p]);return $({ourProps:s,theirProps:I,slot:_,defaultTag:He,name:"Radio"})}let Ne=K(Ue),We=K(Se),Be=K(we),Ve=Ce,Ke=Ge,Tt=Object.assign(Ne,{Option:We,Radio:Be,Label:Ve,Description:Ke});export{Be as Radio,Tt as RadioGroup,Ke as RadioGroupDescription,Ve as RadioGroupLabel,We as RadioGroupOption};

@@ -1,36 +0,58 @@

import React, { ElementType, Ref } from 'react';
import { Props } from '../../types.js';
import React, { type ElementType, type Ref } from 'react';
import type { Props } from '../../types.js';
import { type HasDisplayName, type RefProp } from '../../utils/render.js';
import { type _internal_ComponentDescription } from '../description/description.js';
import { type _internal_ComponentLabel } from '../label/label.js';
declare let DEFAULT_GROUP_TAG: React.ExoticComponent<{
children?: React.ReactNode;
}>;
declare function Group<TTag extends ElementType = typeof DEFAULT_GROUP_TAG>(props: Props<TTag>): JSX.Element;
interface SwitchRenderPropArg {
export type SwitchGroupProps<TTag extends ElementType = typeof DEFAULT_GROUP_TAG> = Props<TTag>;
declare function GroupFn<TTag extends ElementType = typeof DEFAULT_GROUP_TAG>(props: SwitchGroupProps<TTag>): React.JSX.Element;
declare let DEFAULT_SWITCH_TAG: "button";
type SwitchRenderPropArg = {
checked: boolean;
hover: boolean;
focus: boolean;
active: boolean;
autofocus: boolean;
changing: boolean;
disabled: boolean;
};
type SwitchPropsWeControl = 'aria-checked' | 'aria-describedby' | 'aria-labelledby' | 'role';
export type SwitchProps<TTag extends ElementType = typeof DEFAULT_SWITCH_TAG> = Props<TTag, SwitchRenderPropArg, SwitchPropsWeControl, {
checked?: boolean;
defaultChecked?: boolean;
onChange?(checked: boolean): void;
name?: string;
value?: string;
form?: string;
autoFocus?: boolean;
disabled?: boolean;
tabIndex?: number;
}>;
declare function SwitchFn<TTag extends ElementType = typeof DEFAULT_SWITCH_TAG>(props: SwitchProps<TTag>, ref: Ref<HTMLButtonElement>): React.JSX.Element;
export interface _internal_ComponentSwitch extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_SWITCH_TAG>(props: SwitchProps<TTag> & RefProp<typeof SwitchFn>): JSX.Element;
}
declare type SwitchPropsWeControl = 'role' | 'tabIndex' | 'aria-checked' | 'aria-labelledby' | 'aria-describedby' | 'onClick' | 'onKeyUp' | 'onKeyPress';
export declare let Switch: (<TTag extends React.ElementType<any> = "button">(props: Props<TTag, SwitchRenderPropArg, "value" | "name" | "onChange" | "checked" | "defaultChecked" | SwitchPropsWeControl> & {
checked?: boolean | undefined;
defaultChecked?: boolean | undefined;
onChange?(checked: boolean): void;
name?: string | undefined;
value?: string | undefined;
}, ref: Ref<HTMLElement>) => JSX.Element) & {
displayName: string;
} & {
Group: typeof Group;
Label: (<TTag_1 extends React.ElementType<any> = "label">(props: Omit<import('../../types.js').PropsOf<TTag_1>, "as" | "children" | "refName" | "className"> & {
as?: TTag_1 | undefined;
children?: React.ReactNode | ((bag: {}) => React.ReactElement<any, string | React.JSXElementConstructor<any>>);
refName?: string | undefined;
} & (true extends (import('../../types.js').PropsOf<TTag_1> extends never ? never : "className" extends keyof import('../../types.js').PropsOf<TTag_1> ? true : never) ? {
className?: import('../../types.js').PropsOf<TTag_1>["className"] | ((bag: {}) => string) | undefined;
} : {}) & {
passive?: boolean | undefined;
}, ref: React.Ref<HTMLLabelElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
};
Description: (<TTag_2 extends React.ElementType<any> = "p">(props: Props<TTag_2, {}, "1D45E01E-AF44-47C4-988A-19A94EBAF55C">, ref: React.Ref<HTMLParagraphElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
};
export interface _internal_ComponentSwitchGroup extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_GROUP_TAG>(props: SwitchGroupProps<TTag> & RefProp<typeof GroupFn>): JSX.Element;
}
export interface _internal_ComponentSwitchLabel extends _internal_ComponentLabel {
}
export interface _internal_ComponentSwitchDescription extends _internal_ComponentDescription {
}
/** @deprecated use `<Field>` instead of `<SwitchGroup>` */
export declare let SwitchGroup: _internal_ComponentSwitchGroup;
/** @deprecated use `<Label>` instead of `<SwitchLabel>` */
export declare let SwitchLabel: _internal_ComponentSwitchLabel;
/** @deprecated use `<Description>` instead of `<SwitchDescription>` */
export declare let SwitchDescription: _internal_ComponentSwitchDescription;
export declare let Switch: _internal_ComponentSwitch & {
/** @deprecated use `<Field>` instead of `<Switch.Group>` */
Group: _internal_ComponentSwitchGroup;
/** @deprecated use `<Label>` instead of `<Switch.Label>` */
Label: _internal_ComponentSwitchLabel;
/** @deprecated use `<Description>` instead of `<Switch.Description>` */
Description: _internal_ComponentSwitchDescription;
};
export {};

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

import l,{Fragment as H,createContext as G,useContext as K,useMemo as S,useRef as M,useState as x,useEffect as U}from"react";import{forwardRefWithAs as _,render as w,compact as F}from'../../utils/render.js';import{useId as I}from'../../hooks/use-id.js';import{Keys as P}from'../keyboard.js';import{isDisabledReactIssue7711 as B}from'../../utils/bugs.js';import{Label as O,useLabels as W}from'../label/label.js';import{Description as j,useDescriptions as N}from'../description/description.js';import{useResolveButtonType as $}from'../../hooks/use-resolve-button-type.js';import{useSyncRefs as q}from'../../hooks/use-sync-refs.js';import{Hidden as z,Features as J}from'../../internal/hidden.js';import{attemptSubmit as Q}from'../../utils/form.js';import{useEvent as f}from'../../hooks/use-event.js';import{useControllable as V}from'../../hooks/use-controllable.js';import{useDisposables as X}from'../../hooks/use-disposables.js';let b=G(null);b.displayName="GroupContext";let Y=H;function Z(y){let[t,a]=x(null),[s,m]=W(),[c,o]=N(),p=S(()=>({switch:t,setSwitch:a,labelledby:s,describedby:c}),[t,a,s,c]),d={},h=y;return l.createElement(o,{name:"Switch.Description"},l.createElement(m,{name:"Switch.Label",props:{onClick(){!t||(t.click(),t.focus({preventScroll:!0}))}}},l.createElement(b.Provider,{value:p},w({ourProps:d,theirProps:h,defaultTag:Y,name:"Switch.Group"}))))}let ee="button",te=_(function(t,a){let s=I(),{id:m=`headlessui-switch-${s}`,checked:c,defaultChecked:o=!1,onChange:p,name:d,value:h,...v}=t,r=K(b),u=M(null),k=q(u,a,r===null?null:r.setSwitch),[n,i]=V(c,p,o),T=f(()=>i==null?void 0:i(!n)),g=f(e=>{if(B(e.currentTarget))return e.preventDefault();e.preventDefault(),T()}),C=f(e=>{e.key===P.Space?(e.preventDefault(),T()):e.key===P.Enter&&Q(e.currentTarget)}),D=f(e=>e.preventDefault()),L=S(()=>({checked:n}),[n]),R={id:m,ref:k,role:"switch",type:$(t,u),tabIndex:0,"aria-checked":n,"aria-labelledby":r==null?void 0:r.labelledby,"aria-describedby":r==null?void 0:r.describedby,onClick:g,onKeyUp:C,onKeyPress:D},A=X();return U(()=>{var E;let e=(E=u.current)==null?void 0:E.closest("form");!e||o!==void 0&&A.addEventListener(e,"reset",()=>{i(o)})},[u,i]),l.createElement(l.Fragment,null,d!=null&&n&&l.createElement(z,{features:J.Hidden,...F({as:"input",type:"checkbox",hidden:!0,readOnly:!0,checked:n,name:d,value:h})}),w({ourProps:R,theirProps:v,slot:L,defaultTag:ee,name:"Switch"}))}),Pe=Object.assign(te,{Group:Z,Label:O,Description:j});export{Pe as Switch};
"use client";import{useFocusRing as z}from"@react-aria/focus";import{useHover as Q}from"@react-aria/interactions";import i,{Fragment as Y,createContext as Z,useCallback as ee,useContext as te,useMemo as L,useRef as oe,useState as S}from"react";import{useActivePress as re}from'../../hooks/use-active-press.js';import{useControllable as ne}from'../../hooks/use-controllable.js';import{useDefaultValue as le}from'../../hooks/use-default-value.js';import{useDisposables as ie}from'../../hooks/use-disposables.js';import{useEvent as m}from'../../hooks/use-event.js';import{useId as ae}from'../../hooks/use-id.js';import{useResolveButtonType as se}from'../../hooks/use-resolve-button-type.js';import{useSyncRefs as pe}from'../../hooks/use-sync-refs.js';import{useDisabled as ce}from'../../internal/disabled.js';import{FormFields as ue}from'../../internal/form-fields.js';import{useProvidedId as de}from'../../internal/id.js';import{isDisabledReactIssue7711 as me}from'../../utils/bugs.js';import{attemptSubmit as fe}from'../../utils/form.js';import{forwardRefWithAs as he,mergeProps as be,render as G}from'../../utils/render.js';import{Description as Te,useDescribedBy as ye,useDescriptions as Se}from'../description/description.js';import{Keys as R}from'../keyboard.js';import{Label as we,useLabelledBy as Ee,useLabels as _e}from'../label/label.js';let w=Z(null);w.displayName="GroupContext";let Pe=Y;function De(n){var a;let[o,p]=S(null),[f,h]=_e(),[b,t]=Se(),c=L(()=>({switch:o,setSwitch:p}),[o,p]),T={},y=n;return i.createElement(t,{name:"Switch.Description",value:b},i.createElement(h,{name:"Switch.Label",value:f,props:{htmlFor:(a=c.switch)==null?void 0:a.id,onClick(u){o&&(u.currentTarget instanceof HTMLLabelElement&&u.preventDefault(),o.click(),o.focus({preventScroll:!0}))}}},i.createElement(w.Provider,{value:c},G({ourProps:T,theirProps:y,slot:{},defaultTag:Pe,name:"Switch.Group"}))))}let ge="button";function ve(n,o){var C;let p=ae(),f=de(),h=ce(),{id:b=f||`headlessui-switch-${p}`,disabled:t=h||!1,checked:c,defaultChecked:T,onChange:y,name:a,value:u,form:A,autoFocus:d=!1,...F}=n,E=te(w),[H,k]=S(null),M=oe(null),U=pe(M,o,E===null?null:E.setSwitch,k),l=le(T),[s,r]=ne(c,y,l!=null?l:!1),I=ie(),[_,P]=S(!1),D=m(()=>{P(!0),r==null||r(!s),I.nextFrame(()=>{P(!1)})}),B=m(e=>{if(me(e.currentTarget))return e.preventDefault();e.preventDefault(),D()}),K=m(e=>{e.key===R.Space?(e.preventDefault(),D()):e.key===R.Enter&&fe(e.currentTarget)}),W=m(e=>e.preventDefault()),O=Ee(),N=ye(),{isFocusVisible:g,focusProps:J}=z({autoFocus:d}),{isHovered:v,hoverProps:V}=Q({isDisabled:t}),{pressed:x,pressProps:X}=re({disabled:t}),j=L(()=>({checked:s,disabled:t,hover:v,focus:g,active:x,autofocus:d,changing:_}),[s,v,g,x,t,_,d]),$=be({id:b,ref:U,role:"switch",type:se(n,H),tabIndex:n.tabIndex===-1?0:(C=n.tabIndex)!=null?C:0,"aria-checked":s,"aria-labelledby":O,"aria-describedby":N,disabled:t||void 0,autoFocus:d,onClick:B,onKeyUp:K,onKeyPress:W},J,V,X),q=ee(()=>{if(l!==void 0)return r==null?void 0:r(l)},[r,l]);return i.createElement(i.Fragment,null,a!=null&&i.createElement(ue,{disabled:t,data:{[a]:u||"on"},overrides:{type:"checkbox",checked:s},form:A,onReset:q}),G({ourProps:$,theirProps:F,slot:j,defaultTag:ge,name:"Switch"}))}let xe=he(ve),Ce=De,Le=we,Ge=Te,Qe=Object.assign(xe,{Group:Ce,Label:Le,Description:Ge});export{Qe as Switch,Ge as SwitchDescription,Ce as SwitchGroup,Le as SwitchLabel};

@@ -1,61 +0,86 @@

import React, { Ref } from 'react';
import { Props } from '../../types.js';
import { PropsForFeatures } from '../../utils/render.js';
interface TabsRenderPropArg {
import React, { type ElementType, type Ref } from 'react';
import type { Props } from '../../types.js';
import { type HasDisplayName, type PropsForFeatures, type RefProp } from '../../utils/render.js';
declare let DEFAULT_TABS_TAG: "div";
type TabsRenderPropArg = {
selectedIndex: number;
}
interface ListRenderPropArg {
};
type TabsPropsWeControl = never;
export type TabGroupProps<TTag extends ElementType = typeof DEFAULT_TABS_TAG> = Props<TTag, TabsRenderPropArg, TabsPropsWeControl, {
defaultIndex?: number;
onChange?: (index: number) => void;
selectedIndex?: number;
vertical?: boolean;
manual?: boolean;
}>;
declare function GroupFn<TTag extends ElementType = typeof DEFAULT_TABS_TAG>(props: TabGroupProps<TTag>, ref: Ref<HTMLElement>): React.JSX.Element;
declare let DEFAULT_LIST_TAG: "div";
type ListRenderPropArg = {
selectedIndex: number;
}
declare type ListPropsWeControl = 'role' | 'aria-orientation';
interface TabRenderPropArg {
};
type ListPropsWeControl = 'aria-orientation' | 'role';
export type TabListProps<TTag extends ElementType = typeof DEFAULT_LIST_TAG> = Props<TTag, ListRenderPropArg, ListPropsWeControl, {}>;
declare function ListFn<TTag extends ElementType = typeof DEFAULT_LIST_TAG>(props: TabListProps<TTag>, ref: Ref<HTMLElement>): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
declare let DEFAULT_TAB_TAG: "button";
type TabRenderPropArg = {
hover: boolean;
focus: boolean;
active: boolean;
autofocus: boolean;
selected: boolean;
}
declare type TabPropsWeControl = 'role' | 'type' | 'aria-controls' | 'aria-selected' | 'tabIndex';
interface PanelsRenderPropArg {
disabled: boolean;
};
type TabPropsWeControl = 'aria-controls' | 'aria-selected' | 'role' | 'tabIndex';
export type TabProps<TTag extends ElementType = typeof DEFAULT_TAB_TAG> = Props<TTag, TabRenderPropArg, TabPropsWeControl, {
autoFocus?: boolean;
disabled?: boolean;
}>;
declare function TabFn<TTag extends ElementType = typeof DEFAULT_TAB_TAG>(props: TabProps<TTag>, ref: Ref<HTMLElement>): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
declare let DEFAULT_PANELS_TAG: "div";
type PanelsRenderPropArg = {
selectedIndex: number;
}
interface PanelRenderPropArg {
};
export type TabPanelsProps<TTag extends ElementType = typeof DEFAULT_PANELS_TAG> = Props<TTag, PanelsRenderPropArg>;
declare function PanelsFn<TTag extends ElementType = typeof DEFAULT_PANELS_TAG>(props: TabPanelsProps<TTag>, ref: Ref<HTMLElement>): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
declare let DEFAULT_PANEL_TAG: "div";
type PanelRenderPropArg = {
selected: boolean;
focus: boolean;
};
type PanelPropsWeControl = 'role' | 'aria-labelledby';
declare let PanelRenderFeatures: number;
export type TabPanelProps<TTag extends ElementType = typeof DEFAULT_PANEL_TAG> = Props<TTag, PanelRenderPropArg, PanelPropsWeControl, PropsForFeatures<typeof PanelRenderFeatures> & {
id?: string;
tabIndex?: number;
}>;
declare function PanelFn<TTag extends ElementType = typeof DEFAULT_PANEL_TAG>(props: TabPanelProps<TTag>, ref: Ref<HTMLElement>): React.JSX.Element | null;
export interface _internal_ComponentTab extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_TAB_TAG>(props: TabProps<TTag> & RefProp<typeof TabFn>): JSX.Element;
}
declare type PanelPropsWeControl = 'role' | 'aria-labelledby' | 'tabIndex';
declare let PanelRenderFeatures: number;
export declare let Tab: (<TTag extends React.ElementType<any> = "button">(props: Props<TTag, TabRenderPropArg, TabPropsWeControl>, ref: Ref<HTMLElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
} & {
Group: (<TTag_1 extends React.ElementType<any> = React.ExoticComponent<{
children?: React.ReactNode;
}>>(props: Omit<import('../../types.js').PropsOf<TTag_1>, "as" | "children" | "refName" | "className"> & {
as?: TTag_1 | undefined;
children?: React.ReactNode | ((bag: TabsRenderPropArg) => React.ReactElement<any, string | React.JSXElementConstructor<any>>);
refName?: string | undefined;
} & (true extends (import('../../types.js').PropsOf<TTag_1> extends never ? never : "className" extends keyof import('../../types.js').PropsOf<TTag_1> ? true : never) ? {
className?: import('../../types.js').PropsOf<TTag_1>["className"] | ((bag: TabsRenderPropArg) => string) | undefined;
} : {}) & {
defaultIndex?: number | undefined;
onChange?: ((index: number) => void) | undefined;
selectedIndex?: number | undefined;
vertical?: boolean | undefined;
manual?: boolean | undefined;
}, ref: Ref<HTMLElement>) => JSX.Element) & {
displayName: string;
};
List: (<TTag_2 extends React.ElementType<any> = "div">(props: Props<TTag_2, ListRenderPropArg, ListPropsWeControl> & {}, ref: Ref<HTMLElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
};
Panels: (<TTag_3 extends React.ElementType<any> = "div">(props: Props<TTag_3, PanelsRenderPropArg, "1D45E01E-AF44-47C4-988A-19A94EBAF55C">, ref: Ref<HTMLElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
displayName: string;
};
Panel: (<TTag_4 extends React.ElementType<any> = "div">(props: Props<TTag_4, PanelRenderPropArg, PanelPropsWeControl> & (({
static?: undefined;
} & {
unmount?: boolean | undefined;
}) | ({
unmount?: undefined;
} & {
static?: boolean | undefined;
})), ref: Ref<HTMLElement>) => JSX.Element | null) & {
displayName: string;
};
export interface _internal_ComponentTabGroup extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_TABS_TAG>(props: TabGroupProps<TTag> & RefProp<typeof GroupFn>): JSX.Element;
}
export interface _internal_ComponentTabList extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_LIST_TAG>(props: TabListProps<TTag> & RefProp<typeof ListFn>): JSX.Element;
}
export interface _internal_ComponentTabPanels extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_PANELS_TAG>(props: TabPanelsProps<TTag> & RefProp<typeof PanelsFn>): JSX.Element;
}
export interface _internal_ComponentTabPanel extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_PANEL_TAG>(props: TabPanelProps<TTag> & RefProp<typeof PanelFn>): JSX.Element;
}
export declare let TabGroup: _internal_ComponentTabGroup;
export declare let TabList: _internal_ComponentTabList;
export declare let TabPanels: _internal_ComponentTabPanels;
export declare let TabPanel: _internal_ComponentTabPanel;
export declare let Tab: _internal_ComponentTab & {
/** @deprecated use `<TabGroup>` instead of `<Tab.Group>` */
Group: _internal_ComponentTabGroup;
/** @deprecated use `<TabList>` instead of `<Tab.List>` */
List: _internal_ComponentTabList;
/** @deprecated use `<TabPanels>` instead of `<Tab.Panels>` */
Panels: _internal_ComponentTabPanels;
/** @deprecated use `<TabPanel>` instead of `<Tab.Panel>` */
Panel: _internal_ComponentTabPanel;
};
export {};

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

import F,{Fragment as le,createContext as K,useContext as $,useMemo as h,useReducer as oe,useRef as H}from"react";import{render as _,Features as ee,forwardRefWithAs as U}from'../../utils/render.js';import{useId as te}from'../../hooks/use-id.js';import{match as re}from'../../utils/match.js';import{Keys as T}from'../../components/keyboard.js';import{focusIn as D,Focus as m,sortByDomNode as ne,FocusResult as O}from'../../utils/focus-management.js';import{useIsoMorphicEffect as z}from'../../hooks/use-iso-morphic-effect.js';import{useSyncRefs as w}from'../../hooks/use-sync-refs.js';import{useResolveButtonType as se}from'../../hooks/use-resolve-button-type.js';import{useLatestValue as V}from'../../hooks/use-latest-value.js';import{FocusSentinel as ie}from'../../internal/focus-sentinel.js';import{useEvent as S}from'../../hooks/use-event.js';import{microTask as ue}from'../../utils/micro-task.js';import{Hidden as ce}from'../../internal/hidden.js';import{getOwnerDocument as de}from'../../utils/owner.js';var pe=(n=>(n[n.SetSelectedIndex=0]="SetSelectedIndex",n[n.RegisterTab=1]="RegisterTab",n[n.UnregisterTab=2]="UnregisterTab",n[n.RegisterPanel=3]="RegisterPanel",n[n.UnregisterPanel=4]="UnregisterPanel",n))(pe||{});let fe={[0](e,t){let r=e.tabs.filter(c=>{var s;return!((s=c.current)!=null&&s.hasAttribute("disabled"))});if(t.index<0)return{...e,selectedIndex:e.tabs.indexOf(r[0])};if(t.index>e.tabs.length)return{...e,selectedIndex:e.tabs.indexOf(r[r.length-1])};let i=e.tabs.slice(0,t.index),n=[...e.tabs.slice(t.index),...i].find(c=>r.includes(c));return n?{...e,selectedIndex:e.tabs.indexOf(n)}:e},[1](e,t){var n;if(e.tabs.includes(t.tab))return e;let r=e.tabs[e.selectedIndex],i=ne([...e.tabs,t.tab],c=>c.current),o=(n=i.indexOf(r))!=null?n:e.selectedIndex;return o===-1&&(o=e.selectedIndex),{...e,tabs:i,selectedIndex:o}},[2](e,t){return{...e,tabs:e.tabs.filter(r=>r!==t.tab)}},[3](e,t){return e.panels.includes(t.panel)?e:{...e,panels:ne([...e.panels,t.panel],r=>r.current)}},[4](e,t){return{...e,panels:e.panels.filter(r=>r!==t.panel)}}},q=K(null);q.displayName="TabsSSRContext";function J(e){let t=$(q);if(t===null){let r=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,J),r}return t}let Q=K(null);Q.displayName="TabsDataContext";function M(e){let t=$(Q);if(t===null){let r=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,M),r}return t}let X=K(null);X.displayName="TabsActionsContext";function Y(e){let t=$(X);if(t===null){let r=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Y),r}return t}function be(e,t){return re(t.type,fe,e,t)}let Te=le,me=U(function(t,r){let{defaultIndex:i=0,vertical:o=!1,manual:n=!1,onChange:c,selectedIndex:s=null,...L}=t;const g=o?"vertical":"horizontal",A=n?"manual":"auto";let d=s!==null,v=w(r),[p,l]=oe(be,{selectedIndex:s!=null?s:i,tabs:[],panels:[]}),P=h(()=>({selectedIndex:p.selectedIndex}),[p.selectedIndex]),E=V(c||(()=>{})),f=V(p.tabs),b=h(()=>({orientation:g,activation:A,...p}),[g,A,p]),y=S(u=>(l({type:1,tab:u}),()=>l({type:2,tab:u}))),I=S(u=>(l({type:3,panel:u}),()=>l({type:4,panel:u}))),R=S(u=>{k.current!==u&&E.current(u),d||l({type:0,index:u})}),k=V(d?t.selectedIndex:p.selectedIndex),G=h(()=>({registerTab:y,registerPanel:I,change:R}),[]);z(()=>{l({type:0,index:s!=null?s:i})},[s]);let j=H({tabs:[],panels:[]}),W={ref:v};return F.createElement(q.Provider,{value:j},F.createElement(X.Provider,{value:G},F.createElement(Q.Provider,{value:b},b.tabs.length<=0&&F.createElement(ie,{onFocus:()=>{var u,C;for(let a of f.current)if(((u=a.current)==null?void 0:u.tabIndex)===0)return(C=a.current)==null||C.focus(),!0;return!1}}),_({ourProps:W,theirProps:L,slot:P,defaultTag:Te,name:"Tabs"}))))}),Pe="div",xe=U(function(t,r){let{orientation:i,selectedIndex:o}=M("Tab.List"),n=w(r);return _({ourProps:{ref:n,role:"tablist","aria-orientation":i},theirProps:t,slot:{selectedIndex:o},defaultTag:Pe,name:"Tabs.List"})}),ge="button",ye=U(function(t,r){var u,C;let i=te(),{id:o=`headlessui-tabs-tab-${i}`,...n}=t,{orientation:c,activation:s,selectedIndex:L,tabs:g,panels:A}=M("Tab"),d=Y("Tab"),v=M("Tab"),p=J("Tab"),l=H(null),P=w(l,r);z(()=>d.registerTab(l),[d,l]);let E=p.current.tabs.indexOf(o);E===-1&&(E=p.current.tabs.push(o)-1);let f=g.indexOf(l);f===-1&&(f=E);let b=f===L,y=S(a=>{var N;let x=a();if(x===O.Success&&s==="auto"){let B=(N=de(l))==null?void 0:N.activeElement,Z=v.tabs.findIndex(ae=>ae.current===B);Z!==-1&&d.change(Z)}return x}),I=S(a=>{let x=g.map(B=>B.current).filter(Boolean);if(a.key===T.Space||a.key===T.Enter){a.preventDefault(),a.stopPropagation(),d.change(f);return}switch(a.key){case T.Home:case T.PageUp:return a.preventDefault(),a.stopPropagation(),y(()=>D(x,m.First));case T.End:case T.PageDown:return a.preventDefault(),a.stopPropagation(),y(()=>D(x,m.Last))}if(y(()=>re(c,{vertical(){return a.key===T.ArrowUp?D(x,m.Previous|m.WrapAround):a.key===T.ArrowDown?D(x,m.Next|m.WrapAround):O.Error},horizontal(){return a.key===T.ArrowLeft?D(x,m.Previous|m.WrapAround):a.key===T.ArrowRight?D(x,m.Next|m.WrapAround):O.Error}}))===O.Success)return a.preventDefault()}),R=H(!1),k=S(()=>{var a;R.current||(R.current=!0,(a=l.current)==null||a.focus(),d.change(f),ue(()=>{R.current=!1}))}),G=S(a=>{a.preventDefault()}),j=h(()=>({selected:b}),[b]),W={ref:P,onKeyDown:I,onMouseDown:G,onClick:k,id:o,role:"tab",type:se(t,l),"aria-controls":(C=(u=A[f])==null?void 0:u.current)==null?void 0:C.id,"aria-selected":b,tabIndex:b?0:-1};return _({ourProps:W,theirProps:n,slot:j,defaultTag:ge,name:"Tabs.Tab"})}),Re="div",Ae=U(function(t,r){let{selectedIndex:i}=M("Tab.Panels"),o=w(r),n=h(()=>({selectedIndex:i}),[i]);return _({ourProps:{ref:o},theirProps:t,slot:n,defaultTag:Re,name:"Tabs.Panels"})}),Ee="div",Se=ee.RenderStrategy|ee.Static,Le=U(function(t,r){var b,y,I,R;let i=te(),{id:o=`headlessui-tabs-panel-${i}`,...n}=t,{selectedIndex:c,tabs:s,panels:L}=M("Tab.Panel"),g=Y("Tab.Panel"),A=J("Tab.Panel"),d=H(null),v=w(d,r);z(()=>g.registerPanel(d),[g,d]);let p=A.current.panels.indexOf(o);p===-1&&(p=A.current.panels.push(o)-1);let l=L.indexOf(d);l===-1&&(l=p);let P=l===c,E=h(()=>({selected:P}),[P]),f={ref:v,id:o,role:"tabpanel","aria-labelledby":(y=(b=s[l])==null?void 0:b.current)==null?void 0:y.id,tabIndex:P?0:-1};return!P&&((I=n.unmount)!=null?I:!0)&&!((R=n.static)!=null&&R)?F.createElement(ce,{as:"span",...f}):_({ourProps:f,theirProps:n,slot:E,defaultTag:Ee,features:Se,visible:P,name:"Tabs.Panel"})}),Je=Object.assign(ye,{Group:me,List:xe,Panels:Ae,Panel:Le});export{Je as Tab};
"use client";import{useFocusRing as re}from"@react-aria/focus";import{useHover as fe}from"@react-aria/interactions";import U,{createContext as ne,useContext as ae,useMemo as S,useReducer as be,useRef as q,useState as me}from"react";import{useActivePress as Pe}from'../../hooks/use-active-press.js';import{useEvent as F}from'../../hooks/use-event.js';import{useId as le}from'../../hooks/use-id.js';import{useIsoMorphicEffect as W}from'../../hooks/use-iso-morphic-effect.js';import{useLatestValue as j}from'../../hooks/use-latest-value.js';import{useResolveButtonType as ye}from'../../hooks/use-resolve-button-type.js';import{useSyncRefs as H}from'../../hooks/use-sync-refs.js';import{FocusSentinel as xe}from'../../internal/focus-sentinel.js';import{Hidden as ge}from'../../internal/hidden.js';import{Focus as P,FocusResult as K,focusIn as v,sortByDomNode as w}from'../../utils/focus-management.js';import{match as O}from'../../utils/match.js';import{microTask as Ae}from'../../utils/micro-task.js';import{getOwnerDocument as Ee}from'../../utils/owner.js';import{RenderFeatures as oe,forwardRefWithAs as N,mergeProps as se,render as k}from'../../utils/render.js';import{StableCollection as Le,useStableCollectionIndex as ie}from'../../utils/stable-collection.js';import{Keys as y}from'../keyboard.js';var Re=(t=>(t[t.Forwards=0]="Forwards",t[t.Backwards=1]="Backwards",t))(Re||{}),_e=(l=>(l[l.Less=-1]="Less",l[l.Equal=0]="Equal",l[l.Greater=1]="Greater",l))(_e||{}),De=(n=>(n[n.SetSelectedIndex=0]="SetSelectedIndex",n[n.RegisterTab=1]="RegisterTab",n[n.UnregisterTab=2]="UnregisterTab",n[n.RegisterPanel=3]="RegisterPanel",n[n.UnregisterPanel=4]="UnregisterPanel",n))(De||{});let Se={[0](e,r){var d;let t=w(e.tabs,u=>u.current),l=w(e.panels,u=>u.current),a=t.filter(u=>{var T;return!((T=u.current)!=null&&T.hasAttribute("disabled"))}),n={...e,tabs:t,panels:l};if(r.index<0||r.index>t.length-1){let u=O(Math.sign(r.index-e.selectedIndex),{[-1]:()=>1,[0]:()=>O(Math.sign(r.index),{[-1]:()=>0,[0]:()=>0,[1]:()=>1}),[1]:()=>0});if(a.length===0)return n;let T=O(u,{[0]:()=>t.indexOf(a[0]),[1]:()=>t.indexOf(a[a.length-1])});return{...n,selectedIndex:T===-1?e.selectedIndex:T}}let p=t.slice(0,r.index),x=[...t.slice(r.index),...p].find(u=>a.includes(u));if(!x)return n;let f=(d=t.indexOf(x))!=null?d:e.selectedIndex;return f===-1&&(f=e.selectedIndex),{...n,selectedIndex:f}},[1](e,r){if(e.tabs.includes(r.tab))return e;let t=e.tabs[e.selectedIndex],l=w([...e.tabs,r.tab],n=>n.current),a=e.selectedIndex;return e.info.current.isControlled||(a=l.indexOf(t),a===-1&&(a=e.selectedIndex)),{...e,tabs:l,selectedIndex:a}},[2](e,r){return{...e,tabs:e.tabs.filter(t=>t!==r.tab)}},[3](e,r){return e.panels.includes(r.panel)?e:{...e,panels:w([...e.panels,r.panel],t=>t.current)}},[4](e,r){return{...e,panels:e.panels.filter(t=>t!==r.panel)}}},z=ne(null);z.displayName="TabsDataContext";function C(e){let r=ae(z);if(r===null){let t=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,C),t}return r}let V=ne(null);V.displayName="TabsActionsContext";function Q(e){let r=ae(V);if(r===null){let t=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Q),t}return r}function Fe(e,r){return O(r.type,Se,e,r)}let Ie="div";function he(e,r){let{defaultIndex:t=0,vertical:l=!1,manual:a=!1,onChange:n,selectedIndex:p=null,..._}=e;const x=l?"vertical":"horizontal",f=a?"manual":"auto";let d=p!==null,u=j({isControlled:d}),T=H(r),[s,c]=be(Fe,{info:u,selectedIndex:p!=null?p:t,tabs:[],panels:[]}),I=S(()=>({selectedIndex:s.selectedIndex}),[s.selectedIndex]),m=j(n||(()=>{})),M=j(s.tabs),D=S(()=>({orientation:x,activation:f,...s}),[x,f,s]),b=F(i=>(c({type:1,tab:i}),()=>c({type:2,tab:i}))),g=F(i=>(c({type:3,panel:i}),()=>c({type:4,panel:i}))),A=F(i=>{L.current!==i&&m.current(i),d||c({type:0,index:i})}),L=j(d?e.selectedIndex:s.selectedIndex),G=S(()=>({registerTab:b,registerPanel:g,change:A}),[]);W(()=>{c({type:0,index:p!=null?p:t})},[p]),W(()=>{if(L.current===void 0||s.tabs.length<=0)return;let i=w(s.tabs,R=>R.current);i.some((R,B)=>s.tabs[B]!==R)&&A(i.indexOf(s.tabs[L.current]))});let J={ref:T};return U.createElement(Le,null,U.createElement(V.Provider,{value:G},U.createElement(z.Provider,{value:D},D.tabs.length<=0&&U.createElement(xe,{onFocus:()=>{var i,h;for(let R of M.current)if(((i=R.current)==null?void 0:i.tabIndex)===0)return(h=R.current)==null||h.focus(),!0;return!1}}),k({ourProps:J,theirProps:_,slot:I,defaultTag:Ie,name:"Tabs"}))))}let ve="div";function Ce(e,r){let{orientation:t,selectedIndex:l}=C("Tab.List"),a=H(r),n=S(()=>({selectedIndex:l}),[l]);return k({ourProps:{ref:a,role:"tablist","aria-orientation":t},theirProps:e,slot:n,defaultTag:ve,name:"Tabs.List"})}let Me="button";function Ge(e,r){var Z,ee;let t=le(),{id:l=`headlessui-tabs-tab-${t}`,disabled:a=!1,autoFocus:n=!1,...p}=e,{orientation:_,activation:x,selectedIndex:f,tabs:d,panels:u}=C("Tab"),T=Q("Tab"),s=C("Tab"),[c,I]=me(null),m=q(null),M=H(m,r,I);W(()=>T.registerTab(m),[T,m]);let D=ie("tabs"),b=d.indexOf(m);b===-1&&(b=D);let g=b===f,A=F(o=>{var X;let E=o();if(E===K.Success&&x==="auto"){let $=(X=Ee(m))==null?void 0:X.activeElement,te=s.tabs.findIndex(ce=>ce.current===$);te!==-1&&T.change(te)}return E}),L=F(o=>{let E=d.map($=>$.current).filter(Boolean);if(o.key===y.Space||o.key===y.Enter){o.preventDefault(),o.stopPropagation(),T.change(b);return}switch(o.key){case y.Home:case y.PageUp:return o.preventDefault(),o.stopPropagation(),A(()=>v(E,P.First));case y.End:case y.PageDown:return o.preventDefault(),o.stopPropagation(),A(()=>v(E,P.Last))}if(A(()=>O(_,{vertical(){return o.key===y.ArrowUp?v(E,P.Previous|P.WrapAround):o.key===y.ArrowDown?v(E,P.Next|P.WrapAround):K.Error},horizontal(){return o.key===y.ArrowLeft?v(E,P.Previous|P.WrapAround):o.key===y.ArrowRight?v(E,P.Next|P.WrapAround):K.Error}}))===K.Success)return o.preventDefault()}),G=q(!1),J=F(()=>{var o;G.current||(G.current=!0,(o=m.current)==null||o.focus({preventScroll:!0}),T.change(b),Ae(()=>{G.current=!1}))}),i=F(o=>{o.preventDefault()}),{isFocusVisible:h,focusProps:R}=re({autoFocus:n}),{isHovered:B,hoverProps:pe}=fe({isDisabled:a}),{pressed:Y,pressProps:ue}=Pe({disabled:a}),Te=S(()=>({selected:g,hover:B,active:Y,focus:h,autofocus:n,disabled:a}),[g,B,h,Y,n,a]),de=se({ref:M,onKeyDown:L,onMouseDown:i,onClick:J,id:l,role:"tab",type:ye(e,c),"aria-controls":(ee=(Z=u[b])==null?void 0:Z.current)==null?void 0:ee.id,"aria-selected":g,tabIndex:g?0:-1,disabled:a||void 0,autoFocus:n},R,pe,ue);return k({ourProps:de,theirProps:p,slot:Te,defaultTag:Me,name:"Tabs.Tab"})}let Ue="div";function He(e,r){let{selectedIndex:t}=C("Tab.Panels"),l=H(r),a=S(()=>({selectedIndex:t}),[t]);return k({ourProps:{ref:l},theirProps:e,slot:a,defaultTag:Ue,name:"Tabs.Panels"})}let we="div",Oe=oe.RenderStrategy|oe.Static;function Ne(e,r){var b,g,A,L;let t=le(),{id:l=`headlessui-tabs-panel-${t}`,tabIndex:a=0,...n}=e,{selectedIndex:p,tabs:_,panels:x}=C("Tab.Panel"),f=Q("Tab.Panel"),d=q(null),u=H(d,r);W(()=>f.registerPanel(d),[f,d]);let T=ie("panels"),s=x.indexOf(d);s===-1&&(s=T);let c=s===p,{isFocusVisible:I,focusProps:m}=re(),M=S(()=>({selected:c,focus:I}),[c,I]),D=se({ref:u,id:l,role:"tabpanel","aria-labelledby":(g=(b=_[s])==null?void 0:b.current)==null?void 0:g.id,tabIndex:c?a:-1},m);return!c&&((A=n.unmount)==null||A)&&!((L=n.static)!=null&&L)?U.createElement(ge,{"aria-hidden":"true",...D}):k({ourProps:D,theirProps:n,slot:M,defaultTag:we,features:Oe,visible:c,name:"Tabs.Panel"})}let ke=N(Ge),Be=N(he),We=N(Ce),je=N(He),Ke=N(Ne),ut=Object.assign(ke,{Group:Be,List:We,Panels:je,Panel:Ke});export{ut as Tab,Be as TabGroup,We as TabList,Ke as TabPanel,je as TabPanels};

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

import React, { MutableRefObject, Ref } from 'react';
import { Props, ReactTag } from '../../types.js';
import { Features, PropsForFeatures } from '../../utils/render.js';
export interface TransitionClasses {
enter?: string;
enterFrom?: string;
enterTo?: string;
entered?: string;
leave?: string;
leaveFrom?: string;
leaveTo?: string;
}
export interface TransitionEvents {
beforeEnter?: () => void;
afterEnter?: () => void;
beforeLeave?: () => void;
afterLeave?: () => void;
}
declare type TransitionChildProps<TTag extends ReactTag> = Props<TTag, TransitionChildRenderPropArg> & PropsForFeatures<typeof TransitionChildRenderFeatures> & TransitionClasses & TransitionEvents & {
appear?: boolean;
};
declare type TransitionChildRenderPropArg = MutableRefObject<HTMLDivElement>;
declare let TransitionChildRenderFeatures: Features;
export declare let Transition: (<TTag extends React.ElementType<any> = "div">(props: TransitionChildProps<TTag> & {
show?: boolean | undefined;
appear?: boolean | undefined;
}, ref: Ref<HTMLElement>) => JSX.Element) & {
displayName: string;
} & {
Child: (<TTag_1 extends React.ElementType<any> = "div">(props: TransitionChildProps<TTag_1>, ref: MutableRefObject<HTMLElement>) => JSX.Element) & {
displayName: string;
};
Root: (<TTag extends React.ElementType<any> = "div">(props: TransitionChildProps<TTag> & {
show?: boolean | undefined;
appear?: boolean | undefined;
}, ref: Ref<HTMLElement>) => JSX.Element) & {
displayName: string;
};
};
export {};
export * from '../transition/transition.js';

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

import T,{Fragment as Q,createContext as X,useContext as W,useEffect as y,useMemo as Y,useRef as c,useState as q}from"react";import{Features as fe,forwardRefWithAs as z,render as Z,RenderStrategy as g}from'../../utils/render.js';import{OpenClosedProvider as Te,State as O,useOpenClosed as $}from'../../internal/open-closed.js';import{match as H}from'../../utils/match.js';import{useIsMounted as ce}from'../../hooks/use-is-mounted.js';import{useIsoMorphicEffect as me}from'../../hooks/use-iso-morphic-effect.js';import{useLatestValue as F}from'../../hooks/use-latest-value.js';import{useServerHandoffComplete as ee}from'../../hooks/use-server-handoff-complete.js';import{useSyncRefs as te}from'../../hooks/use-sync-refs.js';import{useTransition as pe}from'../../hooks/use-transition.js';import{useEvent as N}from'../../hooks/use-event.js';import{useDisposables as ve}from'../../hooks/use-disposables.js';import{classNames as he}from'../../utils/class-names.js';function P(i=""){return i.split(" ").filter(e=>e.trim().length>1)}let A=X(null);A.displayName="TransitionContext";var Ce=(s=>(s.Visible="visible",s.Hidden="hidden",s))(Ce||{});function ge(){let i=W(A);if(i===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return i}function be(){let i=W(M);if(i===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return i}let M=X(null);M.displayName="NestingContext";function I(i){return"children"in i?I(i.children):i.current.filter(({el:e})=>e.current!==null).filter(({state:e})=>e==="visible").length>0}function ne(i,e){let s=F(i),n=c([]),m=ce(),R=ve(),b=N((l,r=g.Hidden)=>{let t=n.current.findIndex(({el:o})=>o===l);t!==-1&&(H(r,{[g.Unmount](){n.current.splice(t,1)},[g.Hidden](){n.current[t].state="hidden"}}),R.microTask(()=>{var o;!I(n)&&m.current&&((o=s.current)==null||o.call(s))}))}),E=N(l=>{let r=n.current.find(({el:t})=>t===l);return r?r.state!=="visible"&&(r.state="visible"):n.current.push({el:l,state:"visible"}),()=>b(l,g.Unmount)}),S=c([]),u=c(Promise.resolve()),p=c({enter:[],leave:[],idle:[]}),d=N((l,r,t)=>{S.current.splice(0),e&&(e.chains.current[r]=e.chains.current[r].filter(([o])=>o!==l)),e==null||e.chains.current[r].push([l,new Promise(o=>{S.current.push(o)})]),e==null||e.chains.current[r].push([l,new Promise(o=>{Promise.all(p.current[r].map(([f,a])=>a)).then(()=>o())})]),r==="enter"?u.current=u.current.then(()=>e==null?void 0:e.wait.current).then(()=>t(r)):t(r)}),v=N((l,r,t)=>{Promise.all(p.current[r].splice(0).map(([o,f])=>f)).then(()=>{var o;(o=S.current.shift())==null||o()}).then(()=>t(r))});return Y(()=>({children:n,register:E,unregister:b,onStart:d,onStop:v,wait:u,chains:p}),[E,b,n,d,v,p,u])}function Ee(){}let Se=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function re(i){var s;let e={};for(let n of Se)e[n]=(s=i[n])!=null?s:Ee;return e}function xe(i){let e=c(re(i));return y(()=>{e.current=re(i)},[i]),e}let Pe="div",ie=fe.RenderStrategy,oe=z(function(e,s){let{beforeEnter:n,afterEnter:m,beforeLeave:R,afterLeave:b,enter:E,enterFrom:S,enterTo:u,entered:p,leave:d,leaveFrom:v,leaveTo:l,...r}=e,t=c(null),o=te(t,s),f=r.unmount?g.Unmount:g.Hidden,{show:a,appear:x,initial:se}=ge(),[h,_]=q(a?"visible":"hidden"),K=be(),{register:D,unregister:V}=K,j=c(null);y(()=>D(t),[D,t]),y(()=>{if(f===g.Hidden&&!!t.current){if(a&&h!=="visible"){_("visible");return}return H(h,{["hidden"]:()=>V(t),["visible"]:()=>D(t)})}},[h,t,D,V,a,f]);let U=F({enter:P(E),enterFrom:P(S),enterTo:P(u),entered:P(p),leave:P(d),leaveFrom:P(v),leaveTo:P(l)}),w=xe({beforeEnter:n,afterEnter:m,beforeLeave:R,afterLeave:b}),k=ee();y(()=>{if(k&&h==="visible"&&t.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[t,h,k]);let G=se&&!x,le=(()=>!k||G||j.current===a?"idle":a?"enter":"leave")(),ae=N(C=>H(C,{enter:()=>w.current.beforeEnter(),leave:()=>w.current.beforeLeave(),idle:()=>{}})),ue=N(C=>H(C,{enter:()=>w.current.afterEnter(),leave:()=>w.current.afterLeave(),idle:()=>{}})),L=ne(()=>{_("hidden"),V(t)},K);pe({container:t,classes:U,direction:le,onStart:F(C=>{L.onStart(t,C,ae)}),onStop:F(C=>{L.onStop(t,C,ue),C==="leave"&&!I(L)&&(_("hidden"),V(t))})}),y(()=>{!G||(f===g.Hidden?j.current=null:j.current=a)},[a,G,h]);let B=r,de={ref:o};return x&&a&&(typeof window=="undefined"||typeof document=="undefined")&&(B={...B,className:he(r.className,...U.current.enter,...U.current.enterFrom)}),T.createElement(M.Provider,{value:L},T.createElement(Te,{value:H(h,{["visible"]:O.Open,["hidden"]:O.Closed})},Z({ourProps:de,theirProps:B,defaultTag:Pe,features:ie,visible:h==="visible",name:"Transition.Child"})))}),J=z(function(e,s){let{show:n,appear:m=!1,unmount:R,...b}=e,E=c(null),S=te(E,s);ee();let u=$();if(n===void 0&&u!==null&&(n=H(u,{[O.Open]:!0,[O.Closed]:!1})),![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[p,d]=q(n?"visible":"hidden"),v=ne(()=>{d("hidden")}),[l,r]=q(!0),t=c([n]);me(()=>{l!==!1&&t.current[t.current.length-1]!==n&&(t.current.push(n),r(!1))},[t,n]);let o=Y(()=>({show:n,appear:m,initial:l}),[n,m,l]);y(()=>{if(n)d("visible");else if(!I(v))d("hidden");else{let a=E.current;if(!a)return;let x=a.getBoundingClientRect();x.x===0&&x.y===0&&x.width===0&&x.height===0&&d("hidden")}},[n,v]);let f={unmount:R};return T.createElement(M.Provider,{value:v},T.createElement(A.Provider,{value:o},Z({ourProps:{...f,as:Q,children:T.createElement(oe,{ref:S,...f,...b})},theirProps:{},defaultTag:Q,features:ie,visible:p==="visible",name:"Transition"})))}),ye=z(function(e,s){let n=W(A)!==null,m=$()!==null;return T.createElement(T.Fragment,null,!n&&m?T.createElement(J,{ref:s,...e}):T.createElement(oe,{ref:s,...e}))}),Je=Object.assign(J,{Child:ye,Root:J});export{Je as Transition};
export*from'../transition/transition.js';

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

import"client-only";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/button/button.js';export*from'./components/checkbox/checkbox.js';export*from'./components/close-button/close-button.js';export*from'./components/combobox/combobox.js';export*from'./components/data-interactive/data-interactive.js';import{Description as x}from'./components/description/description.js';export*from'./components/dialog/dialog.js';export*from'./components/disclosure/disclosure.js';export*from'./components/field/field.js';export*from'./components/fieldset/fieldset.js';export*from'./components/focus-trap/focus-trap.js';export*from'./components/input/input.js';import{Label as n}from'./components/label/label.js';export*from'./components/legend/legend.js';export*from'./components/listbox/listbox.js';export*from'./components/menu/menu.js';export*from'./components/popover/popover.js';import{Portal as d}from'./components/portal/portal.js';export*from'./components/radio-group/radio-group.js';export*from'./components/select/select.js';export*from'./components/switch/switch.js';export*from'./components/tabs/tabs.js';export*from'./components/textarea/textarea.js';import{useClose as w}from'./internal/close-provider.js';export*from'./components/transition/transition.js';export{x as Description,n as Label,d as Portal,w as useClose};

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

/**
* The `useDisposables` hook returns a `disposables` object that is disposed
* when the component is unmounted.
*/
export declare function useDisposables(): {
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: Window | Document | HTMLElement, name: TEventName, listener: (event: WindowEventMap[TEventName]) => any, options?: boolean | AddEventListenerOptions | undefined): () => void;
requestAnimationFrame(callback: FrameRequestCallback): () => void;

@@ -8,5 +11,16 @@ nextFrame(callback: FrameRequestCallback): () => void;

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

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

import{useState as s,useEffect as o}from"react";import{disposables as t}from'../utils/disposables.js';function p(){let[e]=s(t);return o(()=>()=>e.dispose(),[e]),e}export{p as useDisposables};
import{useEffect as s,useState as o}from"react";import{disposables as t}from'../utils/disposables.js';function p(){let[e]=o(t);return s(()=>()=>e.dispose(),[e]),e}export{p as useDisposables};

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

export declare function useDocumentEvent<TType extends keyof DocumentEventMap>(type: TType, listener: (ev: DocumentEventMap[TType]) => any, options?: boolean | AddEventListenerOptions): void;
export declare function useDocumentEvent<TType extends keyof DocumentEventMap>(enabled: boolean, type: TType, listener: (ev: DocumentEventMap[TType]) => any, options?: boolean | AddEventListenerOptions): void;

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

import{useEffect as m}from"react";import{useLatestValue as c}from'./use-latest-value.js';function d(e,r,n){let o=c(r);m(()=>{function t(u){o.current(u)}return document.addEventListener(e,t,n),()=>document.removeEventListener(e,t,n)},[e,n])}export{d as useDocumentEvent};
import{useEffect as c}from"react";import{useLatestValue as a}from'./use-latest-value.js';function i(t,e,o,n){let u=a(o);c(()=>{if(!t)return;function r(m){u.current(m)}return document.addEventListener(e,r,n),()=>document.removeEventListener(e,r,n)},[t,e,n])}export{i as useDocumentEvent};
export declare function useFlags(initialFlags?: number): {
flags: number;
setFlag: (flag: number) => void;
addFlag: (flag: number) => void;

@@ -3,0 +5,0 @@ hasFlag: (flag: number) => boolean;

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

import{useState as m,useCallback as t}from"react";function b(g=0){let[r,l]=m(g),u=t(e=>l(a=>a|e),[r]),n=t(e=>Boolean(r&e),[r]),o=t(e=>l(a=>a&~e),[l]),s=t(e=>l(a=>a^e),[l]);return{addFlag:u,hasFlag:n,removeFlag:o,toggleFlag:s}}export{b as useFlags};
import{useCallback as r,useState as b}from"react";function c(u=0){let[t,l]=b(u),g=r(e=>l(e),[t]),s=r(e=>l(a=>a|e),[t]),m=r(e=>(t&e)===e,[t]),n=r(e=>l(a=>a&~e),[l]),F=r(e=>l(a=>a^e),[l]);return{flags:t,setFlag:g,addFlag:s,hasFlag:m,removeFlag:n,toggleFlag:F}}export{c as useFlags};

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

export declare let useId: any;
export { useId } from 'react';

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

var u;import t from"react";import{useIsoMorphicEffect as d}from'./use-iso-morphic-effect.js';import{useServerHandoffComplete as f}from'./use-server-handoff-complete.js';let l=0;function r(){return++l}let I=(u=t.useId)!=null?u:function(){let n=f(),[e,o]=t.useState(n?r:null);return d(()=>{e===null&&o(r())},[e]),e!=null?""+e:void 0};export{I as useId};
import{useId as r}from"react";export{r as useId};

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

import { MutableRefObject } from 'react';
export declare function useInertOthers<TElement extends HTMLElement>(container: MutableRefObject<TElement | null>, enabled?: boolean): void;
/**
* Mark all elements on the page as inert, except for the ones that are allowed.
*
* We move up the tree from the allowed elements, and mark all their siblings as
* inert. If any of the children happens to be a parent of one of the elements,
* then that child will not be marked as inert.
*
* E.g.:
*
* ```html
* <body> <!-- Stop at body -->
* <header></header> <!-- Inert, sibling of parent -->
* <main> <!-- Not inert, parent of allowed element -->
* <div>Sidebar</div> <!-- Inert, sibling of parent -->
* <div> <!-- Not inert, parent of allowed element -->
* <listbox> <!-- Not inert, parent of allowed element -->
* <button></button> <!-- Not inert, allowed element -->
* <options></options> <!-- Not inert, allowed element -->
* </listbox>
* </div>
* </main>
* <footer></footer> <!-- Inert, sibling of parent -->
* </body>
* ```
*/
export declare function useInertOthers(enabled: boolean, { allowed, disallowed, }?: {
allowed?: () => (HTMLElement | null)[];
disallowed?: () => (HTMLElement | null)[];
}): void;

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

import{getOwnerDocument as s}from'../utils/owner.js';import{useIsoMorphicEffect as d}from'./use-iso-morphic-effect.js';let i=new Set,r=new Map;function u(t){t.setAttribute("aria-hidden","true"),t.inert=!0}function l(t){let n=r.get(t);!n||(n["aria-hidden"]===null?t.removeAttribute("aria-hidden"):t.setAttribute("aria-hidden",n["aria-hidden"]),t.inert=n.inert)}function M(t,n=!0){d(()=>{if(!n||!t.current)return;let o=t.current,a=s(o);if(!!a){i.add(o);for(let e of r.keys())e.contains(o)&&(l(e),r.delete(e));return a.querySelectorAll("body > *").forEach(e=>{if(e instanceof HTMLElement){for(let f of i)if(e.contains(f))return;i.size===1&&(r.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),u(e))}}),()=>{if(i.delete(o),i.size>0)a.querySelectorAll("body > *").forEach(e=>{if(e instanceof HTMLElement&&!r.has(e)){for(let f of i)if(e.contains(f))return;r.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),u(e)}});else for(let e of r.keys())l(e),r.delete(e)}}},[n])}export{M as useInertOthers};
import{disposables as M}from'../utils/disposables.js';import{getOwnerDocument as b}from'../utils/owner.js';import{useIsTopLayer as L}from'./use-is-top-layer.js';import{useIsoMorphicEffect as T}from'./use-iso-morphic-effect.js';let f=new Map,u=new Map;function h(t){var e;let r=(e=u.get(t))!=null?e:0;return u.set(t,r+1),r!==0?()=>m(t):(f.set(t,{"aria-hidden":t.getAttribute("aria-hidden"),inert:t.inert}),t.setAttribute("aria-hidden","true"),t.inert=!0,()=>m(t))}function m(t){var i;let r=(i=u.get(t))!=null?i:1;if(r===1?u.delete(t):u.set(t,r-1),r!==1)return;let e=f.get(t);e&&(e["aria-hidden"]===null?t.removeAttribute("aria-hidden"):t.setAttribute("aria-hidden",e["aria-hidden"]),t.inert=e.inert,f.delete(t))}function y(t,{allowed:r,disallowed:e}={}){let i=L(t,"inert-others");T(()=>{var d,c;if(!i)return;let a=M();for(let n of(d=e==null?void 0:e())!=null?d:[])n&&a.add(h(n));let s=(c=r==null?void 0:r())!=null?c:[];for(let n of s){if(!n)continue;let l=b(n);if(!l)continue;let o=n.parentElement;for(;o&&o!==l.body;){for(let p of o.children)s.some(E=>p.contains(E))||a.add(h(p));o=o.parentElement}}return a.dispose},[i,r,e])}export{y as useInertOthers};

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

import{useRef as r,useEffect as t}from"react";function n(){let e=r(!0);return t(()=>(e.current=!1,()=>{e.current=!0}),[]),e.current}export{n as useIsInitialRender};
import{useEffect as r,useRef as t}from"react";function n(){let e=t(!0);return r(()=>(e.current=!1,()=>{e.current=!0}),[]),e.current}export{n as useIsInitialRender};

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

import { useEffect } from 'react';
export declare let useIsoMorphicEffect: typeof useEffect;
import { type DependencyList, type EffectCallback } from 'react';
export declare let useIsoMorphicEffect: (effect: EffectCallback, deps?: DependencyList | undefined) => void;

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

import{useLayoutEffect as e,useEffect as f}from"react";import{isServer as o}from'../utils/ssr.js';let s=o?f:e;export{s as useIsoMorphicEffect};
import{useEffect as f,useLayoutEffect as c}from"react";import{env as i}from'../utils/env.js';let n=(e,t)=>{i.isServer?f(e,t):c(e,t)};export{n as useIsoMorphicEffect};

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

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

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

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

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

import { MutableRefObject } from 'react';
export declare function useResolveButtonType<TTag>(props: {
type?: string;
as?: TTag;
}, ref: MutableRefObject<HTMLElement | null>): string | undefined;
}, element: HTMLElement | null): string | undefined;

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

import{useState as o}from"react";import{useIsoMorphicEffect as r}from'./use-iso-morphic-effect.js';function i(t){var n;if(t.type)return t.type;let e=(n=t.as)!=null?n:"button";if(typeof e=="string"&&e.toLowerCase()==="button")return"button"}function s(t,e){let[n,u]=o(()=>i(t));return r(()=>{u(i(t))},[t.type,t.as]),r(()=>{n||!e.current||e.current instanceof HTMLButtonElement&&!e.current.hasAttribute("type")&&u("button")},[n,e]),n}export{s as useResolveButtonType};
import{useMemo as a}from"react";function e(t,u){return a(()=>{var n;if(t.type)return t.type;let r=(n=t.as)!=null?n:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||(u==null?void 0:u.tagName)==="BUTTON"&&!u.hasAttribute("type"))return"button"},[t.type,t.as,u])}export{e as useResolveButtonType};

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

import{useState as o,useEffect as t}from"react";let r={serverHandoffComplete:!1};function a(){let[e,f]=o(r.serverHandoffComplete);return t(()=>{e!==!0&&f(!0)},[e]),t(()=>{r.serverHandoffComplete===!1&&(r.serverHandoffComplete=!0)},[]),e}export{a as useServerHandoffComplete};
import*as t from"react";import{env as f}from'../utils/env.js';function s(){let r=typeof document=="undefined";return"useSyncExternalStore"in t?(o=>o.useSyncExternalStore)(t)(()=>()=>{},()=>!1,()=>!r):!1}function l(){let r=s(),[e,n]=t.useState(f.isHandoffComplete);return e&&f.isHandoffComplete===!1&&n(!1),t.useEffect(()=>{e!==!0&&n(!0)},[e]),t.useEffect(()=>f.handoff(),[]),r?!1:e}export{l as useServerHandoffComplete};

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

import{useRef as l,useEffect as i}from"react";import{useEvent as r}from'./use-event.js';let u=Symbol();function T(t,n=!0){return Object.assign(t,{[u]:n})}function y(...t){let n=l(t);i(()=>{n.current=t},[t]);let c=r(e=>{for(let o of n.current)o!=null&&(typeof o=="function"?o(e):o.current=e)});return t.every(e=>e==null||(e==null?void 0:e[u]))?void 0:c}export{T as optionalRef,y as useSyncRefs};
import{useEffect as l,useRef as i}from"react";import{useEvent as r}from'./use-event.js';let u=Symbol();function T(t,n=!0){return Object.assign(t,{[u]:n})}function y(...t){let n=i(t);l(()=>{n.current=t},[t]);let c=r(e=>{for(let o of n.current)o!=null&&(typeof o=="function"?o(e):o.current=e)});return t.every(e=>e==null||(e==null?void 0:e[u]))?void 0:c}export{T as optionalRef,y as useSyncRefs};

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

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

@@ -1,18 +0,12 @@

import { MutableRefObject } from 'react';
interface TransitionArgs {
container: MutableRefObject<HTMLElement | null>;
classes: MutableRefObject<{
enter: string[];
enterFrom: string[];
enterTo: string[];
leave: string[];
leaveFrom: string[];
leaveTo: string[];
entered: string[];
}>;
direction: 'enter' | 'leave' | 'idle';
onStart: MutableRefObject<(direction: TransitionArgs['direction']) => void>;
onStop: MutableRefObject<(direction: TransitionArgs['direction']) => void>;
}
export declare function useTransition({ container, direction, classes, onStart, onStop }: TransitionArgs): void;
type TransitionData = {
closed?: boolean;
enter?: boolean;
leave?: boolean;
transition?: boolean;
};
export declare function transitionDataAttributes(data: TransitionData): Record<string, string>;
export declare function useTransition(enabled: boolean, element: HTMLElement | null, show: boolean, events?: {
start?(show: boolean): void;
end?(show: boolean): void;
}): [visible: boolean, data: TransitionData];
export {};

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

import{Reason as i,transition as m}from'../components/transitions/utils/transition.js';import{disposables as f}from'../utils/disposables.js';import{match as p}from'../utils/match.js';import{useDisposables as b}from'./use-disposables.js';import{useIsMounted as g}from'./use-is-mounted.js';import{useIsoMorphicEffect as M}from'./use-iso-morphic-effect.js';import{useLatestValue as T}from'./use-latest-value.js';function I({container:o,direction:t,classes:s,onStart:a,onStop:u}){let c=g(),d=b(),r=T(t);M(()=>{let e=f();d.add(e.dispose);let n=o.current;if(!!n&&r.current!=="idle"&&!!c.current)return e.dispose(),a.current(r.current),e.add(m(n,s.current,r.current==="enter",l=>{e.dispose(),p(l,{[i.Ended](){u.current(r.current)},[i.Cancelled]:()=>{}})})),e.dispose},[t])}export{I as useTransition};
import{useRef as T,useState as b}from"react";import{disposables as p}from'../utils/disposables.js';import{useDisposables as m}from'./use-disposables.js';import{useFlags as E}from'./use-flags.js';import{useIsoMorphicEffect as L}from'./use-iso-morphic-effect.js';var g=(r=>(r[r.None=0]="None",r[r.Closed=1]="Closed",r[r.Enter=2]="Enter",r[r.Leave=4]="Leave",r))(g||{});function H(e){let n={};for(let t in e)e[t]===!0&&(n[`data-${t}`]="");return n}function j(e,n,t,i){let[r,a]=b(t),{hasFlag:f,addFlag:o,removeFlag:s}=E(e&&r?3:0),u=T(!1),l=T(!1),S=m();return L(()=>{var d;if(e){if(t&&a(!0),!n){t&&o(3);return}return(d=i==null?void 0:i.start)==null||d.call(i,t),C(n,{inFlight:u,prepare(){l.current?l.current=!1:l.current=u.current,u.current=!0,!l.current&&(t?(o(3),s(4)):(o(4),s(2)))},run(){l.current?t?(s(3),o(4)):(s(4),o(3)):t?s(1):o(1)},done(){var c;l.current&&typeof n.getAnimations=="function"&&n.getAnimations().length>0||(u.current=!1,s(7),t||a(!1),(c=i==null?void 0:i.end)==null||c.call(i,t))}})}},[e,t,n,S]),e?[r,{closed:f(1),enter:f(2),leave:f(4),transition:f(2)||f(4)}]:[t,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function C(e,{prepare:n,run:t,done:i,inFlight:r}){let a=p();return M(e,{prepare:n,inFlight:r}),a.nextFrame(()=>{t(),a.requestAnimationFrame(()=>{a.add(y(e,i))})}),a.dispose}function y(e,n){let t=p();if(!e)return t.dispose;let i=!1;t.add(()=>{i=!0});let r=e.getAnimations().filter(a=>a instanceof CSSTransition);return r.length===0?(n(),t.dispose):(Promise.allSettled(r.map(a=>a.finished)).then(()=>{i||n()}),t.dispose)}function M(e,{inFlight:n,prepare:t}){if(n!=null&&n.current){t();return}let i=e.style.transition;e.style.transition="none",t(),e.offsetHeight,e.style.transition=i}export{H as transitionDataAttributes,j as useTransition};

@@ -1,8 +0,7 @@

declare type AcceptNode = (node: HTMLElement) => typeof NodeFilter.FILTER_ACCEPT | typeof NodeFilter.FILTER_SKIP | typeof NodeFilter.FILTER_REJECT;
export declare function useTreeWalker({ container, accept, walk, enabled, }: {
type AcceptNode = (node: HTMLElement) => typeof NodeFilter.FILTER_ACCEPT | typeof NodeFilter.FILTER_SKIP | typeof NodeFilter.FILTER_REJECT;
export declare function useTreeWalker(enabled: boolean, { container, accept, walk, }: {
container: HTMLElement | null;
accept: AcceptNode;
walk(node: HTMLElement): void;
enabled?: boolean;
}): void;
export {};

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

import{useRef as E,useEffect as m}from"react";import{useIsoMorphicEffect as T}from'./use-iso-morphic-effect.js';import{getOwnerDocument as N}from'../utils/owner.js';function F({container:e,accept:t,walk:r,enabled:c=!0}){let o=E(t),l=E(r);m(()=>{o.current=t,l.current=r},[t,r]),T(()=>{if(!e||!c)return;let n=N(e);if(!n)return;let f=o.current,p=l.current,d=Object.assign(i=>f(i),{acceptNode:f}),u=n.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,d,!1);for(;u.nextNode();)p(u.currentNode)},[e,c,o,l])}export{F as useTreeWalker};
import{useEffect as T,useRef as E}from"react";import{getOwnerDocument as d}from'../utils/owner.js';import{useIsoMorphicEffect as N}from'./use-iso-morphic-effect.js';function F(c,{container:e,accept:t,walk:r}){let o=E(t),l=E(r);T(()=>{o.current=t,l.current=r},[t,r]),N(()=>{if(!e||!c)return;let n=d(e);if(!n)return;let f=o.current,p=l.current,i=Object.assign(m=>f(m),{acceptNode:f}),u=n.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,i,!1);for(;u.nextNode();)p(u.currentNode)},[e,c,o,l])}export{F as useTreeWalker};

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

import{useEffect as s,useRef as f}from"react";import{useEvent as i}from'./use-event.js';function m(u,t){let e=f([]),r=i(u);s(()=>{let o=[...e.current];for(let[n,a]of t.entries())if(e.current[n]!==a){let l=r(t,o);return e.current=t,l}},[r,...t])}export{m as useWatch};
import{useEffect as f,useRef as s}from"react";import{useEvent as i}from'./use-event.js';function m(u,t){let e=s([]),r=i(u);f(()=>{let o=[...e.current];for(let[a,l]of t.entries())if(e.current[a]!==l){let n=r(t,o);return e.current=t,n}},[r,...t])}export{m as useWatch};

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

export declare function useWindowEvent<TType extends keyof WindowEventMap>(type: TType, listener: (ev: WindowEventMap[TType]) => any, options?: boolean | AddEventListenerOptions): void;
export declare function useWindowEvent<TType extends keyof WindowEventMap>(enabled: boolean, type: TType, listener: (ev: WindowEventMap[TType]) => any, options?: boolean | AddEventListenerOptions): void;

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

import{useEffect as d}from"react";import{useLatestValue as a}from'./use-latest-value.js';function s(e,r,n){let o=a(r);d(()=>{function t(i){o.current(i)}return window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)},[e,n])}export{s as useWindowEvent};
import{useEffect as a}from"react";import{useLatestValue as f}from'./use-latest-value.js';function s(t,e,o,n){let i=f(o);a(()=>{if(!t)return;function r(d){i.current(d)}return window.addEventListener(e,r,n),()=>window.removeEventListener(e,r,n)},[t,e,n])}export{s as useWindowEvent};

@@ -1,13 +0,25 @@

import 'client-only';
export * from './components/button/button.js';
export * from './components/checkbox/checkbox.js';
export * from './components/close-button/close-button.js';
export * from './components/combobox/combobox.js';
export * from './components/data-interactive/data-interactive.js';
export { Description, type DescriptionProps } from './components/description/description.js';
export * from './components/dialog/dialog.js';
export * from './components/disclosure/disclosure.js';
export * from './components/field/field.js';
export * from './components/fieldset/fieldset.js';
export * from './components/focus-trap/focus-trap.js';
export * from './components/input/input.js';
export { Label, type LabelProps } from './components/label/label.js';
export * from './components/legend/legend.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 { Portal } from './components/portal/portal.js';
export * from './components/radio-group/radio-group.js';
export * from './components/select/select.js';
export * from './components/switch/switch.js';
export * from './components/tabs/tabs.js';
export * from './components/transitions/transition.js';
export * from './components/textarea/textarea.js';
export { useClose } from './internal/close-provider.js';
export * from './components/transition/transition.js';

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

import"client-only";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/button/button.js';export*from'./components/checkbox/checkbox.js';export*from'./components/close-button/close-button.js';export*from'./components/combobox/combobox.js';export*from'./components/data-interactive/data-interactive.js';import{Description as x}from'./components/description/description.js';export*from'./components/dialog/dialog.js';export*from'./components/disclosure/disclosure.js';export*from'./components/field/field.js';export*from'./components/fieldset/fieldset.js';export*from'./components/focus-trap/focus-trap.js';export*from'./components/input/input.js';import{Label as n}from'./components/label/label.js';export*from'./components/legend/legend.js';export*from'./components/listbox/listbox.js';export*from'./components/menu/menu.js';export*from'./components/popover/popover.js';import{Portal as d}from'./components/portal/portal.js';export*from'./components/radio-group/radio-group.js';export*from'./components/select/select.js';export*from'./components/switch/switch.js';export*from'./components/tabs/tabs.js';export*from'./components/textarea/textarea.js';import{useClose as w}from'./internal/close-provider.js';export*from'./components/transition/transition.js';export{x as Description,n as Label,d as Portal,w as useClose};

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

/// <reference types="react" />
import React from 'react';
interface FocusSentinelProps {
onFocus(): boolean;
}
export declare function FocusSentinel({ onFocus }: FocusSentinelProps): JSX.Element | null;
export declare function FocusSentinel({ onFocus }: FocusSentinelProps): React.JSX.Element | null;
export {};

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

import i,{useState as s}from"react";import{Hidden as c,Features as l}from'./hidden.js';function p({onFocus:n}){let[r,o]=s(!0);return r?i.createElement(c,{as:"button",type:"button",features:l.Focusable,onFocus:a=>{a.preventDefault();let e,u=50;function t(){if(u--<=0){e&&cancelAnimationFrame(e);return}if(n()){o(!1),cancelAnimationFrame(e);return}e=requestAnimationFrame(t)}e=requestAnimationFrame(t)}}):null}export{p as FocusSentinel};
import s,{useState as c}from"react";import{useIsMounted as m}from'../hooks/use-is-mounted.js';import{Hidden as f,HiddenFeatures as l}from'./hidden.js';function b({onFocus:n}){let[r,o]=c(!0),u=m();return r?s.createElement(f,{as:"button",type:"button",features:l.Focusable,onFocus:a=>{a.preventDefault();let e,i=50;function t(){if(i--<=0){e&&cancelAnimationFrame(e);return}if(n()){if(cancelAnimationFrame(e),!u.current)return;o(!1);return}e=requestAnimationFrame(t)}e=requestAnimationFrame(t)}}):null}export{b as FocusSentinel};

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

import { ElementType, Ref } from 'react';
import { Props } from '../types.js';
export declare enum Features {
import type { ElementType, Ref } from 'react';
import type { Props } from '../types.js';
import { type HasDisplayName, type RefProp } from '../utils/render.js';
declare let DEFAULT_VISUALLY_HIDDEN_TAG: "span";
export declare enum HiddenFeatures {
None = 1,

@@ -8,12 +10,12 @@ Focusable = 2,

}
export declare let Hidden: (<TTag extends ElementType<any> = "div">(props: Omit<import('../types.js').PropsOf<TTag>, "as" | "children" | "refName" | "className"> & {
as?: TTag | undefined;
children?: import("react").ReactNode | ((bag: {}) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>);
refName?: string | undefined;
} & (true extends (import('../types.js').PropsOf<TTag> extends never ? never : "className" extends keyof import('../types.js').PropsOf<TTag> ? true : never) ? {
className?: import('../types.js').PropsOf<TTag>["className"] | ((bag: {}) => string) | undefined;
} : {}) & {
features?: Features | undefined;
}, ref: Ref<HTMLElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null) & {
displayName: string;
};
type HiddenRenderPropArg = {};
type HiddenPropsWeControl = never;
export type HiddenProps<TTag extends ElementType = typeof DEFAULT_VISUALLY_HIDDEN_TAG> = Props<TTag, HiddenRenderPropArg, HiddenPropsWeControl, {
features?: HiddenFeatures;
}>;
declare function VisuallyHidden<TTag extends ElementType = typeof DEFAULT_VISUALLY_HIDDEN_TAG>(props: HiddenProps<TTag>, ref: Ref<HTMLElement>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
interface ComponentHidden extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_VISUALLY_HIDDEN_TAG>(props: HiddenProps<TTag> & RefProp<typeof VisuallyHidden>): JSX.Element;
}
export declare let Hidden: ComponentHidden;
export {};

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

import{forwardRefWithAs as i,render as n}from'../utils/render.js';let a="div";var s=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(s||{});let h=i(function(t,o){let{features:e=1,...r}=t,d={ref:o,"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 n({ourProps:d,theirProps:r,slot:{},defaultTag:a,name:"Hidden"})});export{s as Features,h as Hidden};
import{forwardRefWithAs as i,render as p}from'../utils/render.js';let a="span";var s=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(s||{});function l(t,r){var n;let{features:d=1,...e}=t,o={ref:r,"aria-hidden":(d&2)===2?!0:(n=e["aria-hidden"])!=null?n:void 0,hidden:(d&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",...(d&4)===4&&(d&2)!==2&&{display:"none"}}};return p({ourProps:o,theirProps:e,slot:{},defaultTag:a,name:"Hidden"})}let T=i(l);export{T as Hidden,s as HiddenFeatures};

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

import { ReactNode, ReactElement } from 'react';
import React, { type ReactElement, type ReactNode } from 'react';
export declare enum State {
Open = 0,
Closed = 1
Open = 1,
Closed = 2,
Closing = 4,
Opening = 8
}

@@ -12,2 +14,5 @@ export declare function useOpenClosed(): State | null;

export declare function OpenClosedProvider({ value, children }: Props): ReactElement;
export declare function ResetOpenClosedProvider({ children }: {
children: React.ReactNode;
}): ReactElement;
export {};

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

import r,{createContext as l,useContext as d}from"react";let o=l(null);o.displayName="OpenClosedContext";var p=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(p||{});function s(){return d(o)}function C({value:t,children:n}){return r.createElement(o.Provider,{value:t},n)}export{C as OpenClosedProvider,p as State,s as useOpenClosed};
import r,{createContext as l,useContext as d}from"react";let n=l(null);n.displayName="OpenClosedContext";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 u(){return d(n)}function c({value:o,children:t}){return r.createElement(n.Provider,{value:o},t)}function s({children:o}){return r.createElement(n.Provider,{value:null},o)}export{c as OpenClosedProvider,s as ResetOpenClosedProvider,i as State,u as useOpenClosed};

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

import { ReactNode } from 'react';
import React, { type ReactNode } from 'react';
export declare function usePortalRoot(): boolean;

@@ -7,3 +7,3 @@ interface ForcePortalRootProps {

}
export declare function ForcePortalRoot(props: ForcePortalRootProps): JSX.Element;
export declare function ForcePortalRoot(props: ForcePortalRootProps): React.JSX.Element;
export {};

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

import t,{createContext as r,useContext as c}from"react";let e=r(!1);function l(){return c(e)}function P(o){return t.createElement(e.Provider,{value:o.force},o.children)}export{P as ForcePortalRoot,l as usePortalRoot};
import t,{createContext as r,useContext as c}from"react";let e=r(!1);function a(){return c(e)}function l(o){return t.createElement(e.Provider,{value:o.force},o.children)}export{l as ForcePortalRoot,a as usePortalRoot};

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

import { ReactNode, ReactElement, JSXElementConstructor } from 'react';
export declare type ReactTag = keyof JSX.IntrinsicElements | JSXElementConstructor<any>;
declare let __: "1D45E01E-AF44-47C4-988A-19A94EBAF55C";
export declare type __ = typeof __;
export declare type Expand<T> = T extends infer O ? {
import type { JSXElementConstructor, ReactElement, ReactNode } from 'react';
export type ReactTag = keyof JSX.IntrinsicElements | JSXElementConstructor<any>;
export type Expand<T> = T extends infer O ? {
[K in keyof O]: O[K];
} : never;
export declare type PropsOf<TTag extends ReactTag> = TTag extends React.ElementType ? React.ComponentProps<TTag> : never;
declare type PropsWeControl = 'as' | 'children' | 'refName' | 'className';
declare type CleanProps<TTag extends ReactTag, TOmitableProps extends PropertyKey = __> = TOmitableProps extends __ ? Omit<PropsOf<TTag>, PropsWeControl> : Omit<PropsOf<TTag>, TOmitableProps | PropsWeControl>;
declare type OurProps<TTag extends ReactTag, TSlot> = {
export type PropsOf<TTag extends ReactTag> = TTag extends React.ElementType ? Omit<React.ComponentProps<TTag>, 'ref'> : never;
type PropsWeControl = 'as' | 'children' | 'refName' | 'className';
type CleanProps<TTag extends ReactTag, TOmittableProps extends PropertyKey = never> = Omit<PropsOf<TTag>, TOmittableProps | PropsWeControl>;
type OurProps<TTag extends ReactTag, TSlot> = {
as?: TTag;

@@ -16,13 +14,8 @@ children?: ReactNode | ((bag: TSlot) => ReactElement);

};
declare type HasProperty<T extends object, K extends PropertyKey> = T extends never ? never : K extends keyof T ? true : never;
declare type ClassNameOverride<TTag extends ReactTag, TSlot = {}> = true extends HasProperty<PropsOf<TTag>, 'className'> ? {
type HasProperty<T extends object, K extends PropertyKey> = T extends never ? never : K extends keyof T ? true : never;
type ClassNameOverride<TTag extends ReactTag, TSlot = {}> = true extends HasProperty<PropsOf<TTag>, 'className'> ? {
className?: PropsOf<TTag>['className'] | ((bag: TSlot) => string);
} : {};
export declare type Props<TTag extends ReactTag, TSlot = {}, TOmitableProps extends PropertyKey = __> = CleanProps<TTag, TOmitableProps> & OurProps<TTag, TSlot> & ClassNameOverride<TTag, TSlot>;
declare type Without<T, U> = {
[P in Exclude<keyof T, keyof U>]?: never;
};
export declare type XOR<T, U> = T | U extends __ ? never : T extends __ ? U : U extends __ ? T : T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
export declare type ByComparator<T> = (keyof T & string) | ((a: T, b: T) => boolean);
export declare type EnsureArray<T> = T extends any[] ? T : Expand<T>[];
export type Props<TTag extends ReactTag, TSlot = {}, TOmittableProps extends PropertyKey = never, Overrides = {}> = CleanProps<TTag, TOmittableProps | keyof Overrides> & OurProps<TTag, TSlot> & ClassNameOverride<TTag, TSlot> & Overrides;
export type EnsureArray<T> = T extends any[] ? T : Expand<T>[];
export {};

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

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

function e(...n){return n.filter(Boolean).join(" ")}export{e as classNames};
function t(...r){return Array.from(new Set(r.flatMap(n=>typeof n=="string"?n.split(" "):[]))).filter(Boolean).join(" ")}export{t as classNames};

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

export type Disposables = ReturnType<typeof disposables>;
/**
* Disposables are a way to manage event handlers and functions like
* `setTimeout` and `requestAnimationFrame` that need to be cleaned up when they
* are no longer needed.
*
*
* When you register a disposable function, it is added to a collection of
* disposables. Each disposable in the collection provides a `dispose` clean up
* function that can be called when it's no longer needed. There is also a
* `dispose` function on the collection itself that can be used to clean up all
* pending disposables in that collection.
*/
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;

@@ -8,5 +20,6 @@ nextFrame(callback: FrameRequestCallback): () => 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 @@

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

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

import type { MutableRefObject } from 'react';
export declare let focusableSelector: string;
export declare enum Focus {

@@ -13,3 +15,5 @@ /** Focus the first non-disabled element */

/** Prevent scrolling the focusable elements into view */
NoScroll = 32
NoScroll = 32,
/** Focus the first focusable element with the `data-autofocus` attribute. */
AutoFocus = 64
}

@@ -27,2 +31,3 @@ export declare enum FocusResult {

export declare function getFocusableElements(container?: HTMLElement | null): HTMLElement[];
export declare function getAutoFocusableElements(container?: HTMLElement | null): HTMLElement[];
export declare enum FocusableMode {

@@ -39,2 +44,6 @@ /** The element itself must be focusable. */

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 | MutableRefObject<HTMLElement | null>)[];
}>): FocusResult;

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

import{disposables as p}from'./disposables.js';import{match as L}from'./match.js';import{getOwnerDocument as c}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 T=(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))(T||{}),M=(o=>(o[o.Error=0]="Error",o[o.Overflow=1]="Overflow",o[o.Success=2]="Success",o[o.Underflow=3]="Underflow",o))(M||{}),b=(r=>(r[r.Previous=-1]="Previous",r[r.Next=1]="Next",r))(b||{});function d(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(m))}var N=(r=>(r[r.Strict=0]="Strict",r[r.Loose=1]="Loose",r))(N||{});function F(e,t=0){var r;return e===((r=c(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 I(e){let t=c(e);p().nextFrame(()=>{t&&!F(t.activeElement,0)&&h(e)})}function h(e){e==null||e.focus({preventScroll:!0})}let w=["textarea","input"].join(",");function H(e){var t,r;return(r=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,w))!=null?r:!1}function S(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 D(e,t){return O(d(),t,!0,e)}function O(e,t,r=!0,l=null){let o=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,s=Array.isArray(e)?r?S(e):e:d(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")})(),E=(()=>{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")})(),x=t&32?{preventScroll:!0}:{},f=0,i=s.length,u;do{if(f>=i||f+i<=0)return 0;let a=E+f;if(t&16)a=(a+i)%i;else{if(a<0)return 3;if(a>=i)return 1}u=s[a],u==null||u.focus(x),f+=n}while(u!==o.activeElement);return t&6&&H(u)&&u.select(),u.hasAttribute("tabindex")||u.setAttribute("tabindex","0"),2}export{T as Focus,M as FocusResult,N as FocusableMode,h as focusElement,D as focusFrom,O as focusIn,d as getFocusableElements,F as isFocusableElement,I as restoreFocusIfNecessary,S as sortByDomNode};
import{disposables as N}from'./disposables.js';import{match as L}from'./match.js';import{getOwnerDocument as E}from'./owner.js';let f=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),p=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var F=(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.AutoFocus=64]="AutoFocus",n))(F||{}),T=(o=>(o[o.Error=0]="Error",o[o.Overflow=1]="Overflow",o[o.Success=2]="Success",o[o.Underflow=3]="Underflow",o))(T||{}),y=(t=>(t[t.Previous=-1]="Previous",t[t.Next=1]="Next",t))(y||{});function b(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(f)).sort((r,t)=>Math.sign((r.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}function S(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(p)).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 A(e,r=0){var t;return e===((t=E(e))==null?void 0:t.body)?!1:L(r,{[0](){return e.matches(f)},[1](){let u=e;for(;u!==null;){if(u.matches(f))return!0;u=u.parentElement}return!1}})}function G(e){let r=E(e);N().nextFrame(()=>{r&&!A(r.activeElement,0)&&I(e)})}var H=(t=>(t[t.Keyboard=0]="Keyboard",t[t.Mouse=1]="Mouse",t))(H||{});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 I(e){e==null||e.focus({preventScroll:!0})}let w=["textarea","input"].join(",");function O(e){var r,t;return(t=(r=e==null?void 0:e.matches)==null?void 0:r.call(e,w))!=null?t:!1}function _(e,r=t=>t){return e.slice().sort((t,u)=>{let o=r(t),c=r(u);if(o===null||c===null)return 0;let l=o.compareDocumentPosition(c);return l&Node.DOCUMENT_POSITION_FOLLOWING?-1:l&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function j(e,r){return P(b(),r,{relativeTo:e})}function P(e,r,{sorted:t=!0,relativeTo:u=null,skipElements:o=[]}={}){let c=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,l=Array.isArray(e)?t?_(e):e:r&64?S(e):b(e);o.length>0&&l.length>1&&(l=l.filter(s=>!o.some(a=>a!=null&&"current"in a?(a==null?void 0:a.current)===s:a===s))),u=u!=null?u:c.activeElement;let n=(()=>{if(r&5)return 1;if(r&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),x=(()=>{if(r&1)return 0;if(r&2)return Math.max(0,l.indexOf(u))-1;if(r&4)return Math.max(0,l.indexOf(u))+1;if(r&8)return l.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),M=r&32?{preventScroll:!0}:{},m=0,d=l.length,i;do{if(m>=d||m+d<=0)return 0;let s=x+m;if(r&16)s=(s+d)%d;else{if(s<0)return 3;if(s>=d)return 1}i=l[s],i==null||i.focus(M),m+=n}while(i!==c.activeElement);return r&6&&O(i)&&i.select(),2}export{F as Focus,T as FocusResult,h as FocusableMode,I as focusElement,j as focusFrom,P as focusIn,f as focusableSelector,S as getAutoFocusableElements,b as getFocusableElements,A as isFocusableElement,G as restoreFocusIfNecessary,_ 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 { MutableRefObject } from 'react';
import type { MutableRefObject } from 'react';
export declare function getOwnerDocument<T extends Element | MutableRefObject<Element | null>>(element: T | null | undefined): Document | null;

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

import{isServer as n}from'./ssr.js';function e(r){return n?null:r instanceof Node?r.ownerDocument:r!=null&&r.hasOwnProperty("current")&&r.current instanceof Node?r.current.ownerDocument:document}export{e as getOwnerDocument};
import{env as n}from'./env.js';function u(r){return n.isServer?null:r instanceof Node?r.ownerDocument:r!=null&&r.hasOwnProperty("current")&&r.current instanceof Node?r.current.ownerDocument:document}export{u 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,4 +0,4 @@

import { ElementType, ReactElement } from 'react';
import { Props, XOR, __, Expand } from '../types.js';
export declare enum Features {
import { type ElementType, type ReactElement, type Ref } from 'react';
import type { Expand, Props } from '../types.js';
export declare enum RenderFeatures {
/** No features at all */

@@ -24,12 +24,13 @@ None = 0,

}
declare type PropsForFeature<TPassedInFeatures extends Features, TForFeature extends Features, TProps> = {
[P in TPassedInFeatures]: P extends TForFeature ? TProps : __;
}[TPassedInFeatures];
export declare type PropsForFeatures<T extends Features> = XOR<PropsForFeature<T, Features.Static, {
type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) extends (x: infer R) => any ? R : never;
type PropsForFeature<TPassedInFeatures extends RenderFeatures, TForFeature extends RenderFeatures, TProps> = TPassedInFeatures extends TForFeature ? TProps : {};
export type PropsForFeatures<T extends RenderFeatures> = Expand<UnionToIntersection<PropsForFeature<T, RenderFeatures.Static, {
static?: boolean;
}>, PropsForFeature<T, Features.RenderStrategy, {
}> | PropsForFeature<T, RenderFeatures.RenderStrategy, {
unmount?: boolean;
}>>;
export declare function render<TFeature extends Features, TTag extends ElementType, TSlot>({ ourProps, theirProps, slot, defaultTag, features, visible, name, }: {
ourProps: Expand<Props<TTag, TSlot, any> & PropsForFeatures<TFeature>>;
}>>>;
export declare function render<TFeature extends RenderFeatures, TTag extends ElementType, TSlot>({ ourProps, theirProps, slot, defaultTag, features, visible, name, mergeRefs, }: {
ourProps: Expand<Props<TTag, TSlot, any> & PropsForFeatures<TFeature>> & {
ref?: Ref<HTMLElement | ElementType>;
};
theirProps: Expand<Props<TTag, TSlot, any>>;

@@ -41,4 +42,26 @@ slot?: TSlot;

name: string;
mergeRefs?: ReturnType<typeof useMergeRefsFn>;
}): ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
/**
* This is a singleton hook. **You can ONLY call the returned
* function *once* to produce expected results.** If you need
* to call `mergeRefs()` multiple times you need to create a
* separate function for each invocation. This happens as we
* store the list of `refs` to update and always return the
* same function that refers to that list of refs.
*
* You shouldn't normally read refs during render but this
* should actually be okay because React itself is calling
* the `function` that updates these refs and can only do
* so once the ref that contains the list is updated.
*/
export declare function useMergeRefsFn(): (...refs: any[]) => ((value: any) => void) | undefined;
export type HasDisplayName = {
displayName: string;
};
export type RefProp<T extends Function> = T extends (props: any, ref: Ref<infer RefType>) => any ? {
ref?: Ref<RefType>;
} : never;
export declare function mergeProps<T extends Props<any, any>[]>(...listOfProps: T): Props<any, any>;
/**
* This is a hack, but basically we want to keep the full 'API' of the component, but we do want to

@@ -45,0 +68,0 @@ * wrap it in a forwardRef so that we _can_ passthrough the ref

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

import{Fragment as c,cloneElement as P,createElement as b,forwardRef as E,isValidElement as x}from"react";import{match as R}from'./match.js';var S=(a=>(a[a.None=0]="None",a[a.RenderStrategy=1]="RenderStrategy",a[a.Static=2]="Static",a))(S||{}),j=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(j||{});function $({ourProps:r,theirProps:t,slot:e,defaultTag:a,features:o,visible:n=!0,name:l}){let s=T(t,r);if(n)return p(s,e,a,l);let u=o!=null?o:0;if(u&2){let{static:i=!1,...d}=s;if(i)return p(d,e,a,l)}if(u&1){let{unmount:i=!0,...d}=s;return R(i?0:1,{[0](){return null},[1](){return p({...d,hidden:!0,style:{display:"none"}},e,a,l)}})}return p(s,e,a,l)}function p(r,t={},e,a){let{as:o=e,children:n,refName:l="ref",...s}=m(r,["unmount","static"]),u=r.ref!==void 0?{[l]:r.ref}:{},i=typeof n=="function"?n(t):n;s.className&&typeof s.className=="function"&&(s.className=s.className(t));let d={};if(t){let f=!1,y=[];for(let[h,g]of Object.entries(t))typeof g=="boolean"&&(f=!0),g===!0&&y.push(h);f&&(d["data-headlessui-state"]=y.join(" "))}if(o===c&&Object.keys(F(s)).length>0){if(!x(i)||Array.isArray(i)&&i.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${a} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(s).map(f=>` - ${f}`).join(`
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(f=>` - ${f}`).join(`
import{Fragment as R,cloneElement as P,createElement as E,forwardRef as j,isValidElement as v,useCallback as S,useRef as w}from"react";import{classNames as x}from'./class-names.js';import{match as k}from'./match.js';var M=(a=>(a[a.None=0]="None",a[a.RenderStrategy=1]="RenderStrategy",a[a.Static=2]="Static",a))(M||{}),O=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(O||{});function H({ourProps:r,theirProps:n,slot:e,defaultTag:a,features:s,visible:t=!0,name:l,mergeRefs:i}){i=i!=null?i:A;let o=N(n,r);if(t)return b(o,e,a,l,i);let y=s!=null?s:0;if(y&2){let{static:f=!1,...u}=o;if(f)return b(u,e,a,l,i)}if(y&1){let{unmount:f=!0,...u}=o;return k(f?0:1,{[0](){return null},[1](){return b({...u,hidden:!0,style:{display:"none"}},e,a,l,i)}})}return b(o,e,a,l,i)}function b(r,n={},e,a,s){let{as:t=e,children:l,refName:i="ref",...o}=h(r,["unmount","static"]),y=r.ref!==void 0?{[i]:r.ref}:{},f=typeof l=="function"?l(n):l;"className"in o&&o.className&&typeof o.className=="function"&&(o.className=o.className(n)),o["aria-labelledby"]&&o["aria-labelledby"]===o.id&&(o["aria-labelledby"]=void 0);let u={};if(n){let d=!1,p=[];for(let[c,T]of Object.entries(n))typeof T=="boolean"&&(d=!0),T===!0&&p.push(c.replace(/([A-Z])/g,g=>`-${g.toLowerCase()}`));if(d){u["data-headlessui-state"]=p.join(" ");for(let c of p)u[`data-${c}`]=""}}if(t===R&&(Object.keys(m(o)).length>0||Object.keys(m(u)).length>0))if(!v(f)||Array.isArray(f)&&f.length>1){if(Object.keys(m(o)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${a} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(m(o)).concat(Object.keys(m(u))).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 "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(d=>` - ${d}`).join(`
`)].join(`
`));return P(i,Object.assign({},T(i.props,F(m(s,["ref"]))),d,u,w(i.ref,u.ref)))}return b(o,Object.assign({},m(s,["ref"]),o!==c&&u,o!==c&&d),i)}function w(...r){return{ref:r.every(t=>t==null)?void 0:t=>{for(let e of r)e!=null&&(typeof e=="function"?e(t):e.current=t)}}}function T(...r){var a;if(r.length===0)return{};if(r.length===1)return r[0];let t={},e={};for(let o of r)for(let n in o)n.startsWith("on")&&typeof o[n]=="function"?((a=e[n])!=null||(e[n]=[]),e[n].push(o[n])):t[n]=o[n];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(e).map(o=>[o,void 0])));for(let o in e)Object.assign(t,{[o](n,...l){let s=e[o];for(let u of s){if((n instanceof Event||(n==null?void 0:n.nativeEvent)instanceof Event)&&n.defaultPrevented)return;u(n,...l)}}});return t}function C(r){var t;return Object.assign(E(r),{displayName:(t=r.displayName)!=null?t:r.name})}function F(r){let t=Object.assign({},r);for(let e in t)t[e]===void 0&&delete t[e];return t}function m(r,t=[]){let e=Object.assign({},r);for(let a of t)a in e&&delete e[a];return e}export{S as Features,j as RenderStrategy,F as compact,C as forwardRefWithAs,$ as render};
`))}else{let d=f.props,p=d==null?void 0:d.className,c=typeof p=="function"?(...F)=>x(p(...F),o.className):x(p,o.className),T=c?{className:c}:{},g=N(f.props,m(h(o,["ref"])));for(let F in u)F in g&&delete u[F];return P(f,Object.assign({},g,u,y,{ref:s(f.ref,y.ref)},T))}return E(t,Object.assign({},h(o,["ref"]),t!==R&&y,t!==R&&u),f)}function I(){let r=w([]),n=S(e=>{for(let a of r.current)a!=null&&(typeof a=="function"?a(e):a.current=e)},[]);return(...e)=>{if(!e.every(a=>a==null))return r.current=e,n}}function A(...r){return r.every(n=>n==null)?void 0:n=>{for(let e of r)e!=null&&(typeof e=="function"?e(n):e.current=n)}}function N(...r){var a;if(r.length===0)return{};if(r.length===1)return r[0];let n={},e={};for(let s of r)for(let t in s)t.startsWith("on")&&typeof s[t]=="function"?((a=e[t])!=null||(e[t]=[]),e[t].push(s[t])):n[t]=s[t];if(n.disabled||n["aria-disabled"])for(let s in e)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(s)&&(e[s]=[t=>{var l;return(l=t==null?void 0:t.preventDefault)==null?void 0:l.call(t)}]);for(let s in e)Object.assign(n,{[s](t,...l){let i=e[s];for(let o of i){if((t instanceof Event||(t==null?void 0:t.nativeEvent)instanceof Event)&&t.defaultPrevented)return;o(t,...l)}}});return n}function D(...r){var a;if(r.length===0)return{};if(r.length===1)return r[0];let n={},e={};for(let s of r)for(let t in s)t.startsWith("on")&&typeof s[t]=="function"?((a=e[t])!=null||(e[t]=[]),e[t].push(s[t])):n[t]=s[t];for(let s in e)Object.assign(n,{[s](...t){let l=e[s];for(let i of l)i==null||i(...t)}});return n}function W(r){var n;return Object.assign(j(r),{displayName:(n=r.displayName)!=null?n:r.name})}function m(r){let n=Object.assign({},r);for(let e in n)n[e]===void 0&&delete n[e];return n}function h(r,n=[]){let e=Object.assign({},r);for(let a of n)a in e&&delete e[a];return e}export{M as RenderFeatures,O as RenderStrategy,m as compact,W as forwardRefWithAs,D as mergeProps,H as render,I as useMergeRefsFn};
{
"name": "@headlessui/react",
"version": "0.0.0-insiders.ef3e154",
"version": "0.0.0-insiders.ef78d58",
"description": "A set of completely unstyled, fully accessible UI components for React, 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,21 +41,24 @@ "type": "module",

"lint": "../../scripts/lint.sh",
"playground": "yarn workspace playground-react dev",
"lint-types": "npm run attw -P --workspaces --if-present",
"playground": "npm run dev --workspace=playground-react",
"clean": "rimraf ./dist"
},
"peerDependencies": {
"react": "^16 || ^17 || ^18",
"react-dom": "^16 || ^17 || ^18"
"react": "^18",
"react-dom": "^18"
},
"devDependencies": {
"@testing-library/react": "^13.0.0",
"@types/react": "^17.0.43",
"@types/react-dom": "^17.0.14",
"esbuild": "^0.11.18",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"snapshot-diff": "^0.8.1"
"@testing-library/react": "^15.0.7",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"snapshot-diff": "^0.10.0"
},
"dependencies": {
"client-only": "^0.0.1"
"@floating-ui/react": "^0.26.16",
"@react-aria/focus": "^3.17.1",
"@react-aria/interactions": "^3.21.3",
"@tanstack/react-virtual": "^3.8.1"
}
}

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