Last
Some checks are pending
Deploy Volleyball CMS / deploy (push) Waiting to run

This commit is contained in:
2025-06-02 18:56:22 +02:00
parent 8f62885a45
commit 33181acf83
1443 changed files with 286102 additions and 12 deletions

View File

@@ -0,0 +1,23 @@
import { type ElementType, type Ref } from 'react';
import type { Props } from '../../types.js';
import { type HasDisplayName, type RefProp } from '../../utils/render.js';
declare let DEFAULT_BUTTON_TAG: "button";
type ButtonRenderPropArg = {
disabled: boolean;
hover: boolean;
focus: boolean;
active: boolean;
autofocus: boolean;
};
type ButtonPropsWeControl = never;
export type ButtonProps<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG> = Props<TTag, ButtonRenderPropArg, ButtonPropsWeControl, {
disabled?: boolean;
autoFocus?: boolean;
type?: 'button' | 'submit' | 'reset';
}>;
declare function ButtonFn<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG>(props: ButtonProps<TTag>, ref: Ref<HTMLElement>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
export interface _internal_ComponentButton extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG>(props: ButtonProps<TTag> & RefProp<typeof ButtonFn>): React.JSX.Element;
}
export declare let Button: _internal_ComponentButton;
export {};

View File

@@ -0,0 +1 @@
"use client";import{useFocusRing as y}from"@react-aria/focus";import{useHover as b}from"@react-aria/interactions";import{useMemo as P}from"react";import{useActivePress as B}from'../../hooks/use-active-press.js';import{useDisabled as c}from'../../internal/disabled.js';import{forwardRefWithAs as A,mergeProps as g,useRender as _}from'../../utils/render.js';let R="button";function v(a,u){var p;let l=c(),{disabled:e=l||!1,autoFocus:t=!1,...o}=a,{isFocusVisible:r,focusProps:i}=y({autoFocus:t}),{isHovered:s,hoverProps:T}=b({isDisabled:e}),{pressed:n,pressProps:d}=B({disabled:e}),f=g({ref:u,type:(p=o.type)!=null?p:"button",disabled:e||void 0,autoFocus:t},i,T,d),m=P(()=>({disabled:e,hover:s,focus:r,active:n,autofocus:t}),[e,s,r,n,t]);return _()({ourProps:f,theirProps:o,slot:m,defaultTag:R,name:"Button"})}let H=A(v);export{H as Button};

View File

@@ -0,0 +1,33 @@
import React, { type ElementType, type Ref } from 'react';
import type { Props } from '../../types.js';
import { type HasDisplayName, type RefProp } from '../../utils/render.js';
declare let DEFAULT_CHECKBOX_TAG: "span";
type CheckboxRenderPropArg = {
checked: boolean;
changing: boolean;
focus: boolean;
active: boolean;
hover: boolean;
autofocus: boolean;
disabled: boolean;
indeterminate: boolean;
};
type CheckboxPropsWeControl = 'aria-checked' | 'aria-describedby' | 'aria-disabled' | 'aria-labelledby' | 'role';
export type CheckboxProps<TTag extends ElementType = typeof DEFAULT_CHECKBOX_TAG, TType = string> = Props<TTag, CheckboxRenderPropArg, CheckboxPropsWeControl, {
value?: TType;
disabled?: boolean;
indeterminate?: boolean;
checked?: boolean;
defaultChecked?: boolean;
autoFocus?: boolean;
form?: string;
name?: string;
onChange?: (checked: boolean) => void;
tabIndex?: number;
}>;
declare function CheckboxFn<TTag extends ElementType = typeof DEFAULT_CHECKBOX_TAG, TType = any>(props: CheckboxProps<TTag, TType>, ref: Ref<HTMLElement>): React.JSX.Element;
export interface _internal_ComponentCheckbox extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_CHECKBOX_TAG, TType = string>(props: CheckboxProps<TTag, TType> & RefProp<typeof CheckboxFn>): React.JSX.Element;
}
export declare let Checkbox: _internal_ComponentCheckbox;
export {};

View File

@@ -0,0 +1 @@
"use client";import{useFocusRing as N}from"@react-aria/focus";import{useHover as V}from"@react-aria/interactions";import i,{useCallback as w,useMemo as J,useState as $}from"react";import{useActivePress as j}from'../../hooks/use-active-press.js';import{useControllable as q}from'../../hooks/use-controllable.js';import{useDefaultValue as z}from'../../hooks/use-default-value.js';import{useDisposables as Q}from'../../hooks/use-disposables.js';import{useEvent as l}from'../../hooks/use-event.js';import{useId as Y}from'../../hooks/use-id.js';import{useDisabled as Z}from'../../internal/disabled.js';import{FormFields as ee}from'../../internal/form-fields.js';import{useProvidedId as oe}from'../../internal/id.js';import{isDisabledReactIssue7711 as te}from'../../utils/bugs.js';import{attemptSubmit as re}from'../../utils/form.js';import{forwardRefWithAs as ae,mergeProps as ne,useRender as le}from'../../utils/render.js';import{useDescribedBy as se}from'../description/description.js';import{Keys as y}from'../keyboard.js';import{useLabelledBy as ie}from'../label/label.js';let de="span";function pe(T,h){let C=Y(),k=oe(),x=Z(),{id:g=k||`headlessui-checkbox-${C}`,disabled:e=x||!1,autoFocus:s=!1,checked:E,defaultChecked:v,onChange:P,name:d,value:D,form:R,indeterminate:n=!1,tabIndex:A=0,...F}=T,r=z(v),[a,t]=q(E,P,r!=null?r:!1),K=ie(),_=se(),H=Q(),[p,c]=$(!1),u=l(()=>{c(!0),t==null||t(!a),H.nextFrame(()=>{c(!1)})}),B=l(o=>{if(te(o.currentTarget))return o.preventDefault();o.preventDefault(),u()}),I=l(o=>{o.key===y.Space?(o.preventDefault(),u()):o.key===y.Enter&&re(o.currentTarget)}),L=l(o=>o.preventDefault()),{isFocusVisible:m,focusProps:M}=N({autoFocus:s}),{isHovered:b,hoverProps:U}=V({isDisabled:e}),{pressed:f,pressProps:O}=j({disabled:e}),X=ne({ref:h,id:g,role:"checkbox","aria-checked":n?"mixed":a?"true":"false","aria-labelledby":K,"aria-describedby":_,"aria-disabled":e?!0:void 0,indeterminate:n?"true":void 0,tabIndex:e?void 0:A,onKeyUp:e?void 0:I,onKeyPress:e?void 0:L,onClick:e?void 0:B},M,U,O),G=J(()=>({checked:a,disabled:e,hover:b,focus:m,active:f,indeterminate:n,changing:p,autofocus:s}),[a,n,e,b,m,f,p,s]),S=w(()=>{if(r!==void 0)return t==null?void 0:t(r)},[t,r]),W=le();return i.createElement(i.Fragment,null,d!=null&&i.createElement(ee,{disabled:e,data:{[d]:D||"on"},overrides:{type:"checkbox",checked:a},form:R,onReset:S}),W({ourProps:X,theirProps:F,slot:G,defaultTag:de,name:"Checkbox"}))}let Fe=ae(pe);export{Fe as Checkbox};

