@headlessui/react
Advanced tools
Comparing version 0.2.0 to 0.3.0-cb4fe61
@@ -1,47 +0,231 @@ | ||
import * as React from 'react'; | ||
import React, { ElementType } from 'react'; | ||
import { Props } from '../../types'; | ||
declare const DEFAULT_LISTBOX_TAG: React.ExoticComponent<{ | ||
declare let DEFAULT_LISTBOX_TAG: React.ExoticComponent<{ | ||
children?: React.ReactNode; | ||
}>; | ||
declare type ListboxRenderPropArg = { | ||
interface ListboxRenderPropArg { | ||
open: boolean; | ||
}; | ||
export declare function Listbox<TTag extends React.ElementType = typeof DEFAULT_LISTBOX_TAG, TType = string>(props: Props<TTag, ListboxRenderPropArg> & { | ||
disabled: boolean; | ||
} | ||
export declare function Listbox<TTag extends ElementType = typeof DEFAULT_LISTBOX_TAG, TType = string>(props: Props<TTag, ListboxRenderPropArg, 'value' | 'onChange'> & { | ||
value: TType; | ||
onChange(value: TType): void; | ||
disabled?: boolean; | ||
}): JSX.Element; | ||
export declare namespace Listbox { | ||
var Button: <TTag extends React.ElementType<any> = "button">(props: Props<TTag, ButtonRenderPropArg, ButtonPropsWeControl>, ref: React.Ref<HTMLButtonElement>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>; | ||
var Label: <TTag extends React.ElementType<any> = "label">(props: Props<TTag, LabelRenderPropArg, LabelPropsWeControl>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>; | ||
var Options: <TTag extends React.ElementType<any> = "ul">(props: ListboxOptionsProp<TTag>, ref: React.Ref<HTMLUListElement>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null; | ||
var Option: <TTag extends React.ElementType<any> = "li", TType = string>(props: { | ||
var Button: <TTag extends React.ElementType<any> = "button">(props: Props<TTag, ButtonRenderPropArg, ButtonPropsWeControl>, ref: React.Ref<HTMLButtonElement>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null; | ||
var Label: <TTag extends React.ElementType<any> = "label">(props: Props<TTag, LabelRenderPropArg, LabelPropsWeControl>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null; | ||
var Options: <TTag extends React.ElementType<any> = "ul">(props: ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionsRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "id">> & { | ||
static?: undefined; | ||
} & { | ||
unmount?: boolean | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionsRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "id">> & { | ||
unmount?: undefined; | ||
} & { | ||
static?: boolean | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionsRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "aria-labelledby">> & { | ||
static?: undefined; | ||
} & { | ||
unmount?: boolean | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionsRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "aria-labelledby">> & { | ||
unmount?: undefined; | ||
} & { | ||
static?: boolean | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionsRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "onKeyDown">> & { | ||
static?: undefined; | ||
} & { | ||
unmount?: boolean | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionsRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "onKeyDown">> & { | ||
unmount?: undefined; | ||
} & { | ||
static?: boolean | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionsRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "aria-activedescendant">> & { | ||
static?: undefined; | ||
} & { | ||
unmount?: boolean | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionsRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "aria-activedescendant">> & { | ||
unmount?: undefined; | ||
} & { | ||
static?: boolean | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionsRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "role">> & { | ||
static?: undefined; | ||
} & { | ||
unmount?: boolean | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionsRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "role">> & { | ||
unmount?: undefined; | ||
} & { | ||
static?: boolean | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionsRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "tabIndex">> & { | ||
static?: undefined; | ||
} & { | ||
unmount?: boolean | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionsRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "tabIndex">> & { | ||
unmount?: undefined; | ||
} & { | ||
static?: boolean | undefined; | ||
}), ref: React.Ref<HTMLUListElement>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null; | ||
var Option: <TTag extends React.ElementType<any> = "li", TType = unknown>(props: ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "id" | "onFocus" | "role" | "tabIndex" | "aria-disabled" | "aria-selected" | "onPointerLeave" | "className">> & { | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "value">> & { | ||
disabled?: boolean | undefined; | ||
value: TType; | ||
className?: string | ((bag: OptionRenderPropArg) => string) | undefined; | ||
}) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "id">> & { | ||
disabled?: boolean | undefined; | ||
value: TType; | ||
className?: string | ((bag: OptionRenderPropArg) => string) | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "role">> & { | ||
disabled?: boolean | undefined; | ||
value: TType; | ||
className?: string | ((bag: OptionRenderPropArg) => string) | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "tabIndex">> & { | ||
disabled?: boolean | undefined; | ||
value: TType; | ||
className?: string | ((bag: OptionRenderPropArg) => string) | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "aria-disabled">> & { | ||
disabled?: boolean | undefined; | ||
value: TType; | ||
className?: string | ((bag: OptionRenderPropArg) => string) | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "aria-selected">> & { | ||
disabled?: boolean | undefined; | ||
value: TType; | ||
className?: string | ((bag: OptionRenderPropArg) => string) | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "onPointerLeave">> & { | ||
disabled?: boolean | undefined; | ||
value: TType; | ||
className?: string | ((bag: OptionRenderPropArg) => string) | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "onMouseLeave">> & { | ||
disabled?: boolean | undefined; | ||
value: TType; | ||
className?: string | ((bag: OptionRenderPropArg) => string) | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "onPointerMove">> & { | ||
disabled?: boolean | undefined; | ||
value: TType; | ||
className?: string | ((bag: OptionRenderPropArg) => string) | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "onMouseMove">> & { | ||
disabled?: boolean | undefined; | ||
value: TType; | ||
className?: string | ((bag: OptionRenderPropArg) => string) | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "onFocus">> & { | ||
disabled?: boolean | undefined; | ||
value: TType; | ||
className?: string | ((bag: OptionRenderPropArg) => string) | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: OptionRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "className">> & { | ||
disabled?: boolean | undefined; | ||
value: TType; | ||
className?: string | ((bag: OptionRenderPropArg) => string) | undefined; | ||
})) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null; | ||
} | ||
declare type ButtonPropsWeControl = 'ref' | 'id' | 'type' | 'aria-haspopup' | 'aria-controls' | 'aria-expanded' | 'aria-labelledby' | 'onKeyDown' | 'onFocus' | 'onBlur' | 'onPointerUp'; | ||
declare type ButtonRenderPropArg = { | ||
interface ButtonRenderPropArg { | ||
open: boolean; | ||
focused: boolean; | ||
}; | ||
declare type LabelPropsWeControl = 'id' | 'ref' | 'onPointerUp'; | ||
declare type LabelRenderPropArg = { | ||
disabled: boolean; | ||
} | ||
declare type ButtonPropsWeControl = 'id' | 'type' | 'aria-haspopup' | 'aria-controls' | 'aria-expanded' | 'aria-labelledby' | 'disabled' | 'onKeyDown' | 'onClick'; | ||
interface LabelRenderPropArg { | ||
open: boolean; | ||
}; | ||
declare type OptionsPropsWeControl = 'aria-activedescendant' | 'aria-labelledby' | 'id' | 'onKeyDown' | 'ref' | 'role' | 'tabIndex'; | ||
declare type OptionsRenderPropArg = { | ||
disabled: boolean; | ||
} | ||
declare type LabelPropsWeControl = 'id' | 'ref' | 'onClick'; | ||
interface OptionsRenderPropArg { | ||
open: boolean; | ||
}; | ||
declare type ListboxOptionsProp<TTag> = Props<TTag, OptionsRenderPropArg, OptionsPropsWeControl> & { | ||
static?: boolean; | ||
}; | ||
declare type OptionRenderPropArg = { | ||
} | ||
interface OptionRenderPropArg { | ||
active: boolean; | ||
selected: boolean; | ||
disabled: boolean; | ||
}; | ||
} | ||
export {}; |
@@ -1,24 +0,116 @@ | ||
import * as React from 'react'; | ||
import React, { ElementType } from 'react'; | ||
import { Props } from '../../types'; | ||
declare const DEFAULT_MENU_TAG: React.ExoticComponent<{ | ||
declare let DEFAULT_MENU_TAG: React.ExoticComponent<{ | ||
children?: React.ReactNode; | ||
}>; | ||
declare type MenuRenderPropArg = { | ||
interface MenuRenderPropArg { | ||
open: boolean; | ||
}; | ||
export declare function Menu<TTag extends React.ElementType = typeof DEFAULT_MENU_TAG>(props: Props<TTag, MenuRenderPropArg>): JSX.Element; | ||
} | ||
export declare function Menu<TTag extends ElementType = typeof DEFAULT_MENU_TAG>(props: Props<TTag, MenuRenderPropArg>): JSX.Element; | ||
export declare namespace Menu { | ||
var Button: <TTag extends React.ElementType<any> = "button">(props: Props<TTag, ButtonRenderPropArg, ButtonPropsWeControl>, ref: React.Ref<HTMLButtonElement>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>; | ||
var Items: <TTag extends React.ElementType<any> = "div">(props: { | ||
var Button: <TTag extends React.ElementType<any> = "button">(props: Props<TTag, ButtonRenderPropArg, ButtonPropsWeControl>, ref: React.Ref<HTMLButtonElement>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null; | ||
var Items: <TTag extends React.ElementType<any> = "div">(props: ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: ItemsRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, ItemsPropsWeControl>> & { | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "id">> & { | ||
static?: undefined; | ||
} & { | ||
unmount?: boolean | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: ItemsRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "id">> & { | ||
unmount?: undefined; | ||
} & { | ||
static?: boolean | undefined; | ||
}, ref: React.Ref<HTMLDivElement>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: ItemsRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "onKeyDown">> & { | ||
static?: undefined; | ||
} & { | ||
unmount?: boolean | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: ItemsRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "onKeyDown">> & { | ||
unmount?: undefined; | ||
} & { | ||
static?: boolean | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: ItemsRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "aria-activedescendant">> & { | ||
static?: undefined; | ||
} & { | ||
unmount?: boolean | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: ItemsRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "aria-activedescendant">> & { | ||
unmount?: undefined; | ||
} & { | ||
static?: boolean | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: ItemsRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "aria-labelledby">> & { | ||
static?: undefined; | ||
} & { | ||
unmount?: boolean | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: ItemsRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "aria-labelledby">> & { | ||
unmount?: undefined; | ||
} & { | ||
static?: boolean | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: ItemsRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "role">> & { | ||
static?: undefined; | ||
} & { | ||
unmount?: boolean | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: ItemsRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "role">> & { | ||
unmount?: undefined; | ||
} & { | ||
static?: boolean | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: ItemsRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "tabIndex">> & { | ||
static?: undefined; | ||
} & { | ||
unmount?: boolean | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: ItemsRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "tabIndex">> & { | ||
unmount?: undefined; | ||
} & { | ||
static?: boolean | undefined; | ||
}), ref: React.Ref<HTMLDivElement>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null; | ||
var Item: <TTag extends React.ElementType<any> = React.ExoticComponent<{ | ||
children?: React.ReactNode; | ||
}>>(props: { | ||
}>>(props: ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: ItemRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "id" | "onFocus" | "role" | "tabIndex" | "aria-disabled" | "onPointerLeave" | "className">> & { | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "id">> & { | ||
disabled?: boolean | undefined; | ||
@@ -29,17 +121,105 @@ onClick?: ((event: { | ||
className?: string | ((bag: ItemRenderPropArg) => string) | undefined; | ||
}) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: ItemRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "role">> & { | ||
disabled?: boolean | undefined; | ||
onClick?: ((event: { | ||
preventDefault: Function; | ||
}) => void) | undefined; | ||
className?: string | ((bag: ItemRenderPropArg) => string) | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: ItemRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "tabIndex">> & { | ||
disabled?: boolean | undefined; | ||
onClick?: ((event: { | ||
preventDefault: Function; | ||
}) => void) | undefined; | ||
className?: string | ((bag: ItemRenderPropArg) => string) | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: ItemRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "aria-disabled">> & { | ||
disabled?: boolean | undefined; | ||
onClick?: ((event: { | ||
preventDefault: Function; | ||
}) => void) | undefined; | ||
className?: string | ((bag: ItemRenderPropArg) => string) | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: ItemRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "onPointerLeave">> & { | ||
disabled?: boolean | undefined; | ||
onClick?: ((event: { | ||
preventDefault: Function; | ||
}) => void) | undefined; | ||
className?: string | ((bag: ItemRenderPropArg) => string) | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: ItemRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "onPointerMove">> & { | ||
disabled?: boolean | undefined; | ||
onClick?: ((event: { | ||
preventDefault: Function; | ||
}) => void) | undefined; | ||
className?: string | ((bag: ItemRenderPropArg) => string) | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: ItemRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "onMouseLeave">> & { | ||
disabled?: boolean | undefined; | ||
onClick?: ((event: { | ||
preventDefault: Function; | ||
}) => void) | undefined; | ||
className?: string | ((bag: ItemRenderPropArg) => string) | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: ItemRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "onMouseMove">> & { | ||
disabled?: boolean | undefined; | ||
onClick?: ((event: { | ||
preventDefault: Function; | ||
}) => void) | undefined; | ||
className?: string | ((bag: ItemRenderPropArg) => string) | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: ItemRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "onFocus">> & { | ||
disabled?: boolean | undefined; | ||
onClick?: ((event: { | ||
preventDefault: Function; | ||
}) => void) | undefined; | ||
className?: string | ((bag: ItemRenderPropArg) => string) | undefined; | ||
}) | ({ | ||
as?: TTag | undefined; | ||
children?: string | number | boolean | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal | ((bag: ItemRenderPropArg) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | null | undefined; | ||
refName?: string | undefined; | ||
} & Pick<import("../../types").PropsOf<TTag>, Exclude<keyof import("../../types").PropsOf<TTag>, "className">> & { | ||
disabled?: boolean | undefined; | ||
onClick?: ((event: { | ||
preventDefault: Function; | ||
}) => void) | undefined; | ||
className?: string | ((bag: ItemRenderPropArg) => string) | undefined; | ||
})) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null; | ||
} | ||
declare type ButtonPropsWeControl = 'ref' | 'id' | 'type' | 'aria-haspopup' | 'aria-controls' | 'aria-expanded' | 'onKeyDown' | 'onFocus' | 'onBlur' | 'onPointerUp'; | ||
declare type ButtonRenderPropArg = { | ||
interface ButtonRenderPropArg { | ||
open: boolean; | ||
focused: boolean; | ||
}; | ||
declare type ItemsPropsWeControl = 'aria-activedescendant' | 'aria-labelledby' | 'id' | 'onKeyDown' | 'ref' | 'role' | 'tabIndex'; | ||
declare type ItemsRenderPropArg = { | ||
} | ||
declare type ButtonPropsWeControl = 'id' | 'type' | 'aria-haspopup' | 'aria-controls' | 'aria-expanded' | 'onKeyDown' | 'onClick'; | ||
interface ItemsRenderPropArg { | ||
open: boolean; | ||
}; | ||
declare type ItemRenderPropArg = { | ||
} | ||
interface ItemRenderPropArg { | ||
active: boolean; | ||
disabled: boolean; | ||
}; | ||
} | ||
export {}; |
@@ -1,21 +0,26 @@ | ||
import * as React from 'react'; | ||
import React, { ElementType } from 'react'; | ||
import { Props } from '../../types'; | ||
declare const DEFAULT_SWITCH_TAG = "button"; | ||
declare type SwitchRenderPropArg = { | ||
declare let DEFAULT_SWITCH_TAG: "button"; | ||
interface SwitchRenderPropArg { | ||
checked: boolean; | ||
}; | ||
declare type SwitchPropsWeControl = 'id' | 'role' | 'tabIndex' | 'aria-checked' | 'onClick' | 'onKeyUp'; | ||
export declare function Switch<TTag extends React.ElementType = typeof DEFAULT_SWITCH_TAG>(props: Props<TTag, SwitchRenderPropArg, SwitchPropsWeControl | 'checked' | 'onChange' | 'className'> & { | ||
} | ||
declare type SwitchPropsWeControl = 'id' | 'role' | 'tabIndex' | 'aria-checked' | 'aria-labelledby' | 'aria-describedby' | 'onClick' | 'onKeyUp' | 'onKeyPress'; | ||
export declare function Switch<TTag extends ElementType = typeof DEFAULT_SWITCH_TAG>(props: Props<TTag, SwitchRenderPropArg, SwitchPropsWeControl | 'checked' | 'onChange' | 'className'> & { | ||
checked: boolean; | ||
onChange(checked: boolean): void; | ||
className?: ((bag: SwitchRenderPropArg) => string) | string; | ||
}): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>; | ||
}): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null; | ||
export declare namespace Switch { | ||
var Group: <TTag extends React.ElementType<any> = React.ExoticComponent<{ | ||
children?: React.ReactNode; | ||
}>>(props: Props<TTag, {}, "">) => JSX.Element; | ||
var Label: <TTag extends React.ElementType<any> = "label">(props: Props<TTag, LabelRenderPropArg, LabelPropsWeControl>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>; | ||
}>>(props: Props<TTag, {}, unique symbol>) => JSX.Element; | ||
var Label: <TTag extends React.ElementType<any> = "label">(props: Props<TTag, LabelRenderPropArg, LabelPropsWeControl>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null; | ||
var Description: <TTag extends React.ElementType<any> = "label">(props: Props<TTag, DescriptionRenderPropArg, DescriptionPropsWeControl>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null; | ||
} | ||
declare type LabelPropsWeControl = 'id' | 'ref' | 'onPointerUp'; | ||
declare type LabelRenderPropArg = {}; | ||
interface LabelRenderPropArg { | ||
} | ||
declare type LabelPropsWeControl = 'id' | 'ref' | 'onClick'; | ||
interface DescriptionRenderPropArg { | ||
} | ||
declare type DescriptionPropsWeControl = 'id' | 'ref'; | ||
export {}; |
@@ -1,25 +0,26 @@ | ||
import * as React from 'react'; | ||
export declare type TransitionClasses = Partial<{ | ||
enter: string; | ||
enterFrom: string; | ||
enterTo: string; | ||
leave: string; | ||
leaveFrom: string; | ||
leaveTo: string; | ||
}>; | ||
declare type HTMLTags = keyof JSX.IntrinsicElements; | ||
declare type HTMLTagProps<TTag extends HTMLTags> = JSX.IntrinsicElements[TTag]; | ||
declare type AsShortcut<TTag extends HTMLTags> = { | ||
children?: React.ReactNode; | ||
as?: TTag; | ||
} & Omit<HTMLTagProps<TTag>, 'ref'>; | ||
declare type AsRenderPropFunction = { | ||
children: (ref: React.MutableRefObject<any>) => JSX.Element; | ||
import { ElementType, MutableRefObject } from 'react'; | ||
import { Props } from '../../types'; | ||
import { Features, PropsForFeatures } from '../../utils/render'; | ||
export interface TransitionClasses { | ||
enter?: string; | ||
enterFrom?: string; | ||
enterTo?: string; | ||
leave?: string; | ||
leaveFrom?: string; | ||
leaveTo?: string; | ||
} | ||
export interface TransitionEvents { | ||
beforeEnter?: () => void; | ||
afterEnter?: () => void; | ||
beforeLeave?: () => void; | ||
afterLeave?: () => void; | ||
} | ||
declare type TransitionChildProps<TTag> = Props<TTag, TransitionChildRenderPropArg> & PropsForFeatures<typeof TransitionChildRenderFeatures> & TransitionClasses & TransitionEvents & { | ||
appear?: boolean; | ||
}; | ||
declare type BaseConfig = Partial<{ | ||
appear: boolean; | ||
}>; | ||
declare type TransitionChildProps<TTag extends HTMLTags> = BaseConfig & (AsShortcut<TTag> | AsRenderPropFunction) & TransitionClasses; | ||
declare function TransitionChild<TTag extends HTMLTags = 'div'>(props: TransitionChildProps<TTag>): JSX.Element | null; | ||
export declare function Transition<TTag extends HTMLTags = 'div'>(props: TransitionChildProps<TTag> & { | ||
declare let DEFAULT_TRANSITION_CHILD_TAG: "div"; | ||
declare type TransitionChildRenderPropArg = MutableRefObject<HTMLDivElement>; | ||
declare let TransitionChildRenderFeatures: Features; | ||
declare function TransitionChild<TTag extends ElementType = typeof DEFAULT_TRANSITION_CHILD_TAG>(props: TransitionChildProps<TTag>): JSX.Element; | ||
export declare function Transition<TTag extends ElementType = typeof DEFAULT_TRANSITION_CHILD_TAG>(props: TransitionChildProps<TTag> & { | ||
show: boolean; | ||
@@ -26,0 +27,0 @@ appear?: boolean; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");function n(){return(n=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function t(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n.indexOf(t=i[r])>=0||(o[t]=e[t]);return o}function r(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var o,i="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,u={serverHandoffComplete:!1},a=0;function c(){return++a}function l(){var n=e.useState(u.serverHandoffComplete?c:null),t=n[0],r=n[1];return i((function(){null===t&&r(c())}),[]),e.useEffect((function(){!1===u.serverHandoffComplete&&(u.serverHandoffComplete=!0)}),[]),null!=t?""+t:void 0}function s(){var n=e.useRef(!0);return e.useEffect((function(){n.current=!1}),[]),n.current}function f(e,n){if(e in n){for(var t=n[e],r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return"function"==typeof t?t.apply(void 0,o):t}var u=new Error('Tried to handle "'+e+'" but there is no handler defined. Only defined handlers are: '+Object.keys(n).map((function(e){return'"'+e+'"'})).join(", ")+".");throw Error.captureStackTrace&&Error.captureStackTrace(u,f),u}function d(){var e=[],n={requestAnimationFrame:function(e){function n(){return e.apply(this,arguments)}return n.toString=function(){return e.toString()},n}((function(){var e=requestAnimationFrame.apply(void 0,arguments);n.add((function(){return cancelAnimationFrame(e)}))})),nextFrame:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];n.requestAnimationFrame((function(){n.requestAnimationFrame.apply(n,t)}))},setTimeout:function(e){function n(){return e.apply(this,arguments)}return n.toString=function(){return e.toString()},n}((function(){var e=setTimeout.apply(void 0,arguments);n.add((function(){return clearTimeout(e)}))})),add:function(n){e.push(n)},dispose:function(){e.splice(0).forEach((function(e){return e()}))}};return n}function v(e){for(var n,t=arguments.length,r=new Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];e&&r.length>0&&(n=e.classList).add.apply(n,r)}function p(e){for(var n,t=arguments.length,r=new Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];e&&r.length>0&&(n=e.classList).remove.apply(n,r)}function m(e,n,t,r,i){var u=d(),a=void 0!==i?function(e){var n={called:!1};return function(){if(!n.called)return n.called=!0,e.apply(void 0,arguments)}}(i):function(){};return v.apply(void 0,[e].concat(n,t)),u.nextFrame((function(){p.apply(void 0,[e].concat(t)),v.apply(void 0,[e].concat(r)),u.add(function(e,n){var t=d();if(!e)return t.dispose;var r=getComputedStyle(e),i=[r.transitionDuration,r.transitionDelay].map((function(e){var n=e.split(",").filter(Boolean).map((function(e){return e.includes("ms")?parseFloat(e):1e3*parseFloat(e)})).sort((function(e,n){return n-e}))[0];return void 0===n?0:n})),u=i[0];return 0!==u?t.setTimeout((function(){n(o.Finished)}),u+i[1]):n(o.Finished),t.add((function(){return n(o.Cancelled)})),t.dispose}(e,(function(t){return p.apply(void 0,[e].concat(r,n)),a(t)})))})),u.add((function(){return p.apply(void 0,[e].concat(n,t,r))})),u.add((function(){return a(o.Cancelled)})),u.dispose}function b(n){return void 0===n&&(n=""),e.useMemo((function(){return n.split(" ").filter((function(e){return e.trim().length>1}))}),[n])}!function(e){e.Finished="finished",e.Cancelled="cancelled"}(o||(o={}));var h,y=e.createContext(null);!function(e){e.Visible="visible",e.Hidden="hidden"}(h||(h={}));var x,I,g,C,R,O=e.createContext(null);function S(n){var t=e.useRef(n),r=e.useRef([]),o=function(){var n=e.useRef(!0);return e.useEffect((function(){return function(){n.current=!1}}),[]),n}();e.useEffect((function(){t.current=n}),[n]);var i=e.useCallback((function(e){var n,i=r.current.indexOf(e);-1!==i&&(r.current.splice(i,1),r.current.length<=0&&o.current&&(null===(n=t.current)||void 0===n||n.call(t)))}),[t,o,r]),u=e.useCallback((function(e){return r.current.push(e),function(){return i(e)}}),[r,i]);return e.useMemo((function(){return{children:r,register:u,unregister:i}}),[u,i,r])}function w(n){var r=n.children,u=n.enter,a=n.enterFrom,c=n.enterTo,f=n.leave,d=n.leaveFrom,v=n.leaveTo,p=t(n,["children","enter","enterFrom","enterTo","leave","leaveFrom","leaveTo"]),x=e.useRef(null),I=e.useState(h.Visible),g=I[0],C=I[1],R=function(){var n=e.useContext(y);if(null===n)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return n}(),w=R.show,k=R.appear,E=function(){var n=e.useContext(O);if(null===n)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return n}(),T=E.register,F=E.unregister,D=s(),L=l(),P=e.useRef(!1),M=S((function(){P.current||(C(h.Hidden),F(L))}));i((function(){if(L)return T(L)}),[T,L]);var A=b(u),G=b(a),N=b(c),j=b(f),U=b(d),H=b(v);e.useEffect((function(){if(g===h.Visible&&null===x.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[x,g]);var Q=D&&!k;if(i((function(){var e=x.current;if(e&&!Q)return P.current=!0,w?m(e,A,G,N,(function(){P.current=!1})):m(e,j,U,H,(function(e){P.current=!1,e===o.Finished&&M.children.current.length<=0&&(C(h.Hidden),F(L))}))}),[L,P,F,M,x,Q,w,A,G,N,j,U,H]),g===h.Hidden)return null;if("function"==typeof r)return e.createElement(O.Provider,{value:M},r(x));var B=p.as,V=void 0===B?"div":B,q=t(p,["as"]);return e.createElement(O.Provider,{value:M},e.createElement(V,Object.assign({},q,{ref:x}),r))}function k(n){var r,o=n.show,i=n.appear,u=void 0!==i&&i,a=t(n,["show","appear"]);if(![!0,!1].includes(o))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");var c=e.useState(o?h.Visible:h.Hidden),l=c[0],d=c[1],v=S((function(){d(h.Hidden)})),p=s(),m=e.useMemo((function(){return{show:o,appear:u||!p}}),[o,u,p]);return e.useEffect((function(){o?d(h.Visible):v.children.current.length<=0&&d(h.Hidden)}),[o,v]),e.createElement(O.Provider,{value:v},e.createElement(y.Provider,{value:m},f(l,((r={})[h.Visible]=function(){return e.createElement(w,Object.assign({},a))},r[h.Hidden]=null,r))))}function E(n,o,i){var u=n.as,a=void 0===u?i:u,c=n.children,l=t(n,["as","children"]),s="function"==typeof c?c(o):c;if(a===e.Fragment&&Object.keys(l).length>0){if(Array.isArray(s)&&s.length>1){var f=new Error("You should only render 1 child");throw Error.captureStackTrace&&Error.captureStackTrace(f,E),f}if(!e.isValidElement(s)){var d=new Error('You should render an element as a child. Did you forget the as="..." prop?');throw Error.captureStackTrace&&Error.captureStackTrace(d,E),d}return e.cloneElement(s,function(e,n,t){for(var o,i=Object.assign({},e),u=function(){var t,r=o.value;void 0!==e[r]&&void 0!==n[r]&&Object.assign(i,((t={})[r]=function(t){t.defaultPrevented||e[r](t),t.defaultPrevented||n[r](t)},t))},a=function(e,n){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return r(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?r(e,void 0):void 0}}(e))){t&&(e=t);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}(["onClick"]);!(o=a()).done;)u();return i}(function(e){var n=Object.assign({},e);for(var t in n)void 0===n[t]&&delete n[t];return n}(l),s.props))}return e.createElement(a,l,s)}function T(n){return e.forwardRef(n)}function F(){var n=e.useState(d)[0];return e.useEffect((function(){return function(){return n.dispose()}}),[n]),n}function D(){for(var n=arguments.length,t=new Array(n),r=0;r<n;r++)t[r]=arguments[r];return e.useCallback((function(e){t.forEach((function(n){if(null!==n)return"function"==typeof n?n(e):void(n.current=e)}))}),[t])}k.Child=w,function(e){e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.ArrowUp="ArrowUp",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"}(x||(x={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(g||(g={})),function(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"}(C||(C={})),function(e){e[e.FirstItem=0]="FirstItem",e[e.PreviousItem=1]="PreviousItem",e[e.NextItem=2]="NextItem",e[e.LastItem=3]="LastItem",e[e.SpecificItem=4]="SpecificItem",e[e.Nothing=5]="Nothing"}(R||(R={}));var L=((I={})[C.CloseMenu]=function(e){return n({},e,{menuState:g.Closed})},I[C.OpenMenu]=function(e){return n({},e,{menuState:g.Open})},I[C.GoToItem]=function(e,t){var r=function(e,n,t){var r,o;if(e.items.length<=0)return null;var i=e.items,u=null!==(r=e.activeItemIndex)&&void 0!==r?r:-1,a=f(n,((o={})[R.FirstItem]=function(){return i.findIndex((function(e){return!e.dataRef.current.disabled}))},o[R.PreviousItem]=function(){var e=i.slice().reverse().findIndex((function(e,n,t){return!(-1!==u&&t.length-n-1>=u||e.dataRef.current.disabled)}));return-1===e?e:i.length-1-e},o[R.NextItem]=function(){return i.findIndex((function(e,n){return!(n<=u||e.dataRef.current.disabled)}))},o[R.LastItem]=function(){var e=i.slice().reverse().findIndex((function(e){return!e.dataRef.current.disabled}));return-1===e?e:i.length-1-e},o[R.SpecificItem]=function(){return i.findIndex((function(e){return e.id===t}))},o[R.Nothing]=function(){return null},o));return-1===a?e.activeItemIndex:a}(e,t.focus,t.id);return""===e.searchQuery&&e.activeItemIndex===r?e:n({},e,{searchQuery:"",activeItemIndex:r})},I[C.Search]=function(e,t){var r=e.searchQuery+t.value,o=e.items.findIndex((function(e){var n;return(null===(n=e.dataRef.current.textValue)||void 0===n?void 0:n.startsWith(r))&&!e.dataRef.current.disabled}));return n({},e,-1===o||o===e.activeItemIndex?{searchQuery:r}:{searchQuery:r,activeItemIndex:o})},I[C.ClearSearch]=function(e){return n({},e,{searchQuery:""})},I[C.RegisterItem]=function(e,t){return n({},e,{items:[].concat(e.items,[{id:t.id,dataRef:t.dataRef}])})},I[C.UnregisterItem]=function(e,t){var r=e.items.slice(),o=null!==e.activeItemIndex?r[e.activeItemIndex]:null,i=r.findIndex((function(e){return e.id===t.id}));return-1!==i&&r.splice(i,1),n({},e,{items:r,activeItemIndex:i===e.activeItemIndex||null===o?null:r.indexOf(o)})},I),P=e.createContext(null);function M(n){var t=e.useContext(P);if(null===t){var r=new Error("<"+n+" /> is missing a parent <"+N.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,M),r}return t}function A(e,n){return f(n.type,L,e,n)}var G=e.Fragment;function N(n){var t=F(),r=e.useReducer(A,{menuState:g.Closed,buttonRef:e.createRef(),itemsRef:e.createRef(),items:[],searchQuery:"",activeItemIndex:null}),o=r[0],i=o.menuState,u=o.itemsRef,a=o.buttonRef,c=r[1];e.useEffect((function(){function e(e){var n,r;i===g.Open&&((null===(n=a.current)||void 0===n?void 0:n.contains(e.target))||((null===(r=u.current)||void 0===r?void 0:r.contains(e.target))||c({type:C.CloseMenu}),e.defaultPrevented||t.nextFrame((function(){var e;return null===(e=a.current)||void 0===e?void 0:e.focus()}))))}return window.addEventListener("click",e),function(){return window.removeEventListener("click",e)}}),[i,u,a,t,c]);var l=e.useMemo((function(){return{open:i===g.Open}}),[i]);return e.createElement(P.Provider,{value:r},E(n,l,G))}var j,U,H,Q,B=T((function t(r,o){var i,u=M([N.name,t.name].join(".")),a=u[0],c=u[1],s=D(a.buttonRef,o),f=e.useState(!1),d=f[0],v=f[1],p="headlessui-menu-button-"+l(),m=F(),b=e.useCallback((function(e){switch(e.key){case x.Space:case x.Enter:case x.ArrowDown:e.preventDefault(),c({type:C.OpenMenu}),m.nextFrame((function(){var e;null===(e=a.itemsRef.current)||void 0===e||e.focus(),c({type:C.GoToItem,focus:R.FirstItem})}));break;case x.ArrowUp:e.preventDefault(),c({type:C.OpenMenu}),m.nextFrame((function(){var e;null===(e=a.itemsRef.current)||void 0===e||e.focus(),c({type:C.GoToItem,focus:R.LastItem})}))}}),[c,a,m]),h=e.useCallback((function(e){a.menuState===g.Open?(c({type:C.CloseMenu}),m.nextFrame((function(){var e;return null===(e=a.buttonRef.current)||void 0===e?void 0:e.focus()}))):(e.preventDefault(),c({type:C.OpenMenu}),m.nextFrame((function(){var e;return null===(e=a.itemsRef.current)||void 0===e?void 0:e.focus()})))}),[c,m,a]),y=e.useCallback((function(){var e;a.menuState===g.Open&&(null===(e=a.itemsRef.current)||void 0===e||e.focus()),v(!0)}),[a,v]),I=e.useCallback((function(){return v(!1)}),[v]),O=e.useMemo((function(){return{open:a.menuState===g.Open,focused:d}}),[a,d]);return E(n({},r,{ref:s,id:p,type:"button","aria-haspopup":!0,"aria-controls":null===(i=a.itemsRef.current)||void 0===i?void 0:i.id,"aria-expanded":a.menuState===g.Open||void 0,onKeyDown:b,onFocus:y,onBlur:I,onPointerUp:h}),O,"button")})),V=T((function r(o,i){var u,a,c=o.static,s=void 0!==c&&c,f=t(o,["static"]),v=M([N.name,r.name].join(".")),p=v[0],m=v[1],b=D(p.itemsRef,i),h="headlessui-menu-items-"+l(),y=F(),I=e.useCallback((function(e){switch(y.dispose(),e.key){case x.Space:if(""!==p.searchQuery)return e.preventDefault(),m({type:C.Search,value:e.key});case x.Enter:var n;e.preventDefault(),m({type:C.CloseMenu}),null!==p.activeItemIndex&&(null===(n=document.getElementById(p.items[p.activeItemIndex].id))||void 0===n||n.click()),d().nextFrame((function(){var e;return null===(e=p.buttonRef.current)||void 0===e?void 0:e.focus()}));break;case x.ArrowDown:return e.preventDefault(),m({type:C.GoToItem,focus:R.NextItem});case x.ArrowUp:return e.preventDefault(),m({type:C.GoToItem,focus:R.PreviousItem});case x.Home:case x.PageUp:return e.preventDefault(),m({type:C.GoToItem,focus:R.FirstItem});case x.End:case x.PageDown:return e.preventDefault(),m({type:C.GoToItem,focus:R.LastItem});case x.Escape:e.preventDefault(),m({type:C.CloseMenu}),d().nextFrame((function(){var e;return null===(e=p.buttonRef.current)||void 0===e?void 0:e.focus()}));break;case x.Tab:return e.preventDefault();default:1===e.key.length&&(m({type:C.Search,value:e.key}),y.setTimeout((function(){return m({type:C.ClearSearch})}),350))}}),[m,y,p]),O=e.useMemo((function(){return{open:p.menuState===g.Open}}),[p]),S={"aria-activedescendant":null===p.activeItemIndex||null===(u=p.items[p.activeItemIndex])||void 0===u?void 0:u.id,"aria-labelledby":null===(a=p.buttonRef.current)||void 0===a?void 0:a.id,id:h,onKeyDown:I,role:"menu",tabIndex:0};return s||p.menuState!==g.Closed?E(n({},f,S,{ref:b}),O,"div"):null})),q=e.Fragment;function K(e,n){if(void 0!==e)return"function"==typeof e?e(n):e}function W(n,t){var r=e.useState(n),o=r[0],u=r[1],a=e.useRef(n);return i((function(){a.current=n}),[n]),i((function(){return u(a.current)}),[a,u].concat(t)),o}N.Button=B,N.Items=V,N.Item=function r(o){var u=o.disabled,a=void 0!==u&&u,c=o.className,s=o.onClick,f=t(o,["disabled","className","onClick"]),d=M([N.name,r.name].join(".")),v=d[0],p=d[1],m=F(),b="headlessui-menu-item-"+l(),h=null!==v.activeItemIndex&&v.items[v.activeItemIndex].id===b,y=e.useRef({disabled:a});i((function(){y.current.disabled=a}),[y,a]),i((function(){var e,n;y.current.textValue=null===(e=document.getElementById(b))||void 0===e||null===(n=e.textContent)||void 0===n?void 0:n.toLowerCase()}),[y,b]),i((function(){return p({type:C.RegisterItem,id:b,dataRef:y}),function(){return p({type:C.UnregisterItem,id:b})}}),[y,b]);var x=e.useCallback((function(e){return a?e.preventDefault():(p({type:C.CloseMenu}),m.nextFrame((function(){var e;return null===(e=v.buttonRef.current)||void 0===e?void 0:e.focus()})),s?s(e):void 0)}),[m,p,v.buttonRef,a,s]),I=e.useCallback((function(){if(a)return p({type:C.GoToItem,focus:R.Nothing});p({type:C.GoToItem,focus:R.SpecificItem,id:b})}),[a,b,p]),g=e.useCallback((function(){a||h||p({type:C.GoToItem,focus:R.SpecificItem,id:b})}),[a,h,b,p]),O=e.useCallback((function(){a||h&&p({type:C.GoToItem,focus:R.Nothing})}),[a,h,p]),S=e.useMemo((function(){return{active:h,disabled:a}}),[h,a]);return E(n({},f,{id:b,role:"menuitem",tabIndex:-1,className:K(c,S),"aria-disabled":!0===a||void 0,onClick:x,onFocus:I,onPointerMove:g,onPointerLeave:O}),S,q)},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(U||(U={})),function(e){e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOption=5]="RegisterOption",e[e.UnregisterOption=6]="UnregisterOption"}(H||(H={})),function(e){e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing"}(Q||(Q={}));var Y=((j={})[H.CloseListbox]=function(e){return n({},e,{listboxState:U.Closed})},j[H.OpenListbox]=function(e){return n({},e,{listboxState:U.Open})},j[H.GoToOption]=function(e,t){var r=function(e,n,t){var r,o;if(e.options.length<=0)return null;var i=e.options,u=null!==(r=e.activeOptionIndex)&&void 0!==r?r:-1,a=f(n,((o={})[Q.First]=function(){return i.findIndex((function(e){return!e.dataRef.current.disabled}))},o[Q.Previous]=function(){var e=i.slice().reverse().findIndex((function(e,n,t){return!(-1!==u&&t.length-n-1>=u||e.dataRef.current.disabled)}));return-1===e?e:i.length-1-e},o[Q.Next]=function(){return i.findIndex((function(e,n){return!(n<=u||e.dataRef.current.disabled)}))},o[Q.Last]=function(){var e=i.slice().reverse().findIndex((function(e){return!e.dataRef.current.disabled}));return-1===e?e:i.length-1-e},o[Q.Specific]=function(){return i.findIndex((function(e){return e.id===t}))},o[Q.Nothing]=function(){return null},o));return-1===a?e.activeOptionIndex:a}(e,t.focus,t.id);return""===e.searchQuery&&e.activeOptionIndex===r?e:n({},e,{searchQuery:"",activeOptionIndex:r})},j[H.Search]=function(e,t){var r=e.searchQuery+t.value,o=e.options.findIndex((function(e){var n;return!e.dataRef.current.disabled&&(null===(n=e.dataRef.current.textValue)||void 0===n?void 0:n.startsWith(r))}));return n({},e,-1===o||o===e.activeOptionIndex?{searchQuery:r}:{searchQuery:r,activeOptionIndex:o})},j[H.ClearSearch]=function(e){return n({},e,{searchQuery:""})},j[H.RegisterOption]=function(e,t){return n({},e,{options:[].concat(e.options,[{id:t.id,dataRef:t.dataRef}])})},j[H.UnregisterOption]=function(e,t){var r=e.options.slice(),o=null!==e.activeOptionIndex?r[e.activeOptionIndex]:null,i=r.findIndex((function(e){return e.id===t.id}));return-1!==i&&r.splice(i,1),n({},e,{options:r,activeOptionIndex:i===e.activeOptionIndex||null===o?null:r.indexOf(o)})},j),_=e.createContext(null);function $(e,n){return f(n.type,Y,e,n)}function z(n){var t=e.useContext(_);if(null===t){var r=new Error("<"+n+" /> is missing a parent <"+X.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,z),r}return t}var J=e.Fragment;function X(n){var r=n.value,o=n.onChange,u=t(n,["value","onChange"]),a=F(),c=e.useReducer($,{listboxState:U.Closed,propsRef:{current:{value:r,onChange:o}},labelRef:e.createRef(),buttonRef:e.createRef(),optionsRef:e.createRef(),options:[],searchQuery:"",activeOptionIndex:null}),l=c[0],s=l.listboxState,f=l.propsRef,d=l.optionsRef,v=l.buttonRef,p=c[1];i((function(){f.current.value=r}),[r,f]),i((function(){f.current.onChange=o}),[o,f]),e.useEffect((function(){function e(e){var n,t;s===U.Open&&((null===(n=v.current)||void 0===n?void 0:n.contains(e.target))||((null===(t=d.current)||void 0===t?void 0:t.contains(e.target))||p({type:H.CloseListbox}),e.defaultPrevented||a.nextFrame((function(){var e;return null===(e=v.current)||void 0===e?void 0:e.focus()}))))}return window.addEventListener("click",e),function(){return window.removeEventListener("click",e)}}),[s,d,v,a,p]);var m=e.useMemo((function(){return{open:s===U.Open}}),[s]);return e.createElement(_.Provider,{value:c},E(u,m,J))}var Z=T((function t(r,o){var i,u=z([X.name,t.name].join(".")),a=u[0],c=u[1],s=D(a.buttonRef,o),f=e.useState(!1),d=f[0],v=f[1],p="headlessui-listbox-button-"+l(),m=F(),b=e.useCallback((function(e){switch(e.key){case x.Space:case x.Enter:case x.ArrowDown:e.preventDefault(),c({type:H.OpenListbox}),m.nextFrame((function(){var e;null===(e=a.optionsRef.current)||void 0===e||e.focus(),a.propsRef.current.value||c({type:H.GoToOption,focus:Q.First})}));break;case x.ArrowUp:e.preventDefault(),c({type:H.OpenListbox}),m.nextFrame((function(){var e;null===(e=a.optionsRef.current)||void 0===e||e.focus(),a.propsRef.current.value||c({type:H.GoToOption,focus:Q.Last})}))}}),[c,a,m]),h=e.useCallback((function(e){a.listboxState===U.Open?(c({type:H.CloseListbox}),m.nextFrame((function(){var e;return null===(e=a.buttonRef.current)||void 0===e?void 0:e.focus()}))):(e.preventDefault(),c({type:H.OpenListbox}),m.nextFrame((function(){var e;return null===(e=a.optionsRef.current)||void 0===e?void 0:e.focus()})))}),[c,m,a]),y=e.useCallback((function(){var e;if(a.listboxState===U.Open)return null===(e=a.optionsRef.current)||void 0===e?void 0:e.focus();v(!0)}),[a,v]),I=e.useCallback((function(){return v(!1)}),[v]),g=W((function(){if(a.labelRef.current)return[a.labelRef.current.id,p].join(" ")}),[a.labelRef.current,p]),C=e.useMemo((function(){return{open:a.listboxState===U.Open,focused:d}}),[a,d]);return E(n({},r,{ref:s,id:p,type:"button","aria-haspopup":!0,"aria-controls":null===(i=a.optionsRef.current)||void 0===i?void 0:i.id,"aria-expanded":a.listboxState===U.Open||void 0,"aria-labelledby":g,onKeyDown:b,onFocus:y,onBlur:I,onPointerUp:h}),C,"button")})),ee=T((function r(o,i){var u,a=o.static,c=void 0!==a&&a,s=t(o,["enter","enterFrom","enterTo","leave","leaveFrom","leaveTo","static"]),f=z([X.name,r.name].join(".")),v=f[0],p=f[1],m=D(v.optionsRef,i),b="headlessui-listbox-options-"+l(),h=F(),y=F(),I=e.useCallback((function(e){switch(y.dispose(),e.key){case x.Space:if(""!==v.searchQuery)return e.preventDefault(),p({type:H.Search,value:e.key});case x.Enter:e.preventDefault(),p({type:H.CloseListbox}),null!==v.activeOptionIndex&&v.propsRef.current.onChange(v.options[v.activeOptionIndex].dataRef.current.value),d().nextFrame((function(){var e;return null===(e=v.buttonRef.current)||void 0===e?void 0:e.focus()}));break;case x.ArrowDown:return e.preventDefault(),p({type:H.GoToOption,focus:Q.Next});case x.ArrowUp:return e.preventDefault(),p({type:H.GoToOption,focus:Q.Previous});case x.Home:case x.PageUp:return e.preventDefault(),p({type:H.GoToOption,focus:Q.First});case x.End:case x.PageDown:return e.preventDefault(),p({type:H.GoToOption,focus:Q.Last});case x.Escape:return e.preventDefault(),p({type:H.CloseListbox}),h.nextFrame((function(){var e;return null===(e=v.buttonRef.current)||void 0===e?void 0:e.focus()}));case x.Tab:return e.preventDefault();default:1===e.key.length&&(p({type:H.Search,value:e.key}),y.setTimeout((function(){return p({type:H.ClearSearch})}),350))}}),[h,p,y,v]),g=W((function(){var e,n,t;return null!==(e=null===(n=v.labelRef.current)||void 0===n?void 0:n.id)&&void 0!==e?e:null===(t=v.buttonRef.current)||void 0===t?void 0:t.id}),[v.labelRef.current,v.buttonRef.current]),C=e.useMemo((function(){return{open:v.listboxState===U.Open}}),[v]),R={"aria-activedescendant":null===v.activeOptionIndex||null===(u=v.options[v.activeOptionIndex])||void 0===u?void 0:u.id,"aria-labelledby":g,id:b,onKeyDown:I,role:"listbox",tabIndex:0};return c||v.listboxState!==U.Closed?E(n({},s,R,{ref:m}),C,"ul"):null}));function ne(e,n){if(void 0!==e)return"function"==typeof e?e(n):e}X.Button=Z,X.Label=function t(r){var o=z([X.name,t.name].join("."))[0],i="headlessui-listbox-label-"+l(),u=e.useCallback((function(){var e;return null===(e=o.buttonRef.current)||void 0===e?void 0:e.focus()}),[o.buttonRef]),a=e.useMemo((function(){return{open:o.listboxState===U.Open}}),[o]);return E(n({},r,{ref:o.labelRef,id:i,onPointerUp:u}),a,"label")},X.Options=ee,X.Option=function r(o){var u=o.disabled,a=void 0!==u&&u,c=o.value,s=o.className,f=t(o,["disabled","value","className"]),v=z([X.name,r.name].join(".")),p=v[0],m=v[1],b="headlessui-listbox-option-"+l(),h=null!==p.activeOptionIndex&&p.options[p.activeOptionIndex].id===b,y=p.propsRef.current.value===c,x=e.useRef({disabled:a,value:c});i((function(){x.current.disabled=a}),[x,a]),i((function(){x.current.value=c}),[x,c]),i((function(){var e,n;x.current.textValue=null===(e=document.getElementById(b))||void 0===e||null===(n=e.textContent)||void 0===n?void 0:n.toLowerCase()}),[x,b]);var I=e.useCallback((function(){return p.propsRef.current.onChange(c)}),[p.propsRef,c]);i((function(){return m({type:H.RegisterOption,id:b,dataRef:x}),function(){return m({type:H.UnregisterOption,id:b})}}),[x,b]),i((function(){var e,n;y&&(m({type:H.GoToOption,focus:Q.Specific,id:b}),null===(e=document.getElementById(b))||void 0===e||null===(n=e.focus)||void 0===n||n.call(e))}),[]),i((function(){if(h){var e=d();return e.nextFrame((function(){var e,n;return null===(e=document.getElementById(b))||void 0===e||null===(n=e.scrollIntoView)||void 0===n?void 0:n.call(e,{block:"nearest"})})),e.dispose}}),[h]);var g=e.useCallback((function(e){if(a)return e.preventDefault();I(),m({type:H.CloseListbox}),d().nextFrame((function(){var e;return null===(e=p.buttonRef.current)||void 0===e?void 0:e.focus()}))}),[m,p.buttonRef,a,I]),C=e.useCallback((function(){if(a)return m({type:H.GoToOption,focus:Q.Nothing});m({type:H.GoToOption,focus:Q.Specific,id:b})}),[a,b,m]),R=e.useCallback((function(){a||h||m({type:H.GoToOption,focus:Q.Specific,id:b})}),[a,h,b,m]),O=e.useCallback((function(){a||h&&m({type:H.GoToOption,focus:Q.Nothing})}),[a,h,m]),S=e.useMemo((function(){return{active:h,selected:y,disabled:a}}),[h,y,a]);return E(n({},f,{id:b,role:"option",tabIndex:-1,className:ne(s,S),"aria-disabled":!0===a||void 0,"aria-selected":!0===y||void 0,onClick:g,onFocus:C,onPointerMove:R,onPointerLeave:O}),S,"li")};var te=e.createContext(null);function re(n){var t=e.useContext(te);if(null===t){var r=new Error("<"+n+" /> is missing a parent <Switch.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,re),r}return t}var oe=e.Fragment;function ie(r){var o,i=r.checked,u=r.onChange,a=r.className,c=t(r,["checked","onChange","className"]),s="headlessui-switch-"+l(),f=e.useContext(te),d=e.useCallback((function(){return u(!i)}),[u,i]),v=e.useCallback((function(e){e.preventDefault(),d()}),[d]),p=e.useCallback((function(e){e.key===x.Space&&(e.preventDefault(),d())}),[d]),m=e.useMemo((function(){return{checked:i}}),[i]);return E(n({},c,{id:s,ref:null===f?void 0:f.setSwitch,role:"switch",tabIndex:0,className:ue(a,m),"aria-checked":i,"aria-labelledby":null==f||null===(o=f.label)||void 0===o?void 0:o.id,onClick:v,onKeyUp:p}),m,"button")}function ue(e,n){if(void 0!==e)return"function"==typeof e?e(n):e}ie.Group=function(n){var t=e.useState(null),r=t[0],o=t[1],i=e.useState(null),u=i[0],a=i[1],c=e.useMemo((function(){return{switch:r,label:u,setSwitch:o,setLabel:a}}),[r,o,u,a]);return e.createElement(te.Provider,{value:c},E(n,{},oe))},ie.Label=function t(r){var o=re([ie.name,t.name].join(".")),i="headlessui-switch-label-"+l(),u=e.useCallback((function(){o.switch&&(o.switch.click(),o.switch.focus())}),[o.switch]);return E(n({},r,{ref:o.setLabel,id:i,onPointerUp:u}),{},"label")},exports.Listbox=X,exports.Menu=N,exports.Switch=ie,exports.Transition=k; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,n,r,o=require("react"),i=(e=o)&&"object"==typeof e&&"default"in e?e.default:e,u=require("react-dom");function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function c(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return l(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function f(e,t){if(e in t){for(var n=t[e],r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return"function"==typeof n?n.apply(void 0,o):n}var u=new Error('Tried to handle "'+e+'" but there is no handler defined. Only defined handlers are: '+Object.keys(t).map((function(e){return'"'+e+'"'})).join(", ")+".");throw Error.captureStackTrace&&Error.captureStackTrace(u,f),u}function d(e,r,o,i,u){if(void 0===u&&(u=!0),u)return p(e,r,o);var l=null!=i?i:t.None;if(l&t.Static){var s=e.static,d=void 0!==s&&s,v=c(e,["static"]);if(d)return p(v,r,o)}if(l&t.RenderStrategy){var m,h=e.unmount,b=void 0===h||h,y=c(e,["unmount"]);return f(b?n.Unmount:n.Hidden,((m={})[n.Unmount]=function(){return null},m[n.Hidden]=function(){return p(a({},y,{hidden:!0,style:{display:"none"}}),r,o)},m))}return p(e,r,o)}function p(e,t,n){var r,i=m(e,["unmount","static"]),u=i.as,a=void 0===u?n:u,l=i.children,f=i.refName,d=void 0===f?"ref":f,v=c(i,["as","children","refName"]),h=void 0!==e.ref?((r={})[d]=e.ref,r):{},b="function"==typeof l?l(t):l;if(a===o.Fragment&&Object.keys(v).length>0){if(Array.isArray(b)&&b.length>1){var y=new Error("You should only render 1 child");throw Error.captureStackTrace&&Error.captureStackTrace(y,p),y}if(!o.isValidElement(b)){var g=new Error('You should render an element as a child. Did you forget the as="..." prop?');throw Error.captureStackTrace&&Error.captureStackTrace(g,p),g}return o.cloneElement(b,Object.assign({},function(e,t,n){for(var r,o=Object.assign({},e),i=function(){var n,i=r.value;void 0!==e[i]&&void 0!==t[i]&&Object.assign(o,((n={})[i]=function(n){n.defaultPrevented||e[i](n),n.defaultPrevented||t[i](n)},n))},u=s(["onClick"]);!(r=u()).done;)i();return o}(function(e){var t=Object.assign({},e);for(var n in t)void 0===t[n]&&delete t[n];return t}(m(v,["ref"])),b.props),h))}return o.createElement(a,Object.assign({},m(v,["ref"]),a!==o.Fragment&&h),b)}function v(e){return Object.assign(o.forwardRef(e),{name:e.name})}function m(e,t){void 0===t&&(t=[]);for(var n,r=Object.assign({},e),o=s(t);!(n=o()).done;){var i=n.value;i in r&&delete r[i]}return r}function h(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return o.useCallback((function(e){t.forEach((function(t){if(null!=t)return"function"==typeof t?t(e):void(t.current=e)}))}),[t])}function b(e){for(var t,n,r=e.parentElement,o=null;r&&!(r instanceof HTMLFieldSetElement);)r instanceof HTMLLegendElement&&(o=r),r=r.parentElement;var i=null!=(t=""===(null==(n=r)?void 0:n.getAttribute("disabled")))&&t;return(!i||!function(e){if(!e)return!1;for(var t=e.previousElementSibling;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(o))&&i}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(t||(t={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(n||(n={})),function(e){e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.ArrowUp="ArrowUp",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"}(r||(r={}));var y="undefined"!=typeof window?o.useLayoutEffect:o.useEffect,g={serverHandoffComplete:!1},x=0;function w(){return++x}function E(){var e=o.useState(g.serverHandoffComplete?w:null),t=e[0],n=e[1];return y((function(){null===t&&n(w())}),[t]),o.useEffect((function(){!1===g.serverHandoffComplete&&(g.serverHandoffComplete=!0)}),[]),null!=t?""+t:void 0}var S=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map((function(e){return e+":not([tabindex='-1'])"})).join(",");function C(e){e&&e.focus({preventScroll:!0})}function O(e,t,n){void 0===t&&(t=!0),void 0===n&&(n={});var i=o.useRef("undefined"!=typeof window?document.activeElement:null),u=o.useRef(null),a=o.useRef(!1),c=o.useCallback((function(){return e.current?Array.from(e.current.querySelectorAll(S)):[]}),[e]);y((function(){var r,o,l,s;if(t){a.current=!0;var f,d=document.activeElement;if(null==(r=n.initialFocus)?void 0:r.current){if((null==(f=n.initialFocus)?void 0:f.current)===d)return}else if(null==(o=e.current)?void 0:o.contains(d))return;i.current=d;var p=c();if(p.length<=0)throw new Error("There are no focusable elements inside the <FocusTrap />");return function e(t){void 0!==t&&(C(t),document.activeElement!==t?e(p[p.indexOf(t)+1]):u.current=t)}(null!=(l=null==(s=n.initialFocus)?void 0:s.current)?l:p[0]),function(){a.current=!1,C(i.current),i.current=null,u.current=null}}}),[t,a,n.initialFocus]),y((function(){if(t)return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)};function e(e){if(e.key===r.Tab&&document.activeElement){e.preventDefault();var t=e.shiftKey?-1:1,n=c(),o=n.length,i=n.indexOf(document.activeElement);!function e(r){void 0===r&&(r=0);var a=(n.indexOf(document.activeElement)+o+t+r)%o,c=n[a];if(C(c),c!==document.activeElement){if(i===a)return;e(r+t)}else u.current=c}()}}}),[t,c]),y((function(){if(t&&e.current){var n=e.current;return window.addEventListener("focus",r,!0),function(){return window.removeEventListener("focus",r,!0)}}function r(e){var t=u.current;if(t&&a.current){var r=e.target;r&&r instanceof HTMLElement?n.contains(r)?(u.current=r,C(r)):(e.preventDefault(),e.stopPropagation(),C(t)):C(u.current)}}}),[t,a,e])}function I(e,t){return e(t={exports:{}},t.exports),t.exports}var k=I((function(e){var t=function(e){var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",i=r.asyncIterator||"@@asyncIterator",u=r.toStringTag||"@@toStringTag";function a(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{a({},"")}catch(e){a=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var o=Object.create((t&&t.prototype instanceof f?t:f).prototype),i=new S(r||[]);return o._invoke=function(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return{value:void 0,done:!0}}for(n.method=o,n.arg=i;;){var u=n.delegate;if(u){var a=x(u,n);if(a){if(a===s)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=l(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===s)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}(e,n,i),o}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var s={};function f(){}function d(){}function p(){}var v={};v[o]=function(){return this};var m=Object.getPrototypeOf,h=m&&m(m(C([])));h&&h!==t&&n.call(h,o)&&(v=h);var b=p.prototype=f.prototype=Object.create(v);function y(e){["next","throw","return"].forEach((function(t){a(e,t,(function(e){return this._invoke(t,e)}))}))}function g(e,t){var r;this._invoke=function(o,i){function u(){return new t((function(r,u){!function r(o,i,u,a){var c=l(e[o],e,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,u,a)}),(function(e){r("throw",e,u,a)})):t.resolve(f).then((function(e){s.value=e,u(s)}),(function(e){return r("throw",e,u,a)}))}a(c.arg)}(o,i,r,u)}))}return r=r?r.then(u,u):u()}}function x(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method))return s;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var r=l(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,s;var o=r.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,s):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,s)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function C(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return d.prototype=b.constructor=p,p.constructor=d,d.displayName=a(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,a(e,u,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},y(g.prototype),g.prototype[i]=function(){return this},e.AsyncIterator=g,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var u=new g(c(t,n,r,o),i);return e.isGeneratorFunction(n)?u:u.next().then((function(e){return e.done?e.value:u.next()}))},y(b),a(b,u,"Generator"),b[o]=function(){return this},b.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=C,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return u.type="throw",u.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var a=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(a&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=e,u.arg=t,i?(this.method="next",this.next=i.finallyLoc,s):this.complete(u)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),s},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),s}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:C(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),s}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}})),R=k.mark(T);function T(e){var t;return k.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(e.parentElement){n.next=2;break}return n.abrupt("return");case 2:t=e.parentElement.firstChild;case 3:if(!t){n.next=10;break}if(!(t!==e&&t instanceof HTMLElement)){n.next=7;break}return n.next=7,t;case 7:t=t.nextSibling,n.next=3;break;case 10:case"end":return n.stop()}}),R)}var L,D,F,P=o.Fragment;function M(e){var t=o.useState((function(){if("undefined"==typeof window)return null;var e=document.getElementById("headlessui-portal-root");if(e)return e;var t=document.createElement("div");return t.setAttribute("id","headlessui-portal-root"),document.body.appendChild(t)}))[0];return y((function(){return function(){t&&t.childNodes.length<=1&&document.body.removeChild(t)}}),[t]),t?u.createPortal(d(e,{},P),t):null}!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(D||(D={})),function(e){e[e.SetTitleElement=0]="SetTitleElement",e[e.SetDescriptionElement=1]="SetDescriptionElement"}(F||(F={}));var A=((L={})[F.SetTitleElement]=function(e,t){return e.titleElement===t.element?e:a({},e,{titleElement:t.element})},L[F.SetDescriptionElement]=function(e,t){return e.descriptionElement===t.element?e:a({},e,{descriptionElement:t.element})},L),N=o.createContext(null);function j(e){var t=o.useContext(N);if(null===t){var n=new Error("<"+e+" /> is missing a parent <"+B.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,j),n}return t}function G(e,t){return f(t.type,A,e,t)}N.displayName="DialogContext";var U,H,V,_=t.RenderStrategy|t.Static,B=Object.assign(v((function(e,t){var n,u,l=e.open,f=e.onClose,p=e.initialFocus,v=c(e,["open","onClose","initialFocus"]),m=o.useRef(null),b=h(m,t),g=e.hasOwnProperty("open"),x=e.hasOwnProperty("onClose");if(!g)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!x)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if("boolean"!=typeof l)throw new Error("You provided an `open` prop to the `Dialog`, but the value is not a boolean. Received: "+l);if("function"!=typeof f)throw new Error("You provided an `onClose` prop to the `Dialog`, but the value is not a function. Received: "+f);var w=l?D.Open:D.Closed,S=o.useReducer(G,{titleElement:null,descriptionElement:null}),C=S[0],I=S[1],k=o.useCallback((function(){return f(!1)}),[f]),R=o.useCallback((function(e){return I({type:F.SetTitleElement,element:e})}),[I]),L=o.useCallback((function(e){return I({type:F.SetDescriptionElement,element:e})}),[I]);o.useEffect((function(){function e(e){e.key===r.Escape&&w===D.Open&&k()}return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)}}),[k,w]),o.useEffect((function(){if(w===D.Open){var e=window.scrollX,t=window.scrollY,n=document.documentElement.style.overflow,r=document.documentElement.style.paddingRight,o=window.innerWidth-document.documentElement.clientWidth;return document.documentElement.style.overflow="hidden",document.documentElement.style.paddingRight=o+"px",function(){document.documentElement.style.overflow=n,document.documentElement.style.paddingRight=r,window.scroll(e,t)}}}),[w]),o.useEffect((function(){if(w===D.Open&&m.current){var e=new IntersectionObserver((function(e){for(var t,n=s(e);!(t=n()).done;)t.value.isIntersecting||k()}),{root:document.body});return e.observe(m.current),function(){return e.disconnect()}}}),[w,m,k]);var P=!!e.static||w===D.Open;O(m,P,{initialFocus:p}),function(e,t){void 0===t&&(t=!0),y((function(){if(t&&e.current){for(var n,r=e.current,o=new Map,i=s(T(r));!(n=i()).done;){var u=n.value;o.set(u,{"aria-hidden":u.getAttribute("aria-hidden"),inert:u.inert})}document.querySelectorAll("body > *").forEach((function(e){e!==r&&e instanceof HTMLElement&&(e.contains(r)||o.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}))}));for(var a,c=s(o.keys());!(a=c()).done;){var l=a.value;l.setAttribute("aria-hidden","true"),l.inert=!0}return function(){for(var e,t=s(o.entries());!(e=t()).done;){var n=e.value,r=n[0],i=n[1];null!==r&&(null===i["aria-hidden"]?r.removeAttribute("aria-hidden"):r.setAttribute("aria-hidden",i["aria-hidden"]),r.inert=i.inert)}o.clear()}}}),[t])}(m,P);var A="headlessui-dialog-"+E(),j=o.useMemo((function(){return[{dialogState:w,close:k,setTitle:R,setDescription:L},C]}),[w,C,k,R,L]),U=o.useMemo((function(){return{open:w===D.Open,close:k}}),[w,k]),H={ref:b,id:A,role:"dialog","aria-modal":w===D.Open||void 0,"aria-labelledby":null==(n=C.titleElement)?void 0:n.id,"aria-describedby":null==(u=C.descriptionElement)?void 0:u.id};return i.createElement(M,null,i.createElement(N.Provider,{value:j},d(a({},v,H),U,"div",_,w===D.Open)))})),{Overlay:v((function e(t,n){var r=j([B.name,e.name].join("."))[0],i=r.dialogState,u=r.close,c=h(n),l="headlessui-dialog-overlay-"+E(),s=o.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();u()}),[u]),f=o.useMemo((function(){return{open:i===D.Open}}),[i]);return d(a({},t,{ref:c,id:l,"aria-hidden":!0,onClick:s}),f,"div")})),Title:function e(t){var n=j([B.name,e.name].join("."))[0],r=n.dialogState,i=n.setTitle,u="headlessui-dialog-title-"+E(),c=o.useMemo((function(){return{open:r===D.Open}}),[r]);return d(a({},t,{ref:i,id:u}),c,"h2")},Description:function e(t){var n=j([B.name,e.name].join("."))[0],r=n.dialogState,i=n.setDescription,u="headlessui-dialog-description-"+E(),c=o.useMemo((function(){return{open:r===D.Open}}),[r]);return d(a({},t,{ref:i,id:u}),c,"p")}});!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(H||(H={})),function(e){e[e.ToggleDisclosure=0]="ToggleDisclosure",e[e.SetButtonId=1]="SetButtonId",e[e.SetPanelId=2]="SetPanelId",e[e.LinkPanel=3]="LinkPanel",e[e.UnlinkPanel=4]="UnlinkPanel"}(V||(V={}));var Q=((U={})[V.ToggleDisclosure]=function(e){var t;return a({},e,{disclosureState:f(e.disclosureState,(t={},t[H.Open]=H.Closed,t[H.Closed]=H.Open,t))})},U[V.LinkPanel]=function(e){return a({},e,{linkedPanel:!0})},U[V.UnlinkPanel]=function(e){return a({},e,{linkedPanel:!1})},U[V.SetButtonId]=function(e,t){return a({},e,{buttonId:t.buttonId})},U[V.SetPanelId]=function(e,t){return a({},e,{panelId:t.panelId})},U),K=o.createContext(null);function Y(e){var t=o.useContext(K);if(null===t){var n=new Error("<"+e+" /> is missing a parent <"+J.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,Y),n}return t}function q(e,t){return f(t.type,Q,e,t)}K.displayName="DisclosureContext";var W=o.Fragment;function J(e){var t="headlessui-disclosure-button-"+E(),n="headlessui-disclosure-panel-"+E(),r=o.useReducer(q,{disclosureState:H.Closed,linkedPanel:!1,buttonId:t,panelId:n}),u=r[0].disclosureState,a=r[1];o.useEffect((function(){return a({type:V.SetButtonId,buttonId:t})}),[t,a]),o.useEffect((function(){return a({type:V.SetPanelId,panelId:n})}),[n,a]);var c=o.useMemo((function(){return{open:u===H.Open}}),[u]);return i.createElement(K.Provider,{value:r},d(e,c,W))}var X,$,z,Z,ee=v((function e(t,n){var i=Y([J.name,e.name].join(".")),u=i[0],c=i[1],l=h(n),s=o.useCallback((function(e){switch(e.key){case r.Space:case r.Enter:e.preventDefault(),c({type:V.ToggleDisclosure})}}),[c]),f=o.useCallback((function(e){b(e.currentTarget)||t.disabled||c({type:V.ToggleDisclosure})}),[c,t.disabled]),p=o.useMemo((function(){return{open:u.disclosureState===H.Open}}),[u]);return d(a({},t,{ref:l,id:u.buttonId,type:"button","aria-expanded":u.disclosureState===H.Open||void 0,"aria-controls":u.linkedPanel?u.panelId:void 0,onKeyDown:s,onClick:f}),p,"button")})),te=t.RenderStrategy|t.Static,ne=v((function e(t,n){var r=Y([J.name,e.name].join(".")),u=r[0],c=r[1],l=h(n,(function(){u.linkedPanel||c({type:V.LinkPanel})}));o.useEffect((function(){return function(){return c({type:V.UnlinkPanel})}}),[c]),i.useEffect((function(){var e;u.disclosureState!==H.Closed||null!=(e=t.unmount)&&!e||c({type:V.UnlinkPanel})}),[u.disclosureState,t.unmount,c]);var s=i.useMemo((function(){return{open:u.disclosureState===H.Open}}),[u]);return d(a({},t,{ref:l,id:u.panelId}),s,"div",te,u.disclosureState===H.Open)}));function re(){var e=[],t={requestAnimationFrame:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=requestAnimationFrame.apply(void 0,arguments);t.add((function(){return cancelAnimationFrame(e)}))})),nextFrame:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t.requestAnimationFrame((function(){t.requestAnimationFrame.apply(t,n)}))},setTimeout:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=setTimeout.apply(void 0,arguments);t.add((function(){return clearTimeout(e)}))})),add:function(t){e.push(t)},dispose:function(){for(var t,n=s(e.splice(0));!(t=n()).done;)(0,t.value)()}};return t}function oe(){var e=o.useState(re)[0];return o.useEffect((function(){return function(){return e.dispose()}}),[e]),e}function ie(e,t){var n=o.useState(e),r=n[0],i=n[1],u=o.useRef(e);return y((function(){u.current=e}),[e]),y((function(){return i(u.current)}),[u,i].concat(t)),r}function ue(e,t){var n=t.resolveItems();if(n.length<=0)return null;var r=t.resolveActiveIndex(),o=null!=r?r:-1,i=function(){switch(e.focus){case X.First:return n.findIndex((function(e){return!t.resolveDisabled(e)}));case X.Previous:var r=n.slice().reverse().findIndex((function(e,n,r){return!(-1!==o&&r.length-n-1>=o||t.resolveDisabled(e))}));return-1===r?r:n.length-1-r;case X.Next:return n.findIndex((function(e,n){return!(n<=o||t.resolveDisabled(e))}));case X.Last:var i=n.slice().reverse().findIndex((function(e){return!t.resolveDisabled(e)}));return-1===i?i:n.length-1-i;case X.Specific:return n.findIndex((function(n){return t.resolveId(n)===e.id}));case X.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===i?r:i}function ae(e,t){if(void 0!==e)return"function"==typeof e?e(t):e}J.Button=ee,J.Panel=ne,function(e){e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing"}(X||(X={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(z||(z={})),function(e){e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.SetDisabled=2]="SetDisabled",e[e.GoToOption=3]="GoToOption",e[e.Search=4]="Search",e[e.ClearSearch=5]="ClearSearch",e[e.RegisterOption=6]="RegisterOption",e[e.UnregisterOption=7]="UnregisterOption"}(Z||(Z={}));var ce=(($={})[Z.CloseListbox]=function(e){return e.disabled||e.listboxState===z.Closed?e:a({},e,{activeOptionIndex:null,listboxState:z.Closed})},$[Z.OpenListbox]=function(e){return e.disabled||e.listboxState===z.Open?e:a({},e,{listboxState:z.Open})},$[Z.SetDisabled]=function(e,t){return e.disabled===t.disabled?e:a({},e,{disabled:t.disabled})},$[Z.GoToOption]=function(e,t){if(e.disabled)return e;if(e.listboxState===z.Closed)return e;var n=ue(t,{resolveItems:function(){return e.options},resolveActiveIndex:function(){return e.activeOptionIndex},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.current.disabled}});return""===e.searchQuery&&e.activeOptionIndex===n?e:a({},e,{searchQuery:"",activeOptionIndex:n})},$[Z.Search]=function(e,t){if(e.disabled)return e;if(e.listboxState===z.Closed)return e;var n=e.searchQuery+t.value,r=e.options.findIndex((function(e){var t;return!e.dataRef.current.disabled&&(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(n))}));return a({},e,-1===r||r===e.activeOptionIndex?{searchQuery:n}:{searchQuery:n,activeOptionIndex:r})},$[Z.ClearSearch]=function(e){return e.disabled||e.listboxState===z.Closed||""===e.searchQuery?e:a({},e,{searchQuery:""})},$[Z.RegisterOption]=function(e,t){return a({},e,{options:[].concat(e.options,[{id:t.id,dataRef:t.dataRef}])})},$[Z.UnregisterOption]=function(e,t){var n=e.options.slice(),r=null!==e.activeOptionIndex?n[e.activeOptionIndex]:null,o=n.findIndex((function(e){return e.id===t.id}));return-1!==o&&n.splice(o,1),a({},e,{options:n,activeOptionIndex:o===e.activeOptionIndex||null===r?null:n.indexOf(r)})},$),le=o.createContext(null);function se(e){var t=o.useContext(le);if(null===t){var n=new Error("<"+e+" /> is missing a parent <"+pe.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,se),n}return t}function fe(e,t){return f(t.type,ce,e,t)}le.displayName="ListboxContext";var de=o.Fragment;function pe(e){var t=e.value,n=e.onChange,r=e.disabled,u=void 0!==r&&r,a=c(e,["value","onChange","disabled"]),l=oe(),s=o.useReducer(fe,{listboxState:z.Closed,propsRef:{current:{value:t,onChange:n}},labelRef:o.createRef(),buttonRef:o.createRef(),optionsRef:o.createRef(),disabled:u,options:[],searchQuery:"",activeOptionIndex:null}),f=s[0],p=f.listboxState,v=f.propsRef,m=f.optionsRef,h=f.buttonRef,b=s[1];y((function(){v.current.value=t}),[t,v]),y((function(){v.current.onChange=n}),[n,v]),y((function(){return b({type:Z.SetDisabled,disabled:u})}),[u]),o.useEffect((function(){function e(e){var t,n,r,o=e.target,i=document.activeElement;p===z.Open&&((null==(t=h.current)?void 0:t.contains(o))||((null==(n=m.current)?void 0:n.contains(o))||b({type:Z.CloseListbox}),i!==document.body&&(null==i?void 0:i.contains(o))||e.defaultPrevented||null==(r=h.current)||r.focus({preventScroll:!0})))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[p,m,h,l,b]);var g=o.useMemo((function(){return{open:p===z.Open,disabled:u}}),[p,u]);return i.createElement(le.Provider,{value:s},d(a,g,de))}var ve,me,he,be=v((function e(t,n){var i,u=se([pe.name,e.name].join(".")),c=u[0],l=u[1],s=h(c.buttonRef,n),f="headlessui-listbox-button-"+E(),p=oe(),v=o.useCallback((function(e){switch(e.key){case r.Space:case r.Enter:case r.ArrowDown:e.preventDefault(),l({type:Z.OpenListbox}),p.nextFrame((function(){var e;null==(e=c.optionsRef.current)||e.focus({preventScroll:!0}),c.propsRef.current.value||l({type:Z.GoToOption,focus:X.First})}));break;case r.ArrowUp:e.preventDefault(),l({type:Z.OpenListbox}),p.nextFrame((function(){var e;null==(e=c.optionsRef.current)||e.focus({preventScroll:!0}),c.propsRef.current.value||l({type:Z.GoToOption,focus:X.Last})}))}}),[l,c,p]),m=o.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();c.listboxState===z.Open?(l({type:Z.CloseListbox}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:Z.OpenListbox}),p.nextFrame((function(){var e;return null==(e=c.optionsRef.current)?void 0:e.focus({preventScroll:!0})})))}),[l,p,c]),y=ie((function(){if(c.labelRef.current)return[c.labelRef.current.id,f].join(" ")}),[c.labelRef.current,f]),g=o.useMemo((function(){return{open:c.listboxState===z.Open,disabled:c.disabled}}),[c]);return d(a({},t,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(i=c.optionsRef.current)?void 0:i.id,"aria-expanded":c.listboxState===z.Open||void 0,"aria-labelledby":y,disabled:c.disabled,onKeyDown:v,onClick:m}),g,"button")})),ye=t.RenderStrategy|t.Static,ge=v((function e(t,n){var i,u=se([pe.name,e.name].join(".")),c=u[0],l=u[1],s=h(c.optionsRef,n),f="headlessui-listbox-options-"+E(),p=oe(),v=oe(),m=o.useCallback((function(e){switch(v.dispose(),e.key){case r.Space:if(""!==c.searchQuery)return e.preventDefault(),l({type:Z.Search,value:e.key});case r.Enter:e.preventDefault(),l({type:Z.CloseListbox}),null!==c.activeOptionIndex&&c.propsRef.current.onChange(c.options[c.activeOptionIndex].dataRef.current.value),re().nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case r.ArrowDown:return e.preventDefault(),l({type:Z.GoToOption,focus:X.Next});case r.ArrowUp:return e.preventDefault(),l({type:Z.GoToOption,focus:X.Previous});case r.Home:case r.PageUp:return e.preventDefault(),l({type:Z.GoToOption,focus:X.First});case r.End:case r.PageDown:return e.preventDefault(),l({type:Z.GoToOption,focus:X.Last});case r.Escape:return e.preventDefault(),l({type:Z.CloseListbox}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));case r.Tab:return e.preventDefault();default:1===e.key.length&&(l({type:Z.Search,value:e.key}),v.setTimeout((function(){return l({type:Z.ClearSearch})}),350))}}),[p,l,v,c]),b=ie((function(){var e,t,n;return null!=(e=null==(t=c.labelRef.current)?void 0:t.id)?e:null==(n=c.buttonRef.current)?void 0:n.id}),[c.labelRef.current,c.buttonRef.current]),y=o.useMemo((function(){return{open:c.listboxState===z.Open}}),[c]);return d(a({},t,{"aria-activedescendant":null===c.activeOptionIndex||null==(i=c.options[c.activeOptionIndex])?void 0:i.id,"aria-labelledby":b,id:f,onKeyDown:m,role:"listbox",tabIndex:0,ref:s}),y,"ul",ye,c.listboxState===z.Open)}));pe.Button=be,pe.Label=function e(t){var n=se([pe.name,e.name].join("."))[0],r="headlessui-listbox-label-"+E(),i=o.useCallback((function(){var e;return null==(e=n.buttonRef.current)?void 0:e.focus({preventScroll:!0})}),[n.buttonRef]),u=o.useMemo((function(){return{open:n.listboxState===z.Open,disabled:n.disabled}}),[n]);return d(a({},t,{ref:n.labelRef,id:r,onClick:i}),u,"label")},pe.Options=ge,pe.Option=function e(t){var n=t.disabled,r=void 0!==n&&n,i=t.value,u=t.className,l=c(t,["disabled","value","className"]),s=se([pe.name,e.name].join(".")),f=s[0],p=s[1],v="headlessui-listbox-option-"+E(),m=null!==f.activeOptionIndex&&f.options[f.activeOptionIndex].id===v,h=f.propsRef.current.value===i,b=o.useRef({disabled:r,value:i});y((function(){b.current.disabled=r}),[b,r]),y((function(){b.current.value=i}),[b,i]),y((function(){var e,t;b.current.textValue=null==(e=document.getElementById(v))||null==(t=e.textContent)?void 0:t.toLowerCase()}),[b,v]);var g=o.useCallback((function(){return f.propsRef.current.onChange(i)}),[f.propsRef,i]);y((function(){return p({type:Z.RegisterOption,id:v,dataRef:b}),function(){return p({type:Z.UnregisterOption,id:v})}}),[b,v]),y((function(){var e;f.listboxState===z.Open&&h&&(p({type:Z.GoToOption,focus:X.Specific,id:v}),null==(e=document.getElementById(v))||null==e.focus||e.focus())}),[f.listboxState]),y((function(){if(f.listboxState===z.Open&&m){var e=re();return e.nextFrame((function(){var e;return null==(e=document.getElementById(v))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[v,m,f.listboxState]);var x=o.useCallback((function(e){if(r)return e.preventDefault();g(),p({type:Z.CloseListbox}),re().nextFrame((function(){var e;return null==(e=f.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))}),[p,f.buttonRef,r,g]),w=o.useCallback((function(){if(r)return p({type:Z.GoToOption,focus:X.Nothing});p({type:Z.GoToOption,focus:X.Specific,id:v})}),[r,v,p]),S=o.useCallback((function(){r||m||p({type:Z.GoToOption,focus:X.Specific,id:v})}),[r,m,v,p]),C=o.useCallback((function(){r||m&&p({type:Z.GoToOption,focus:X.Nothing})}),[r,m,p]),O=o.useMemo((function(){return{active:m,selected:h,disabled:r}}),[m,h,r]);return d(a({},l,{id:v,role:"option",tabIndex:-1,className:ae(u,O),"aria-disabled":!0===r||void 0,"aria-selected":!0===h||void 0,onClick:x,onFocus:w,onPointerMove:S,onMouseMove:S,onPointerLeave:C,onMouseLeave:C}),O,"li")},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(me||(me={})),function(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"}(he||(he={}));var xe=((ve={})[he.CloseMenu]=function(e){return a({},e,{activeItemIndex:null,menuState:me.Closed})},ve[he.OpenMenu]=function(e){return a({},e,{menuState:me.Open})},ve[he.GoToItem]=function(e,t){var n=ue(t,{resolveItems:function(){return e.items},resolveActiveIndex:function(){return e.activeItemIndex},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.current.disabled}});return""===e.searchQuery&&e.activeItemIndex===n?e:a({},e,{searchQuery:"",activeItemIndex:n})},ve[he.Search]=function(e,t){var n=e.searchQuery+t.value,r=e.items.findIndex((function(e){var t;return(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(n))&&!e.dataRef.current.disabled}));return a({},e,-1===r||r===e.activeItemIndex?{searchQuery:n}:{searchQuery:n,activeItemIndex:r})},ve[he.ClearSearch]=function(e){return a({},e,{searchQuery:""})},ve[he.RegisterItem]=function(e,t){return a({},e,{items:[].concat(e.items,[{id:t.id,dataRef:t.dataRef}])})},ve[he.UnregisterItem]=function(e,t){var n=e.items.slice(),r=null!==e.activeItemIndex?n[e.activeItemIndex]:null,o=n.findIndex((function(e){return e.id===t.id}));return-1!==o&&n.splice(o,1),a({},e,{items:n,activeItemIndex:o===e.activeItemIndex||null===r?null:n.indexOf(r)})},ve),we=o.createContext(null);function Ee(e){var t=o.useContext(we);if(null===t){var n=new Error("<"+e+" /> is missing a parent <"+Oe.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,Ee),n}return t}function Se(e,t){return f(t.type,xe,e,t)}we.displayName="MenuContext";var Ce=o.Fragment;function Oe(e){var t=o.useReducer(Se,{menuState:me.Closed,buttonRef:o.createRef(),itemsRef:o.createRef(),items:[],searchQuery:"",activeItemIndex:null}),n=t[0],r=n.menuState,u=n.itemsRef,a=n.buttonRef,c=t[1];o.useEffect((function(){function e(e){var t,n,o,i=e.target,l=document.activeElement;r===me.Open&&((null==(t=a.current)?void 0:t.contains(i))||((null==(n=u.current)?void 0:n.contains(i))||c({type:he.CloseMenu}),l!==document.body&&(null==l?void 0:l.contains(i))||e.defaultPrevented||null==(o=a.current)||o.focus({preventScroll:!0})))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[r,u,a,c]);var l=o.useMemo((function(){return{open:r===me.Open}}),[r]);return i.createElement(we.Provider,{value:t},d(e,l,Ce))}var Ie=v((function e(t,n){var i,u=Ee([Oe.name,e.name].join(".")),c=u[0],l=u[1],s=h(c.buttonRef,n),f="headlessui-menu-button-"+E(),p=oe(),v=o.useCallback((function(e){switch(e.key){case r.Space:case r.Enter:case r.ArrowDown:e.preventDefault(),l({type:he.OpenMenu}),p.nextFrame((function(){var e;null==(e=c.itemsRef.current)||e.focus({preventScroll:!0}),l({type:he.GoToItem,focus:X.First})}));break;case r.ArrowUp:e.preventDefault(),l({type:he.OpenMenu}),p.nextFrame((function(){var e;null==(e=c.itemsRef.current)||e.focus({preventScroll:!0}),l({type:he.GoToItem,focus:X.Last})}))}}),[l,c,p]),m=o.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();t.disabled||(c.menuState===me.Open?(l({type:he.CloseMenu}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:he.OpenMenu}),p.nextFrame((function(){var e;return null==(e=c.itemsRef.current)?void 0:e.focus({preventScroll:!0})}))))}),[l,p,c,t.disabled]),y=o.useMemo((function(){return{open:c.menuState===me.Open}}),[c]);return d(a({},t,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(i=c.itemsRef.current)?void 0:i.id,"aria-expanded":c.menuState===me.Open||void 0,onKeyDown:v,onClick:m}),y,"button")})),ke=t.RenderStrategy|t.Static,Re=v((function e(t,n){var i,u,c=Ee([Oe.name,e.name].join(".")),l=c[0],s=c[1],f=h(l.itemsRef,n),p="headlessui-menu-items-"+E(),v=oe();y((function(){var e=l.itemsRef.current;if(e&&l.menuState===me.Open)for(var t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:function(e){return"menuitem"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}});t.nextNode();)t.currentNode.setAttribute("role","none")}));var m=o.useCallback((function(e){switch(v.dispose(),e.key){case r.Space:if(""!==l.searchQuery)return e.preventDefault(),s({type:he.Search,value:e.key});case r.Enter:var t;e.preventDefault(),s({type:he.CloseMenu}),null!==l.activeItemIndex&&(null==(t=document.getElementById(l.items[l.activeItemIndex].id))||t.click()),re().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case r.ArrowDown:return e.preventDefault(),s({type:he.GoToItem,focus:X.Next});case r.ArrowUp:return e.preventDefault(),s({type:he.GoToItem,focus:X.Previous});case r.Home:case r.PageUp:return e.preventDefault(),s({type:he.GoToItem,focus:X.First});case r.End:case r.PageDown:return e.preventDefault(),s({type:he.GoToItem,focus:X.Last});case r.Escape:e.preventDefault(),s({type:he.CloseMenu}),re().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case r.Tab:return e.preventDefault();default:1===e.key.length&&(s({type:he.Search,value:e.key}),v.setTimeout((function(){return s({type:he.ClearSearch})}),350))}}),[s,v,l]),b=o.useMemo((function(){return{open:l.menuState===me.Open}}),[l]);return d(a({},t,{"aria-activedescendant":null===l.activeItemIndex||null==(i=l.items[l.activeItemIndex])?void 0:i.id,"aria-labelledby":null==(u=l.buttonRef.current)?void 0:u.id,id:p,onKeyDown:m,role:"menu",tabIndex:0,ref:f}),b,"div",ke,l.menuState===me.Open)})),Te=o.Fragment;Oe.Button=Ie,Oe.Items=Re,Oe.Item=function e(t){var n=t.disabled,r=void 0!==n&&n,i=t.className,u=t.onClick,l=c(t,["disabled","className","onClick"]),s=Ee([Oe.name,e.name].join(".")),f=s[0],p=s[1],v="headlessui-menu-item-"+E(),m=null!==f.activeItemIndex&&f.items[f.activeItemIndex].id===v;y((function(){if(f.menuState===me.Open&&m){var e=re();return e.nextFrame((function(){var e;return null==(e=document.getElementById(v))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[v,m,f.menuState]);var h=o.useRef({disabled:r});y((function(){h.current.disabled=r}),[h,r]),y((function(){var e,t;h.current.textValue=null==(e=document.getElementById(v))||null==(t=e.textContent)?void 0:t.toLowerCase()}),[h,v]),y((function(){return p({type:he.RegisterItem,id:v,dataRef:h}),function(){return p({type:he.UnregisterItem,id:v})}}),[h,v]);var b=o.useCallback((function(e){return r?e.preventDefault():(p({type:he.CloseMenu}),re().nextFrame((function(){var e;return null==(e=f.buttonRef.current)?void 0:e.focus({preventScroll:!0})})),u?u(e):void 0)}),[p,f.buttonRef,r,u]),g=o.useCallback((function(){if(r)return p({type:he.GoToItem,focus:X.Nothing});p({type:he.GoToItem,focus:X.Specific,id:v})}),[r,v,p]),x=o.useCallback((function(){r||m||p({type:he.GoToItem,focus:X.Specific,id:v})}),[r,m,v,p]),w=o.useCallback((function(){r||m&&p({type:he.GoToItem,focus:X.Nothing})}),[r,m,p]),S=o.useMemo((function(){return{active:m,disabled:r}}),[m,r]);return d(a({},l,{id:v,role:"menuitem",tabIndex:-1,className:ae(i,S),"aria-disabled":!0===r||void 0,onClick:b,onFocus:g,onPointerMove:x,onMouseMove:x,onPointerLeave:w,onMouseLeave:w}),S,Te)};var Le=o.createContext(null);function De(e){var t=o.useContext(Le);if(null===t){var n=new Error("<"+e+" /> is missing a parent <Switch.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(n,De),n}return t}Le.displayName="GroupContext";var Fe,Pe=o.Fragment;function Me(e){var t,n,i=e.checked,u=e.onChange,l=e.className,s=c(e,["checked","onChange","className"]),f="headlessui-switch-"+E(),p=o.useContext(Le),v=o.useCallback((function(){return u(!i)}),[u,i]),m=o.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();e.preventDefault(),v()}),[v]),h=o.useCallback((function(e){e.key!==r.Tab&&e.preventDefault(),e.key===r.Space&&v()}),[v]),y=o.useCallback((function(e){return e.preventDefault()}),[]),g=o.useMemo((function(){return{checked:i}}),[i]),x={id:f,ref:null===p?void 0:p.setSwitch,role:"switch",tabIndex:0,className:ae(l,g),"aria-checked":i,"aria-labelledby":null==p||null==(t=p.label)?void 0:t.id,"aria-describedby":null==p||null==(n=p.description)?void 0:n.id,onClick:m,onKeyUp:h,onKeyPress:y};return"button"===s.as&&Object.assign(x,{type:"button"}),d(a({},s,x),g,"button")}function Ae(){var e=o.useRef(!0);return o.useEffect((function(){e.current=!1}),[]),e.current}function Ne(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e&&r.length>0&&(t=e.classList).add.apply(t,r)}function je(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e&&r.length>0&&(t=e.classList).remove.apply(t,r)}function Ge(e,t,n,r,o){var i=re(),u=void 0!==o?function(e){var t={called:!1};return function(){if(!t.called)return t.called=!0,e.apply(void 0,arguments)}}(o):function(){};return Ne.apply(void 0,[e].concat(t,n)),i.nextFrame((function(){je.apply(void 0,[e].concat(n)),Ne.apply(void 0,[e].concat(r)),i.add(function(e,t){var n=re();if(!e)return n.dispose;var r=getComputedStyle(e),o=[r.transitionDuration,r.transitionDelay].map((function(e){var t=e.split(",").filter(Boolean).map((function(e){return e.includes("ms")?parseFloat(e):1e3*parseFloat(e)})).sort((function(e,t){return t-e}))[0];return void 0===t?0:t})),i=o[0];return 0!==i?n.setTimeout((function(){t(Fe.Finished)}),i+o[1]):t(Fe.Finished),n.add((function(){return t(Fe.Cancelled)})),n.dispose}(e,(function(n){return je.apply(void 0,[e].concat(r,t)),u(n)})))})),i.add((function(){return je.apply(void 0,[e].concat(t,n,r))})),i.add((function(){return u(Fe.Cancelled)})),i.dispose}function Ue(e){return void 0===e&&(e=""),o.useMemo((function(){return e.split(" ").filter((function(e){return e.trim().length>1}))}),[e])}Me.Group=function(e){var t=o.useState(null),n=t[0],r=t[1],u=o.useState(null),a=u[0],c=u[1],l=o.useState(null),s=l[0],f=l[1],p=o.useMemo((function(){return{switch:n,setSwitch:r,label:a,setLabel:c,description:s,setDescription:f}}),[n,r,a,c,s,f]);return i.createElement(Le.Provider,{value:p},d(e,{},Pe))},Me.Label=function e(t){var n=De([Me.name,e.name].join(".")),r="headlessui-switch-label-"+E(),i=o.useCallback((function(){n.switch&&(n.switch.click(),n.switch.focus({preventScroll:!0}))}),[n.switch]);return d(a({},t,{ref:n.setLabel,id:r,onClick:i}),{},"label")},Me.Description=function e(t){var n=De([Me.name,e.name].join(".")),r="headlessui-switch-description-"+E();return d(a({},t,{ref:n.setDescription,id:r}),{},"p")},function(e){e.Finished="finished",e.Cancelled="cancelled"}(Fe||(Fe={}));var He,Ve=o.createContext(null);Ve.displayName="TransitionContext",function(e){e.Visible="visible",e.Hidden="hidden"}(He||(He={}));var _e=o.createContext(null);function Be(e){return"children"in e?Be(e.children):e.current.filter((function(e){return e.state===He.Visible})).length>0}function Qe(e){var t=o.useRef(e),r=o.useRef([]),i=function(){var e=o.useRef(!0);return o.useEffect((function(){return function(){e.current=!1}}),[]),e}();o.useEffect((function(){t.current=e}),[e]);var u=o.useCallback((function(e,o){var u;void 0===o&&(o=n.Hidden);var a=r.current.findIndex((function(t){return t.id===e}));-1!==a&&(f(o,((u={})[n.Unmount]=function(){r.current.splice(a,1)},u[n.Hidden]=function(){r.current[a].state=He.Hidden},u)),!Be(r)&&i.current&&(null==t.current||t.current()))}),[t,i,r]),a=o.useCallback((function(e){var t=r.current.find((function(t){return t.id===e}));return t?t.state!==He.Visible&&(t.state=He.Visible):r.current.push({id:e,state:He.Visible}),function(){return u(e,n.Unmount)}}),[r,u]);return o.useMemo((function(){return{children:r,register:a,unregister:u}}),[a,u,r])}function Ke(){}_e.displayName="NestingContext";var Ye=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function qe(e){for(var t,n={},r=s(Ye);!(t=r()).done;){var o,i=t.value;n[i]=null!=(o=e[i])?o:Ke}return n}var We=t.RenderStrategy;function Je(e){var t=e.beforeEnter,r=e.afterEnter,u=e.beforeLeave,l=e.afterLeave,s=e.enter,p=e.enterFrom,v=e.enterTo,m=e.leave,h=e.leaveFrom,b=e.leaveTo,g=c(e,["beforeEnter","afterEnter","beforeLeave","afterLeave","enter","enterFrom","enterTo","leave","leaveFrom","leaveTo"]),x=o.useRef(null),w=o.useState(He.Visible),S=w[0],C=w[1],O=g.unmount?n.Unmount:n.Hidden,I=function(){var e=o.useContext(Ve);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),k=I.show,R=I.appear,T=function(){var e=o.useContext(_e);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),L=T.register,D=T.unregister,F=Ae(),P=E(),M=o.useRef(!1),A=Qe((function(){M.current||(C(He.Hidden),D(P),_.current.afterLeave())}));y((function(){if(P)return L(P)}),[L,P]),y((function(){var e;O===n.Hidden&&P&&(k&&S!==He.Visible?C(He.Visible):f(S,((e={})[He.Hidden]=function(){return D(P)},e[He.Visible]=function(){return L(P)},e)))}),[S,P,L,D,k,O]);var N=Ue(s),j=Ue(p),G=Ue(v),U=Ue(m),H=Ue(h),V=Ue(b),_=function(e){var t=o.useRef(qe(e));return o.useEffect((function(){t.current=qe(e)}),[e]),t}({beforeEnter:t,afterEnter:r,beforeLeave:u,afterLeave:l});o.useEffect((function(){if(S===He.Visible&&null===x.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[x,S]);var B=F&&!R;return y((function(){var e=x.current;if(e&&!B)return M.current=!0,k&&_.current.beforeEnter(),k||_.current.beforeLeave(),k?Ge(e,N,j,G,(function(e){M.current=!1,e===Fe.Finished&&_.current.afterEnter()})):Ge(e,U,H,V,(function(e){M.current=!1,e===Fe.Finished&&(Be(A)||(C(He.Hidden),D(P),_.current.afterLeave()))}))}),[_,P,M,D,A,x,B,k,N,j,G,U,H,V]),i.createElement(_e.Provider,{value:A},d(a({},g,{ref:x}),{},"div",We,S===He.Visible))}function Xe(e){var t=e.show,n=e.appear,r=void 0!==n&&n,u=e.unmount,l=c(e,["show","appear","unmount"]);if(![!0,!1].includes(t))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");var s=o.useState(t?He.Visible:He.Hidden),f=s[0],p=s[1],v=Qe((function(){p(He.Hidden)})),m=Ae(),h=o.useMemo((function(){return{show:t,appear:r||!m}}),[t,r,m]);o.useEffect((function(){t?p(He.Visible):Be(v)||p(He.Hidden)}),[t,v]);var b={unmount:u};return i.createElement(_e.Provider,{value:v},i.createElement(Ve.Provider,{value:h},d(a({},b,{as:o.Fragment,children:i.createElement(Je,Object.assign({},b,l))}),{},o.Fragment,We,f===He.Visible)))}Xe.Child=Je,exports.Dialog=B,exports.Disclosure=J,exports.FocusTrap=function(e){var t=o.useRef(null),n=e.initialFocus,r=c(e,["initialFocus"]);return O(t,!0,{initialFocus:n}),d(a({},r,{ref:t}),{},"div")},exports.Listbox=pe,exports.Menu=Oe,exports.Portal=M,exports.Switch=Me,exports.Transition=Xe; | ||
//# sourceMappingURL=headlessui.cjs.production.min.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],n):n((e=e||self).headlessui={},e.React)}(this,(function(e,n){"use strict";function t(){return(t=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function r(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n.indexOf(t=i[r])>=0||(o[t]=e[t]);return o}function o(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var i,u="undefined"!=typeof window?n.useLayoutEffect:n.useEffect,a={serverHandoffComplete:!1},c=0;function l(){return++c}function s(){var e=n.useState(a.serverHandoffComplete?l:null),t=e[0],r=e[1];return u((function(){null===t&&r(l())}),[]),n.useEffect((function(){!1===a.serverHandoffComplete&&(a.serverHandoffComplete=!0)}),[]),null!=t?""+t:void 0}function f(){var e=n.useRef(!0);return n.useEffect((function(){e.current=!1}),[]),e.current}function d(e,n){if(e in n){for(var t=n[e],r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return"function"==typeof t?t.apply(void 0,o):t}var u=new Error('Tried to handle "'+e+'" but there is no handler defined. Only defined handlers are: '+Object.keys(n).map((function(e){return'"'+e+'"'})).join(", ")+".");throw Error.captureStackTrace&&Error.captureStackTrace(u,d),u}function v(){var e=[],n={requestAnimationFrame:function(e){function n(){return e.apply(this,arguments)}return n.toString=function(){return e.toString()},n}((function(){var e=requestAnimationFrame.apply(void 0,arguments);n.add((function(){return cancelAnimationFrame(e)}))})),nextFrame:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];n.requestAnimationFrame((function(){n.requestAnimationFrame.apply(n,t)}))},setTimeout:function(e){function n(){return e.apply(this,arguments)}return n.toString=function(){return e.toString()},n}((function(){var e=setTimeout.apply(void 0,arguments);n.add((function(){return clearTimeout(e)}))})),add:function(n){e.push(n)},dispose:function(){e.splice(0).forEach((function(e){return e()}))}};return n}function p(e){for(var n,t=arguments.length,r=new Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];e&&r.length>0&&(n=e.classList).add.apply(n,r)}function m(e){for(var n,t=arguments.length,r=new Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];e&&r.length>0&&(n=e.classList).remove.apply(n,r)}function b(e,n,t,r,o){var u=v(),a=void 0!==o?function(e){var n={called:!1};return function(){if(!n.called)return n.called=!0,e.apply(void 0,arguments)}}(o):function(){};return p.apply(void 0,[e].concat(n,t)),u.nextFrame((function(){m.apply(void 0,[e].concat(t)),p.apply(void 0,[e].concat(r)),u.add(function(e,n){var t=v();if(!e)return t.dispose;var r=getComputedStyle(e),o=[r.transitionDuration,r.transitionDelay].map((function(e){var n=e.split(",").filter(Boolean).map((function(e){return e.includes("ms")?parseFloat(e):1e3*parseFloat(e)})).sort((function(e,n){return n-e}))[0];return void 0===n?0:n})),u=o[0];return 0!==u?t.setTimeout((function(){n(i.Finished)}),u+o[1]):n(i.Finished),t.add((function(){return n(i.Cancelled)})),t.dispose}(e,(function(t){return m.apply(void 0,[e].concat(r,n)),a(t)})))})),u.add((function(){return m.apply(void 0,[e].concat(n,t,r))})),u.add((function(){return a(i.Cancelled)})),u.dispose}function h(e){return void 0===e&&(e=""),n.useMemo((function(){return e.split(" ").filter((function(e){return e.trim().length>1}))}),[e])}!function(e){e.Finished="finished",e.Cancelled="cancelled"}(i||(i={}));var y,x=n.createContext(null);!function(e){e.Visible="visible",e.Hidden="hidden"}(y||(y={}));var I,g,C,R,O,S=n.createContext(null);function w(e){var t=n.useRef(e),r=n.useRef([]),o=function(){var e=n.useRef(!0);return n.useEffect((function(){return function(){e.current=!1}}),[]),e}();n.useEffect((function(){t.current=e}),[e]);var i=n.useCallback((function(e){var n,i=r.current.indexOf(e);-1!==i&&(r.current.splice(i,1),r.current.length<=0&&o.current&&(null===(n=t.current)||void 0===n||n.call(t)))}),[t,o,r]),u=n.useCallback((function(e){return r.current.push(e),function(){return i(e)}}),[r,i]);return n.useMemo((function(){return{children:r,register:u,unregister:i}}),[u,i,r])}function k(e){var t=e.children,o=e.enter,a=e.enterFrom,c=e.enterTo,l=e.leave,d=e.leaveFrom,v=e.leaveTo,p=r(e,["children","enter","enterFrom","enterTo","leave","leaveFrom","leaveTo"]),m=n.useRef(null),I=n.useState(y.Visible),g=I[0],C=I[1],R=function(){var e=n.useContext(x);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),O=R.show,k=R.appear,E=function(){var e=n.useContext(S);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),T=E.register,F=E.unregister,D=f(),L=s(),P=n.useRef(!1),M=w((function(){P.current||(C(y.Hidden),F(L))}));u((function(){if(L)return T(L)}),[T,L]);var A=h(o),G=h(a),N=h(c),j=h(l),U=h(d),H=h(v);n.useEffect((function(){if(g===y.Visible&&null===m.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[m,g]);var Q=D&&!k;if(u((function(){var e=m.current;if(e&&!Q)return P.current=!0,O?b(e,A,G,N,(function(){P.current=!1})):b(e,j,U,H,(function(e){P.current=!1,e===i.Finished&&M.children.current.length<=0&&(C(y.Hidden),F(L))}))}),[L,P,F,M,m,Q,O,A,G,N,j,U,H]),g===y.Hidden)return null;if("function"==typeof t)return n.createElement(S.Provider,{value:M},t(m));var B=p.as,V=void 0===B?"div":B,q=r(p,["as"]);return n.createElement(S.Provider,{value:M},n.createElement(V,Object.assign({},q,{ref:m}),t))}function E(e){var t,o=e.show,i=e.appear,u=void 0!==i&&i,a=r(e,["show","appear"]);if(![!0,!1].includes(o))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");var c=n.useState(o?y.Visible:y.Hidden),l=c[0],s=c[1],v=w((function(){s(y.Hidden)})),p=f(),m=n.useMemo((function(){return{show:o,appear:u||!p}}),[o,u,p]);return n.useEffect((function(){o?s(y.Visible):v.children.current.length<=0&&s(y.Hidden)}),[o,v]),n.createElement(S.Provider,{value:v},n.createElement(x.Provider,{value:m},d(l,((t={})[y.Visible]=function(){return n.createElement(k,Object.assign({},a))},t[y.Hidden]=null,t))))}function T(e,t,i){var u=e.as,a=void 0===u?i:u,c=e.children,l=r(e,["as","children"]),s="function"==typeof c?c(t):c;if(a===n.Fragment&&Object.keys(l).length>0){if(Array.isArray(s)&&s.length>1){var f=new Error("You should only render 1 child");throw Error.captureStackTrace&&Error.captureStackTrace(f,T),f}if(!n.isValidElement(s)){var d=new Error('You should render an element as a child. Did you forget the as="..." prop?');throw Error.captureStackTrace&&Error.captureStackTrace(d,T),d}return n.cloneElement(s,function(e,n,t){for(var r,i=Object.assign({},e),u=function(){var t,o=r.value;void 0!==e[o]&&void 0!==n[o]&&Object.assign(i,((t={})[o]=function(t){t.defaultPrevented||e[o](t),t.defaultPrevented||n[o](t)},t))},a=function(e,n){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return o(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?o(e,void 0):void 0}}(e))){t&&(e=t);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}(["onClick"]);!(r=a()).done;)u();return i}(function(e){var n=Object.assign({},e);for(var t in n)void 0===n[t]&&delete n[t];return n}(l),s.props))}return n.createElement(a,l,s)}function F(e){return n.forwardRef(e)}function D(){var e=n.useState(v)[0];return n.useEffect((function(){return function(){return e.dispose()}}),[e]),e}function L(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.useCallback((function(e){t.forEach((function(n){if(null!==n)return"function"==typeof n?n(e):void(n.current=e)}))}),[t])}E.Child=k,function(e){e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.ArrowUp="ArrowUp",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"}(I||(I={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(C||(C={})),function(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"}(R||(R={})),function(e){e[e.FirstItem=0]="FirstItem",e[e.PreviousItem=1]="PreviousItem",e[e.NextItem=2]="NextItem",e[e.LastItem=3]="LastItem",e[e.SpecificItem=4]="SpecificItem",e[e.Nothing=5]="Nothing"}(O||(O={}));var P=((g={})[R.CloseMenu]=function(e){return t({},e,{menuState:C.Closed})},g[R.OpenMenu]=function(e){return t({},e,{menuState:C.Open})},g[R.GoToItem]=function(e,n){var r=function(e,n,t){var r,o;if(e.items.length<=0)return null;var i=e.items,u=null!==(r=e.activeItemIndex)&&void 0!==r?r:-1,a=d(n,((o={})[O.FirstItem]=function(){return i.findIndex((function(e){return!e.dataRef.current.disabled}))},o[O.PreviousItem]=function(){var e=i.slice().reverse().findIndex((function(e,n,t){return!(-1!==u&&t.length-n-1>=u||e.dataRef.current.disabled)}));return-1===e?e:i.length-1-e},o[O.NextItem]=function(){return i.findIndex((function(e,n){return!(n<=u||e.dataRef.current.disabled)}))},o[O.LastItem]=function(){var e=i.slice().reverse().findIndex((function(e){return!e.dataRef.current.disabled}));return-1===e?e:i.length-1-e},o[O.SpecificItem]=function(){return i.findIndex((function(e){return e.id===t}))},o[O.Nothing]=function(){return null},o));return-1===a?e.activeItemIndex:a}(e,n.focus,n.id);return""===e.searchQuery&&e.activeItemIndex===r?e:t({},e,{searchQuery:"",activeItemIndex:r})},g[R.Search]=function(e,n){var r=e.searchQuery+n.value,o=e.items.findIndex((function(e){var n;return(null===(n=e.dataRef.current.textValue)||void 0===n?void 0:n.startsWith(r))&&!e.dataRef.current.disabled}));return t({},e,-1===o||o===e.activeItemIndex?{searchQuery:r}:{searchQuery:r,activeItemIndex:o})},g[R.ClearSearch]=function(e){return t({},e,{searchQuery:""})},g[R.RegisterItem]=function(e,n){return t({},e,{items:[].concat(e.items,[{id:n.id,dataRef:n.dataRef}])})},g[R.UnregisterItem]=function(e,n){var r=e.items.slice(),o=null!==e.activeItemIndex?r[e.activeItemIndex]:null,i=r.findIndex((function(e){return e.id===n.id}));return-1!==i&&r.splice(i,1),t({},e,{items:r,activeItemIndex:i===e.activeItemIndex||null===o?null:r.indexOf(o)})},g),M=n.createContext(null);function A(e){var t=n.useContext(M);if(null===t){var r=new Error("<"+e+" /> is missing a parent <"+j.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,A),r}return t}function G(e,n){return d(n.type,P,e,n)}var N=n.Fragment;function j(e){var t=D(),r=n.useReducer(G,{menuState:C.Closed,buttonRef:n.createRef(),itemsRef:n.createRef(),items:[],searchQuery:"",activeItemIndex:null}),o=r[0],i=o.menuState,u=o.itemsRef,a=o.buttonRef,c=r[1];n.useEffect((function(){function e(e){var n,r;i===C.Open&&((null===(n=a.current)||void 0===n?void 0:n.contains(e.target))||((null===(r=u.current)||void 0===r?void 0:r.contains(e.target))||c({type:R.CloseMenu}),e.defaultPrevented||t.nextFrame((function(){var e;return null===(e=a.current)||void 0===e?void 0:e.focus()}))))}return window.addEventListener("click",e),function(){return window.removeEventListener("click",e)}}),[i,u,a,t,c]);var l=n.useMemo((function(){return{open:i===C.Open}}),[i]);return n.createElement(M.Provider,{value:r},T(e,l,N))}var U,H,Q,B,V=F((function e(r,o){var i,u=A([j.name,e.name].join(".")),a=u[0],c=u[1],l=L(a.buttonRef,o),f=n.useState(!1),d=f[0],v=f[1],p="headlessui-menu-button-"+s(),m=D(),b=n.useCallback((function(e){switch(e.key){case I.Space:case I.Enter:case I.ArrowDown:e.preventDefault(),c({type:R.OpenMenu}),m.nextFrame((function(){var e;null===(e=a.itemsRef.current)||void 0===e||e.focus(),c({type:R.GoToItem,focus:O.FirstItem})}));break;case I.ArrowUp:e.preventDefault(),c({type:R.OpenMenu}),m.nextFrame((function(){var e;null===(e=a.itemsRef.current)||void 0===e||e.focus(),c({type:R.GoToItem,focus:O.LastItem})}))}}),[c,a,m]),h=n.useCallback((function(e){a.menuState===C.Open?(c({type:R.CloseMenu}),m.nextFrame((function(){var e;return null===(e=a.buttonRef.current)||void 0===e?void 0:e.focus()}))):(e.preventDefault(),c({type:R.OpenMenu}),m.nextFrame((function(){var e;return null===(e=a.itemsRef.current)||void 0===e?void 0:e.focus()})))}),[c,m,a]),y=n.useCallback((function(){var e;a.menuState===C.Open&&(null===(e=a.itemsRef.current)||void 0===e||e.focus()),v(!0)}),[a,v]),x=n.useCallback((function(){return v(!1)}),[v]),g=n.useMemo((function(){return{open:a.menuState===C.Open,focused:d}}),[a,d]);return T(t({},r,{ref:l,id:p,type:"button","aria-haspopup":!0,"aria-controls":null===(i=a.itemsRef.current)||void 0===i?void 0:i.id,"aria-expanded":a.menuState===C.Open||void 0,onKeyDown:b,onFocus:y,onBlur:x,onPointerUp:h}),g,"button")})),q=F((function e(o,i){var u,a,c=o.static,l=void 0!==c&&c,f=r(o,["static"]),d=A([j.name,e.name].join(".")),p=d[0],m=d[1],b=L(p.itemsRef,i),h="headlessui-menu-items-"+s(),y=D(),x=n.useCallback((function(e){switch(y.dispose(),e.key){case I.Space:if(""!==p.searchQuery)return e.preventDefault(),m({type:R.Search,value:e.key});case I.Enter:var n;e.preventDefault(),m({type:R.CloseMenu}),null!==p.activeItemIndex&&(null===(n=document.getElementById(p.items[p.activeItemIndex].id))||void 0===n||n.click()),v().nextFrame((function(){var e;return null===(e=p.buttonRef.current)||void 0===e?void 0:e.focus()}));break;case I.ArrowDown:return e.preventDefault(),m({type:R.GoToItem,focus:O.NextItem});case I.ArrowUp:return e.preventDefault(),m({type:R.GoToItem,focus:O.PreviousItem});case I.Home:case I.PageUp:return e.preventDefault(),m({type:R.GoToItem,focus:O.FirstItem});case I.End:case I.PageDown:return e.preventDefault(),m({type:R.GoToItem,focus:O.LastItem});case I.Escape:e.preventDefault(),m({type:R.CloseMenu}),v().nextFrame((function(){var e;return null===(e=p.buttonRef.current)||void 0===e?void 0:e.focus()}));break;case I.Tab:return e.preventDefault();default:1===e.key.length&&(m({type:R.Search,value:e.key}),y.setTimeout((function(){return m({type:R.ClearSearch})}),350))}}),[m,y,p]),g=n.useMemo((function(){return{open:p.menuState===C.Open}}),[p]),S={"aria-activedescendant":null===p.activeItemIndex||null===(u=p.items[p.activeItemIndex])||void 0===u?void 0:u.id,"aria-labelledby":null===(a=p.buttonRef.current)||void 0===a?void 0:a.id,id:h,onKeyDown:x,role:"menu",tabIndex:0};return l||p.menuState!==C.Closed?T(t({},f,S,{ref:b}),g,"div"):null})),K=n.Fragment;function W(e,n){if(void 0!==e)return"function"==typeof e?e(n):e}function Y(e,t){var r=n.useState(e),o=r[0],i=r[1],a=n.useRef(e);return u((function(){a.current=e}),[e]),u((function(){return i(a.current)}),[a,i].concat(t)),o}j.Button=V,j.Items=q,j.Item=function e(o){var i=o.disabled,a=void 0!==i&&i,c=o.className,l=o.onClick,f=r(o,["disabled","className","onClick"]),d=A([j.name,e.name].join(".")),v=d[0],p=d[1],m=D(),b="headlessui-menu-item-"+s(),h=null!==v.activeItemIndex&&v.items[v.activeItemIndex].id===b,y=n.useRef({disabled:a});u((function(){y.current.disabled=a}),[y,a]),u((function(){var e,n;y.current.textValue=null===(e=document.getElementById(b))||void 0===e||null===(n=e.textContent)||void 0===n?void 0:n.toLowerCase()}),[y,b]),u((function(){return p({type:R.RegisterItem,id:b,dataRef:y}),function(){return p({type:R.UnregisterItem,id:b})}}),[y,b]);var x=n.useCallback((function(e){return a?e.preventDefault():(p({type:R.CloseMenu}),m.nextFrame((function(){var e;return null===(e=v.buttonRef.current)||void 0===e?void 0:e.focus()})),l?l(e):void 0)}),[m,p,v.buttonRef,a,l]),I=n.useCallback((function(){if(a)return p({type:R.GoToItem,focus:O.Nothing});p({type:R.GoToItem,focus:O.SpecificItem,id:b})}),[a,b,p]),g=n.useCallback((function(){a||h||p({type:R.GoToItem,focus:O.SpecificItem,id:b})}),[a,h,b,p]),C=n.useCallback((function(){a||h&&p({type:R.GoToItem,focus:O.Nothing})}),[a,h,p]),S=n.useMemo((function(){return{active:h,disabled:a}}),[h,a]);return T(t({},f,{id:b,role:"menuitem",tabIndex:-1,className:W(c,S),"aria-disabled":!0===a||void 0,onClick:x,onFocus:I,onPointerMove:g,onPointerLeave:C}),S,K)},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(H||(H={})),function(e){e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOption=5]="RegisterOption",e[e.UnregisterOption=6]="UnregisterOption"}(Q||(Q={})),function(e){e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing"}(B||(B={}));var _=((U={})[Q.CloseListbox]=function(e){return t({},e,{listboxState:H.Closed})},U[Q.OpenListbox]=function(e){return t({},e,{listboxState:H.Open})},U[Q.GoToOption]=function(e,n){var r=function(e,n,t){var r,o;if(e.options.length<=0)return null;var i=e.options,u=null!==(r=e.activeOptionIndex)&&void 0!==r?r:-1,a=d(n,((o={})[B.First]=function(){return i.findIndex((function(e){return!e.dataRef.current.disabled}))},o[B.Previous]=function(){var e=i.slice().reverse().findIndex((function(e,n,t){return!(-1!==u&&t.length-n-1>=u||e.dataRef.current.disabled)}));return-1===e?e:i.length-1-e},o[B.Next]=function(){return i.findIndex((function(e,n){return!(n<=u||e.dataRef.current.disabled)}))},o[B.Last]=function(){var e=i.slice().reverse().findIndex((function(e){return!e.dataRef.current.disabled}));return-1===e?e:i.length-1-e},o[B.Specific]=function(){return i.findIndex((function(e){return e.id===t}))},o[B.Nothing]=function(){return null},o));return-1===a?e.activeOptionIndex:a}(e,n.focus,n.id);return""===e.searchQuery&&e.activeOptionIndex===r?e:t({},e,{searchQuery:"",activeOptionIndex:r})},U[Q.Search]=function(e,n){var r=e.searchQuery+n.value,o=e.options.findIndex((function(e){var n;return!e.dataRef.current.disabled&&(null===(n=e.dataRef.current.textValue)||void 0===n?void 0:n.startsWith(r))}));return t({},e,-1===o||o===e.activeOptionIndex?{searchQuery:r}:{searchQuery:r,activeOptionIndex:o})},U[Q.ClearSearch]=function(e){return t({},e,{searchQuery:""})},U[Q.RegisterOption]=function(e,n){return t({},e,{options:[].concat(e.options,[{id:n.id,dataRef:n.dataRef}])})},U[Q.UnregisterOption]=function(e,n){var r=e.options.slice(),o=null!==e.activeOptionIndex?r[e.activeOptionIndex]:null,i=r.findIndex((function(e){return e.id===n.id}));return-1!==i&&r.splice(i,1),t({},e,{options:r,activeOptionIndex:i===e.activeOptionIndex||null===o?null:r.indexOf(o)})},U),$=n.createContext(null);function z(e,n){return d(n.type,_,e,n)}function J(e){var t=n.useContext($);if(null===t){var r=new Error("<"+e+" /> is missing a parent <"+Z.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,J),r}return t}var X=n.Fragment;function Z(e){var t=e.value,o=e.onChange,i=r(e,["value","onChange"]),a=D(),c=n.useReducer(z,{listboxState:H.Closed,propsRef:{current:{value:t,onChange:o}},labelRef:n.createRef(),buttonRef:n.createRef(),optionsRef:n.createRef(),options:[],searchQuery:"",activeOptionIndex:null}),l=c[0],s=l.listboxState,f=l.propsRef,d=l.optionsRef,v=l.buttonRef,p=c[1];u((function(){f.current.value=t}),[t,f]),u((function(){f.current.onChange=o}),[o,f]),n.useEffect((function(){function e(e){var n,t;s===H.Open&&((null===(n=v.current)||void 0===n?void 0:n.contains(e.target))||((null===(t=d.current)||void 0===t?void 0:t.contains(e.target))||p({type:Q.CloseListbox}),e.defaultPrevented||a.nextFrame((function(){var e;return null===(e=v.current)||void 0===e?void 0:e.focus()}))))}return window.addEventListener("click",e),function(){return window.removeEventListener("click",e)}}),[s,d,v,a,p]);var m=n.useMemo((function(){return{open:s===H.Open}}),[s]);return n.createElement($.Provider,{value:c},T(i,m,X))}var ee=F((function e(r,o){var i,u=J([Z.name,e.name].join(".")),a=u[0],c=u[1],l=L(a.buttonRef,o),f=n.useState(!1),d=f[0],v=f[1],p="headlessui-listbox-button-"+s(),m=D(),b=n.useCallback((function(e){switch(e.key){case I.Space:case I.Enter:case I.ArrowDown:e.preventDefault(),c({type:Q.OpenListbox}),m.nextFrame((function(){var e;null===(e=a.optionsRef.current)||void 0===e||e.focus(),a.propsRef.current.value||c({type:Q.GoToOption,focus:B.First})}));break;case I.ArrowUp:e.preventDefault(),c({type:Q.OpenListbox}),m.nextFrame((function(){var e;null===(e=a.optionsRef.current)||void 0===e||e.focus(),a.propsRef.current.value||c({type:Q.GoToOption,focus:B.Last})}))}}),[c,a,m]),h=n.useCallback((function(e){a.listboxState===H.Open?(c({type:Q.CloseListbox}),m.nextFrame((function(){var e;return null===(e=a.buttonRef.current)||void 0===e?void 0:e.focus()}))):(e.preventDefault(),c({type:Q.OpenListbox}),m.nextFrame((function(){var e;return null===(e=a.optionsRef.current)||void 0===e?void 0:e.focus()})))}),[c,m,a]),y=n.useCallback((function(){var e;if(a.listboxState===H.Open)return null===(e=a.optionsRef.current)||void 0===e?void 0:e.focus();v(!0)}),[a,v]),x=n.useCallback((function(){return v(!1)}),[v]),g=Y((function(){if(a.labelRef.current)return[a.labelRef.current.id,p].join(" ")}),[a.labelRef.current,p]),C=n.useMemo((function(){return{open:a.listboxState===H.Open,focused:d}}),[a,d]);return T(t({},r,{ref:l,id:p,type:"button","aria-haspopup":!0,"aria-controls":null===(i=a.optionsRef.current)||void 0===i?void 0:i.id,"aria-expanded":a.listboxState===H.Open||void 0,"aria-labelledby":g,onKeyDown:b,onFocus:y,onBlur:x,onPointerUp:h}),C,"button")})),ne=F((function e(o,i){var u,a=o.static,c=void 0!==a&&a,l=r(o,["enter","enterFrom","enterTo","leave","leaveFrom","leaveTo","static"]),f=J([Z.name,e.name].join(".")),d=f[0],p=f[1],m=L(d.optionsRef,i),b="headlessui-listbox-options-"+s(),h=D(),y=D(),x=n.useCallback((function(e){switch(y.dispose(),e.key){case I.Space:if(""!==d.searchQuery)return e.preventDefault(),p({type:Q.Search,value:e.key});case I.Enter:e.preventDefault(),p({type:Q.CloseListbox}),null!==d.activeOptionIndex&&d.propsRef.current.onChange(d.options[d.activeOptionIndex].dataRef.current.value),v().nextFrame((function(){var e;return null===(e=d.buttonRef.current)||void 0===e?void 0:e.focus()}));break;case I.ArrowDown:return e.preventDefault(),p({type:Q.GoToOption,focus:B.Next});case I.ArrowUp:return e.preventDefault(),p({type:Q.GoToOption,focus:B.Previous});case I.Home:case I.PageUp:return e.preventDefault(),p({type:Q.GoToOption,focus:B.First});case I.End:case I.PageDown:return e.preventDefault(),p({type:Q.GoToOption,focus:B.Last});case I.Escape:return e.preventDefault(),p({type:Q.CloseListbox}),h.nextFrame((function(){var e;return null===(e=d.buttonRef.current)||void 0===e?void 0:e.focus()}));case I.Tab:return e.preventDefault();default:1===e.key.length&&(p({type:Q.Search,value:e.key}),y.setTimeout((function(){return p({type:Q.ClearSearch})}),350))}}),[h,p,y,d]),g=Y((function(){var e,n,t;return null!==(e=null===(n=d.labelRef.current)||void 0===n?void 0:n.id)&&void 0!==e?e:null===(t=d.buttonRef.current)||void 0===t?void 0:t.id}),[d.labelRef.current,d.buttonRef.current]),C=n.useMemo((function(){return{open:d.listboxState===H.Open}}),[d]),R={"aria-activedescendant":null===d.activeOptionIndex||null===(u=d.options[d.activeOptionIndex])||void 0===u?void 0:u.id,"aria-labelledby":g,id:b,onKeyDown:x,role:"listbox",tabIndex:0};return c||d.listboxState!==H.Closed?T(t({},l,R,{ref:m}),C,"ul"):null}));function te(e,n){if(void 0!==e)return"function"==typeof e?e(n):e}Z.Button=ee,Z.Label=function e(r){var o=J([Z.name,e.name].join("."))[0],i="headlessui-listbox-label-"+s(),u=n.useCallback((function(){var e;return null===(e=o.buttonRef.current)||void 0===e?void 0:e.focus()}),[o.buttonRef]),a=n.useMemo((function(){return{open:o.listboxState===H.Open}}),[o]);return T(t({},r,{ref:o.labelRef,id:i,onPointerUp:u}),a,"label")},Z.Options=ne,Z.Option=function e(o){var i=o.disabled,a=void 0!==i&&i,c=o.value,l=o.className,f=r(o,["disabled","value","className"]),d=J([Z.name,e.name].join(".")),p=d[0],m=d[1],b="headlessui-listbox-option-"+s(),h=null!==p.activeOptionIndex&&p.options[p.activeOptionIndex].id===b,y=p.propsRef.current.value===c,x=n.useRef({disabled:a,value:c});u((function(){x.current.disabled=a}),[x,a]),u((function(){x.current.value=c}),[x,c]),u((function(){var e,n;x.current.textValue=null===(e=document.getElementById(b))||void 0===e||null===(n=e.textContent)||void 0===n?void 0:n.toLowerCase()}),[x,b]);var I=n.useCallback((function(){return p.propsRef.current.onChange(c)}),[p.propsRef,c]);u((function(){return m({type:Q.RegisterOption,id:b,dataRef:x}),function(){return m({type:Q.UnregisterOption,id:b})}}),[x,b]),u((function(){var e,n;y&&(m({type:Q.GoToOption,focus:B.Specific,id:b}),null===(e=document.getElementById(b))||void 0===e||null===(n=e.focus)||void 0===n||n.call(e))}),[]),u((function(){if(h){var e=v();return e.nextFrame((function(){var e,n;return null===(e=document.getElementById(b))||void 0===e||null===(n=e.scrollIntoView)||void 0===n?void 0:n.call(e,{block:"nearest"})})),e.dispose}}),[h]);var g=n.useCallback((function(e){if(a)return e.preventDefault();I(),m({type:Q.CloseListbox}),v().nextFrame((function(){var e;return null===(e=p.buttonRef.current)||void 0===e?void 0:e.focus()}))}),[m,p.buttonRef,a,I]),C=n.useCallback((function(){if(a)return m({type:Q.GoToOption,focus:B.Nothing});m({type:Q.GoToOption,focus:B.Specific,id:b})}),[a,b,m]),R=n.useCallback((function(){a||h||m({type:Q.GoToOption,focus:B.Specific,id:b})}),[a,h,b,m]),O=n.useCallback((function(){a||h&&m({type:Q.GoToOption,focus:B.Nothing})}),[a,h,m]),S=n.useMemo((function(){return{active:h,selected:y,disabled:a}}),[h,y,a]);return T(t({},f,{id:b,role:"option",tabIndex:-1,className:te(l,S),"aria-disabled":!0===a||void 0,"aria-selected":!0===y||void 0,onClick:g,onFocus:C,onPointerMove:R,onPointerLeave:O}),S,"li")};var re=n.createContext(null);function oe(e){var t=n.useContext(re);if(null===t){var r=new Error("<"+e+" /> is missing a parent <Switch.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,oe),r}return t}var ie=n.Fragment;function ue(e){var o,i=e.checked,u=e.onChange,a=e.className,c=r(e,["checked","onChange","className"]),l="headlessui-switch-"+s(),f=n.useContext(re),d=n.useCallback((function(){return u(!i)}),[u,i]),v=n.useCallback((function(e){e.preventDefault(),d()}),[d]),p=n.useCallback((function(e){e.key===I.Space&&(e.preventDefault(),d())}),[d]),m=n.useMemo((function(){return{checked:i}}),[i]);return T(t({},c,{id:l,ref:null===f?void 0:f.setSwitch,role:"switch",tabIndex:0,className:ae(a,m),"aria-checked":i,"aria-labelledby":null==f||null===(o=f.label)||void 0===o?void 0:o.id,onClick:v,onKeyUp:p}),m,"button")}function ae(e,n){if(void 0!==e)return"function"==typeof e?e(n):e}ue.Group=function(e){var t=n.useState(null),r=t[0],o=t[1],i=n.useState(null),u=i[0],a=i[1],c=n.useMemo((function(){return{switch:r,label:u,setSwitch:o,setLabel:a}}),[r,o,u,a]);return n.createElement(re.Provider,{value:c},T(e,{},ie))},ue.Label=function e(r){var o=oe([ue.name,e.name].join(".")),i="headlessui-switch-label-"+s(),u=n.useCallback((function(){o.switch&&(o.switch.click(),o.switch.focus())}),[o.switch]);return T(t({},r,{ref:o.setLabel,id:i,onPointerUp:u}),{},"label")},e.Listbox=Z,e.Menu=j,e.Switch=ue,e.Transition=E,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],t):t((e=e||self).headlessui={},e.React,e.reactDom)}(this,(function(e,t,n){"use strict";var r,o,i,u="default"in t?t.default:t;function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function c(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return l(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function f(e,t){if(e in t){for(var n=t[e],r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return"function"==typeof n?n.apply(void 0,o):n}var u=new Error('Tried to handle "'+e+'" but there is no handler defined. Only defined handlers are: '+Object.keys(t).map((function(e){return'"'+e+'"'})).join(", ")+".");throw Error.captureStackTrace&&Error.captureStackTrace(u,f),u}function d(e,t,n,i,u){if(void 0===u&&(u=!0),u)return p(e,t,n);var l=null!=i?i:r.None;if(l&r.Static){var s=e.static,d=void 0!==s&&s,v=c(e,["static"]);if(d)return p(v,t,n)}if(l&r.RenderStrategy){var m,h=e.unmount,b=void 0===h||h,y=c(e,["unmount"]);return f(b?o.Unmount:o.Hidden,((m={})[o.Unmount]=function(){return null},m[o.Hidden]=function(){return p(a({},y,{hidden:!0,style:{display:"none"}}),t,n)},m))}return p(e,t,n)}function p(e,n,r){var o,i=m(e,["unmount","static"]),u=i.as,a=void 0===u?r:u,l=i.children,f=i.refName,d=void 0===f?"ref":f,v=c(i,["as","children","refName"]),h=void 0!==e.ref?((o={})[d]=e.ref,o):{},b="function"==typeof l?l(n):l;if(a===t.Fragment&&Object.keys(v).length>0){if(Array.isArray(b)&&b.length>1){var y=new Error("You should only render 1 child");throw Error.captureStackTrace&&Error.captureStackTrace(y,p),y}if(!t.isValidElement(b)){var g=new Error('You should render an element as a child. Did you forget the as="..." prop?');throw Error.captureStackTrace&&Error.captureStackTrace(g,p),g}return t.cloneElement(b,Object.assign({},function(e,t,n){for(var r,o=Object.assign({},e),i=function(){var n,i=r.value;void 0!==e[i]&&void 0!==t[i]&&Object.assign(o,((n={})[i]=function(n){n.defaultPrevented||e[i](n),n.defaultPrevented||t[i](n)},n))},u=s(["onClick"]);!(r=u()).done;)i();return o}(function(e){var t=Object.assign({},e);for(var n in t)void 0===t[n]&&delete t[n];return t}(m(v,["ref"])),b.props),h))}return t.createElement(a,Object.assign({},m(v,["ref"]),a!==t.Fragment&&h),b)}function v(e){return Object.assign(t.forwardRef(e),{name:e.name})}function m(e,t){void 0===t&&(t=[]);for(var n,r=Object.assign({},e),o=s(t);!(n=o()).done;){var i=n.value;i in r&&delete r[i]}return r}function h(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return t.useCallback((function(e){n.forEach((function(t){if(null!=t)return"function"==typeof t?t(e):void(t.current=e)}))}),[n])}function b(e){for(var t,n,r=e.parentElement,o=null;r&&!(r instanceof HTMLFieldSetElement);)r instanceof HTMLLegendElement&&(o=r),r=r.parentElement;var i=null!=(t=""===(null==(n=r)?void 0:n.getAttribute("disabled")))&&t;return(!i||!function(e){if(!e)return!1;for(var t=e.previousElementSibling;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(o))&&i}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(r||(r={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(o||(o={})),function(e){e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.ArrowUp="ArrowUp",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"}(i||(i={}));var y="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,g={serverHandoffComplete:!1},x=0;function w(){return++x}function E(){var e=t.useState(g.serverHandoffComplete?w:null),n=e[0],r=e[1];return y((function(){null===n&&r(w())}),[n]),t.useEffect((function(){!1===g.serverHandoffComplete&&(g.serverHandoffComplete=!0)}),[]),null!=n?""+n:void 0}var S=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map((function(e){return e+":not([tabindex='-1'])"})).join(",");function C(e){e&&e.focus({preventScroll:!0})}function O(e,n,r){void 0===n&&(n=!0),void 0===r&&(r={});var o=t.useRef("undefined"!=typeof window?document.activeElement:null),u=t.useRef(null),a=t.useRef(!1),c=t.useCallback((function(){return e.current?Array.from(e.current.querySelectorAll(S)):[]}),[e]);y((function(){var t,i,l,s;if(n){a.current=!0;var f,d=document.activeElement;if(null==(t=r.initialFocus)?void 0:t.current){if((null==(f=r.initialFocus)?void 0:f.current)===d)return}else if(null==(i=e.current)?void 0:i.contains(d))return;o.current=d;var p=c();if(p.length<=0)throw new Error("There are no focusable elements inside the <FocusTrap />");return function e(t){void 0!==t&&(C(t),document.activeElement!==t?e(p[p.indexOf(t)+1]):u.current=t)}(null!=(l=null==(s=r.initialFocus)?void 0:s.current)?l:p[0]),function(){a.current=!1,C(o.current),o.current=null,u.current=null}}}),[n,a,r.initialFocus]),y((function(){if(n)return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)};function e(e){if(e.key===i.Tab&&document.activeElement){e.preventDefault();var t=e.shiftKey?-1:1,n=c(),r=n.length,o=n.indexOf(document.activeElement);!function e(i){void 0===i&&(i=0);var a=(n.indexOf(document.activeElement)+r+t+i)%r,c=n[a];if(C(c),c!==document.activeElement){if(o===a)return;e(i+t)}else u.current=c}()}}}),[n,c]),y((function(){if(n&&e.current){var t=e.current;return window.addEventListener("focus",r,!0),function(){return window.removeEventListener("focus",r,!0)}}function r(e){var n=u.current;if(n&&a.current){var r=e.target;r&&r instanceof HTMLElement?t.contains(r)?(u.current=r,C(r)):(e.preventDefault(),e.stopPropagation(),C(n)):C(u.current)}}}),[n,a,e])}function I(e,t){return e(t={exports:{}},t.exports),t.exports}var k=I((function(e){var t=function(e){var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",i=r.asyncIterator||"@@asyncIterator",u=r.toStringTag||"@@toStringTag";function a(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{a({},"")}catch(e){a=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var o=Object.create((t&&t.prototype instanceof f?t:f).prototype),i=new S(r||[]);return o._invoke=function(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return{value:void 0,done:!0}}for(n.method=o,n.arg=i;;){var u=n.delegate;if(u){var a=x(u,n);if(a){if(a===s)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=l(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===s)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}(e,n,i),o}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var s={};function f(){}function d(){}function p(){}var v={};v[o]=function(){return this};var m=Object.getPrototypeOf,h=m&&m(m(C([])));h&&h!==t&&n.call(h,o)&&(v=h);var b=p.prototype=f.prototype=Object.create(v);function y(e){["next","throw","return"].forEach((function(t){a(e,t,(function(e){return this._invoke(t,e)}))}))}function g(e,t){var r;this._invoke=function(o,i){function u(){return new t((function(r,u){!function r(o,i,u,a){var c=l(e[o],e,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,u,a)}),(function(e){r("throw",e,u,a)})):t.resolve(f).then((function(e){s.value=e,u(s)}),(function(e){return r("throw",e,u,a)}))}a(c.arg)}(o,i,r,u)}))}return r=r?r.then(u,u):u()}}function x(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method))return s;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var r=l(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,s;var o=r.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,s):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,s)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function C(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return d.prototype=b.constructor=p,p.constructor=d,d.displayName=a(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,a(e,u,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},y(g.prototype),g.prototype[i]=function(){return this},e.AsyncIterator=g,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var u=new g(c(t,n,r,o),i);return e.isGeneratorFunction(n)?u:u.next().then((function(e){return e.done?e.value:u.next()}))},y(b),a(b,u,"Generator"),b[o]=function(){return this},b.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=C,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return u.type="throw",u.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var a=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(a&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=e,u.arg=t,i?(this.method="next",this.next=i.finallyLoc,s):this.complete(u)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),s},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),s}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:C(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),s}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}})),R=k.mark(T);function T(e){var t;return k.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(e.parentElement){n.next=2;break}return n.abrupt("return");case 2:t=e.parentElement.firstChild;case 3:if(!t){n.next=10;break}if(!(t!==e&&t instanceof HTMLElement)){n.next=7;break}return n.next=7,t;case 7:t=t.nextSibling,n.next=3;break;case 10:case"end":return n.stop()}}),R)}var L,D,F,P=t.Fragment;function M(e){var r=t.useState((function(){if("undefined"==typeof window)return null;var e=document.getElementById("headlessui-portal-root");if(e)return e;var t=document.createElement("div");return t.setAttribute("id","headlessui-portal-root"),document.body.appendChild(t)}))[0];return y((function(){return function(){r&&r.childNodes.length<=1&&document.body.removeChild(r)}}),[r]),r?n.createPortal(d(e,{},P),r):null}!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(D||(D={})),function(e){e[e.SetTitleElement=0]="SetTitleElement",e[e.SetDescriptionElement=1]="SetDescriptionElement"}(F||(F={}));var A=((L={})[F.SetTitleElement]=function(e,t){return e.titleElement===t.element?e:a({},e,{titleElement:t.element})},L[F.SetDescriptionElement]=function(e,t){return e.descriptionElement===t.element?e:a({},e,{descriptionElement:t.element})},L),N=t.createContext(null);function j(e){var n=t.useContext(N);if(null===n){var r=new Error("<"+e+" /> is missing a parent <"+B.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,j),r}return n}function G(e,t){return f(t.type,A,e,t)}N.displayName="DialogContext";var U,H,V,_=r.RenderStrategy|r.Static,B=Object.assign(v((function(e,n){var r,o,l=e.open,f=e.onClose,p=e.initialFocus,v=c(e,["open","onClose","initialFocus"]),m=t.useRef(null),b=h(m,n),g=e.hasOwnProperty("open"),x=e.hasOwnProperty("onClose");if(!g)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!x)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if("boolean"!=typeof l)throw new Error("You provided an `open` prop to the `Dialog`, but the value is not a boolean. Received: "+l);if("function"!=typeof f)throw new Error("You provided an `onClose` prop to the `Dialog`, but the value is not a function. Received: "+f);var w=l?D.Open:D.Closed,S=t.useReducer(G,{titleElement:null,descriptionElement:null}),C=S[0],I=S[1],k=t.useCallback((function(){return f(!1)}),[f]),R=t.useCallback((function(e){return I({type:F.SetTitleElement,element:e})}),[I]),L=t.useCallback((function(e){return I({type:F.SetDescriptionElement,element:e})}),[I]);t.useEffect((function(){function e(e){e.key===i.Escape&&w===D.Open&&k()}return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)}}),[k,w]),t.useEffect((function(){if(w===D.Open){var e=window.scrollX,t=window.scrollY,n=document.documentElement.style.overflow,r=document.documentElement.style.paddingRight,o=window.innerWidth-document.documentElement.clientWidth;return document.documentElement.style.overflow="hidden",document.documentElement.style.paddingRight=o+"px",function(){document.documentElement.style.overflow=n,document.documentElement.style.paddingRight=r,window.scroll(e,t)}}}),[w]),t.useEffect((function(){if(w===D.Open&&m.current){var e=new IntersectionObserver((function(e){for(var t,n=s(e);!(t=n()).done;)t.value.isIntersecting||k()}),{root:document.body});return e.observe(m.current),function(){return e.disconnect()}}}),[w,m,k]);var P=!!e.static||w===D.Open;O(m,P,{initialFocus:p}),function(e,t){void 0===t&&(t=!0),y((function(){if(t&&e.current){for(var n,r=e.current,o=new Map,i=s(T(r));!(n=i()).done;){var u=n.value;o.set(u,{"aria-hidden":u.getAttribute("aria-hidden"),inert:u.inert})}document.querySelectorAll("body > *").forEach((function(e){e!==r&&e instanceof HTMLElement&&(e.contains(r)||o.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}))}));for(var a,c=s(o.keys());!(a=c()).done;){var l=a.value;l.setAttribute("aria-hidden","true"),l.inert=!0}return function(){for(var e,t=s(o.entries());!(e=t()).done;){var n=e.value,r=n[0],i=n[1];null!==r&&(null===i["aria-hidden"]?r.removeAttribute("aria-hidden"):r.setAttribute("aria-hidden",i["aria-hidden"]),r.inert=i.inert)}o.clear()}}}),[t])}(m,P);var A="headlessui-dialog-"+E(),j=t.useMemo((function(){return[{dialogState:w,close:k,setTitle:R,setDescription:L},C]}),[w,C,k,R,L]),U=t.useMemo((function(){return{open:w===D.Open,close:k}}),[w,k]),H={ref:b,id:A,role:"dialog","aria-modal":w===D.Open||void 0,"aria-labelledby":null==(r=C.titleElement)?void 0:r.id,"aria-describedby":null==(o=C.descriptionElement)?void 0:o.id};return u.createElement(M,null,u.createElement(N.Provider,{value:j},d(a({},v,H),U,"div",_,w===D.Open)))})),{Overlay:v((function e(n,r){var o=j([B.name,e.name].join("."))[0],i=o.dialogState,u=o.close,c=h(r),l="headlessui-dialog-overlay-"+E(),s=t.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();u()}),[u]),f=t.useMemo((function(){return{open:i===D.Open}}),[i]);return d(a({},n,{ref:c,id:l,"aria-hidden":!0,onClick:s}),f,"div")})),Title:function e(n){var r=j([B.name,e.name].join("."))[0],o=r.dialogState,i=r.setTitle,u="headlessui-dialog-title-"+E(),c=t.useMemo((function(){return{open:o===D.Open}}),[o]);return d(a({},n,{ref:i,id:u}),c,"h2")},Description:function e(n){var r=j([B.name,e.name].join("."))[0],o=r.dialogState,i=r.setDescription,u="headlessui-dialog-description-"+E(),c=t.useMemo((function(){return{open:o===D.Open}}),[o]);return d(a({},n,{ref:i,id:u}),c,"p")}});!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(H||(H={})),function(e){e[e.ToggleDisclosure=0]="ToggleDisclosure",e[e.SetButtonId=1]="SetButtonId",e[e.SetPanelId=2]="SetPanelId",e[e.LinkPanel=3]="LinkPanel",e[e.UnlinkPanel=4]="UnlinkPanel"}(V||(V={}));var Q=((U={})[V.ToggleDisclosure]=function(e){var t;return a({},e,{disclosureState:f(e.disclosureState,(t={},t[H.Open]=H.Closed,t[H.Closed]=H.Open,t))})},U[V.LinkPanel]=function(e){return a({},e,{linkedPanel:!0})},U[V.UnlinkPanel]=function(e){return a({},e,{linkedPanel:!1})},U[V.SetButtonId]=function(e,t){return a({},e,{buttonId:t.buttonId})},U[V.SetPanelId]=function(e,t){return a({},e,{panelId:t.panelId})},U),K=t.createContext(null);function Y(e){var n=t.useContext(K);if(null===n){var r=new Error("<"+e+" /> is missing a parent <"+J.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Y),r}return n}function q(e,t){return f(t.type,Q,e,t)}K.displayName="DisclosureContext";var W=t.Fragment;function J(e){var n="headlessui-disclosure-button-"+E(),r="headlessui-disclosure-panel-"+E(),o=t.useReducer(q,{disclosureState:H.Closed,linkedPanel:!1,buttonId:n,panelId:r}),i=o[0].disclosureState,a=o[1];t.useEffect((function(){return a({type:V.SetButtonId,buttonId:n})}),[n,a]),t.useEffect((function(){return a({type:V.SetPanelId,panelId:r})}),[r,a]);var c=t.useMemo((function(){return{open:i===H.Open}}),[i]);return u.createElement(K.Provider,{value:o},d(e,c,W))}var X,$,z,Z,ee=v((function e(n,r){var o=Y([J.name,e.name].join(".")),u=o[0],c=o[1],l=h(r),s=t.useCallback((function(e){switch(e.key){case i.Space:case i.Enter:e.preventDefault(),c({type:V.ToggleDisclosure})}}),[c]),f=t.useCallback((function(e){b(e.currentTarget)||n.disabled||c({type:V.ToggleDisclosure})}),[c,n.disabled]),p=t.useMemo((function(){return{open:u.disclosureState===H.Open}}),[u]);return d(a({},n,{ref:l,id:u.buttonId,type:"button","aria-expanded":u.disclosureState===H.Open||void 0,"aria-controls":u.linkedPanel?u.panelId:void 0,onKeyDown:s,onClick:f}),p,"button")})),te=r.RenderStrategy|r.Static,ne=v((function e(n,r){var o=Y([J.name,e.name].join(".")),i=o[0],c=o[1],l=h(r,(function(){i.linkedPanel||c({type:V.LinkPanel})}));t.useEffect((function(){return function(){return c({type:V.UnlinkPanel})}}),[c]),u.useEffect((function(){var e;i.disclosureState!==H.Closed||null!=(e=n.unmount)&&!e||c({type:V.UnlinkPanel})}),[i.disclosureState,n.unmount,c]);var s=u.useMemo((function(){return{open:i.disclosureState===H.Open}}),[i]);return d(a({},n,{ref:l,id:i.panelId}),s,"div",te,i.disclosureState===H.Open)}));function re(){var e=[],t={requestAnimationFrame:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=requestAnimationFrame.apply(void 0,arguments);t.add((function(){return cancelAnimationFrame(e)}))})),nextFrame:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t.requestAnimationFrame((function(){t.requestAnimationFrame.apply(t,n)}))},setTimeout:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=setTimeout.apply(void 0,arguments);t.add((function(){return clearTimeout(e)}))})),add:function(t){e.push(t)},dispose:function(){for(var t,n=s(e.splice(0));!(t=n()).done;)(0,t.value)()}};return t}function oe(){var e=t.useState(re)[0];return t.useEffect((function(){return function(){return e.dispose()}}),[e]),e}function ie(e,n){var r=t.useState(e),o=r[0],i=r[1],u=t.useRef(e);return y((function(){u.current=e}),[e]),y((function(){return i(u.current)}),[u,i].concat(n)),o}function ue(e,t){var n=t.resolveItems();if(n.length<=0)return null;var r=t.resolveActiveIndex(),o=null!=r?r:-1,i=function(){switch(e.focus){case X.First:return n.findIndex((function(e){return!t.resolveDisabled(e)}));case X.Previous:var r=n.slice().reverse().findIndex((function(e,n,r){return!(-1!==o&&r.length-n-1>=o||t.resolveDisabled(e))}));return-1===r?r:n.length-1-r;case X.Next:return n.findIndex((function(e,n){return!(n<=o||t.resolveDisabled(e))}));case X.Last:var i=n.slice().reverse().findIndex((function(e){return!t.resolveDisabled(e)}));return-1===i?i:n.length-1-i;case X.Specific:return n.findIndex((function(n){return t.resolveId(n)===e.id}));case X.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===i?r:i}function ae(e,t){if(void 0!==e)return"function"==typeof e?e(t):e}J.Button=ee,J.Panel=ne,function(e){e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing"}(X||(X={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(z||(z={})),function(e){e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.SetDisabled=2]="SetDisabled",e[e.GoToOption=3]="GoToOption",e[e.Search=4]="Search",e[e.ClearSearch=5]="ClearSearch",e[e.RegisterOption=6]="RegisterOption",e[e.UnregisterOption=7]="UnregisterOption"}(Z||(Z={}));var ce=(($={})[Z.CloseListbox]=function(e){return e.disabled||e.listboxState===z.Closed?e:a({},e,{activeOptionIndex:null,listboxState:z.Closed})},$[Z.OpenListbox]=function(e){return e.disabled||e.listboxState===z.Open?e:a({},e,{listboxState:z.Open})},$[Z.SetDisabled]=function(e,t){return e.disabled===t.disabled?e:a({},e,{disabled:t.disabled})},$[Z.GoToOption]=function(e,t){if(e.disabled)return e;if(e.listboxState===z.Closed)return e;var n=ue(t,{resolveItems:function(){return e.options},resolveActiveIndex:function(){return e.activeOptionIndex},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.current.disabled}});return""===e.searchQuery&&e.activeOptionIndex===n?e:a({},e,{searchQuery:"",activeOptionIndex:n})},$[Z.Search]=function(e,t){if(e.disabled)return e;if(e.listboxState===z.Closed)return e;var n=e.searchQuery+t.value,r=e.options.findIndex((function(e){var t;return!e.dataRef.current.disabled&&(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(n))}));return a({},e,-1===r||r===e.activeOptionIndex?{searchQuery:n}:{searchQuery:n,activeOptionIndex:r})},$[Z.ClearSearch]=function(e){return e.disabled||e.listboxState===z.Closed||""===e.searchQuery?e:a({},e,{searchQuery:""})},$[Z.RegisterOption]=function(e,t){return a({},e,{options:[].concat(e.options,[{id:t.id,dataRef:t.dataRef}])})},$[Z.UnregisterOption]=function(e,t){var n=e.options.slice(),r=null!==e.activeOptionIndex?n[e.activeOptionIndex]:null,o=n.findIndex((function(e){return e.id===t.id}));return-1!==o&&n.splice(o,1),a({},e,{options:n,activeOptionIndex:o===e.activeOptionIndex||null===r?null:n.indexOf(r)})},$),le=t.createContext(null);function se(e){var n=t.useContext(le);if(null===n){var r=new Error("<"+e+" /> is missing a parent <"+pe.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,se),r}return n}function fe(e,t){return f(t.type,ce,e,t)}le.displayName="ListboxContext";var de=t.Fragment;function pe(e){var n=e.value,r=e.onChange,o=e.disabled,i=void 0!==o&&o,a=c(e,["value","onChange","disabled"]),l=oe(),s=t.useReducer(fe,{listboxState:z.Closed,propsRef:{current:{value:n,onChange:r}},labelRef:t.createRef(),buttonRef:t.createRef(),optionsRef:t.createRef(),disabled:i,options:[],searchQuery:"",activeOptionIndex:null}),f=s[0],p=f.listboxState,v=f.propsRef,m=f.optionsRef,h=f.buttonRef,b=s[1];y((function(){v.current.value=n}),[n,v]),y((function(){v.current.onChange=r}),[r,v]),y((function(){return b({type:Z.SetDisabled,disabled:i})}),[i]),t.useEffect((function(){function e(e){var t,n,r,o=e.target,i=document.activeElement;p===z.Open&&((null==(t=h.current)?void 0:t.contains(o))||((null==(n=m.current)?void 0:n.contains(o))||b({type:Z.CloseListbox}),i!==document.body&&(null==i?void 0:i.contains(o))||e.defaultPrevented||null==(r=h.current)||r.focus({preventScroll:!0})))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[p,m,h,l,b]);var g=t.useMemo((function(){return{open:p===z.Open,disabled:i}}),[p,i]);return u.createElement(le.Provider,{value:s},d(a,g,de))}var ve,me,he,be=v((function e(n,r){var o,u=se([pe.name,e.name].join(".")),c=u[0],l=u[1],s=h(c.buttonRef,r),f="headlessui-listbox-button-"+E(),p=oe(),v=t.useCallback((function(e){switch(e.key){case i.Space:case i.Enter:case i.ArrowDown:e.preventDefault(),l({type:Z.OpenListbox}),p.nextFrame((function(){var e;null==(e=c.optionsRef.current)||e.focus({preventScroll:!0}),c.propsRef.current.value||l({type:Z.GoToOption,focus:X.First})}));break;case i.ArrowUp:e.preventDefault(),l({type:Z.OpenListbox}),p.nextFrame((function(){var e;null==(e=c.optionsRef.current)||e.focus({preventScroll:!0}),c.propsRef.current.value||l({type:Z.GoToOption,focus:X.Last})}))}}),[l,c,p]),m=t.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();c.listboxState===z.Open?(l({type:Z.CloseListbox}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:Z.OpenListbox}),p.nextFrame((function(){var e;return null==(e=c.optionsRef.current)?void 0:e.focus({preventScroll:!0})})))}),[l,p,c]),y=ie((function(){if(c.labelRef.current)return[c.labelRef.current.id,f].join(" ")}),[c.labelRef.current,f]),g=t.useMemo((function(){return{open:c.listboxState===z.Open,disabled:c.disabled}}),[c]);return d(a({},n,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(o=c.optionsRef.current)?void 0:o.id,"aria-expanded":c.listboxState===z.Open||void 0,"aria-labelledby":y,disabled:c.disabled,onKeyDown:v,onClick:m}),g,"button")})),ye=r.RenderStrategy|r.Static,ge=v((function e(n,r){var o,u=se([pe.name,e.name].join(".")),c=u[0],l=u[1],s=h(c.optionsRef,r),f="headlessui-listbox-options-"+E(),p=oe(),v=oe(),m=t.useCallback((function(e){switch(v.dispose(),e.key){case i.Space:if(""!==c.searchQuery)return e.preventDefault(),l({type:Z.Search,value:e.key});case i.Enter:e.preventDefault(),l({type:Z.CloseListbox}),null!==c.activeOptionIndex&&c.propsRef.current.onChange(c.options[c.activeOptionIndex].dataRef.current.value),re().nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case i.ArrowDown:return e.preventDefault(),l({type:Z.GoToOption,focus:X.Next});case i.ArrowUp:return e.preventDefault(),l({type:Z.GoToOption,focus:X.Previous});case i.Home:case i.PageUp:return e.preventDefault(),l({type:Z.GoToOption,focus:X.First});case i.End:case i.PageDown:return e.preventDefault(),l({type:Z.GoToOption,focus:X.Last});case i.Escape:return e.preventDefault(),l({type:Z.CloseListbox}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));case i.Tab:return e.preventDefault();default:1===e.key.length&&(l({type:Z.Search,value:e.key}),v.setTimeout((function(){return l({type:Z.ClearSearch})}),350))}}),[p,l,v,c]),b=ie((function(){var e,t,n;return null!=(e=null==(t=c.labelRef.current)?void 0:t.id)?e:null==(n=c.buttonRef.current)?void 0:n.id}),[c.labelRef.current,c.buttonRef.current]),y=t.useMemo((function(){return{open:c.listboxState===z.Open}}),[c]);return d(a({},n,{"aria-activedescendant":null===c.activeOptionIndex||null==(o=c.options[c.activeOptionIndex])?void 0:o.id,"aria-labelledby":b,id:f,onKeyDown:m,role:"listbox",tabIndex:0,ref:s}),y,"ul",ye,c.listboxState===z.Open)}));pe.Button=be,pe.Label=function e(n){var r=se([pe.name,e.name].join("."))[0],o="headlessui-listbox-label-"+E(),i=t.useCallback((function(){var e;return null==(e=r.buttonRef.current)?void 0:e.focus({preventScroll:!0})}),[r.buttonRef]),u=t.useMemo((function(){return{open:r.listboxState===z.Open,disabled:r.disabled}}),[r]);return d(a({},n,{ref:r.labelRef,id:o,onClick:i}),u,"label")},pe.Options=ge,pe.Option=function e(n){var r=n.disabled,o=void 0!==r&&r,i=n.value,u=n.className,l=c(n,["disabled","value","className"]),s=se([pe.name,e.name].join(".")),f=s[0],p=s[1],v="headlessui-listbox-option-"+E(),m=null!==f.activeOptionIndex&&f.options[f.activeOptionIndex].id===v,h=f.propsRef.current.value===i,b=t.useRef({disabled:o,value:i});y((function(){b.current.disabled=o}),[b,o]),y((function(){b.current.value=i}),[b,i]),y((function(){var e,t;b.current.textValue=null==(e=document.getElementById(v))||null==(t=e.textContent)?void 0:t.toLowerCase()}),[b,v]);var g=t.useCallback((function(){return f.propsRef.current.onChange(i)}),[f.propsRef,i]);y((function(){return p({type:Z.RegisterOption,id:v,dataRef:b}),function(){return p({type:Z.UnregisterOption,id:v})}}),[b,v]),y((function(){var e;f.listboxState===z.Open&&h&&(p({type:Z.GoToOption,focus:X.Specific,id:v}),null==(e=document.getElementById(v))||null==e.focus||e.focus())}),[f.listboxState]),y((function(){if(f.listboxState===z.Open&&m){var e=re();return e.nextFrame((function(){var e;return null==(e=document.getElementById(v))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[v,m,f.listboxState]);var x=t.useCallback((function(e){if(o)return e.preventDefault();g(),p({type:Z.CloseListbox}),re().nextFrame((function(){var e;return null==(e=f.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))}),[p,f.buttonRef,o,g]),w=t.useCallback((function(){if(o)return p({type:Z.GoToOption,focus:X.Nothing});p({type:Z.GoToOption,focus:X.Specific,id:v})}),[o,v,p]),S=t.useCallback((function(){o||m||p({type:Z.GoToOption,focus:X.Specific,id:v})}),[o,m,v,p]),C=t.useCallback((function(){o||m&&p({type:Z.GoToOption,focus:X.Nothing})}),[o,m,p]),O=t.useMemo((function(){return{active:m,selected:h,disabled:o}}),[m,h,o]);return d(a({},l,{id:v,role:"option",tabIndex:-1,className:ae(u,O),"aria-disabled":!0===o||void 0,"aria-selected":!0===h||void 0,onClick:x,onFocus:w,onPointerMove:S,onMouseMove:S,onPointerLeave:C,onMouseLeave:C}),O,"li")},function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(me||(me={})),function(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"}(he||(he={}));var xe=((ve={})[he.CloseMenu]=function(e){return a({},e,{activeItemIndex:null,menuState:me.Closed})},ve[he.OpenMenu]=function(e){return a({},e,{menuState:me.Open})},ve[he.GoToItem]=function(e,t){var n=ue(t,{resolveItems:function(){return e.items},resolveActiveIndex:function(){return e.activeItemIndex},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.current.disabled}});return""===e.searchQuery&&e.activeItemIndex===n?e:a({},e,{searchQuery:"",activeItemIndex:n})},ve[he.Search]=function(e,t){var n=e.searchQuery+t.value,r=e.items.findIndex((function(e){var t;return(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(n))&&!e.dataRef.current.disabled}));return a({},e,-1===r||r===e.activeItemIndex?{searchQuery:n}:{searchQuery:n,activeItemIndex:r})},ve[he.ClearSearch]=function(e){return a({},e,{searchQuery:""})},ve[he.RegisterItem]=function(e,t){return a({},e,{items:[].concat(e.items,[{id:t.id,dataRef:t.dataRef}])})},ve[he.UnregisterItem]=function(e,t){var n=e.items.slice(),r=null!==e.activeItemIndex?n[e.activeItemIndex]:null,o=n.findIndex((function(e){return e.id===t.id}));return-1!==o&&n.splice(o,1),a({},e,{items:n,activeItemIndex:o===e.activeItemIndex||null===r?null:n.indexOf(r)})},ve),we=t.createContext(null);function Ee(e){var n=t.useContext(we);if(null===n){var r=new Error("<"+e+" /> is missing a parent <"+Oe.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Ee),r}return n}function Se(e,t){return f(t.type,xe,e,t)}we.displayName="MenuContext";var Ce=t.Fragment;function Oe(e){var n=t.useReducer(Se,{menuState:me.Closed,buttonRef:t.createRef(),itemsRef:t.createRef(),items:[],searchQuery:"",activeItemIndex:null}),r=n[0],o=r.menuState,i=r.itemsRef,a=r.buttonRef,c=n[1];t.useEffect((function(){function e(e){var t,n,r,u=e.target,l=document.activeElement;o===me.Open&&((null==(t=a.current)?void 0:t.contains(u))||((null==(n=i.current)?void 0:n.contains(u))||c({type:he.CloseMenu}),l!==document.body&&(null==l?void 0:l.contains(u))||e.defaultPrevented||null==(r=a.current)||r.focus({preventScroll:!0})))}return window.addEventListener("mousedown",e),function(){return window.removeEventListener("mousedown",e)}}),[o,i,a,c]);var l=t.useMemo((function(){return{open:o===me.Open}}),[o]);return u.createElement(we.Provider,{value:n},d(e,l,Ce))}var Ie=v((function e(n,r){var o,u=Ee([Oe.name,e.name].join(".")),c=u[0],l=u[1],s=h(c.buttonRef,r),f="headlessui-menu-button-"+E(),p=oe(),v=t.useCallback((function(e){switch(e.key){case i.Space:case i.Enter:case i.ArrowDown:e.preventDefault(),l({type:he.OpenMenu}),p.nextFrame((function(){var e;null==(e=c.itemsRef.current)||e.focus({preventScroll:!0}),l({type:he.GoToItem,focus:X.First})}));break;case i.ArrowUp:e.preventDefault(),l({type:he.OpenMenu}),p.nextFrame((function(){var e;null==(e=c.itemsRef.current)||e.focus({preventScroll:!0}),l({type:he.GoToItem,focus:X.Last})}))}}),[l,c,p]),m=t.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();n.disabled||(c.menuState===me.Open?(l({type:he.CloseMenu}),p.nextFrame((function(){var e;return null==(e=c.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:he.OpenMenu}),p.nextFrame((function(){var e;return null==(e=c.itemsRef.current)?void 0:e.focus({preventScroll:!0})}))))}),[l,p,c,n.disabled]),y=t.useMemo((function(){return{open:c.menuState===me.Open}}),[c]);return d(a({},n,{ref:s,id:f,type:"button","aria-haspopup":!0,"aria-controls":null==(o=c.itemsRef.current)?void 0:o.id,"aria-expanded":c.menuState===me.Open||void 0,onKeyDown:v,onClick:m}),y,"button")})),ke=r.RenderStrategy|r.Static,Re=v((function e(n,r){var o,u,c=Ee([Oe.name,e.name].join(".")),l=c[0],s=c[1],f=h(l.itemsRef,r),p="headlessui-menu-items-"+E(),v=oe();y((function(){var e=l.itemsRef.current;if(e&&l.menuState===me.Open)for(var t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:function(e){return"menuitem"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}});t.nextNode();)t.currentNode.setAttribute("role","none")}));var m=t.useCallback((function(e){switch(v.dispose(),e.key){case i.Space:if(""!==l.searchQuery)return e.preventDefault(),s({type:he.Search,value:e.key});case i.Enter:var t;e.preventDefault(),s({type:he.CloseMenu}),null!==l.activeItemIndex&&(null==(t=document.getElementById(l.items[l.activeItemIndex].id))||t.click()),re().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case i.ArrowDown:return e.preventDefault(),s({type:he.GoToItem,focus:X.Next});case i.ArrowUp:return e.preventDefault(),s({type:he.GoToItem,focus:X.Previous});case i.Home:case i.PageUp:return e.preventDefault(),s({type:he.GoToItem,focus:X.First});case i.End:case i.PageDown:return e.preventDefault(),s({type:he.GoToItem,focus:X.Last});case i.Escape:e.preventDefault(),s({type:he.CloseMenu}),re().nextFrame((function(){var e;return null==(e=l.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case i.Tab:return e.preventDefault();default:1===e.key.length&&(s({type:he.Search,value:e.key}),v.setTimeout((function(){return s({type:he.ClearSearch})}),350))}}),[s,v,l]),b=t.useMemo((function(){return{open:l.menuState===me.Open}}),[l]);return d(a({},n,{"aria-activedescendant":null===l.activeItemIndex||null==(o=l.items[l.activeItemIndex])?void 0:o.id,"aria-labelledby":null==(u=l.buttonRef.current)?void 0:u.id,id:p,onKeyDown:m,role:"menu",tabIndex:0,ref:f}),b,"div",ke,l.menuState===me.Open)})),Te=t.Fragment;Oe.Button=Ie,Oe.Items=Re,Oe.Item=function e(n){var r=n.disabled,o=void 0!==r&&r,i=n.className,u=n.onClick,l=c(n,["disabled","className","onClick"]),s=Ee([Oe.name,e.name].join(".")),f=s[0],p=s[1],v="headlessui-menu-item-"+E(),m=null!==f.activeItemIndex&&f.items[f.activeItemIndex].id===v;y((function(){if(f.menuState===me.Open&&m){var e=re();return e.nextFrame((function(){var e;return null==(e=document.getElementById(v))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[v,m,f.menuState]);var h=t.useRef({disabled:o});y((function(){h.current.disabled=o}),[h,o]),y((function(){var e,t;h.current.textValue=null==(e=document.getElementById(v))||null==(t=e.textContent)?void 0:t.toLowerCase()}),[h,v]),y((function(){return p({type:he.RegisterItem,id:v,dataRef:h}),function(){return p({type:he.UnregisterItem,id:v})}}),[h,v]);var b=t.useCallback((function(e){return o?e.preventDefault():(p({type:he.CloseMenu}),re().nextFrame((function(){var e;return null==(e=f.buttonRef.current)?void 0:e.focus({preventScroll:!0})})),u?u(e):void 0)}),[p,f.buttonRef,o,u]),g=t.useCallback((function(){if(o)return p({type:he.GoToItem,focus:X.Nothing});p({type:he.GoToItem,focus:X.Specific,id:v})}),[o,v,p]),x=t.useCallback((function(){o||m||p({type:he.GoToItem,focus:X.Specific,id:v})}),[o,m,v,p]),w=t.useCallback((function(){o||m&&p({type:he.GoToItem,focus:X.Nothing})}),[o,m,p]),S=t.useMemo((function(){return{active:m,disabled:o}}),[m,o]);return d(a({},l,{id:v,role:"menuitem",tabIndex:-1,className:ae(i,S),"aria-disabled":!0===o||void 0,onClick:b,onFocus:g,onPointerMove:x,onMouseMove:x,onPointerLeave:w,onMouseLeave:w}),S,Te)};var Le=t.createContext(null);function De(e){var n=t.useContext(Le);if(null===n){var r=new Error("<"+e+" /> is missing a parent <Switch.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,De),r}return n}Le.displayName="GroupContext";var Fe,Pe=t.Fragment;function Me(e){var n,r,o=e.checked,u=e.onChange,l=e.className,s=c(e,["checked","onChange","className"]),f="headlessui-switch-"+E(),p=t.useContext(Le),v=t.useCallback((function(){return u(!o)}),[u,o]),m=t.useCallback((function(e){if(b(e.currentTarget))return e.preventDefault();e.preventDefault(),v()}),[v]),h=t.useCallback((function(e){e.key!==i.Tab&&e.preventDefault(),e.key===i.Space&&v()}),[v]),y=t.useCallback((function(e){return e.preventDefault()}),[]),g=t.useMemo((function(){return{checked:o}}),[o]),x={id:f,ref:null===p?void 0:p.setSwitch,role:"switch",tabIndex:0,className:ae(l,g),"aria-checked":o,"aria-labelledby":null==p||null==(n=p.label)?void 0:n.id,"aria-describedby":null==p||null==(r=p.description)?void 0:r.id,onClick:m,onKeyUp:h,onKeyPress:y};return"button"===s.as&&Object.assign(x,{type:"button"}),d(a({},s,x),g,"button")}function Ae(){var e=t.useRef(!0);return t.useEffect((function(){e.current=!1}),[]),e.current}function Ne(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e&&r.length>0&&(t=e.classList).add.apply(t,r)}function je(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e&&r.length>0&&(t=e.classList).remove.apply(t,r)}function Ge(e,t,n,r,o){var i=re(),u=void 0!==o?function(e){var t={called:!1};return function(){if(!t.called)return t.called=!0,e.apply(void 0,arguments)}}(o):function(){};return Ne.apply(void 0,[e].concat(t,n)),i.nextFrame((function(){je.apply(void 0,[e].concat(n)),Ne.apply(void 0,[e].concat(r)),i.add(function(e,t){var n=re();if(!e)return n.dispose;var r=getComputedStyle(e),o=[r.transitionDuration,r.transitionDelay].map((function(e){var t=e.split(",").filter(Boolean).map((function(e){return e.includes("ms")?parseFloat(e):1e3*parseFloat(e)})).sort((function(e,t){return t-e}))[0];return void 0===t?0:t})),i=o[0];return 0!==i?n.setTimeout((function(){t(Fe.Finished)}),i+o[1]):t(Fe.Finished),n.add((function(){return t(Fe.Cancelled)})),n.dispose}(e,(function(n){return je.apply(void 0,[e].concat(r,t)),u(n)})))})),i.add((function(){return je.apply(void 0,[e].concat(t,n,r))})),i.add((function(){return u(Fe.Cancelled)})),i.dispose}function Ue(e){return void 0===e&&(e=""),t.useMemo((function(){return e.split(" ").filter((function(e){return e.trim().length>1}))}),[e])}Me.Group=function(e){var n=t.useState(null),r=n[0],o=n[1],i=t.useState(null),a=i[0],c=i[1],l=t.useState(null),s=l[0],f=l[1],p=t.useMemo((function(){return{switch:r,setSwitch:o,label:a,setLabel:c,description:s,setDescription:f}}),[r,o,a,c,s,f]);return u.createElement(Le.Provider,{value:p},d(e,{},Pe))},Me.Label=function e(n){var r=De([Me.name,e.name].join(".")),o="headlessui-switch-label-"+E(),i=t.useCallback((function(){r.switch&&(r.switch.click(),r.switch.focus({preventScroll:!0}))}),[r.switch]);return d(a({},n,{ref:r.setLabel,id:o,onClick:i}),{},"label")},Me.Description=function e(t){var n=De([Me.name,e.name].join(".")),r="headlessui-switch-description-"+E();return d(a({},t,{ref:n.setDescription,id:r}),{},"p")},function(e){e.Finished="finished",e.Cancelled="cancelled"}(Fe||(Fe={}));var He,Ve=t.createContext(null);Ve.displayName="TransitionContext",function(e){e.Visible="visible",e.Hidden="hidden"}(He||(He={}));var _e=t.createContext(null);function Be(e){return"children"in e?Be(e.children):e.current.filter((function(e){return e.state===He.Visible})).length>0}function Qe(e){var n=t.useRef(e),r=t.useRef([]),i=function(){var e=t.useRef(!0);return t.useEffect((function(){return function(){e.current=!1}}),[]),e}();t.useEffect((function(){n.current=e}),[e]);var u=t.useCallback((function(e,t){var u;void 0===t&&(t=o.Hidden);var a=r.current.findIndex((function(t){return t.id===e}));-1!==a&&(f(t,((u={})[o.Unmount]=function(){r.current.splice(a,1)},u[o.Hidden]=function(){r.current[a].state=He.Hidden},u)),!Be(r)&&i.current&&(null==n.current||n.current()))}),[n,i,r]),a=t.useCallback((function(e){var t=r.current.find((function(t){return t.id===e}));return t?t.state!==He.Visible&&(t.state=He.Visible):r.current.push({id:e,state:He.Visible}),function(){return u(e,o.Unmount)}}),[r,u]);return t.useMemo((function(){return{children:r,register:a,unregister:u}}),[a,u,r])}function Ke(){}_e.displayName="NestingContext";var Ye=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function qe(e){for(var t,n={},r=s(Ye);!(t=r()).done;){var o,i=t.value;n[i]=null!=(o=e[i])?o:Ke}return n}var We=r.RenderStrategy;function Je(e){var n=e.beforeEnter,r=e.afterEnter,i=e.beforeLeave,l=e.afterLeave,s=e.enter,p=e.enterFrom,v=e.enterTo,m=e.leave,h=e.leaveFrom,b=e.leaveTo,g=c(e,["beforeEnter","afterEnter","beforeLeave","afterLeave","enter","enterFrom","enterTo","leave","leaveFrom","leaveTo"]),x=t.useRef(null),w=t.useState(He.Visible),S=w[0],C=w[1],O=g.unmount?o.Unmount:o.Hidden,I=function(){var e=t.useContext(Ve);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),k=I.show,R=I.appear,T=function(){var e=t.useContext(_e);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition />.");return e}(),L=T.register,D=T.unregister,F=Ae(),P=E(),M=t.useRef(!1),A=Qe((function(){M.current||(C(He.Hidden),D(P),_.current.afterLeave())}));y((function(){if(P)return L(P)}),[L,P]),y((function(){var e;O===o.Hidden&&P&&(k&&S!==He.Visible?C(He.Visible):f(S,((e={})[He.Hidden]=function(){return D(P)},e[He.Visible]=function(){return L(P)},e)))}),[S,P,L,D,k,O]);var N=Ue(s),j=Ue(p),G=Ue(v),U=Ue(m),H=Ue(h),V=Ue(b),_=function(e){var n=t.useRef(qe(e));return t.useEffect((function(){n.current=qe(e)}),[e]),n}({beforeEnter:n,afterEnter:r,beforeLeave:i,afterLeave:l});t.useEffect((function(){if(S===He.Visible&&null===x.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[x,S]);var B=F&&!R;return y((function(){var e=x.current;if(e&&!B)return M.current=!0,k&&_.current.beforeEnter(),k||_.current.beforeLeave(),k?Ge(e,N,j,G,(function(e){M.current=!1,e===Fe.Finished&&_.current.afterEnter()})):Ge(e,U,H,V,(function(e){M.current=!1,e===Fe.Finished&&(Be(A)||(C(He.Hidden),D(P),_.current.afterLeave()))}))}),[_,P,M,D,A,x,B,k,N,j,G,U,H,V]),u.createElement(_e.Provider,{value:A},d(a({},g,{ref:x}),{},"div",We,S===He.Visible))}function Xe(e){var n=e.show,r=e.appear,o=void 0!==r&&r,i=e.unmount,l=c(e,["show","appear","unmount"]);if(![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");var s=t.useState(n?He.Visible:He.Hidden),f=s[0],p=s[1],v=Qe((function(){p(He.Hidden)})),m=Ae(),h=t.useMemo((function(){return{show:n,appear:o||!m}}),[n,o,m]);t.useEffect((function(){n?p(He.Visible):Be(v)||p(He.Hidden)}),[n,v]);var b={unmount:i};return u.createElement(_e.Provider,{value:v},u.createElement(Ve.Provider,{value:h},d(a({},b,{as:t.Fragment,children:u.createElement(Je,Object.assign({},b,l))}),{},t.Fragment,We,f===He.Visible)))}Xe.Child=Je,e.Dialog=B,e.Disclosure=J,e.FocusTrap=function(e){var n=t.useRef(null),r=e.initialFocus,o=c(e,["initialFocus"]);return O(n,!0,{initialFocus:r}),d(a({},o,{ref:n}),{},"div")},e.Listbox=pe,e.Menu=Oe,e.Portal=M,e.Switch=Me,e.Transition=Xe,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=headlessui.umd.production.min.js.map |
@@ -1,2 +0,2 @@ | ||
import * as React from 'react'; | ||
/// <reference types="react" /> | ||
export declare function useComputed<T>(cb: () => T, dependencies: React.DependencyList): T; |
@@ -1,2 +0,2 @@ | ||
import * as React from 'react'; | ||
export declare function useIsMounted(): React.MutableRefObject<boolean>; | ||
/// <reference types="react" /> | ||
export declare function useIsMounted(): import("react").MutableRefObject<boolean>; |
@@ -1,2 +0,2 @@ | ||
import * as React from 'react'; | ||
export declare const useIsoMorphicEffect: typeof React.useLayoutEffect; | ||
import { useLayoutEffect } from 'react'; | ||
export declare const useIsoMorphicEffect: typeof useLayoutEffect; |
@@ -1,2 +0,2 @@ | ||
import * as React from 'react'; | ||
/// <reference types="react" /> | ||
export declare function useSyncRefs<TType>(...refs: (React.MutableRefObject<TType> | ((instance: TType) => void) | null)[]): (value: TType) => void; |
@@ -1,4 +0,8 @@ | ||
export * from './components/transitions/transition'; | ||
export * from './components/dialog/dialog'; | ||
export * from './components/disclosure/disclosure'; | ||
export * from './components/focus-trap/focus-trap'; | ||
export * from './components/listbox/listbox'; | ||
export * from './components/menu/menu'; | ||
export * from './components/listbox/listbox'; | ||
export * from './components/portal/portal'; | ||
export * from './components/switch/switch'; | ||
export * from './components/transitions/transition'; |
@@ -7,4 +7,8 @@ export declare function getMenuButton(): HTMLElement | null; | ||
export declare enum MenuState { | ||
Open = 0, | ||
Closed = 1 | ||
/** The menu is visible to the user. */ | ||
Visible = 0, | ||
/** The menu is **not** visible to the user. It's still in the DOM, but it is hidden. */ | ||
InvisibleHidden = 1, | ||
/** The menu is **not** visible to the user. It's not in the DOM, it is unmounted. */ | ||
InvisibleUnmounted = 2 | ||
} | ||
@@ -35,4 +39,8 @@ export declare function assertMenuButton(options: { | ||
export declare enum ListboxState { | ||
Open = 0, | ||
Closed = 1 | ||
/** The listbox is visible to the user. */ | ||
Visible = 0, | ||
/** The listbox is **not** visible to the user. It's still in the DOM, but it is hidden. */ | ||
InvisibleHidden = 1, | ||
/** The listbox is **not** visible to the user. It's not in the DOM, it is unmounted. */ | ||
InvisibleUnmounted = 2 | ||
} | ||
@@ -76,4 +84,60 @@ export declare function assertListbox(options: { | ||
label?: string; | ||
description?: string; | ||
}, switchElement?: HTMLElement | null): void; | ||
export declare function getDisclosureButton(): HTMLElement | null; | ||
export declare function getDisclosurePanel(): HTMLElement | null; | ||
export declare enum DisclosureState { | ||
/** The disclosure is visible to the user. */ | ||
Visible = 0, | ||
/** The disclosure is **not** visible to the user. It's still in the DOM, but it is hidden. */ | ||
InvisibleHidden = 1, | ||
/** The disclosure is **not** visible to the user. It's not in the DOM, it is unmounted. */ | ||
InvisibleUnmounted = 2 | ||
} | ||
export declare function assertDisclosureButton(options: { | ||
attributes?: Record<string, string | null>; | ||
textContent?: string; | ||
state: DisclosureState; | ||
}, button?: HTMLElement | null): void; | ||
export declare function assertDisclosurePanel(options: { | ||
attributes?: Record<string, string | null>; | ||
textContent?: string; | ||
state: DisclosureState; | ||
}, panel?: HTMLElement | null): void; | ||
export declare function assertLabelValue(element: HTMLElement | null, value: string): void; | ||
export declare function assertDescriptionValue(element: HTMLElement | null, value: string): void; | ||
export declare function getDialog(): HTMLElement | null; | ||
export declare function getDialogTitle(): HTMLElement | null; | ||
export declare function getDialogDescription(): HTMLElement | null; | ||
export declare function getDialogOverlay(): HTMLElement | null; | ||
export declare enum DialogState { | ||
/** The dialog is visible to the user. */ | ||
Visible = 0, | ||
/** The dialog is **not** visible to the user. It's still in the DOM, but it is hidden. */ | ||
InvisibleHidden = 1, | ||
/** The dialog is **not** visible to the user. It's not in the DOM, it is unmounted. */ | ||
InvisibleUnmounted = 2 | ||
} | ||
export declare function assertDialog(options: { | ||
attributes?: Record<string, string | null>; | ||
textContent?: string; | ||
state: DialogState; | ||
}, dialog?: HTMLElement | null): void; | ||
export declare function assertDialogTitle(options: { | ||
attributes?: Record<string, string | null>; | ||
textContent?: string; | ||
state: DialogState; | ||
}, title?: HTMLElement | null, dialog?: HTMLElement | null): void; | ||
export declare function assertDialogDescription(options: { | ||
attributes?: Record<string, string | null>; | ||
textContent?: string; | ||
state: DialogState; | ||
}, description?: HTMLElement | null, dialog?: HTMLElement | null): void; | ||
export declare function assertDialogOverlay(options: { | ||
attributes?: Record<string, string | null>; | ||
textContent?: string; | ||
state: DialogState; | ||
}, overlay?: HTMLElement | null): void; | ||
export declare function assertActiveElement(element: HTMLElement | null): void; | ||
export declare function assertHidden(element: HTMLElement | null): void; | ||
export declare function assertVisible(element: HTMLElement | null): void; |
@@ -1,2 +0,2 @@ | ||
export declare const Keys: Record<string, Partial<KeyboardEvent>>; | ||
export declare let Keys: Record<string, Partial<KeyboardEvent>>; | ||
export declare function shift(event: Partial<KeyboardEvent>): { | ||
@@ -47,5 +47,9 @@ shiftKey: boolean; | ||
export declare function word(input: string): Partial<KeyboardEvent>[]; | ||
export declare function type(events: Partial<KeyboardEvent>[]): Promise<void>; | ||
export declare function press(event: Partial<KeyboardEvent>): Promise<void>; | ||
export declare function click(element: Document | Element | Window | Node | null): Promise<void>; | ||
export declare function type(events: Partial<KeyboardEvent>[], element?: Element | null): Promise<void>; | ||
export declare function press(event: Partial<KeyboardEvent>, element?: Element | null): Promise<void>; | ||
export declare enum MouseButton { | ||
Left = 0, | ||
Right = 2 | ||
} | ||
export declare function click(element: Document | Element | Window | Node | null, button?: MouseButton): Promise<void>; | ||
export declare function focus(element: Document | Element | Window | Node | null): Promise<void>; | ||
@@ -52,0 +56,0 @@ export declare function mouseEnter(element: Document | Element | Window | null): Promise<void>; |
/// <reference types="react" /> | ||
declare const __: unique symbol; | ||
export declare type __ = typeof __; | ||
export declare type Expand<T> = T extends infer O ? { | ||
[K in keyof O]: O[K]; | ||
} : never; | ||
export declare type PropsOf<TTag = any> = TTag extends React.ElementType ? React.ComponentProps<TTag> : never; | ||
export declare type Props<TTag, TSlot = {}, TOmitableProps extends keyof any = ''> = { | ||
export declare type Props<TTag, TSlot = {}, TOmitableProps extends keyof any = __> = { | ||
as?: TTag; | ||
children?: React.ReactNode | ((bag: TSlot) => React.ReactElement); | ||
} & Omit<PropsOf<TTag>, TOmitableProps>; | ||
refName?: string; | ||
} & (TOmitableProps extends __ ? PropsOf<TTag> : Omit<PropsOf<TTag>, TOmitableProps>); | ||
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 {}; |
@@ -1,4 +0,33 @@ | ||
import * as React from 'react'; | ||
import { Props } from '../types'; | ||
export declare function render<TTag extends React.ElementType, TBag>(props: Props<TTag, TBag, any>, bag: TBag, tag: React.ElementType): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>; | ||
import { ElementType, ReactElement } from 'react'; | ||
import { Props, XOR, __, Expand } from '../types'; | ||
export declare enum Features { | ||
/** No features at all */ | ||
None = 0, | ||
/** | ||
* When used, this will allow us to use one of the render strategies. | ||
* | ||
* **The render strategies are:** | ||
* - **Unmount** _(Will unmount the component.)_ | ||
* - **Hidden** _(Will hide the component using the [hidden] attribute.)_ | ||
*/ | ||
RenderStrategy = 1, | ||
/** | ||
* When used, this will allow the user of our component to be in control. This can be used when | ||
* you want to transition based on some state. | ||
*/ | ||
Static = 2 | ||
} | ||
export declare enum RenderStrategy { | ||
Unmount = 0, | ||
Hidden = 1 | ||
} | ||
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, { | ||
static?: boolean; | ||
}>, PropsForFeature<T, Features.RenderStrategy, { | ||
unmount?: boolean; | ||
}>>; | ||
export declare function render<TFeature extends Features, TTag extends ElementType, TBag>(props: Expand<Props<TTag, TBag, any> & PropsForFeatures<TFeature>>, propsBag: TBag, defaultTag: ElementType, features?: TFeature, visible?: boolean): ReactElement<any, string | ((props: any) => ReactElement<any, string | any | (new (props: any) => import("react").Component<any, any, any>)> | null) | (new (props: any) => import("react").Component<any, any, any>)> | null; | ||
/** | ||
@@ -8,2 +37,5 @@ * This is a hack, but basically we want to keep the full 'API' of the component, but we do want to | ||
*/ | ||
export declare function forwardRefWithAs<T>(component: T): T; | ||
export declare function forwardRefWithAs<T extends { | ||
name: string; | ||
}>(component: T): T; | ||
export {}; |
{ | ||
"name": "@headlessui/react", | ||
"version": "0.2.0", | ||
"version": "0.3.0-cb4fe61", | ||
"main": "dist/index.js", | ||
@@ -34,12 +34,12 @@ "typings": "dist/index.d.ts", | ||
"devDependencies": { | ||
"@types/react": "^16.9.50", | ||
"@types/react-dom": "^16.9.8", | ||
"@popperjs/core": "^2.5.3", | ||
"@testing-library/react": "^11.0.4", | ||
"framer-motion": "^2.7.7", | ||
"next": "9.5.3", | ||
"react": "^16.13.1", | ||
"react-dom": "^16.13.1", | ||
"@types/react": "^16.14.2", | ||
"@types/react-dom": "^16.9.10", | ||
"@popperjs/core": "^2.6.0", | ||
"@testing-library/react": "^11.2.3", | ||
"framer-motion": "^2.9.5", | ||
"next": "10.0.5", | ||
"react": "^16.14.0", | ||
"react-dom": "^16.14.0", | ||
"snapshot-diff": "^0.8.1" | ||
} | ||
} |
414
README.md
@@ -32,3 +32,3 @@ <h3 align="center"> | ||
- [Menu Button (Dropdown)](#menu-button-dropdown) | ||
- [Listbox (Select)](#listbox) | ||
- [Listbox (Select)](#listbox-select) | ||
- [Switch (Toggle)](#switch-toggle) | ||
@@ -148,27 +148,2 @@ | ||
If you'd prefer not to render an additional element at all, you can pass your children as a function instead which will receive a `ref` that you need to attach to your root node: | ||
```tsx | ||
import { Transition } from '@headlessui/react' | ||
import { useState } from 'react' | ||
function MyComponent() { | ||
const [isOpen, setIsOpen] = useState(false) | ||
return ( | ||
<> | ||
<button onClick={() => setIsOpen(!isOpen)}>Toggle</button> | ||
<Transition | ||
show={isOpen} | ||
// ... | ||
> | ||
{ref => <div ref={ref}>{/* Your content goes here*/}</div>} | ||
</Transition> | ||
</> | ||
) | ||
} | ||
``` | ||
Be sure to attach the `ref` or your transitions will not work correctly. | ||
### Animating transitions | ||
@@ -317,19 +292,22 @@ | ||
| Prop | Type | Description | | ||
| ----------- | ------------------------------------- | ------------------------------------------------------------------------------------- | | ||
| `show` | Boolean | Whether the children should be shown or hidden. | | ||
| `as` | String Component _(Default: `'div'`)_ | The element or component to render in place of the `Transition` itself. | | ||
| `appear` | Boolean _(Default: `false`)_ | Whether the transition should run on initial mount. | | ||
| `enter` | String _(Default: '')_ | Classes to add to the transitioning element during the entire enter phase. | | ||
| `enterFrom` | String _(Default: '')_ | Classes to add to the transitioning element before the enter phase starts. | | ||
| `enterTo` | String _(Default: '')_ | Classes to add to the transitioning element immediately after the enter phase starts. | | ||
| `leave` | String _(Default: '')_ | Classes to add to the transitioning element during the entire leave phase. | | ||
| `leaveFrom` | String _(Default: '')_ | Classes to add to the transitioning element before the leave phase starts. | | ||
| `leaveTo` | String _(Default: '')_ | Classes to add to the transitioning element immediately after the leave phase starts. | | ||
| Prop | Type | Description | | ||
| ------------- | ------------------------------------- | ------------------------------------------------------------------------------------- | | ||
| `show` | Boolean | Whether the children should be shown or hidden. | | ||
| `as` | String Component _(Default: `'div'`)_ | The element or component to render in place of the `Transition` itself. | | ||
| `appear` | Boolean _(Default: `false`)_ | Whether the transition should run on initial mount. | | ||
| `unmount` | Boolean _(Default: `true`)_ | Whether the element should be `unmounted` or `hidden` based on the show state. | | ||
| `enter` | String _(Default: '')_ | Classes to add to the transitioning element during the entire enter phase. | | ||
| `enterFrom` | String _(Default: '')_ | Classes to add to the transitioning element before the enter phase starts. | | ||
| `enterTo` | String _(Default: '')_ | Classes to add to the transitioning element immediately after the enter phase starts. | | ||
| `leave` | String _(Default: '')_ | Classes to add to the transitioning element during the entire leave phase. | | ||
| `leaveFrom` | String _(Default: '')_ | Classes to add to the transitioning element before the leave phase starts. | | ||
| `leaveTo` | String _(Default: '')_ | Classes to add to the transitioning element immediately after the leave phase starts. | | ||
| `beforeEnter` | Function | Callback which is called before we start the enter transition. | | ||
| `afterEnter` | Function | Callback which is called after we finished the enter transition. | | ||
| `beforeLeave` | Function | Callback which is called before we start the leave transition. | | ||
| `afterLeave` | Function | Callback which is called after we finished the leave transition. | | ||
##### Render prop arguments | ||
| Prop | Type | Description | | ||
| ----- | ---------------------- | ----------------------------------------------------------------------------------- | | ||
| `ref` | React.MutableRefObject | A ref that needs to be manually added to the child node when using the render prop. | | ||
- None | ||
@@ -356,18 +334,21 @@ #### Transition.Child | ||
| Prop | Type | Description | | ||
| ----------- | ------------------------------------- | ------------------------------------------------------------------------------------- | | ||
| `as` | String Component _(Default: `'div'`)_ | The element or component to render in place of the `Transition.Child` itself. | | ||
| `appear` | Boolean _(Default: `false`)_ | Whether the transition should run on initial mount. | | ||
| `enter` | String _(Default: '')_ | Classes to add to the transitioning element during the entire enter phase. | | ||
| `enterFrom` | String _(Default: '')_ | Classes to add to the transitioning element before the enter phase starts. | | ||
| `enterTo` | String _(Default: '')_ | Classes to add to the transitioning element immediately after the enter phase starts. | | ||
| `leave` | String _(Default: '')_ | Classes to add to the transitioning element during the entire leave phase. | | ||
| `leaveFrom` | String _(Default: '')_ | Classes to add to the transitioning element before the leave phase starts. | | ||
| `leaveTo` | String _(Default: '')_ | Classes to add to the transitioning element immediately after the leave phase starts. | | ||
| Prop | Type | Description | | ||
| ------------- | ------------------------------------- | ------------------------------------------------------------------------------------- | | ||
| `as` | String Component _(Default: `'div'`)_ | The element or component to render in place of the `Transition.Child` itself. | | ||
| `appear` | Boolean _(Default: `false`)_ | Whether the transition should run on initial mount. | | ||
| `unmount` | Boolean _(Default: `true`)_ | Whether the element should be `unmounted` or `hidden` based on the show state. | | ||
| `enter` | String _(Default: '')_ | Classes to add to the transitioning element during the entire enter phase. | | ||
| `enterFrom` | String _(Default: '')_ | Classes to add to the transitioning element before the enter phase starts. | | ||
| `enterTo` | String _(Default: '')_ | Classes to add to the transitioning element immediately after the enter phase starts. | | ||
| `leave` | String _(Default: '')_ | Classes to add to the transitioning element during the entire leave phase. | | ||
| `leaveFrom` | String _(Default: '')_ | Classes to add to the transitioning element before the leave phase starts. | | ||
| `leaveTo` | String _(Default: '')_ | Classes to add to the transitioning element immediately after the leave phase starts. | | ||
| `beforeEnter` | Function | Callback which is called before we start the enter transition. | | ||
| `afterEnter` | Function | Callback which is called after we finished the enter transition. | | ||
| `beforeLeave` | Function | Callback which is called before we start the leave transition. | | ||
| `afterLeave` | Function | Callback which is called after we finished the leave transition. | | ||
##### Render prop arguments | ||
| Prop | Type | Description | | ||
| ----- | ---------------------- | ----------------------------------------------------------------------------------- | | ||
| `ref` | React.MutableRefObject | A ref that needs to be manually added to the child node when using the render prop. | | ||
- None | ||
@@ -585,5 +566,5 @@ --- | ||
<Menu.Items> | ||
<div class="px-4 py-3"> | ||
<p class="text-sm leading-5">Signed in as</p> | ||
<p class="text-sm font-medium leading-5 text-gray-900 truncate">tom@example.com</p> | ||
<div className="px-4 py-3"> | ||
<p className="text-sm leading-5">Signed in as</p> | ||
<p className="text-sm font-medium leading-5 text-gray-900 truncate">tom@example.com</p> | ||
</div> | ||
@@ -730,7 +711,10 @@ <Menu.Item> | ||
| Prop | Type | Default | Description | | ||
| -------- | ------------------- | ------- | --------------------------------------------------------------------------- | | ||
| `as` | String \| Component | `div` | The element or component the `Menu.Items` should render as. | | ||
| `static` | Boolean | `false` | Whether the element should ignore the internally managed open/closed state. | | ||
| Prop | Type | Default | Description | | ||
| --------- | ------------------- | ------- | --------------------------------------------------------------------------------- | | ||
| `as` | String \| Component | `div` | The element or component the `Menu.Items` should render as. | | ||
| `static` | Boolean | `false` | Whether the element should ignore the internally managed open/closed state. | | ||
| `unmount` | Boolean | `true` | Whether the element should be unmounted or hidden based on the open/closed state. | | ||
> **note**: `static` and `unmount` can not be used at the same time. You will get a TypeScript error if you try to do it. | ||
##### Render prop object | ||
@@ -794,13 +778,14 @@ | ||
```jsx | ||
import { useState, Fragment } from 'react' | ||
import { useState } from 'react' | ||
import { Listbox } from '@headlessui/react' | ||
const people = [ | ||
{ id: 1, name: 'Durward Reynolds', unavailable: false }, | ||
{ id: 2, name: 'Kenton Towne', unavailable: false }, | ||
{ id: 3, name: 'Therese Wunsch', unavailable: false }, | ||
{ id: 4, name: 'Benedict Kessler', unavailable: true }, | ||
{ id: 5, name: 'Katelyn Rohan', unavailable: false }, | ||
] | ||
function MyListbox() { | ||
const people = [ | ||
{ id: 1, name: 'Durward Reynolds', unavailable: false }, | ||
{ id: 2, name: 'Kenton Towne', unavailable: false }, | ||
{ id: 3, name: 'Therese Wunsch', unavailable: false }, | ||
{ id: 4, name: 'Benedict Kessler', unavailable: true }, | ||
{ id: 5, name: 'Katelyn Rohan', unavailable: false }, | ||
] | ||
const [selectedPerson, setSelectedPerson] = useState(people[0]) | ||
@@ -840,10 +825,11 @@ | ||
const people = [ | ||
{ id: 1, name: 'Durward Reynolds' }, | ||
{ id: 2, name: 'Kenton Towne' }, | ||
{ id: 3, name: 'Therese Wunsch' }, | ||
{ id: 4, name: 'Benedict Kessler' }, | ||
{ id: 5, name: 'Katelyn Rohan' }, | ||
] | ||
function MyListbox() { | ||
const people = [ | ||
{ id: 1, name: 'Durward Reynolds' }, | ||
{ id: 2, name: 'Kenton Towne' }, | ||
{ id: 3, name: 'Therese Wunsch' }, | ||
{ id: 4, name: 'Benedict Kessler' }, | ||
{ id: 5, name: 'Katelyn Rohan' }, | ||
] | ||
const [selectedPerson, setSelectedPerson] = useState(people[0]) | ||
@@ -856,4 +842,4 @@ | ||
{people.map(person => ( | ||
{/* Use the `active` state to conditionally style the active option. */} | ||
{/* Use the `selected` state to conditionally style the selected option. */} | ||
/* Use the `active` state to conditionally style the active option. */ | ||
/* Use the `selected` state to conditionally style the selected option. */ | ||
<Listbox.Option as={Fragment} key={person.id} value={person}> | ||
@@ -883,10 +869,11 @@ {({ active, selected }) => ( | ||
const people = [ | ||
{ id: 1, name: 'Durward Reynolds' }, | ||
{ id: 2, name: 'Kenton Towne' }, | ||
{ id: 3, name: 'Therese Wunsch' }, | ||
{ id: 4, name: 'Benedict Kessler' }, | ||
{ id: 5, name: 'Katelyn Rohan' }, | ||
] | ||
function MyListbox() { | ||
const people = [ | ||
{ id: 1, name: 'Durward Reynolds' }, | ||
{ id: 2, name: 'Kenton Towne' }, | ||
{ id: 3, name: 'Therese Wunsch' }, | ||
{ id: 4, name: 'Benedict Kessler' }, | ||
{ id: 5, name: 'Katelyn Rohan' }, | ||
] | ||
const [selectedPerson, setSelectedPerson] = useState(people[0]) | ||
@@ -915,13 +902,14 @@ | ||
```jsx | ||
import { useState, Fragment } from 'react' | ||
import { useState } from 'react' | ||
import { Listbox } from '@headlessui/react' | ||
const people = [ | ||
{ id: 1, name: 'Durward Reynolds', unavailable: false }, | ||
{ id: 2, name: 'Kenton Towne', unavailable: false }, | ||
{ id: 3, name: 'Therese Wunsch', unavailable: false }, | ||
{ id: 4, name: 'Benedict Kessler', unavailable: true }, | ||
{ id: 5, name: 'Katelyn Rohan', unavailable: false }, | ||
] | ||
function MyListbox() { | ||
const people = [ | ||
{ id: 1, name: 'Durward Reynolds', unavailable: false }, | ||
{ id: 2, name: 'Kenton Towne', unavailable: false }, | ||
{ id: 3, name: 'Therese Wunsch', unavailable: false }, | ||
{ id: 4, name: 'Benedict Kessler', unavailable: true }, | ||
{ id: 5, name: 'Katelyn Rohan', unavailable: false }, | ||
] | ||
const [selectedPerson, setSelectedPerson] = useState(people[0]) | ||
@@ -949,13 +937,14 @@ | ||
```jsx | ||
import { useState, Fragment } from 'react' | ||
import { useState } from 'react' | ||
import { Listbox } from '@headlessui/react' | ||
const people = [ | ||
{ id: 1, name: 'Durward Reynolds', unavailable: false }, | ||
{ id: 2, name: 'Kenton Towne', unavailable: false }, | ||
{ id: 3, name: 'Therese Wunsch', unavailable: false }, | ||
{ id: 4, name: 'Benedict Kessler', unavailable: true }, | ||
{ id: 5, name: 'Katelyn Rohan', unavailable: false }, | ||
] | ||
function MyListbox() { | ||
const people = [ | ||
{ id: 1, name: 'Durward Reynolds', unavailable: false }, | ||
{ id: 2, name: 'Kenton Towne', unavailable: false }, | ||
{ id: 3, name: 'Therese Wunsch', unavailable: false }, | ||
{ id: 4, name: 'Benedict Kessler', unavailable: true }, | ||
{ id: 5, name: 'Katelyn Rohan', unavailable: false }, | ||
] | ||
const [selectedPerson, setSelectedPerson] = useState(people[0]) | ||
@@ -992,13 +981,14 @@ | ||
```jsx | ||
import { useState, Fragment } from 'react' | ||
import { useState } from 'react' | ||
import { Listbox } from '@headlessui/react' | ||
const people = [ | ||
{ id: 1, name: 'Durward Reynolds', unavailable: false }, | ||
{ id: 2, name: 'Kenton Towne', unavailable: false }, | ||
{ id: 3, name: 'Therese Wunsch', unavailable: false }, | ||
{ id: 4, name: 'Benedict Kessler', unavailable: true }, | ||
{ id: 5, name: 'Katelyn Rohan', unavailable: false }, | ||
] | ||
function MyListbox() { | ||
const people = [ | ||
{ id: 1, name: 'Durward Reynolds', unavailable: false }, | ||
{ id: 2, name: 'Kenton Towne', unavailable: false }, | ||
{ id: 3, name: 'Therese Wunsch', unavailable: false }, | ||
{ id: 4, name: 'Benedict Kessler', unavailable: true }, | ||
{ id: 5, name: 'Katelyn Rohan', unavailable: false }, | ||
] | ||
const [selectedPerson, setSelectedPerson] = useState(people[0]) | ||
@@ -1011,3 +1001,3 @@ | ||
{people.map(person => ( | ||
{/* Disabled options will be skipped by keyboard navigation. */} | ||
/* Disabled options will be skipped by keyboard navigation. */ | ||
<Listbox.Option key={person.id} value={person} disabled={person.unavailable}> | ||
@@ -1028,13 +1018,14 @@ <span className={person.unavailable ? 'opacity-75' : ''}>{person.name}</span> | ||
```jsx | ||
import { useState, Fragment } from 'react' | ||
import { useState } from 'react' | ||
import { Listbox, Transition } from '@headlessui/react' | ||
const people = [ | ||
{ id: 1, name: 'Durward Reynolds', unavailable: false }, | ||
{ id: 2, name: 'Kenton Towne', unavailable: false }, | ||
{ id: 3, name: 'Therese Wunsch', unavailable: false }, | ||
{ id: 4, name: 'Benedict Kessler', unavailable: true }, | ||
{ id: 5, name: 'Katelyn Rohan', unavailable: false }, | ||
] | ||
function MyListbox() { | ||
const people = [ | ||
{ id: 1, name: 'Durward Reynolds', unavailable: false }, | ||
{ id: 2, name: 'Kenton Towne', unavailable: false }, | ||
{ id: 3, name: 'Therese Wunsch', unavailable: false }, | ||
{ id: 4, name: 'Benedict Kessler', unavailable: true }, | ||
{ id: 5, name: 'Katelyn Rohan', unavailable: false }, | ||
] | ||
const [selectedPerson, setSelectedPerson] = useState(people[0]) | ||
@@ -1044,21 +1035,25 @@ | ||
<Listbox value={selectedPerson} onChange={setSelectedPerson}> | ||
<Listbox.Button>{selectedPerson.name}</Listbox.Button> | ||
{/* Use the Transition + open render prop argument to add transitions. */} | ||
<Transition | ||
show={open} | ||
enter="transition duration-100 ease-out" | ||
enterFrom="transform scale-95 opacity-0" | ||
enterTo="transform scale-100 opacity-100" | ||
leave="transition duration-75 ease-out" | ||
leaveFrom="transform scale-100 opacity-100" | ||
leaveTo="transform scale-95 opacity-0" | ||
> | ||
<Listbox.Options static> | ||
{people.map(person => ( | ||
<Listbox.Option key={person.id} value={person} disabled={person.unavailable}> | ||
{person.name} | ||
</Listbox.Option> | ||
))} | ||
</Listbox.Options> | ||
</Transition> | ||
{({ open }) => ( | ||
<> | ||
<Listbox.Button>{selectedPerson.name}</Listbox.Button> | ||
{/* Use the Transition + open render prop argument to add transitions. */} | ||
<Transition | ||
show={open} | ||
enter="transition duration-100 ease-out" | ||
enterFrom="transform scale-95 opacity-0" | ||
enterTo="transform scale-100 opacity-100" | ||
leave="transition duration-75 ease-out" | ||
leaveFrom="transform scale-100 opacity-100" | ||
leaveTo="transform scale-95 opacity-0" | ||
> | ||
<Listbox.Options static> | ||
{people.map(person => ( | ||
<Listbox.Option key={person.id} value={person} disabled={person.unavailable}> | ||
{person.name} | ||
</Listbox.Option> | ||
))} | ||
</Listbox.Options> | ||
</Transition> | ||
</> | ||
)} | ||
</Listbox> | ||
@@ -1078,13 +1073,14 @@ ) | ||
```jsx | ||
import { useState, Fragment } from 'react' | ||
import { useState } from 'react' | ||
import { Listbox } from '@headlessui/react' | ||
const people = [ | ||
{ id: 1, name: 'Durward Reynolds' }, | ||
{ id: 2, name: 'Kenton Towne' }, | ||
{ id: 3, name: 'Therese Wunsch' }, | ||
{ id: 4, name: 'Benedict Kessler' }, | ||
{ id: 5, name: 'Katelyn Rohan' }, | ||
] | ||
function MyListbox() { | ||
const people = [ | ||
{ id: 1, name: 'Durward Reynolds' }, | ||
{ id: 2, name: 'Kenton Towne' }, | ||
{ id: 3, name: 'Therese Wunsch' }, | ||
{ id: 4, name: 'Benedict Kessler' }, | ||
{ id: 5, name: 'Katelyn Rohan' }, | ||
] | ||
const [selectedPerson, setSelectedPerson] = useState(people[0]) | ||
@@ -1113,10 +1109,11 @@ | ||
const people = [ | ||
{ id: 1, name: 'Durward Reynolds' }, | ||
{ id: 2, name: 'Kenton Towne' }, | ||
{ id: 3, name: 'Therese Wunsch' }, | ||
{ id: 4, name: 'Benedict Kessler' }, | ||
{ id: 5, name: 'Katelyn Rohan' }, | ||
] | ||
function MyListbox() { | ||
const people = [ | ||
{ id: 1, name: 'Durward Reynolds' }, | ||
{ id: 2, name: 'Kenton Towne' }, | ||
{ id: 3, name: 'Therese Wunsch' }, | ||
{ id: 4, name: 'Benedict Kessler' }, | ||
{ id: 5, name: 'Katelyn Rohan' }, | ||
] | ||
const [selectedPerson, setSelectedPerson] = useState(people[0]) | ||
@@ -1126,3 +1123,3 @@ | ||
<Listbox value={selectedPerson} onChange={setSelectedPerson}> | ||
<Listbox.Button as={React.Fragment}>{selectedPerson.name}</Listbox.Button> | ||
<Listbox.Button as={Fragment}>{selectedPerson.name}</Listbox.Button> | ||
<Listbox.Options> | ||
@@ -1145,13 +1142,14 @@ {people.map(person => ( | ||
```jsx | ||
import { useState, Fragment } from 'react' | ||
import { useState } from 'react' | ||
import { Listbox } from '@headlessui/react' | ||
const people = [ | ||
{ id: 1, name: 'Durward Reynolds' }, | ||
{ id: 2, name: 'Kenton Towne' }, | ||
{ id: 3, name: 'Therese Wunsch' }, | ||
{ id: 4, name: 'Benedict Kessler' }, | ||
{ id: 5, name: 'Katelyn Rohan' }, | ||
] | ||
function MyListbox() { | ||
const people = [ | ||
{ id: 1, name: 'Durward Reynolds' }, | ||
{ id: 2, name: 'Kenton Towne' }, | ||
{ id: 3, name: 'Therese Wunsch' }, | ||
{ id: 4, name: 'Benedict Kessler' }, | ||
{ id: 5, name: 'Katelyn Rohan' }, | ||
] | ||
const [selectedPerson, setSelectedPerson] = useState(people[0]) | ||
@@ -1176,13 +1174,15 @@ | ||
| Prop | Type | Default | Description | | ||
| ---------- | ----------------------- | --------------------------------------- | -------------------------------------------------------- | | ||
| `as` | String \| Component | `React.Fragment` _(no wrapper element_) | The element or component the `Listbox` should render as. | | ||
| `value` | `T` | | The selected value. | | ||
| `onChange` | `(value: T): void` | | The function to call when a new option is selected. | | ||
| Prop | Type | Default | Description | | ||
| ---------- | ------------------- | --------------------------------------- | -------------------------------------------------------- | | ||
| `as` | String \| Component | `React.Fragment` _(no wrapper element_) | The element or component the `Listbox` should render as. | | ||
| `disabled` | Boolean | `false` | Enable/Disable the `Listbox` component. | | ||
| `value` | `T` | | The selected value. | | ||
| `onChange` | `(value: T): void` | | The function to call when a new option is selected. | | ||
##### Render prop object | ||
| Prop | Type | Description | | ||
| ------ | ------- | ----------------------------------- | | ||
| `open` | Boolean | Whether or not the listbox is open. | | ||
| Prop | Type | Description | | ||
| ---------- | ------- | --------------------------------------- | | ||
| `open` | Boolean | Whether or not the listbox is open. | | ||
| `disabled` | Boolean | Whether or not the listbox is disabled. | | ||
@@ -1210,5 +1210,6 @@ #### Listbox.Button | ||
| Prop | Type | Description | | ||
| ------ | ------- | ----------------------------------- | | ||
| `open` | Boolean | Whether or not the listbox is open. | | ||
| Prop | Type | Description | | ||
| ---------- | ------- | --------------------------------------- | | ||
| `open` | Boolean | Whether or not the listbox is open. | | ||
| `disabled` | Boolean | Whether or not the listbox is disabled. | | ||
@@ -1227,2 +1228,9 @@ #### Listbox.Label | ||
##### Render prop object | ||
| Prop | Type | Description | | ||
| ---------- | ------- | --------------------------------------- | | ||
| `open` | Boolean | Whether or not the listbox is open. | | ||
| `disabled` | Boolean | Whether or not the listbox is disabled. | | ||
#### Listbox.Options | ||
@@ -1239,7 +1247,10 @@ | ||
| Prop | Type | Default | Description | | ||
| -------- | ------------------- | ------- | --------------------------------------------------------------------------- | | ||
| `as` | String \| Component | `ul` | The element or component the `Listbox.Options` should render as. | | ||
| `static` | Boolean | `false` | Whether the element should ignore the internally managed open/closed state. | | ||
| Prop | Type | Default | Description | | ||
| --------- | ------------------- | ------- | --------------------------------------------------------------------------------- | | ||
| `as` | String \| Component | `ul` | The element or component the `Listbox.Options` should render as. | | ||
| `static` | Boolean | `false` | Whether the element should ignore the internally managed open/closed state. | | ||
| `unmount` | Boolean | `true` | Whether the element should be unmounted or hidden based on the open/closed state. | | ||
> **note**: `static` and `unmount` can not be used at the same time. You will get a TypeScript error if you try to do it. | ||
##### Render prop object | ||
@@ -1259,7 +1270,7 @@ | ||
| Prop | Type | Default | Description | | ||
| ---------- | ----------------------- | ----------- | --------------------------------------------------------------------------------------- | | ||
| `as` | String \| Component | `li` | The element or component the `Listbox.Option` should render as. | | ||
| `value` | `T` | | The option value. | | ||
| `disabled` | Boolean | `false` | Whether or not the option should be disabled for keyboard navigation and ARIA purposes. | | ||
| Prop | Type | Default | Description | | ||
| ---------- | ------------------- | ------- | --------------------------------------------------------------------------------------- | | ||
| `as` | String \| Component | `li` | The element or component the `Listbox.Option` should render as. | | ||
| `value` | `T` | | The option value. | | ||
| `disabled` | Boolean | `false` | Whether or not the option should be disabled for keyboard navigation and ARIA purposes. | | ||
@@ -1299,7 +1310,11 @@ ##### Render prop object | ||
onChange={setEnabled} | ||
className={`${switchValue ? "bg-blue-600" : "bg-gray-200"} relative inline-flex h-6 rounded-full w-8`} | ||
className={`${ | ||
enabled ? 'bg-blue-600' : 'bg-gray-200' | ||
} relative inline-flex h-6 rounded-full w-8`} | ||
> | ||
<span className="sr-only">Enable notifications</span> | ||
<span | ||
className={`${enabled ? "translate-x-4" : "translate-x-0"} inline-block w-4 h-4 transform bg-white rounded-full`} | ||
className={`${ | ||
enabled ? 'translate-x-4' : 'translate-x-0' | ||
} inline-block w-4 h-4 transform bg-white rounded-full`} | ||
/> | ||
@@ -1330,6 +1345,10 @@ </Switch> | ||
onChange={setEnabled} | ||
className={`${switchValue ? "bg-blue-600" : "bg-gray-200"} relative inline-flex h-6 rounded-full w-8`} | ||
className={`${ | ||
enabled ? 'bg-blue-600' : 'bg-gray-200' | ||
} relative inline-flex h-6 rounded-full w-8`} | ||
> | ||
<span | ||
className={`${enabled ? "translate-x-4" : "translate-x-0"} inline-block w-4 h-4 transform bg-white rounded-full`} | ||
className={`${ | ||
enabled ? 'translate-x-4' : 'translate-x-0' | ||
} inline-block w-4 h-4 transform bg-white rounded-full`} | ||
/> | ||
@@ -1355,15 +1374,14 @@ </Switch> | ||
| Prop | Type | Default | Description | | ||
| ---------- | ----------------------- | --------------------------------------- | -------------------------------------------------------- | | ||
| `as` | String \| Component | `button` | The element or component the `Switch` should render as. | | ||
| `checked` | Boolean | | Whether or not the switch is checked. | | ||
| `onChange` | `(value: boolean): void` | | The function to call when the switch is toggled. | | ||
| Prop | Type | Default | Description | | ||
| ---------- | ------------------------ | -------- | ------------------------------------------------------- | | ||
| `as` | String \| Component | `button` | The element or component the `Switch` should render as. | | ||
| `checked` | Boolean | | Whether or not the switch is checked. | | ||
| `onChange` | `(value: boolean): void` | | The function to call when the switch is toggled. | | ||
##### Render prop object | ||
| Prop | Type | Description | | ||
| ------ | ------- | ----------------------------------- | | ||
| Prop | Type | Description | | ||
| --------- | ------- | ------------------------------------- | | ||
| `checked` | Boolean | Whether or not the switch is checked. | | ||
#### Switch.Label | ||
@@ -1382,5 +1400,5 @@ | ||
| Prop | Type | Default | Description | | ||
| ---------- | ----------------------- | --------------------------------------- | -------------------------------------------------------- | | ||
| `as` | String \| Component | `label` | The element or component the `Switch.Label` should render as. | | ||
| Prop | Type | Default | Description | | ||
| ---- | ------------------- | ------- | ------------------------------------------------------------- | | ||
| `as` | String \| Component | `label` | The element or component the `Switch.Label` should render as. | | ||
@@ -1400,4 +1418,4 @@ #### Switch.Group | ||
| Prop | Type | Default | Description | | ||
| ---------- | ----------------------- | --------------------------------------- | -------------------------------------------------------- | | ||
| `as` | String \| Component | `React.Fragment` _(no wrapper element)_| The element or component the `Switch.Group` should render as. | | ||
| Prop | Type | Default | Description | | ||
| ---- | ------------------- | --------------------------------------- | ------------------------------------------------------------- | | ||
| `as` | String \| Component | `React.Fragment` _(no wrapper element)_ | The element or component the `Switch.Group` should render as. | |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
1661302
48
11072
1392
3
5