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 @@
export declare function useId(): number;

View File

@@ -0,0 +1,2 @@
import type { ScrollLockStep } from './overflow-store.js';
export declare function adjustScrollbarPadding(): ScrollLockStep;

View File

@@ -0,0 +1 @@
function d(){let r;return{before({doc:e}){var l;let o=e.documentElement,t=(l=e.defaultView)!=null?l:window;r=Math.max(0,t.innerWidth-o.clientWidth)},after({doc:e,d:o}){let t=e.documentElement,l=Math.max(0,t.clientWidth-t.offsetWidth),n=Math.max(0,r-l);o.style(t,"paddingRight",`${n}px`)}}}export{d as adjustScrollbarPadding};

View File

@@ -0,0 +1,6 @@
import type { ScrollLockStep } from './overflow-store.js';
interface ContainerMetadata {
containers: (() => HTMLElement[])[];
}
export declare function handleIOSLocking(): ScrollLockStep<ContainerMetadata>;
export {};

View File

@@ -0,0 +1 @@
import{disposables as u}from'../../utils/disposables.js';import*as o from'../../utils/dom.js';import{isIOS as p}from'../../utils/platform.js';function w(){return p()?{before({doc:n,d:l,meta:f}){function i(a){return f.containers.flatMap(r=>r()).some(r=>r.contains(a))}l.microTask(()=>{var c;if(window.getComputedStyle(n.documentElement).scrollBehavior!=="auto"){let t=u();t.style(n.documentElement,"scrollBehavior","auto"),l.add(()=>l.microTask(()=>t.dispose()))}let a=(c=window.scrollY)!=null?c:window.pageYOffset,r=null;l.addEventListener(n,"click",t=>{if(o.isHTMLorSVGElement(t.target))try{let e=t.target.closest("a");if(!e)return;let{hash:m}=new URL(e.href),s=n.querySelector(m);o.isHTMLorSVGElement(s)&&!i(s)&&(r=s)}catch{}},!0),l.addEventListener(n,"touchstart",t=>{if(o.isHTMLorSVGElement(t.target)&&o.hasInlineStyle(t.target))if(i(t.target)){let e=t.target;for(;e.parentElement&&i(e.parentElement);)e=e.parentElement;l.style(e,"overscrollBehavior","contain")}else l.style(t.target,"touchAction","none")}),l.addEventListener(n,"touchmove",t=>{if(o.isHTMLorSVGElement(t.target)){if(o.isHTMLInputElement(t.target))return;if(i(t.target)){let e=t.target;for(;e.parentElement&&e.dataset.headlessuiPortal!==""&&!(e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth);)e=e.parentElement;e.dataset.headlessuiPortal===""&&t.preventDefault()}else t.preventDefault()}},{passive:!1}),l.add(()=>{var e;let t=(e=window.scrollY)!=null?e:window.pageYOffset;a!==t&&window.scrollTo(0,a),r&&r.isConnected&&(r.scrollIntoView({block:"nearest"}),r=null)})})}}:{}}export{w as handleIOSLocking};

View File

@@ -0,0 +1,19 @@
import { type Disposables } from '../../utils/disposables.js';
interface DocEntry {
doc: Document;
count: number;
d: Disposables;
meta: Set<MetaFn>;
}
export type MetaFn = (meta: Record<string, any>) => Record<string, any>;
export interface Context<MetaType extends Record<string, any> = any> {
doc: Document;
d: Disposables;
meta: MetaType;
}
export interface ScrollLockStep<MetaType extends Record<string, any> = any> {
before?(ctx: Context<MetaType>): void;
after?(ctx: Context<MetaType>): void;
}
export declare let overflows: import('../../utils/store.js').Store<Map<Document, DocEntry>, "PUSH" | "POP" | "SCROLL_PREVENT" | "SCROLL_ALLOW" | "TEARDOWN">;
export {};

View File