View File

@@ -0,0 +1,6 @@
import { type ElementType } from 'react';
import { type ButtonProps, type _internal_ComponentButton } from '../button/button.js';
declare let DEFAULT_BUTTON_TAG: "button";
export type CloseButtonProps<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG> = ButtonProps<TTag>;
export declare let CloseButton: _internal_ComponentButton;
export {};

View File

@@ -0,0 +1 @@
"use client";import n from"react";import{useClose as T}from'../../internal/close-provider.js';import{forwardRefWithAs as p,mergeProps as r}from'../../utils/render.js';import{Button as s}from'../button/button.js';let i="button";function l(t,e){let o=T();return n.createElement(s,{ref:e,...r({onClick:o},t)})}let y=p(l);export{y as CloseButton};

View File

@@ -0,0 +1,2 @@
export type * from '../combobox/combobox.js';
export { ComboboxButton } from '../combobox/combobox.js';

View File

@@ -0,0 +1 @@
import{ComboboxButton as m}from'../combobox/combobox.js';export{m as ComboboxButton};

View File

@@ -0,0 +1,2 @@
export type * from '../combobox/combobox.js';
export { ComboboxInput } from '../combobox/combobox.js';

View File

@@ -0,0 +1 @@
import{ComboboxInput as m}from'../combobox/combobox.js';export{m as ComboboxInput};

View File

@@ -0,0 +1,2 @@
export type * from '../combobox/combobox.js';
export { ComboboxLabel } from '../combobox/combobox.js';

View File

@@ -0,0 +1 @@
import{ComboboxLabel as m}from'../combobox/combobox.js';export{m as ComboboxLabel};

View File

@@ -0,0 +1,2 @@
export type * from '../combobox/combobox.js';
export { ComboboxOption } from '../combobox/combobox.js';

View File

@@ -0,0 +1 @@
import{ComboboxOption as m}from'../combobox/combobox.js';export{m as ComboboxOption};

View File

@@ -0,0 +1,2 @@
export type * from '../combobox/combobox.js';
export { ComboboxOptions } from '../combobox/combobox.js';

View File

@@ -0,0 +1 @@
import{ComboboxOptions as m}from'../combobox/combobox.js';export{m as ComboboxOptions};

View File

@@ -0,0 +1,5 @@
/// <reference types="react" />
import { ComboboxMachine } from './combobox-machine.js';
export declare const ComboboxContext: import("react").Context<ComboboxMachine<unknown> | null>;
export declare function useComboboxMachineContext<T>(component: string): ComboboxMachine<T>;
export declare function useComboboxMachine({ id, virtual, __demoMode, }: Parameters<typeof ComboboxMachine.new>[0]): ComboboxMachine<any>;

View File

@@ -0,0 +1 @@
import{createContext as r,useContext as a,useMemo as m}from"react";import{useOnUnmount as c}from'../../hooks/use-on-unmount.js';import{ComboboxMachine as i}from'./combobox-machine.js';const u=r(null);function p(n){let o=a(u);if(o===null){let e=new Error(`<${n} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(e,b),e}return o}function b({id:n,virtual:o=null,__demoMode:e=!1}){let t=m(()=>i.new({id:n,virtual:o,__demoMode:e}),[]);return c(()=>t.dispose()),t}export{u as ComboboxContext,b as useComboboxMachine,p as useComboboxMachineContext};

View File

@@ -0,0 +1,164 @@
import { Machine } from '../../machine.js';
import type { EnsureArray } from '../../types.js';
import { Focus } from '../../utils/calculate-active-index.js';
interface MutableRefObject<T> {
current: T;
}
export declare enum ComboboxState {
Open = 0,
Closed = 1
}
export declare enum ValueMode {
Single = 0,
Multi = 1
}
export declare enum ActivationTrigger {
Pointer = 0,
Focus = 1,
Other = 2
}
export type ComboboxOptionDataRef<T> = MutableRefObject<{
disabled: boolean;
value: T;
domRef: MutableRefObject<HTMLElement | null>;
order: number | null;
}>;
export interface State<T> {
id: string;
dataRef: MutableRefObject<{
value: unknown;
defaultValue: unknown;
disabled: boolean;
invalid: boolean;
mode: ValueMode;
immediate: boolean;
onChange: (value: T) => void;
onClose?: () => void;
compare(a: unknown, z: unknown): boolean;
isSelected(value: unknown): boolean;
virtual: {
options: T[];
disabled: (value: T) => boolean;
} | null;
calculateIndex(value: unknown): number;
__demoMode: boolean;
optionsPropsRef: MutableRefObject<{
static: boolean;
hold: boolean;
}>;
}>;
virtual: {
options: T[];
disabled: (value: unknown) => boolean;
} | null;
comboboxState: ComboboxState;
defaultToFirstOption: boolean;
options: {
id: string;
dataRef: ComboboxOptionDataRef<T>;
}[];
activeOptionIndex: number | null;
activationTrigger: ActivationTrigger;
isTyping: boolean;
inputElement: HTMLInputElement | null;
buttonElement: HTMLButtonElement | null;
optionsElement: HTMLElement | null;
__demoMode: boolean;
}
export declare enum ActionTypes {
OpenCombobox = 0,
CloseCombobox = 1,
GoToOption = 2,
SetTyping = 3,
RegisterOption = 4,
UnregisterOption = 5,
DefaultToFirstOption = 6,
SetActivationTrigger = 7,
UpdateVirtualConfiguration = 8,
SetInputElement = 9,
SetButtonElement = 10,
SetOptionsElement = 11
}
type Actions<T> = {
type: ActionTypes.CloseCombobox;
} | {
type: ActionTypes.OpenCombobox;
} | {
type: ActionTypes.GoToOption;
focus: Focus.Specific;
idx: number;
trigger?: ActivationTrigger;
} | {
type: ActionTypes.SetTyping;
isTyping: boolean;
} | {
type: ActionTypes.GoToOption;
focus: Exclude<Focus, Focus.Specific>;
trigger?: ActivationTrigger;
} | {
type: ActionTypes.RegisterOption;
payload: {
id: string;
dataRef: ComboboxOptionDataRef<T>;
};
} | {
type: ActionTypes.UnregisterOption;
id: string;
} | {
type: ActionTypes.DefaultToFirstOption;
value: boolean;
} | {
type: ActionTypes.SetActivationTrigger;
trigger: ActivationTrigger;
} | {
type: ActionTypes.UpdateVirtualConfiguration;
options: T[];
disabled: ((value: any) => boolean) | null;
} | {
type: ActionTypes.SetInputElement;
element: HTMLInputElement | null;
} | {
type: ActionTypes.SetButtonElement;
element: HTMLButtonElement | null;
} | {
type: ActionTypes.SetOptionsElement;
element: HTMLElement | null;
};
export declare class ComboboxMachine<T> extends Machine<State<T>, Actions<T>> {
static new<T, TMultiple extends boolean | undefined>({ id, virtual, __demoMode, }: {
id: string;
virtual?: {
options: TMultiple extends true ? EnsureArray<NoInfer<T>> : NoInfer<T>[];
disabled?: (value: TMultiple extends true ? EnsureArray<NoInfer<T>>[number] : NoInfer<T>) => boolean;
} | null;
__demoMode?: boolean;
}): ComboboxMachine<any>;
constructor(initialState: State<T>);
actions: {
onChange: (newValue: T) => void;
registerOption: (id: string, dataRef: ComboboxOptionDataRef<T>) => () => void;
goToOption: (focus: {
focus: Focus.Specific;
idx: number;
} | {
focus: Exclude<Focus, Focus.Specific>;
}, trigger?: ActivationTrigger) => void;
setIsTyping: (isTyping: boolean) => void;
closeCombobox: () => void;
openCombobox: () => void;
setActivationTrigger: (trigger: ActivationTrigger) => void;
selectActiveOption: () => void;
setInputElement: (element: HTMLInputElement | null) => void;
setButtonElement: (element: HTMLButtonElement | null) => void;
setOptionsElement: (element: HTMLElement | null) => void;
};
selectors: {
activeDescendantId: (state: State<T>) => string | undefined;
activeOptionIndex: (state: State<T>) => number | null;
activeOption: (state: State<T>) => T | null;
isActive: (state: State<T>, value: T, id: string) => boolean;
shouldScrollIntoView: (state: State<T>, value: T, id: string) => boolean;
};
reduce(state: Readonly<State<T>>, action: Actions<T>): State<T>;
}
export {};

File diff suppressed because one or more lines are too long

View File

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

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,19 @@
import { type ElementType, type Ref } from 'react';
import type { Props } from '../../types.js';
import { type HasDisplayName, type RefProp } from '../../utils/render.js';
declare let DEFAULT_DATA_INTERACTIVE_TAG: import("react").ExoticComponent<{
children?: import("react").ReactNode;
}>;
type DataInteractiveRenderPropArg = {
hover: boolean;
focus: boolean;
active: boolean;
};
type DataInteractivePropsWeControl = never;
export type DataInteractiveProps<TTag extends ElementType = typeof DEFAULT_DATA_INTERACTIVE_TAG> = Props<TTag, DataInteractiveRenderPropArg, DataInteractivePropsWeControl, {}>;
declare function DataInteractiveFn<TTag extends ElementType = typeof DEFAULT_DATA_INTERACTIVE_TAG>(props: DataInteractiveProps<TTag>, ref: Ref<HTMLElement>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
export interface _internal_ComponentDataInteractive extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_DATA_INTERACTIVE_TAG>(props: DataInteractiveProps<TTag> & RefProp<typeof DataInteractiveFn>): React.JSX.Element;
}
export declare let DataInteractive: _internal_ComponentDataInteractive;
export {};

View File

@@ -0,0 +1 @@
"use client";import{useFocusRing as m}from"@react-aria/focus";import{useHover as A}from"@react-aria/interactions";import{Fragment as D,useMemo as f}from"react";import{useActivePress as v}from'../../hooks/use-active-press.js';import{forwardRefWithAs as I,mergeProps as y,useRender as P}from'../../utils/render.js';let E=D;function d(o,n){let{...s}=o,e=!1,{isFocusVisible:t,focusProps:p}=m(),{isHovered:r,hoverProps:i}=A({isDisabled:e}),{pressed:a,pressProps:T}=v({disabled:e}),l=y({ref:n},p,i,T),c=f(()=>({hover:r,focus:t,active:a}),[r,t,a]);return P()({ourProps:l,theirProps:s,slot:c,defaultTag:E,name:"DataInteractive"})}let x=I(d);export{x as DataInteractive};

View File

@@ -0,0 +1,25 @@
import React, { type ElementType, type ReactNode, type Ref } from 'react';
import type { Props } from '../../types.js';
import { type HasDisplayName, type RefProp } from '../../utils/render.js';
interface SharedData {
slot?: {};
name?: string;
props?: {};
}
export declare function useDescribedBy(): string | undefined;
interface DescriptionProviderProps extends SharedData {
children: ReactNode;
value?: string | undefined;
}
export declare function useDescriptions(): [
string | undefined,
(props: DescriptionProviderProps) => React.JSX.Element
];
declare let DEFAULT_DESCRIPTION_TAG: "p";
export type DescriptionProps<TTag extends ElementType = typeof DEFAULT_DESCRIPTION_TAG> = Props<TTag>;
declare function DescriptionFn<TTag extends ElementType = typeof DEFAULT_DESCRIPTION_TAG>(props: DescriptionProps<TTag>, ref: Ref<HTMLElement>): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
export interface _internal_ComponentDescription extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_DESCRIPTION_TAG>(props: DescriptionProps<TTag> & RefProp<typeof DescriptionFn>): React.JSX.Element;
}
export declare let Description: _internal_ComponentDescription;
export {};

View File

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

View File

@@ -0,0 +1,2 @@
export type * from '../dialog/dialog.js';
export { DialogDescription } from '../dialog/dialog.js';

View File

@@ -0,0 +1 @@
import{DialogDescription as r}from'../dialog/dialog.js';export{r as DialogDescription};

View File

@@ -0,0 +1,2 @@
export type * from '../dialog/dialog.js';
export { DialogPanel } from '../dialog/dialog.js';

View File

@@ -0,0 +1 @@
import{DialogPanel as e}from'../dialog/dialog.js';export{e as DialogPanel};

View File

@@ -0,0 +1,2 @@
export type * from '../dialog/dialog.js';
export { DialogTitle } from '../dialog/dialog.js';

View File

@@ -0,0 +1 @@
import{DialogTitle as i}from'../dialog/dialog.js';export{i as DialogTitle};

View File

@@ -0,0 +1,70 @@
import React, { type ElementType, type MutableRefObject, type Ref } from 'react';
import type { Props } from '../../types.js';
import { type HasDisplayName, type PropsForFeatures, type RefProp } from '../../utils/render.js';
import { type _internal_ComponentDescription } from '../description/description.js';
declare let DEFAULT_DIALOG_TAG: "div";
type DialogRenderPropArg = {
open: boolean;
};
type DialogPropsWeControl = 'aria-describedby' | 'aria-labelledby' | 'aria-modal';
declare let DialogRenderFeatures: number;
export type DialogProps<TTag extends ElementType = typeof DEFAULT_DIALOG_TAG> = Props<TTag, DialogRenderPropArg, DialogPropsWeControl, PropsForFeatures<typeof DialogRenderFeatures> & {
open?: boolean;
onClose: (value: boolean) => void;
initialFocus?: MutableRefObject<HTMLElement | null>;
role?: 'dialog' | 'alertdialog';
autoFocus?: boolean;
transition?: boolean;
__demoMode?: boolean;
}>;
declare function DialogFn<TTag extends ElementType = typeof DEFAULT_DIALOG_TAG>(props: DialogProps<TTag>, ref: Ref<HTMLElement>): React.JSX.Element;
declare let DEFAULT_PANEL_TAG: "div";
type PanelRenderPropArg = {
open: boolean;
};
export type DialogPanelProps<TTag extends ElementType = typeof DEFAULT_PANEL_TAG> = Props<TTag, PanelRenderPropArg, never, {
transition?: boolean;
}>;
declare function PanelFn<TTag extends ElementType = typeof DEFAULT_PANEL_TAG>(props: DialogPanelProps<TTag>, ref: Ref<HTMLElement>): React.JSX.Element;
declare let DEFAULT_BACKDROP_TAG: "div";
type BackdropRenderPropArg = {
open: boolean;
};
export type DialogBackdropProps<TTag extends ElementType = typeof DEFAULT_BACKDROP_TAG> = Props<TTag, BackdropRenderPropArg, never, {
transition?: boolean;
}>;
declare function BackdropFn<TTag extends ElementType = typeof DEFAULT_BACKDROP_TAG>(props: DialogBackdropProps<TTag>, ref: Ref<HTMLElement>): React.JSX.Element;
declare let DEFAULT_TITLE_TAG: "h2";
type TitleRenderPropArg = {
open: boolean;
};
export type DialogTitleProps<TTag extends ElementType = typeof DEFAULT_TITLE_TAG> = Props<TTag, TitleRenderPropArg>;
declare function TitleFn<TTag extends ElementType = typeof DEFAULT_TITLE_TAG>(props: DialogTitleProps<TTag>, ref: Ref<HTMLElement>): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
export interface _internal_ComponentDialog extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_DIALOG_TAG>(props: DialogProps<TTag> & RefProp<typeof DialogFn>): React.JSX.Element;
}
export interface _internal_ComponentDialogPanel extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_PANEL_TAG>(props: DialogPanelProps<TTag> & RefProp<typeof PanelFn>): React.JSX.Element;
}
export interface _internal_ComponentDialogBackdrop extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_BACKDROP_TAG>(props: DialogBackdropProps<TTag> & RefProp<typeof BackdropFn>): React.JSX.Element;
}
export interface _internal_ComponentDialogTitle extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_TITLE_TAG>(props: DialogTitleProps<TTag> & RefProp<typeof TitleFn>): React.JSX.Element;
}
export interface _internal_ComponentDialogDescription extends _internal_ComponentDescription {
}
export declare let DialogPanel: _internal_ComponentDialogPanel;
export declare let DialogBackdrop: _internal_ComponentDialogBackdrop;
export declare let DialogTitle: _internal_ComponentDialogTitle;
/** @deprecated use `<Description>` instead of `<DialogDescription>` */
export declare let DialogDescription: _internal_ComponentDialogDescription;
export declare let Dialog: _internal_ComponentDialog & {
/** @deprecated use `<DialogPanel>` instead of `<Dialog.Panel>` */
Panel: _internal_ComponentDialogPanel;
/** @deprecated use `<DialogTitle>` instead of `<Dialog.Title>` */
Title: _internal_ComponentDialogTitle;
/** @deprecated use `<Description>` instead of `<Dialog.Description>` */
Description: _internal_ComponentDialogDescription;
};
export {};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
export type * from '../disclosure/disclosure.js';
export { DisclosureButton } from '../disclosure/disclosure.js';

View File

@@ -0,0 +1 @@
import{DisclosureButton as e}from'../disclosure/disclosure.js';export{e as DisclosureButton};

View File

@@ -0,0 +1,2 @@
export type * from '../disclosure/disclosure.js';
export { DisclosurePanel } from '../disclosure/disclosure.js';

View File

@@ -0,0 +1 @@
import{DisclosurePanel as r}from'../disclosure/disclosure.js';export{r as DisclosurePanel};

View File

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

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,14 @@
import React, { type ElementType } from 'react';
import type { Props } from '../../types.js';
import { type HasDisplayName } from '../../utils/render.js';
declare let DEFAULT_FIELD_TAG: "div";
type FieldRenderPropArg = {};
type FieldPropsWeControl = never;
export type FieldProps<TTag extends ElementType = typeof DEFAULT_FIELD_TAG> = Props<TTag, FieldRenderPropArg, FieldPropsWeControl, {
disabled?: boolean;
}>;
export interface _internal_ComponentField extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_FIELD_TAG>(props: FieldProps<TTag>): React.JSX.Element;
}
export declare let Field: _internal_ComponentField;
export {};

View File

@@ -0,0 +1 @@
"use client";import r,{useMemo as f}from"react";import{useId as P}from'../../hooks/use-id.js';import{DisabledProvider as y,useDisabled as u}from'../../internal/disabled.js';import{FormFieldsProvider as D}from'../../internal/form-fields.js';import{IdProvider as v}from'../../internal/id.js';import{forwardRefWithAs as b,useRender as E}from'../../utils/render.js';import{useDescriptions as A}from'../description/description.js';import{useLabels as L}from'../label/label.js';let _="div";function c(d,l){let t=`headlessui-control-${P()}`,[s,p]=L(),[n,a]=A(),m=u(),{disabled:e=m||!1,...i}=d,o=f(()=>({disabled:e}),[e]),F={ref:l,disabled:e||void 0,"aria-disabled":e||void 0},T=E();return r.createElement(y,{value:e},r.createElement(p,{value:s},r.createElement(a,{value:n},r.createElement(v,{id:t},T({ourProps:F,theirProps:{...i,children:r.createElement(D,null,typeof i.children=="function"?i.children(o):i.children)},slot:o,defaultTag:_,name:"Field"})))))}let H=b(c);export{H as Field};

View File

@@ -0,0 +1,14 @@
import React, { type ElementType } from 'react';
import type { Props } from '../../types.js';
import { type HasDisplayName } from '../../utils/render.js';
declare let DEFAULT_FIELDSET_TAG: "fieldset";
type FieldsetRenderPropArg = {};
type FieldsetPropsWeControl = 'aria-labelledby' | 'aria-disabled' | 'role';
export type FieldsetProps<TTag extends ElementType = typeof DEFAULT_FIELDSET_TAG> = Props<TTag, FieldsetRenderPropArg, FieldsetPropsWeControl, {
disabled?: boolean;
}>;
export interface _internal_ComponentFieldset extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_FIELDSET_TAG>(props: FieldsetProps<TTag>): React.JSX.Element;
}
export declare let Fieldset: _internal_ComponentFieldset;
export {};

View File

@@ -0,0 +1 @@
"use client";import o,{useMemo as b}from"react";import{useResolvedTag as E}from'../../hooks/use-resolved-tag.js';import{useSyncRefs as P}from'../../hooks/use-sync-refs.js';import{DisabledProvider as u,useDisabled as g}from'../../internal/disabled.js';import{forwardRefWithAs as D,useRender as A}from'../../utils/render.js';import{useLabels as L}from'../label/label.js';let d="fieldset";function _(t,a){var s;let i=g(),{disabled:e=i||!1,...p}=t,[n,T]=E((s=t.as)!=null?s:d),l=P(a,T),[r,f]=L(),m=b(()=>({disabled:e}),[e]),y=n==="fieldset"?{ref:l,"aria-labelledby":r,disabled:e||void 0}:{ref:l,role:"group","aria-labelledby":r,"aria-disabled":e||void 0},F=A();return o.createElement(u,{value:e},o.createElement(f,null,F({ourProps:y,theirProps:p,slot:m,defaultTag:d,name:"Fieldset"})))}let G=D(_);export{G as Fieldset};

View File

@@ -0,0 +1,2 @@
export type * from '../focus-trap/focus-trap.js';
export { FocusTrapFeatures } from '../focus-trap/focus-trap.js';

View File

@@ -0,0 +1 @@
import{FocusTrapFeatures as p}from'../focus-trap/focus-trap.js';export{p as FocusTrapFeatures};

View File

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

View File

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

View File

@@ -0,0 +1,23 @@
import { type ElementType, type Ref } from 'react';
import type { Props } from '../../types.js';
import { type HasDisplayName, type RefProp } from '../../utils/render.js';
declare let DEFAULT_INPUT_TAG: "input";
type InputRenderPropArg = {
disabled: boolean;
hover: boolean;
focus: boolean;
autofocus: boolean;
invalid: boolean;
};
type InputPropsWeControl = 'aria-labelledby' | 'aria-describedby';
export type InputProps<TTag extends ElementType = typeof DEFAULT_INPUT_TAG> = Props<TTag, InputRenderPropArg, InputPropsWeControl, {
disabled?: boolean;
invalid?: boolean;
autoFocus?: boolean;
}>;
declare function InputFn<TTag extends ElementType = typeof DEFAULT_INPUT_TAG>(props: InputProps<TTag>, ref: Ref<HTMLElement>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
export interface _internal_ComponentInput extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_INPUT_TAG>(props: InputProps<TTag> & RefProp<typeof InputFn>): React.JSX.Element;
}
export declare let Input: _internal_ComponentInput;
export {};

View File

@@ -0,0 +1 @@
"use client";import{useFocusRing as P}from"@react-aria/focus";import{useHover as c}from"@react-aria/interactions";import{useMemo as g}from"react";import{useId as v}from'../../hooks/use-id.js';import{useDisabled as A}from'../../internal/disabled.js';import{useProvidedId as _}from'../../internal/id.js';import{forwardRefWithAs as R,mergeProps as D,useRender as E}from'../../utils/render.js';import{useDescribedBy as F}from'../description/description.js';import{useLabelledBy as U}from'../label/label.js';let x="input";function h(p,s){let a=v(),l=_(),i=A(),{id:d=l||`headlessui-input-${a}`,disabled:e=i||!1,autoFocus:o=!1,invalid:t=!1,...u}=p,f=U(),m=F(),{isFocused:r,focusProps:T}=P({autoFocus:o}),{isHovered:n,hoverProps:b}=c({isDisabled:e}),y=D({ref:s,id:d,"aria-labelledby":f,"aria-describedby":m,"aria-invalid":t?"true":void 0,disabled:e||void 0,autoFocus:o},T,b),I=g(()=>({disabled:e,invalid:t,hover:n,focus:r,autofocus:o}),[e,t,n,r,o]);return E()({ourProps:y,theirProps:u,slot:I,defaultTag:x,name:"Input"})}let S=R(h);export{S as Input};

View File

@@ -0,0 +1,16 @@
export declare enum Keys {
Space = " ",
Enter = "Enter",
Escape = "Escape",
Backspace = "Backspace",
Delete = "Delete",
ArrowLeft = "ArrowLeft",
ArrowUp = "ArrowUp",
ArrowRight = "ArrowRight",
ArrowDown = "ArrowDown",
Home = "Home",
End = "End",
PageUp = "PageUp",
PageDown = "PageDown",
Tab = "Tab"
}

View File

@@ -0,0 +1 @@
var o=(r=>(r.Space=" ",r.Enter="Enter",r.Escape="Escape",r.Backspace="Backspace",r.Delete="Delete",r.ArrowLeft="ArrowLeft",r.ArrowUp="ArrowUp",r.ArrowRight="ArrowRight",r.ArrowDown="ArrowDown",r.Home="Home",r.End="End",r.PageUp="PageUp",r.PageDown="PageDown",r.Tab="Tab",r))(o||{});export{o as Keys};

View File

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

View File

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

View File

@@ -0,0 +1,12 @@
import React, { type ElementType } from 'react';
import type { Props } from '../../types.js';
import { type HasDisplayName } from '../../utils/render.js';
declare let DEFAULT_LEGEND_TAG: import('../label/label.js')._internal_ComponentLabel;
type LegendRenderPropArg = {};
type LegendPropsWeControl = never;
export type LegendProps<TTag extends ElementType = typeof DEFAULT_LEGEND_TAG> = Props<TTag, LegendRenderPropArg, LegendPropsWeControl, {}>;
export interface _internal_ComponentLegend extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_LEGEND_TAG>(props: LegendProps<TTag>): React.JSX.Element;
}
export declare let Legend: _internal_ComponentLegend;
export {};

View File

@@ -0,0 +1 @@
"use client";import p from"react";import{forwardRefWithAs as r}from'../../utils/render.js';import{Label as e}from'../label/label.js';let a=e;function o(t,n){return p.createElement(e,{as:"div",ref:n,...t})}let d=r(o);export{d as Legend};

View File

@@ -0,0 +1,2 @@
export type * from '../listbox/listbox.js';
export { ListboxButton } from '../listbox/listbox.js';

View File

@@ -0,0 +1 @@
import{ListboxButton as x}from'../listbox/listbox.js';export{x as ListboxButton};

View File

@@ -0,0 +1,2 @@
export type * from '../listbox/listbox.js';
export { ListboxLabel } from '../listbox/listbox.js';

View File

@@ -0,0 +1 @@
import{ListboxLabel as x}from'../listbox/listbox.js';export{x as ListboxLabel};

View File

@@ -0,0 +1,2 @@
export type * from '../listbox/listbox.js';
export { ListboxOption } from '../listbox/listbox.js';

View File

@@ -0,0 +1 @@
import{ListboxOption as x}from'../listbox/listbox.js';export{x as ListboxOption};

View File

@@ -0,0 +1,2 @@
export type * from '../listbox/listbox.js';
export { ListboxOptions } from '../listbox/listbox.js';

View File

@@ -0,0 +1 @@
import{ListboxOptions as x}from'../listbox/listbox.js';export{x as ListboxOptions};

View File

@@ -0,0 +1,2 @@
export type * from '../listbox/listbox.js';
export { ListboxSelectedOption } from '../listbox/listbox.js';

View File

@@ -0,0 +1 @@
import{ListboxSelectedOption as e}from'../listbox/listbox.js';export{e as ListboxSelectedOption};

View File

@@ -0,0 +1,8 @@
/// <reference types="react" />
import { ListboxMachine } from './listbox-machine.js';
export declare const ListboxContext: import("react").Context<ListboxMachine<unknown> | null>;
export declare function useListboxMachineContext<T>(component: string): ListboxMachine<T>;
export declare function useListboxMachine({ id, __demoMode, }: {
id: string;
__demoMode?: boolean;
}): ListboxMachine<unknown>;

View File

@@ -0,0 +1 @@
import{createContext as n,useContext as r,useMemo as i}from"react";import{useOnUnmount as s}from'../../hooks/use-on-unmount.js';import{ListboxMachine as a}from'./listbox-machine.js';const c=n(null);function p(o){let e=r(c);if(e===null){let t=new Error(`<${o} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,u),t}return e}function u({id:o,__demoMode:e=!1}){let t=i(()=>a.new({id:o,__demoMode:e}),[]);return s(()=>t.dispose()),t}export{c as ListboxContext,u as useListboxMachine,p as useListboxMachineContext};