@@ -0,0 +1 @@
import{disposables as s}from'../../utils/disposables.js';import{createStore as i}from'../../utils/store.js';import{adjustScrollbarPadding as l}from'./adjust-scrollbar-padding.js';import{handleIOSLocking as d}from'./handle-ios-locking.js';import{preventScroll as p}from'./prevent-scroll.js';function m(e){let n={};for(let t of e)Object.assign(n,t(n));return n}let a=i(()=>new Map,{PUSH(e,n){var o;let t=(o=this.get(e))!=null?o:{doc:e,count:0,d:s(),meta:new Set};return t.count++,t.meta.add(n),this.set(e,t),this},POP(e,n){let t=this.get(e);return t&&(t.count--,t.meta.delete(n)),this},SCROLL_PREVENT({doc:e,d:n,meta:t}){let o={doc:e,d:n,meta:m(t)},c=[d(),l(),p()];c.forEach(({before:r})=>r==null?void 0:r(o)),c.forEach(({after:r})=>r==null?void 0:r(o))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});a.subscribe(()=>{let e=a.getSnapshot(),n=new Map;for(let[t]of e)n.set(t,t.documentElement.style.overflow);for(let t of e.values()){let o=n.get(t.doc)==="hidden",c=t.count!==0;(c&&!o||!c&&o)&&a.dispatch(t.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",t),t.count===0&&a.dispatch("TEARDOWN",t)}});export{a as overflows};

View File

@@ -0,0 +1,2 @@
import type { ScrollLockStep } from './overflow-store.js';
export declare function preventScroll(): ScrollLockStep;

View File

@@ -0,0 +1 @@
function r(){return{before({doc:e,d:o}){o.style(e.documentElement,"overflow","hidden")}}}export{r as preventScroll};

View File

@@ -0,0 +1 @@
export declare function useDocumentOverflowLockedEffect(shouldBeLocked: boolean, doc: Document | null, meta?: (meta: Record<string, any>) => Record<string, any>): boolean;

View File

@@ -0,0 +1 @@
import{useStore as s}from'../../hooks/use-store.js';import{useIsoMorphicEffect as u}from'../use-iso-morphic-effect.js';import{overflows as t}from'./overflow-store.js';function a(r,e,n=()=>({containers:[]})){let f=s(t),o=e?f.get(e):void 0,i=o?o.count>0:!1;return u(()=>{if(!(!e||!r))return t.dispatch("PUSH",e,n),()=>t.dispatch("POP",e,n)},[r,e]),i}export{a as useDocumentOverflowLockedEffect};

View File

@@ -0,0 +1,14 @@
export declare function useActivePress({ disabled }?: Partial<{
disabled: boolean;
}>): {
pressed: boolean;
pressProps: {
onPointerDown?: undefined;
onPointerUp?: undefined;
onClick?: undefined;
} | {
onPointerDown: (event: PointerEvent) => void;
onPointerUp: () => void;
onClick: () => void;
};
};

View File

@@ -0,0 +1 @@
import{useRef as a,useState as m}from"react";import{getOwnerDocument as d}from'../utils/owner.js';import{useDisposables as g}from'./use-disposables.js';import{useEvent as u}from'./use-event.js';function E(e){let t=e.width/2,n=e.height/2;return{top:e.clientY-n,right:e.clientX+t,bottom:e.clientY+n,left:e.clientX-t}}function P(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function w({disabled:e=!1}={}){let t=a(null),[n,l]=m(!1),r=g(),o=u(()=>{t.current=null,l(!1),r.dispose()}),f=u(s=>{if(r.dispose(),t.current===null){t.current=s.currentTarget,l(!0);{let i=d(s.currentTarget);r.addEventListener(i,"pointerup",o,!1),r.addEventListener(i,"pointermove",c=>{if(t.current){let p=E(c);l(P(p,t.current.getBoundingClientRect()))}},!1),r.addEventListener(i,"pointercancel",o,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:f,onPointerUp:o,onClick:o}}}export{w as useActivePress};

View File

@@ -0,0 +1,2 @@
export type ByComparator<T> = (NonNullable<T> extends never ? string : keyof NonNullable<T> & string) | ((a: T, z: T) => boolean);
export declare function useByComparator<T>(by?: ByComparator<T>): (a: T, z: T) => boolean;

View File

@@ -0,0 +1 @@
import{useCallback as n}from"react";function l(e,r){return e!==null&&r!==null&&typeof e=="object"&&typeof r=="object"&&"id"in e&&"id"in r?e.id===r.id:e===r}function u(e=l){return n((r,t)=>{if(typeof e=="string"){let o=e;return(r==null?void 0:r[o])===(t==null?void 0:t[o])}return e(r,t)},[e])}export{u as useByComparator};

View File

@@ -0,0 +1,2 @@
/// <reference types="react" />
export declare function useComputed<T>(cb: () => T, dependencies: React.DependencyList): T;

View File

@@ -0,0 +1 @@
import{useState as s}from"react";import{useIsoMorphicEffect as f}from'./use-iso-morphic-effect.js';import{useLatestValue as m}from'./use-latest-value.js';function i(e,o){let[u,t]=s(e),r=m(e);return f(()=>t(r.current),[r,t,...o]),u}export{i as useComputed};

View File

@@ -0,0 +1 @@
export declare function useControllable<T>(controlledValue: T | undefined, onChange?: (value: T) => void, defaultValue?: T): readonly [NonNullable<T>, (value: any) => void | undefined];

View File

@@ -0,0 +1 @@
import{useRef as o,useState as f}from"react";import{useEvent as a}from'./use-event.js';function T(l,r,c){let[i,s]=f(c),e=l!==void 0,t=o(e),u=o(!1),d=o(!1);return e&&!t.current&&!u.current?(u.current=!0,t.current=e,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!e&&t.current&&!d.current&&(d.current=!0,t.current=e,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[e?l:i,a(n=>(e||s(n),r==null?void 0:r(n)))]}export{T as useControllable};

View File

@@ -0,0 +1,8 @@
/**
* Returns a stable value that never changes unless the component is re-mounted.
*
* This ensures that we can use this value in a dependency array without causing
* unnecessary re-renders (because while the incoming `value` can change, the
* returned `defaultValue` won't change).
*/
export declare function useDefaultValue<T>(value: T): T;

View File

@@ -0,0 +1 @@
import{useState as u}from"react";function l(e){let[t]=u(e);return t}export{l as useDefaultValue};

View File

@@ -0,0 +1 @@
export declare function useDidElementMove(enabled: boolean, element: HTMLElement | null): boolean;

View File

@@ -0,0 +1 @@
import{useRef as i}from"react";import{useIsoMorphicEffect as u}from'./use-iso-morphic-effect.js';function s(n,t){let e=i({left:0,top:0});if(u(()=>{if(!t)return;let r=t.getBoundingClientRect();r&&(e.current=r)},[n,t]),t==null||!n||t===document.activeElement)return!1;let o=t.getBoundingClientRect();return o.top!==e.current.top||o.left!==e.current.left}export{s as useDidElementMove};

View File

@@ -0,0 +1,25 @@
/**
* The `useDisposables` hook returns a `disposables` object that is disposed
* when the component is unmounted.
*/
export declare function useDisposables(): {
addEventListener<TEventName extends keyof WindowEventMap>(element: Window | Document | HTMLElement, name: TEventName, listener: (event: WindowEventMap[TEventName]) => any, options?: boolean | AddEventListenerOptions | undefined): () => void;
requestAnimationFrame(callback: FrameRequestCallback): () => void;
nextFrame(callback: FrameRequestCallback): () => void;
setTimeout(callback: (...args: any[]) => void, ms?: number | undefined, ...args: any[]): () => void;
microTask(cb: () => void): () => void;
style(node: ElementCSSInlineStyle, property: string, value: string): () => void;
group(cb: (d: {
addEventListener<TEventName extends keyof WindowEventMap>(element: Window | Document | HTMLElement, name: TEventName, listener: (event: WindowEventMap[TEventName]) => any, options?: boolean | AddEventListenerOptions | undefined): () => void;
requestAnimationFrame(callback: FrameRequestCallback): () => void;
nextFrame(callback: FrameRequestCallback): () => void;
setTimeout(callback: (...args: any[]) => void, ms?: number | undefined, ...args: any[]): () => void;
microTask(cb: () => void): () => void;
style(node: ElementCSSInlineStyle, property: string, value: string): () => void;
group(cb: any): () => void;
add(cb: () => void): () => void;
dispose(): void;
}) => void): () => void;
add(cb: () => void): () => void;
dispose(): void;
};

View File

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

View File

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

View File

@@ -0,0 +1 @@
import{useEffect as c}from"react";import{useLatestValue as a}from'./use-latest-value.js';function i(t,e,o,n){let u=a(o);c(()=>{if(!t)return;function r(m){u.current(m)}return document.addEventListener(e,r,n),()=>document.removeEventListener(e,r,n)},[t,e,n])}export{i as useDocumentEvent};

View File

@@ -0,0 +1,7 @@
export declare function useElementSize(element: HTMLElement | null, unit?: boolean): {
width: number;
height: number;
} | {
width: string;
height: string;
};

View File

@@ -0,0 +1 @@
import{useMemo as o,useReducer as h}from"react";import{useIsoMorphicEffect as s}from'./use-iso-morphic-effect.js';function f(e){if(e===null)return{width:0,height:0};let{width:t,height:r}=e.getBoundingClientRect();return{width:t,height:r}}function d(e,t=!1){let[r,u]=h(()=>({}),{}),i=o(()=>f(e),[e,r]);return s(()=>{if(!e)return;let n=new ResizeObserver(u);return n.observe(e),()=>{n.disconnect()}},[e]),t?{width:`${i.width}px`,height:`${i.height}px`}:i}export{d as useElementSize};

View File

@@ -0,0 +1 @@
export declare function useEscape(enabled: boolean, view: (Window & typeof globalThis) | null | undefined, cb: (event: KeyboardEvent) => void): void;

View File

@@ -0,0 +1 @@
import{Keys as u}from'../components/keyboard.js';import{useEventListener as i}from'./use-event-listener.js';import{useIsTopLayer as f}from'./use-is-top-layer.js';function a(o,r=typeof document!="undefined"?document.defaultView:null,t){let n=f(o,"escape");i(r,"keydown",e=>{n&&(e.defaultPrevented||e.key===u.Escape&&t(e))})}export{a as useEscape};

View File

@@ -0,0 +1 @@
export declare function useEventListener<TType extends keyof WindowEventMap>(element: HTMLElement | Document | Window | EventTarget | null | undefined, type: TType, listener: (event: WindowEventMap[TType]) => any, options?: boolean | AddEventListenerOptions): void;

View File

@@ -0,0 +1 @@
import{useEffect as d}from"react";import{useLatestValue as s}from'./use-latest-value.js';function E(n,e,a,t){let i=s(a);d(()=>{n=n!=null?n:window;function r(o){i.current(o)}return n.addEventListener(e,r,t),()=>n.removeEventListener(e,r,t)},[n,e,t])}export{E as useEventListener};

View File

@@ -0,0 +1 @@
export declare let useEvent: <F extends (...args: any[]) => any, P extends any[] = Parameters<F>, R = ReturnType<F>>(cb: (...args: P) => R) => (...args: P) => R;

View File

@@ -0,0 +1 @@
import a from"react";import{useLatestValue as n}from'./use-latest-value.js';let o=function(t){let e=n(t);return a.useCallback((...r)=>e.current(...r),[e])};export{o as useEvent};

View File

@@ -0,0 +1,8 @@
export declare function useFlags(initialFlags?: number): {
flags: number;
setFlag: (flag: number) => void;
addFlag: (flag: number) => void;
hasFlag: (flag: number) => boolean;
removeFlag: (flag: number) => void;
toggleFlag: (flag: number) => void;
};

View File

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

View File

@@ -0,0 +1 @@
export { useId } from 'react';

1
node_modules/@headlessui/react/dist/hooks/use-id.js generated vendored Normal file
View File

@@ -0,0 +1 @@
import{useId as r}from"react";export{r as useId};

View File

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

View File

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

View File

@@ -0,0 +1 @@
export declare function useIsInitialRender(): boolean;

View File

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

View File

@@ -0,0 +1,2 @@
/// <reference types="react" />
export declare function useIsMounted(): import("react").MutableRefObject<boolean>;

View File

@@ -0,0 +1 @@
import{useRef as r}from"react";import{useIsoMorphicEffect as t}from'./use-iso-morphic-effect.js';function f(){let e=r(!1);return t(()=>(e.current=!0,()=>{e.current=!1}),[]),e}export{f as useIsMounted};

View File

@@ -0,0 +1,24 @@
/**
* A hook that returns whether the current node is on the top of the hierarchy,
* aka "top layer". Note: this does not use the native DOM "top-layer" but
* conceptually it's the same thing.
*
* The hierarchy is also shared across multiple components that use the same
* scope.
*
* This is useful to use in components and hooks that mutate the DOM or share
* some global state.
*
* A use case for this is to use this inside of a `useOutsideClick` hook where
* only the last rendered component should handle the outside click event.
*
* ```ts
* <Dialog>
* <Menu>
* <MenuButton></MenuButton> // Pressing escape on an open `Menu` should close the `Menu` and not the `Dialog`.
* // …
* </Menu>
* </Dialog>
* ```
*/
export declare function useIsTopLayer(enabled: boolean, scope: string | null): boolean;

View File

@@ -0,0 +1 @@
import{useCallback as n,useId as u}from"react";import{stackMachines as p}from'../machines/stack-machine.js';import{useSlice as f}from'../react-glue.js';import{useIsoMorphicEffect as a}from'./use-iso-morphic-effect.js';function I(o,s){let t=u(),r=p.get(s),[i,c]=f(r,n(e=>[r.selectors.isTop(e,t),r.selectors.inStack(e,t)],[r,t]));return a(()=>{if(o)return r.actions.push(t),()=>r.actions.pop(t)},[r,o,t]),o?c?i:!0:!1}export{I as useIsTopLayer};

View File

@@ -0,0 +1 @@
export declare function useIsTouchDevice(): boolean;

View File

@@ -0,0 +1 @@
import{useState as i}from"react";import{useIsoMorphicEffect as s}from'./use-iso-morphic-effect.js';function f(){var t;let[e]=i(()=>typeof window!="undefined"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[o,c]=i((t=e==null?void 0:e.matches)!=null?t:!1);return s(()=>{if(!e)return;function n(r){c(r.matches)}return e.addEventListener("change",n),()=>e.removeEventListener("change",n)},[e]),o}export{f as useIsTouchDevice};

View File

@@ -0,0 +1,2 @@
import { type DependencyList, type EffectCallback } from 'react';
export declare let useIsoMorphicEffect: (effect: EffectCallback, deps?: DependencyList | undefined) => void;

View File

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

View File

@@ -0,0 +1,2 @@
/// <reference types="react" />
export declare function useLatestValue<T>(value: T): import("react").MutableRefObject<T>;

View File

@@ -0,0 +1 @@
import{useRef as t}from"react";import{useIsoMorphicEffect as o}from'./use-iso-morphic-effect.js';function s(e){let r=t(e);return o(()=>{r.current=e},[e]),r}export{s as useLatestValue};

View File

@@ -0,0 +1,9 @@
import { type MutableRefObject } from 'react';
/**
* A hook to ensure that a callback is called when the element has disappeared
* from the screen.
*
* This can happen if you use Tailwind classes like: `hidden md:block`, once the
* viewport is smaller than `md` the element will disappear.
*/
export declare function useOnDisappear(enabled: boolean, ref: MutableRefObject<HTMLElement | null> | HTMLElement | null, cb: () => void): void;

View File

@@ -0,0 +1 @@
import{useEffect as l}from"react";import{disposables as u}from'../utils/disposables.js';import*as c from'../utils/dom.js';import{useLatestValue as d}from'./use-latest-value.js';function p(s,n,o){let i=d(t=>{let e=t.getBoundingClientRect();e.x===0&&e.y===0&&e.width===0&&e.height===0&&o()});l(()=>{if(!s)return;let t=n===null?null:c.isHTMLElement(n)?n:n.current;if(!t)return;let e=u();if(typeof ResizeObserver!="undefined"){let r=new ResizeObserver(()=>i.current(t));r.observe(t),e.add(()=>r.disconnect())}if(typeof IntersectionObserver!="undefined"){let r=new IntersectionObserver(()=>i.current(t));r.observe(t),e.add(()=>r.disconnect())}return()=>e.dispose()},[n,i,s])}export{p as useOnDisappear};

View File

@@ -0,0 +1 @@
export declare function useOnUnmount(cb: () => void): void;

View File

@@ -0,0 +1 @@
import{useEffect as u,useRef as n}from"react";import{microTask as o}from'../utils/micro-task.js';import{useEvent as f}from'./use-event.js';function c(t){let r=f(t),e=n(!1);u(()=>(e.current=!1,()=>{e.current=!0,o(()=>{e.current&&r()})}),[r])}export{c as useOnUnmount};

View File

@@ -0,0 +1,5 @@
type Container = Element | null;
type ContainerCollection = Container[] | Set<Container>;
type ContainerInput = Container | ContainerCollection;
export declare function useOutsideClick(enabled: boolean, containers: ContainerInput | (() => ContainerInput), cb: (event: MouseEvent | PointerEvent | FocusEvent | TouchEvent, target: HTMLOrSVGElement & Element) => void): void;
export {};

View File

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

View File

@@ -0,0 +1,2 @@
import { getOwnerDocument } from '../utils/owner.js';
export declare function useOwnerDocument(...args: Parameters<typeof getOwnerDocument>): Document | null;

View File

@@ -0,0 +1 @@
import{useMemo as t}from"react";import{getOwnerDocument as o}from'../utils/owner.js';function n(...e){return t(()=>o(...e),[...e])}export{n as useOwnerDocument};

View File

@@ -0,0 +1,37 @@
declare enum ActionKind {
Ignore = 0,
Select = 1,
Close = 2
}
export declare const Action: {
/** Do nothing */
Ignore: {
readonly kind: ActionKind.Ignore;
};
/** Select the current item */
Select: (target: HTMLElement) => {
readonly kind: ActionKind.Select;
readonly target: HTMLElement;
};
/** Close the dropdown */
Close: {
readonly kind: ActionKind.Close;
};
};
type PointerEventWithTarget = Exclude<PointerEvent, 'target'> & {
target: HTMLElement;
};
export declare function useQuickRelease(enabled: boolean, { trigger, action, close, select, }: {
trigger: HTMLElement | null;
action: (e: PointerEventWithTarget) => {
kind: ActionKind.Ignore;
} | {
kind: ActionKind.Select;
target: HTMLElement;
} | {
kind: ActionKind.Close;
};
close: () => void;
select: (target: HTMLElement) => void;
}): void;
export {};

View File

@@ -0,0 +1 @@
import{useRef as d}from"react";import*as l from'../utils/dom.js';import{useDocumentEvent as c}from'./use-document-event.js';var m=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(m||{});const g={Ignore:{kind:0},Select:r=>({kind:1,target:r}),Close:{kind:2}},E=200;function k(r,{trigger:n,action:s,close:e,select:a}){let o=d(null);c(r&&n!==null,"pointerdown",t=>{l.isNode(t==null?void 0:t.target)&&n!=null&&n.contains(t.target)&&(o.current=new Date)}),c(r&&n!==null,"pointerup",t=>{if(o.current===null||!l.isHTMLorSVGElement(t.target))return;let i=s(t),u=new Date().getTime()-o.current.getTime();switch(o.current=null,i.kind){case 0:return;case 1:{u>E&&(a(i.target),e());break}case 2:{e();break}}},{capture:!0})}export{g as Action,k as useQuickRelease};

View File

@@ -0,0 +1,7 @@
/**
* The `useRefocusableInput` hook exposes a function to re-focus the input element.
*
* This hook will also keep the cursor position into account to make sure the
* cursor is placed at the correct position as-if we didn't loose focus at all.
*/
export declare function useRefocusableInput(input: HTMLInputElement | null): () => void;

View File

@@ -0,0 +1 @@
import{useRef as u}from"react";import*as r from'../utils/dom.js';import{useEvent as o}from'./use-event.js';import{useEventListener as s}from'./use-event-listener.js';function f(e){let l=u({value:"",selectionStart:null,selectionEnd:null});return s(e,"blur",n=>{let t=n.target;r.isHTMLInputElement(t)&&(l.current={value:t.value,selectionStart:t.selectionStart,selectionEnd:t.selectionEnd})}),o(()=>{if(document.activeElement!==e&&r.isHTMLInputElement(e)&&e.isConnected){if(e.focus({preventScroll:!0}),e.value!==l.current.value)e.setSelectionRange(e.value.length,e.value.length);else{let{selectionStart:n,selectionEnd:t}=l.current;n!==null&&t!==null&&e.setSelectionRange(n,t)}l.current={value:"",selectionStart:null,selectionEnd:null}}})}export{f as useRefocusableInput};

View File

@@ -0,0 +1,4 @@
export declare function useResolveButtonType<TTag>(props: {
type?: string;
as?: TTag;
}, element: HTMLElement | null): string | undefined;

View File

@@ -0,0 +1 @@
import{useMemo as a}from"react";function e(t,u){return a(()=>{var n;if(t.type)return t.type;let r=(n=t.as)!=null?n:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||(u==null?void 0:u.tagName)==="BUTTON"&&!u.hasAttribute("type"))return"button"},[t.type,t.as,u])}export{e as useResolveButtonType};

View File

@@ -0,0 +1,10 @@
/// <reference types="react" />
/**
* Resolve the actual rendered tag of a DOM node. If the `tag` provided is
* already a string we can use that as-is. This will happen when the `as` prop is
* not used or when it's used with a string value.
*
* If an actual component is used, then we need to do some more work because
* then we actually need to render the component to know what the tag name is.
*/
export declare function useResolvedTag<T extends React.ElementType>(tag: T): readonly [string | undefined, (ref: any) => void];

View File

@@ -0,0 +1 @@
import{useCallback as r,useState as a}from"react";import*as i from'../utils/dom.js';function d(t){let e=typeof t=="string"?t:void 0,[s,o]=a(e);return[e!=null?e:s,r(n=>{e||i.isHTMLElement(n)&&o(n.tagName.toLowerCase())},[e])]}export{d as useResolvedTag};

View File

@@ -0,0 +1,40 @@
import React, { type MutableRefObject } from 'react';
export declare function useRootContainers({ defaultContainers, portals, mainTreeNode, }?: {
defaultContainers?: (Element | null | MutableRefObject<Element | null>)[];
portals?: MutableRefObject<Element[]>;
mainTreeNode?: Element | null;
}): {
resolveContainers: () => Element[];
contains: (element: Element) => boolean;
};
/**
* A provider for the main tree node.
*
* When a component is rendered in a `Portal`, it is no longer part of the main
* tree. This provider helps to find the main tree node and pass it along to the
* components that need it.
*
* The main tree node is used for features such as outside click behavior, where
* we allow clicks in 3rd party containers, but not in the parent of the "main
* tree".
*
* In case of a `Popover`, we can use the `PopoverButton` as a marker in the
* "main tree", the `PopoverPanel` can't be used because it could be rendered in
* a `Portal` (e.g. when using the `anchor` props).
*
* However, we can't use the `PopoverButton` when it's nested inside of another
* `Popover`'s `PopoverPanel` component if the parent `PopoverPanel` is
* rendered in a `Portal`.
*
* This is where the `MainTreeProvider` comes in. It will find the "main tree"
* node and pass it on. The top-level `PopoverButton` will be used as a marker
* in the "main tree" and nested `Popover` will use this button as well.
*/
export declare function MainTreeProvider({ children, node, }: {
children: React.ReactNode;
node?: Element | null;
}): React.JSX.Element;
/**
* Get the main tree node from context or fallback to the optionally provided node.
*/
export declare function useMainTreeNode(fallbackMainTreeNode?: Element | null): Element | null;

View File

@@ -0,0 +1 @@
import s,{createContext as E,useContext as h,useState as p}from"react";import{Hidden as b,HiddenFeatures as M}from'../internal/hidden.js';import*as f from'../utils/dom.js';import{getOwnerDocument as v}from'../utils/owner.js';import{useEvent as m}from'./use-event.js';import{useOwnerDocument as x}from'./use-owner.js';function H({defaultContainers:r=[],portals:n,mainTreeNode:o}={}){let l=x(o),u=m(()=>{var i,c;let t=[];for(let e of r)e!==null&&(f.isElement(e)?t.push(e):"current"in e&&f.isElement(e.current)&&t.push(e.current));if(n!=null&&n.current)for(let e of n.current)t.push(e);for(let e of(i=l==null?void 0:l.querySelectorAll("html > *, body > *"))!=null?i:[])e!==document.body&&e!==document.head&&f.isElement(e)&&e.id!=="headlessui-portal-root"&&(o&&(e.contains(o)||e.contains((c=o==null?void 0:o.getRootNode())==null?void 0:c.host))||t.some(d=>e.contains(d))||t.push(e));return t});return{resolveContainers:u,contains:m(t=>u().some(i=>i.contains(t)))}}let a=E(null);function P({children:r,node:n}){let[o,l]=p(null),u=y(n!=null?n:o);return s.createElement(a.Provider,{value:u},r,u===null&&s.createElement(b,{features:M.Hidden,ref:t=>{var i,c;if(t){for(let e of(c=(i=v(t))==null?void 0:i.querySelectorAll("html > *, body > *"))!=null?c:[])if(e!==document.body&&e!==document.head&&f.isElement(e)&&e!=null&&e.contains(t)){l(e);break}}}}))}function y(r=null){var n;return(n=h(a))!=null?n:r}export{P as MainTreeProvider,y as useMainTreeNode,H as useRootContainers};

View File

@@ -0,0 +1 @@
export declare function useScrollLock(enabled: boolean, ownerDocument: Document | null, resolveAllowedContainers?: () => Element[]): void;

View File

@@ -0,0 +1 @@
import{useDocumentOverflowLockedEffect as l}from'./document-overflow/use-document-overflow.js';import{useIsTopLayer as m}from'./use-is-top-layer.js';function f(e,c,n=()=>[document.body]){let r=m(e,"scroll-lock");l(r,c,t=>{var o;return{containers:[...(o=t.containers)!=null?o:[],n]}})}export{f as useScrollLock};

View File

@@ -0,0 +1 @@
export declare function useServerHandoffComplete(): boolean;

View File

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

View File

@@ -0,0 +1,2 @@
import type { Store } from '../utils/store.js';
export declare function useStore<T>(store: Store<T, any>): T;

View File

@@ -0,0 +1 @@
import{useSyncExternalStore as e}from"react";function o(t){return e(t.subscribe,t.getSnapshot,t.getSnapshot)}export{o as useStore};

View File

@@ -0,0 +1,5 @@
/// <reference types="react" />
export declare function optionalRef<T>(cb: (ref: T) => void, isOptional?: boolean): ((ref: T) => void) & {
[x: symbol]: boolean;
};
export declare function useSyncRefs<TType>(...refs: (React.MutableRefObject<TType | null> | ((instance: TType) => void) | null)[]): ((value: TType) => void) | undefined;

View File

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

View File

@@ -0,0 +1,6 @@
/// <reference types="react" />
export declare enum Direction {
Forwards = 0,
Backwards = 1
}
export declare function useTabDirection(): import("react").MutableRefObject<Direction>;

View File

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

View File

@@ -0,0 +1,2 @@
import { type MutableRefObject } from 'react';
export declare function useTextValue(element: MutableRefObject<HTMLElement | null>): () => string;

View File

@@ -0,0 +1 @@
import{useRef as l}from"react";import{getTextValue as i}from'../utils/get-text-value.js';import{useEvent as o}from'./use-event.js';function s(c){let t=l(""),r=l("");return o(()=>{let e=c.current;if(!e)return"";let u=e.innerText;if(t.current===u)return r.current;let n=i(e).trim().toLowerCase();return t.current=u,r.current=n,n})}export{s as useTextValue};

View File

@@ -0,0 +1,4 @@
export declare function useTrackedPointer(): {
wasMoved(evt: PointerEvent): boolean;
update(evt: PointerEvent): void;
};

View File

@@ -0,0 +1 @@
import{useRef as o}from"react";function t(e){return[e.screenX,e.screenY]}function u(){let e=o([-1,-1]);return{wasMoved(r){let n=t(r);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(r){e.current=t(r)}}}export{u as useTrackedPointer};

View File

@@ -0,0 +1,12 @@
type TransitionData = {
closed?: boolean;
enter?: boolean;
leave?: boolean;
transition?: boolean;
};
export declare function transitionDataAttributes(data: TransitionData): Record<string, string>;
export declare function useTransition(enabled: boolean, element: HTMLElement | null, show: boolean, events?: {
start?(show: boolean): void;
end?(show: boolean): void;
}): [visible: boolean, data: TransitionData];
export {};

View File

@@ -0,0 +1,2 @@
var T,b;import{useRef as c,useState as S}from"react";import{disposables as m}from'../utils/disposables.js';import{useDisposables as g}from'./use-disposables.js';import{useFlags as y}from'./use-flags.js';import{useIsoMorphicEffect as A}from'./use-iso-morphic-effect.js';typeof process!="undefined"&&typeof globalThis!="undefined"&&typeof Element!="undefined"&&((T=process==null?void 0:process.env)==null?void 0:T["NODE_ENV"])==="test"&&typeof((b=Element==null?void 0:Element.prototype)==null?void 0:b.getAnimations)=="undefined"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
`)),[]});var L=(r=>(r[r.None=0]="None",r[r.Closed=1]="Closed",r[r.Enter=2]="Enter",r[r.Leave=4]="Leave",r))(L||{});function R(t){let n={};for(let e in t)t[e]===!0&&(n[`data-${e}`]="");return n}function x(t,n,e,i){let[r,o]=S(e),{hasFlag:s,addFlag:a,removeFlag:l}=y(t&&r?3:0),u=c(!1),f=c(!1),E=g();return A(()=>{var d;if(t){if(e&&o(!0),!n){e&&a(3);return}return(d=i==null?void 0:i.start)==null||d.call(i,e),C(n,{inFlight:u,prepare(){f.current?f.current=!1:f.current=u.current,u.current=!0,!f.current&&(e?(a(3),l(4)):(a(4),l(2)))},run(){f.current?e?(l(3),a(4)):(l(4),a(3)):e?l(1):a(1)},done(){var p;f.current&&typeof n.getAnimations=="function"&&n.getAnimations().length>0||(u.current=!1,l(7),e||o(!1),(p=i==null?void 0:i.end)==null||p.call(i,e))}})}},[t,e,n,E]),t?[r,{closed:s(1),enter:s(2),leave:s(4),transition:s(2)||s(4)}]:[e,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function C(t,{prepare:n,run:e,done:i,inFlight:r}){let o=m();return j(t,{prepare:n,inFlight:r}),o.nextFrame(()=>{e(),o.requestAnimationFrame(()=>{o.add(M(t,i))})}),o.dispose}function M(t,n){var o,s;let e=m();if(!t)return e.dispose;let i=!1;e.add(()=>{i=!0});let r=(s=(o=t.getAnimations)==null?void 0:o.call(t).filter(a=>a instanceof CSSTransition))!=null?s:[];return r.length===0?(n(),e.dispose):(Promise.allSettled(r.map(a=>a.finished)).then(()=>{i||n()}),e.dispose)}function j(t,{inFlight:n,prepare:e}){if(n!=null&&n.current){e();return}let i=t.style.transition;t.style.transition="none",e(),t.offsetHeight,t.style.transition=i}export{R as transitionDataAttributes,x as useTransition};

View File

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

View File

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

View File

@@ -0,0 +1 @@
export declare function useWatch<T extends any[]>(cb: (newValues: [...T], oldValues: [...T]) => void | (() => void), dependencies: [...T]): void;

View File

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

View File

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

View File

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