View File

@@ -0,0 +1,151 @@
import { Machine } from '../../machine.js';
import { Focus } from '../../utils/calculate-active-index.js';
interface MutableRefObject<T> {
current: T;
}
export declare enum ListboxStates {
Open = 0,
Closed = 1
}
export declare enum ValueMode {
Single = 0,
Multi = 1
}
export declare enum ActivationTrigger {
Pointer = 0,
Other = 1
}
type ListboxOptionDataRef<T> = MutableRefObject<{
textValue?: string;
disabled: boolean;
value: T;
domRef: MutableRefObject<HTMLElement | null>;
}>;
interface State<T> {
id: string;
__demoMode: boolean;
dataRef: MutableRefObject<{
value: unknown;
disabled: boolean;
invalid: boolean;
mode: ValueMode;
orientation: 'horizontal' | 'vertical';
onChange: (value: T) => void;
compare(a: unknown, z: unknown): boolean;
isSelected(value: unknown): boolean;
optionsPropsRef: MutableRefObject<{
static: boolean;
hold: boolean;
}>;
listRef: MutableRefObject<Map<string, HTMLElement | null>>;
}>;
listboxState: ListboxStates;
options: {
id: string;
dataRef: ListboxOptionDataRef<T>;
}[];
searchQuery: string;
activeOptionIndex: number | null;
activationTrigger: ActivationTrigger;
buttonElement: HTMLButtonElement | null;
optionsElement: HTMLElement | null;
pendingShouldSort: boolean;
pendingFocus: {
focus: Exclude<Focus, Focus.Specific>;
} | {
focus: Focus.Specific;
id: string;
};
}
export declare enum ActionTypes {
OpenListbox = 0,
CloseListbox = 1,
GoToOption = 2,
Search = 3,
ClearSearch = 4,
RegisterOptions = 5,
UnregisterOptions = 6,
SetButtonElement = 7,
SetOptionsElement = 8,
SortOptions = 9
}
type Actions<T> = {
type: ActionTypes.CloseListbox;
} | {
type: ActionTypes.OpenListbox;
focus: {
focus: Exclude<Focus, Focus.Specific>;
} | {
focus: Focus.Specific;
id: string;
};
} | {
type: ActionTypes.GoToOption;
focus: Focus.Specific;
id: string;
trigger?: ActivationTrigger;
} | {
type: ActionTypes.GoToOption;
focus: Exclude<Focus, Focus.Specific>;
trigger?: ActivationTrigger;
} | {
type: ActionTypes.Search;
value: string;
} | {
type: ActionTypes.ClearSearch;
} | {
type: ActionTypes.RegisterOptions;
options: {
id: string;
dataRef: ListboxOptionDataRef<T>;
}[];
} | {
type: ActionTypes.UnregisterOptions;
options: string[];
} | {
type: ActionTypes.SetButtonElement;
element: HTMLButtonElement | null;
} | {
type: ActionTypes.SetOptionsElement;
element: HTMLElement | null;
} | {
type: ActionTypes.SortOptions;
};
export declare class ListboxMachine<T> extends Machine<State<T>, Actions<T>> {
static new({ id, __demoMode }: {
id: string;
__demoMode?: boolean;
}): ListboxMachine<unknown>;
constructor(initialState: State<T>);
actions: {
onChange: (newValue: T) => void;
registerOption: (id: string, dataRef: ListboxOptionDataRef<T>) => void;
unregisterOption: (id: string) => void;
goToOption: (focus: {
focus: Focus.Specific;
id: string;
} | {
focus: Exclude<Focus, Focus.Specific>;
}, trigger?: ActivationTrigger | undefined) => void;
closeListbox: () => void;
openListbox: (focus: {
focus: Exclude<Focus, Focus.Specific>;
} | {
focus: Focus.Specific;
id: string;
}) => void;
selectActiveOption: () => void;
selectOption: (id: string) => void;
search: (value: string) => void;
clearSearch: () => void;
setButtonElement: (element: HTMLButtonElement | null) => void;
setOptionsElement: (element: HTMLElement | null) => void;
};
selectors: {
activeDescendantId(state: State<T>): string | undefined;
isActive(state: State<T>, id: string): boolean;
shouldScrollIntoView(state: State<T>, id: string): boolean;
};
reduce(state: Readonly<State<T>>, action: Actions<T>): State<T>;
}
export {};

File diff suppressed because one or more lines are too long

View File

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

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
export type * from '../menu/menu.js';
export { MenuButton } from '../menu/menu.js';

View File

@@ -0,0 +1 @@
import{MenuButton as t}from'../menu/menu.js';export{t as MenuButton};

View File

@@ -0,0 +1,2 @@
export type * from '../menu/menu.js';
export { MenuHeading } from '../menu/menu.js';

View File

@@ -0,0 +1 @@
import{MenuHeading as n}from'../menu/menu.js';export{n as MenuHeading};

View File

@@ -0,0 +1,2 @@
export type * from '../menu/menu.js';
export { MenuItem } from '../menu/menu.js';

View File

@@ -0,0 +1 @@
import{MenuItem as o}from'../menu/menu.js';export{o as MenuItem};

View File

@@ -0,0 +1,2 @@
export type * from '../menu/menu.js';
export { MenuItems } from '../menu/menu.js';

View File

@@ -0,0 +1 @@
import{MenuItems as o}from'../menu/menu.js';export{o as MenuItems};

View File

@@ -0,0 +1,2 @@
export type * from '../menu/menu.js';
export { MenuSection } from '../menu/menu.js';

View File

@@ -0,0 +1 @@
import{MenuSection as m}from'../menu/menu.js';export{m as MenuSection};

View File

@@ -0,0 +1,2 @@
export type * from '../menu/menu.js';
export { MenuSeparator } from '../menu/menu.js';

View File

@@ -0,0 +1 @@
import{MenuSeparator as o}from'../menu/menu.js';export{o as MenuSeparator};

View File

@@ -0,0 +1,8 @@
/// <reference types="react" />
import { MenuMachine } from './menu-machine.js';
export declare const MenuContext: import("react").Context<MenuMachine | null>;
export declare function useMenuMachineContext(component: string): MenuMachine;
export declare function useMenuMachine({ id, __demoMode }: {
id: string;
__demoMode?: boolean;
}): MenuMachine;

View File

@@ -0,0 +1 @@
import{createContext as r,useContext as o,useMemo as u}from"react";import{useOnUnmount as i}from'../../hooks/use-on-unmount.js';import{MenuMachine as c}from'./menu-machine.js';const a=r(null);function p(t){let n=o(a);if(n===null){let e=new Error(`<${t} /> is missing a parent <Menu /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(e,s),e}return n}function s({id:t,__demoMode:n=!1}){let e=u(()=>c.new({id:t,__demoMode:n}),[]);return i(()=>e.dispose()),e}export{a as MenuContext,s as useMenuMachine,p as useMenuMachineContext};

View File

@@ -0,0 +1,112 @@
import { Machine } from '../../machine.js';
import { Focus } from '../../utils/calculate-active-index.js';
export declare enum MenuState {
Open = 0,
Closed = 1
}
export declare enum ActivationTrigger {
Pointer = 0,
Other = 1
}
export type MenuItemDataRef = {
current: {
textValue?: string;
disabled: boolean;
domRef: {
current: HTMLElement | null;
};
};
};
export interface State {
id: string;
__demoMode: boolean;
menuState: MenuState;
buttonElement: HTMLButtonElement | null;
itemsElement: HTMLElement | null;
items: {
id: string;
dataRef: MenuItemDataRef;
}[];
searchQuery: string;
activeItemIndex: number | null;
activationTrigger: ActivationTrigger;
pendingShouldSort: boolean;
pendingFocus: {
focus: Exclude<Focus, Focus.Specific>;
} | {
focus: Focus.Specific;
id: string;
};
}
export declare enum ActionTypes {
OpenMenu = 0,
CloseMenu = 1,
GoToItem = 2,
Search = 3,
ClearSearch = 4,
RegisterItems = 5,
UnregisterItems = 6,
SetButtonElement = 7,
SetItemsElement = 8,
SortItems = 9
}
export type Actions = {
type: ActionTypes.CloseMenu;
} | {
type: ActionTypes.OpenMenu;
focus: {
focus: Exclude<Focus, Focus.Specific>;
} | {
focus: Focus.Specific;
id: string;
};
trigger?: ActivationTrigger;
} | {
type: ActionTypes.GoToItem;
focus: Focus.Specific;
id: string;
trigger?: ActivationTrigger;
} | {
type: ActionTypes.GoToItem;
focus: Exclude<Focus, Focus.Specific>;
trigger?: ActivationTrigger;
} | {
type: ActionTypes.Search;
value: string;
} | {
type: ActionTypes.ClearSearch;
} | {
type: ActionTypes.RegisterItems;
items: {
id: string;
dataRef: MenuItemDataRef;
}[];
} | {
type: ActionTypes.UnregisterItems;
items: string[];
} | {
type: ActionTypes.SetButtonElement;
element: HTMLButtonElement | null;
} | {
type: ActionTypes.SetItemsElement;
element: HTMLElement | null;
} | {
type: ActionTypes.SortItems;
};
export declare class MenuMachine extends Machine<State, Actions> {
static new({ id, __demoMode }: {
id: string;
__demoMode?: boolean;
}): MenuMachine;
constructor(initialState: State);
reduce(state: Readonly<State>, action: Actions): State;
actions: {
registerItem: (id: string, dataRef: MenuItemDataRef) => void;
unregisterItem: (id: string) => void;
};
selectors: {
activeDescendantId(state: State): string | undefined;
isActive(state: State, id: string): boolean;
shouldScrollIntoView(state: State, id: string): boolean;
};
}

File diff suppressed because one or more lines are too long

View File

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

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
export declare enum MouseButton {
Left = 0,
Right = 2
}

View File

@@ -0,0 +1 @@
var g=(f=>(f[f.Left=0]="Left",f[f.Right=2]="Right",f))(g||{});export{g as MouseButton};

View File

@@ -0,0 +1,2 @@
export type * from '../popover/popover.js';
export { PopoverBackdrop } from '../popover/popover.js';

View File

@@ -0,0 +1 @@
import{PopoverBackdrop as r}from'../popover/popover.js';export{r as PopoverBackdrop};

View File

@@ -0,0 +1,2 @@
export type * from '../popover/popover.js';
export { PopoverButton } from '../popover/popover.js';

View File

@@ -0,0 +1 @@
import{PopoverButton as r}from'../popover/popover.js';export{r as PopoverButton};

View File

@@ -0,0 +1,2 @@
export type * from '../popover/popover.js';
export { PopoverGroup } from '../popover/popover.js';

View File

@@ -0,0 +1 @@
import{PopoverGroup as r}from'../popover/popover.js';export{r as PopoverGroup};

View File

@@ -0,0 +1,2 @@
export type * from '../popover/popover.js';
export { PopoverOverlay } from '../popover/popover.js';

View File

@@ -0,0 +1 @@
import{PopoverOverlay as r}from'../popover/popover.js';export{r as PopoverOverlay};

Some files were not shown because too many files have changed in this diff Show More