@necto-react/hooks 2.12.5 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/index.cjs +30 -1
- package/dist/index.d.cts +591 -159
- package/dist/index.d.ts +591 -159
- package/dist/index.global.js +31 -4
- package/dist/index.js +30 -1
- package/package.json +34 -21
- package/LICENSE +0 -21
package/dist/index.js
CHANGED
|
@@ -1 +1,30 @@
|
|
|
1
|
-
import{useRef as De,useCallback as He}from"react";import{mergeProps as Oe}from"@necto/mergers";function Ve({props:t,ref:e,context:n}){let o=j({context:n,slot:t.slot})||{},{ref:r=null,...u}=o,f=De(null),c=He(a=>{f.current=a,typeof e=="function"?e(a):e&&(e.current=a),typeof r=="function"?r(a):r&&typeof r=="object"&&(r.current=a)},[e,r]),i=Oe(u,t);return"style"in u&&u.style&&"style"in t&&t.style&&(typeof u.style=="function"||typeof t.style=="function"?i.style=a=>{let m=typeof u.style=="function"?u.style(a):u.style,d={...a.defaultStyle,...m},v=typeof t.style=="function"?t.style({...a,defaultStyle:d}):t.style;return{...d,...v}}:i.style={...u.style,...t.style}),[i,c]}import{useContext as ke}from"react";import{DisabledContext as Be}from"@necto-react/contexts";function A(t={}){let{type:e="general",defaultFallback:n=!1}=t;return(ke(Be)||{})[e]??n}import{useMemo as Ie}from"react";function Ke(t={}){let{type:e="general",extraProps:n={}}=t,o=A({type:e,defaultFallback:!1});return Ie(()=>{let r={...n};return o&&(r={...r,...typeof n.onClick=="function"||typeof n.onChange=="function"?{disabled:o}:{},"aria-disabled":o}),r},[o,n])}import{useRef as ae,useState as G,useCallback as We,useEffect as je}from"react";function Ae(t={}){let{partialVisibility:e=!1,threshold:n=0,rootMargin:o="0px",root:r=null,active:u=!0,once:f=!1,onChange:c}=t,[i,a]=G(null),[m,d]=G(!1),[v,y]=G(null),E=ae(!1),p=ae(null),l=K(T=>{let h=T[0],M=h.isIntersecting,B={isIntersecting:h.isIntersecting,intersectionRatio:h.intersectionRatio,intersectionRect:h.intersectionRect,boundingClientRect:h.boundingClientRect,rootBounds:h.rootBounds,time:h.time};y(B),d(R=>f&&E.current?!0:M&&f?(E.current=!0,R!==!0&&c&&c(!0),!0):R!==M?(c&&c(M),M):R)}),F=We(T=>{a(T)},[]);return je(()=>{if(!u||!i)return;let T;return e===!0?T=[0,.1,.25,.5,.75,1]:typeof e=="string"?T=.01:T=n,p.current=new IntersectionObserver(l,{root:r,rootMargin:o,threshold:T}),p.current.observe(i),()=>{p.current&&p.current.disconnect()}},[u,i,r,o,n,e]),[F,m,v]}import{useCallback as N}from"react";import{getOwnerDocument as Ge,getEventTarget as Ne,getActiveElement as le}from"@necto/dom";function S(t={}){let{isDisabled:e,onFocus:n,onBlur:o,onFocusChange:r}=t,u=N((a,m)=>{a?(n?.(m),r?.(!0)):(o?.(m),r?.(!1))},[n,o,r]),f=N(a=>{a.target===a.currentTarget&&u(!1,a)},[u]),c=C({onBlur:f}),i=N(a=>{let m=Ge(a.target),d=m?le(m):le();a.target===a.currentTarget&&d===Ne(a.nativeEvent)&&(u(!0,a),c(a))},[u,c]);return{focusProps:{...e?{}:{onFocus:i,onBlur:f}}}}import{getOwnerDocument as $e,getActiveElement as fe,runAfterTransition as ze,focusWithoutScrolling as pe}from"@necto/dom";import{mergeProps as de}from"@necto/mergers";import{useEffect as _e,useRef as qe,useContext as Ye}from"react";import{FocusableContext as Je}from"@necto-react/contexts";function Qe(t,e){let{autoFocus:n,isDisabled:o,excludeFromTabOrder:r}=t,{focusProps:u}=S(t),{keyboardProps:f}=$(t),c=Ye(Je)||{},i=qe(n);z({context:c,ref:e});let{ref:a,...m}=c,d=$e(e.current),v=fe(d);_e(()=>{if(i.current&&e.current)if(D()==="virtual"){let E=v;ze(()=>{fe(d)===E&&e.current?.isConnected&&pe(e.current)})}else pe(e.current);i.current=!1},[e]);let y=r?-1:0;return o&&(y=void 0),{focusableProps:de({...de(u??{},f),tabIndex:y},o?{}:m)}}import{useRef as Xe,useState as me,useCallback as ye}from"react";var Ze=null;function et(t={}){let{within:e=!1,isTextInput:n=!1,autoFocus:o=!1}=t,r=Xe({isFocused:o,isFocusVisible:o||Ze!=="pointer"}),[u,f]=me(o),[c,i]=me(()=>r.current.isFocused&&r.current.isFocusVisible),a=ye(()=>{i(r.current.isFocused&&r.current.isFocusVisible)},[]),m=ye(y=>{r.current.isFocused=y,f(y),a()},[a]);H({fn:y=>{r.current.isFocusVisible=y,a()},deps:[],opts:{isTextInput:n}});let{focusProps:d={}}=S({isDisabled:e,onFocusChange:m})||{},{focusWithinProps:v={}}=_({isDisabled:!e,onFocusWithinChange:m})||{};return{isFocused:u,isFocusVisible:c,focusProps:e?v:d}}import{useState as tt}from"react";function nt(t={}){let{isTextInput:e,autoFocus:n}=t,[o,r]=tt(n||D()!=="pointer");return H({fn:u=>r(u),deps:[e],opts:{isTextInput:e}}),{isFocusVisible:o}}var L=new Map,W=new Set,Ee=!1,q=null,ve=!1,g={get hasEventBeforeFocus(){return Ee},set hasEventBeforeFocus(t){Ee=t},get hasBlurredWindowRecently(){return ve},set hasBlurredWindowRecently(t){ve=t},get currentModality(){return q},set currentModality(t){q=t}};function D(){return q}import{isMacOS as rt}from"std-env";import{useEffect as ot}from"react";import{isKeyboardFocusEvent as st}from"@necto-react/helpers";import{getOwnerDocument as be,getOwnerWindow as ge}from"@necto/dom";function J(t,e){W.forEach(n=>n(t,e))}function ut(t){return!(t.metaKey||rt&&t.altKey||t.ctrlKey||["Control","Shift","Meta"].includes(t.key))}function xe(t){ut(t)&&(g.hasEventBeforeFocus=!0,g.currentModality="keyboard",J("keyboard",t))}function Y(t){["mousedown","pointerdown"].includes(t.type)&&(g.hasEventBeforeFocus=!0,g.currentModality="pointer",J("pointer",t))}function Fe(t){[window,document].includes(t.target)||!t.isTrusted||!g.hasEventBeforeFocus&&!g.hasBlurredWindowRecently||(!g.hasEventBeforeFocus&&!g.hasBlurredWindowRecently&&(g.currentModality="virtual",J("virtual",t)),g.hasEventBeforeFocus=!1,g.hasBlurredWindowRecently=!1)}function Pe(){g.hasEventBeforeFocus=!1,g.hasBlurredWindowRecently=!0}function it(t){let e=ge(t),n=be(t);if(typeof window>"u"||typeof document>"u"||L.has(e))return;let o=e.HTMLElement.prototype.focus;e.HTMLElement.prototype.focus=function(...r){g.hasEventBeforeFocus=!0,o.apply(this,r)},n.addEventListener("keydown",xe,!0),n.addEventListener("click",Y,!0),e.addEventListener("focus",Fe,!0),e.addEventListener("blur",Pe,!1),typeof PointerEvent<"u"&&n.addEventListener("pointerdown",Y,!0),L.set(e,{focus:o})}function ct(t){let e=ge(t),n=be(t);if(!L.has(e))return;let{focus:o}=L.get(e);e.HTMLElement.prototype.focus=o,n.removeEventListener("keydown",xe,!0),n.removeEventListener("click",Y,!0),e.removeEventListener("focus",Fe,!0),e.removeEventListener("blur",Pe,!1),L.delete(e)}function H(t){let{fn:e,deps:n,opts:o}=t;typeof window>"u"||typeof document>"u"||(it(),ot(()=>{let r=(u,f)=>{st(!!o?.isTextInput,u,f)&&e(g.currentModality!=="pointer")};return W.add(r),()=>{W.delete(r),ct()}},n))}import{useCallback as Te,useRef as at}from"react";import{createSyntheticEvent as lt}from"@necto-react/helpers";import{getOwnerDocument as ft,getActiveElement as pt,getEventTarget as dt,nodeContains as mt}from"@necto/dom";function _(t){let{isDisabled:e,onFocusWithin:n,onBlurWithin:o,onFocusWithinChange:r}=t,u=at({isFocusWithin:!1}),{addGlobalListener:f,removeAllGlobalListeners:c}=O(),i=Te(d=>{d.currentTarget.contains(d.target)&&u.current.isFocusWithin&&!d.currentTarget.contains(d.relatedTarget)&&(u.current.isFocusWithin=!1,c(),o&&o(d),r&&r(!1))},[o,r,c]),a=C({onBlur:i}),m=Te(d=>{if(!d.currentTarget.contains(d.target))return;let v=ft(d.target),y=pt(v);if(!u.current.isFocusWithin&&y===dt(d.nativeEvent)){n&&n(d),r&&r(!0),u.current.isFocusWithin=!0,a(d);let E=d.currentTarget;f(v,"focus",p=>{if(u.current.isFocusWithin&&!mt(E,p.target)&&v.defaultView&&typeof v.defaultView.FocusEvent=="function"){let l=new v.defaultView.FocusEvent("blur",{relatedTarget:p.target});Object.defineProperty(l,"target",{value:E}),Object.defineProperty(l,"currentTarget",{value:E});let F=lt(l);i(F)}},{capture:!0})}},[n,r,a,f,i]);return e?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:m,onBlur:i}}}import{useRef as yt,useCallback as Q,useEffect as Et}from"react";function O(){let t=yt(new Map),e=Q((r,u,f,c)=>{let i=typeof c=="object"&&c?.once?(...a)=>{t.current.delete(f),f(...a)}:f;t.current.set(f,{type:u,eventTarget:r,options:c}),r.addEventListener(u,i,c)},[]),n=Q((r,u,f,c)=>{let i=t.current.get(f),a=i?.options?.once?i.fn:f;r.removeEventListener(u,a,c),t.current.delete(f)},[]),o=Q(()=>{t.current.forEach((r,u)=>{r.eventTarget.removeEventListener(r.type,u,r.options)}),t.current.clear()},[]);return Et(()=>()=>o(),[o]),{addGlobalListener:e,removeGlobalListener:n,removeAllGlobalListeners:o}}import{isTest as X}from"std-env";import{getOwnerDocument as vt,nodeContains as bt}from"@necto/dom";import{useRef as he,useState as gt,useCallback as Z,useEffect as Re,useMemo as xt}from"react";function Ft(t={}){let{onHoverStart:e,onHoverChange:n,onHoverEnd:o,isDisabled:r}=t,[u,f]=gt(!1),c=he({hoverCount:0,ignoreEmulated:!1}),i=he({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current,{addGlobalListener:a,removeAllGlobalListeners:m}=O(),d=Z(()=>{c.current.ignoreEmulated=!0,setTimeout(()=>{c.current.ignoreEmulated=!1},50)},[]);Re(()=>{let p=F=>{F.pointerType==="touch"&&d()};if(typeof document>"u")return;let l=c.current;return l.hoverCount++,typeof PointerEvent<"u"?document.addEventListener("pointerup",p):X&&document.addEventListener("touchend",d),()=>{l.hoverCount--,l.hoverCount===0&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",p):X&&document.removeEventListener("touchend",d))}},[d]);let v=Z((p,l)=>{r||l==="touch"||i.isHovered||!(p.currentTarget&&p.currentTarget.contains(p.target))||(i.isHovered=!0,i.pointerType=l,i.target=p.currentTarget,a(vt(p.target instanceof Element?p.target:null),"pointerover",F=>{i.isHovered&&i.target&&!bt(i.target,F.target)&&y(F,F.pointerType)},{capture:!0}),e?.({type:"hoverstart",target:p.currentTarget,pointerType:l}),n?.(!0),f(!0))},[r,e,n,a,i]),y=Z((p,l)=>{l==="touch"||!i.isHovered||!i.target||(i.isHovered=!1,i.pointerType="",i.target=null,m(),o?.({type:"hoverend",target:p.currentTarget,pointerType:l}),n?.(!1),f(!1))},[o,n,m,i.target,i]),E=xt(()=>{let p={};return typeof PointerEvent<"u"?(p.onPointerEnter=l=>{c.current.ignoreEmulated&&l.pointerType==="mouse"||v(l,l.pointerType)},p.onPointerLeave=l=>{!r&&l.currentTarget instanceof Element&&l.currentTarget.contains(l.target)&&y(l,l.pointerType)}):X&&(p.onTouchStart=()=>{i.ignoreEmulatedMouseEvents=!0},p.onMouseEnter=l=>{!i.ignoreEmulatedMouseEvents&&!c.current.ignoreEmulated&&v(l.nativeEvent,"mouse"),i.ignoreEmulatedMouseEvents=!1},p.onMouseLeave=l=>{!r&&l.currentTarget.contains(l.target)&&y(l.nativeEvent,"mouse")}),p},[r,v,y,i]);return Re(()=>{r&&i.isHovered&&y({currentTarget:i.target},i.pointerType)},[r,y,i.isHovered,i.pointerType,i.target]),{hoverProps:E,isHovered:u}}import{isTest as Pt}from"std-env";var ee={prefix:String(Math.round(Math.random()*1e10)),current:0},V=new Map,k=typeof FinalizationRegistry<"u"?new FinalizationRegistry(t=>{V.delete(t)}):null;import Tt,{useRef as Me,useState as ht,useEffect as Ue,useId as Rt}from"react";function Mt(t={}){let{prefix:e="necto",defaultId:n}=t,[o,r]=ht(()=>n),u=Me(null),f=Me({}),c=(()=>{if(n)return n;let i=typeof Tt.useId=="function"?Rt():String(++ee.current);return`${Pt?e:`${e}${ee.prefix}`}-${i}`})();return Ue(()=>{if(typeof window<"u"&&window.document?.createElement){let i=V.get(c)||[],a={current:u.current};i.some(m=>m===a)||V.set(c,[...i,a])}return k&&k.register(f.current,c),()=>{k&&k.unregister(f.current),V.delete(c)}},[c]),Ue(()=>{let i=u.current;i&&(r(i),u.current=null)},[]),c}import{createEventHandler as Le}from"@necto-react/helpers";function $(t){return{keyboardProps:t.isDisabled?{}:{onKeyDown:t.onKeyDown?Le(e=>t.onKeyDown?.(e.nativeEvent)):void 0,onKeyUp:t.onKeyUp?Le(e=>t.onKeyUp?.(e.nativeEvent)):void 0}}}import{useRef as Ut,useState as Lt,useCallback as wt,useEffect as St}from"react";function te(t={}){let{type:e="function"}=t,n=Ut(!1),[o,r]=Lt(!1),u=wt(()=>n.current,[]);return St(()=>(n.current=!0,r(!0),()=>{n.current=!1,r(!1)}),[]),e==="ref"?n:e==="boolean"?o:u}import{getOwnerWindow as we,disableTextSelection as ne,restoreTextSelection as U}from"@necto/dom";import{useState as Ct,useRef as re,useCallback as P,useEffect as Se,useMemo as Dt}from"react";function x(t,e,n){return{type:t,pointerType:e,target:n.currentTarget??n.target,shiftKey:n.shiftKey,ctrlKey:n.ctrlKey,metaKey:n.metaKey,altKey:n.altKey}}function Ht(t={}){let{isDisabled:e,preventFocusOnPress:n,allowTextSelectionOnPress:o,ref:r,onPress:u,onPressStart:f,onPressEnd:c,onPressChange:i,onPressUp:a,onClick:m}=t,[d,v]=Ct(!1),y=re(!1),E=re(null),p=re(!1),l=P(s=>{d!==s&&(v(s),i?.(s))},[d,i]),F=P(s=>{if(!p.current)return;let b=E.current&&E.current instanceof Node&&s.target instanceof Node&&E.current.contains(s.target);if(p.current=!1,l(!1),!o&&E.current instanceof HTMLElement&&U(E.current),s.target){let w={...x("pressend","mouse",s),target:s.target};c?.(w),a?.(w),b&&u?.(w)}},[c,a,u,l,o]),T=P(s=>{if(e||s.button!==0||y.current)return;n&&s.preventDefault(),o||ne(s.currentTarget),p.current=!0,E.current=s.currentTarget,l(!0);let b=x("pressstart","mouse",s);f?.(b),window.addEventListener("mouseup",F,{once:!0})},[e,n,o,f,l,F]),h=P(s=>{if(e||s.button!==0||!p.current)return;p.current=!1,l(!1),!o&&s.currentTarget instanceof HTMLElement&&U(s.currentTarget);let b=x("pressend","mouse",s);c?.(b),a?.(b),s.currentTarget instanceof Node&&s.currentTarget.contains(s.target)&&u?.(x("press","mouse",s))},[e,u,c,a,l,o]),M=P(s=>{d&&(l(!1),c?.(x("pressend","mouse",s)),!o&&s.currentTarget instanceof HTMLElement&&U(s.currentTarget))},[d,l,c,o]),B=P(s=>{p.current&&!d&&(l(!0),f?.(x("pressstart","mouse",s)))},[d,f,l]),R=P(s=>{if(!p.current)return;p.current=!1,l(!1),!o&&E.current instanceof HTMLElement&&U(E.current);let b={...x("pressend","touch",s),target:s.target};c?.(b),a?.(b)},[c,a,l,o]),I=P(s=>{if(!p.current)return;p.current=!1,l(!1),!o&&E.current instanceof HTMLElement&&U(E.current);let b={...x("pressend","touch",s),target:s.target};c?.(b)},[c,l,o]),oe=P(s=>{e||(o||ne(s.currentTarget),y.current=!0,setTimeout(()=>{y.current=!1},100),p.current=!0,E.current=s.currentTarget,l(!0),f?.(x("pressstart","touch",s)),window.addEventListener("touchend",R,{once:!0}),window.addEventListener("touchcancel",I,{once:!0}))},[e,f,l,o,R,I]),se=P(s=>{if(e||!p.current)return;p.current=!1,l(!1),!o&&s.currentTarget instanceof HTMLElement&&U(s.currentTarget);let b=x("pressend","touch",s);c?.(b),a?.(b),s.currentTarget instanceof Node&&s.currentTarget.contains(s.target)&&u?.(x("press","touch",s))},[e,u,c,a,l,o]),ue=P(s=>{if(e)return;(s.key==="Enter"||s.key===" ")&&!d&&(s.key===" "&&s.preventDefault(),o||ne(),l(!0),p.current=!0,f?.(x("pressstart","keyboard",s)))},[e,d,f,l,o]),ie=P(s=>{if(e)return;if((s.key==="Enter"||s.key===" ")&&d){l(!1),p.current=!1,o||U();let w=x("pressend","keyboard",s);c?.(w),a?.(x("pressup","keyboard",s)),u?.(x("press","keyboard",s))}},[e,d,u,c,a,l,o]),ce=P(s=>{if(e){s.preventDefault();return}y.current||m?.(s)},[e,m]);Se(()=>()=>{window.removeEventListener("mouseup",F),window.removeEventListener("touchend",R),window.removeEventListener("touchcancel",I)},[F,R,I]);let Ce=Dt(()=>({onMouseDown:T,onMouseUp:h,onMouseLeave:M,onMouseEnter:B,onTouchStart:oe,onTouchEnd:se,onKeyDown:ue,onKeyUp:ie,onClick:ce}),[T,h,M,B,oe,se,ue,ie,ce]);return Se(()=>{let s=r?.current;s&&s instanceof we(s).Element&&we(s).getComputedStyle(s).touchAction==="auto"&&(s.style.touchAction="pan-x pan-y pinch-zoom")},[r]),{pressProps:Ce,isPressed:d}}import{useMemo as Ot}from"react";function Vt(t){let{className:e,style:n,children:o,defaultClassName:r="necto",defaultChildren:u,defaultStyle:f,values:c}=t;return Ot(()=>{let i=typeof e=="function"?e({...c,defaultClassName:r}):`${r} ${e}`,a=typeof n=="function"?n({...c,defaultStyle:f||{}}):{...f,...n},m=typeof o=="function"?o({...c,defaultChildren:u}):o??u;return{className:i,style:a,children:m}},[e,n,o,r,u,f,c])}import{useContext as kt}from"react";function j(t){let{context:e,slot:n}=t,o=kt(e);if(n===null)return null;if(o&&typeof o=="object"&&"slots"in o&&o.slots){let r=n||Symbol("default");if(!o.slots[r]){let u=new Intl.ListFormat().format(Object.keys(o.slots).map(c=>`"${c}"`)),f=n?`Invalid slot name: "${n}". This slot is not recognized. Please refer to the component's documentation for valid slot names.`:"A slot prop is required. You must provide a valid slot name to render content in this area.";throw new Error(`${f} Valid slot names are ${u}.`)}return o.slots[r]}return o}import{useLayoutEffect as Bt}from"react";function z(t={}){let{ref:e,context:n}=t;(typeof document<"u"?Bt:()=>{})(()=>{if(n&&n.ref&&e)return n.ref.current=e.current,()=>{n.ref&&(n.ref.current=null)}})}import{createSyntheticEvent as It}from"@necto-react/helpers";import{useRef as Kt,useCallback as Wt,useLayoutEffect as jt}from"react";function C(t){let{onBlur:e}=t,n=Kt({isFocused:!1,observer:null});jt(()=>{let r=n.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let o=K(r=>{e?.(r)});return Wt(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){n.current.isFocused=!0;let u=r.target,f=c=>{if(n.current.isFocused=!1,u.disabled){let i=It(c);o(i)}n.current.observer&&(n.current.observer.disconnect(),n.current.observer=null)};u.addEventListener("focusout",f,{once:!0}),n.current.observer=new MutationObserver(()=>{if(n.current.isFocused&&u.disabled){n.current.observer?.disconnect();let c=u===document.activeElement?null:document.activeElement;u.dispatchEvent(new FocusEvent("blur",{relatedTarget:c})),u.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:c}))}}),n.current.observer.observe(u,{attributes:!0,attributeFilter:["disabled"]})}},[o])}import{useCallback as At,useRef as Gt,useLayoutEffect as Nt,useEffect as $t}from"react";function K(t){let e=Gt(t);return(typeof window<"u"?Nt:$t)(()=>{e.current=t},[t]),At((...n)=>e.current(...n),[])}import{useEffect as zt,useState as _t}from"react";function oo(t){let e=te(),[n,o]=_t(!1);return zt(()=>{e()&&o(!!t())},[t,e]),n}export{D as getInteractionModality,Ve as useContextProps,A as useDisabled,Ke as useDisabledProps,K as useEffectEvent,Ae as useElementVisibility,S as useFocus,et as useFocusRing,nt as useFocusVisible,H as useFocusVisibleListener,_ as useFocusWithin,Qe as useFocusable,O as useGlobalListeners,Ft as useHover,Mt as useId,$ as useKeyboard,te as useMounted,Ht as usePress,Vt as useRenderer,j as useSlottedContext,oo as useSupported,z as useSyncContextRef,C as useSyntheticBlurEvent};
|
|
1
|
+
var Et=Object.create;var De=Object.defineProperty;var bt=Object.getOwnPropertyDescriptor;var ht=Object.getOwnPropertyNames;var Tt=Object.getPrototypeOf,Rt=Object.prototype.hasOwnProperty;var _e=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var le=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Ot=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ht(e))!Rt.call(t,i)&&i!==r&&De(t,i,{get:()=>e[i],enumerable:!(o=bt(e,i))||o.enumerable});return t};var St=(t,e,r)=>(r=t!=null?Et(Tt(t)):{},Ot(e||!t||!t.__esModule?De(r,"default",{value:t,enumerable:!0}):r,t));var st=le(D=>{"use strict";var Xr=_e("react");function ot(t){var e="https://react.dev/errors/"+t;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)e+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function C(){}var K={d:{f:C,r:function(){throw Error(ot(522))},D:C,C,L:C,m:C,X:C,S:C,M:C},p:0,findDOMNode:null},Qr=Symbol.for("react.portal");function Jr(t,e,r){var o=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Qr,key:o==null?null:""+o,children:t,containerInfo:e,implementation:r}}var Z=Xr.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function se(t,e){if(t==="font")return"";if(typeof e=="string")return e==="use-credentials"?e:""}D.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=K;D.createPortal=function(t,e){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)throw Error(ot(299));return Jr(t,e,null,r)};D.flushSync=function(t){var e=Z.T,r=K.p;try{if(Z.T=null,K.p=2,t)return t()}finally{Z.T=e,K.p=r,K.d.f()}};D.preconnect=function(t,e){typeof t=="string"&&(e?(e=e.crossOrigin,e=typeof e=="string"?e==="use-credentials"?e:"":void 0):e=null,K.d.C(t,e))};D.prefetchDNS=function(t){typeof t=="string"&&K.d.D(t)};D.preinit=function(t,e){if(typeof t=="string"&&e&&typeof e.as=="string"){var r=e.as,o=se(r,e.crossOrigin),i=typeof e.integrity=="string"?e.integrity:void 0,u=typeof e.fetchPriority=="string"?e.fetchPriority:void 0;r==="style"?K.d.S(t,typeof e.precedence=="string"?e.precedence:void 0,{crossOrigin:o,integrity:i,fetchPriority:u}):r==="script"&&K.d.X(t,{crossOrigin:o,integrity:i,fetchPriority:u,nonce:typeof e.nonce=="string"?e.nonce:void 0})}};D.preinitModule=function(t,e){if(typeof t=="string")if(typeof e=="object"&&e!==null){if(e.as==null||e.as==="script"){var r=se(e.as,e.crossOrigin);K.d.M(t,{crossOrigin:r,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0})}}else e==null&&K.d.M(t)};D.preload=function(t,e){if(typeof t=="string"&&typeof e=="object"&&e!==null&&typeof e.as=="string"){var r=e.as,o=se(r,e.crossOrigin);K.d.L(t,r,{crossOrigin:o,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,type:typeof e.type=="string"?e.type:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0,referrerPolicy:typeof e.referrerPolicy=="string"?e.referrerPolicy:void 0,imageSrcSet:typeof e.imageSrcSet=="string"?e.imageSrcSet:void 0,imageSizes:typeof e.imageSizes=="string"?e.imageSizes:void 0,media:typeof e.media=="string"?e.media:void 0})}};D.preloadModule=function(t,e){if(typeof t=="string")if(e){var r=se(e.as,e.crossOrigin);K.d.m(t,{as:typeof e.as=="string"&&e.as!=="script"?e.as:void 0,crossOrigin:r,integrity:typeof e.integrity=="string"?e.integrity:void 0})}else K.d.m(t)};D.requestFormReset=function(t){K.d.r(t)};D.unstable_batchedUpdates=function(t,e){return t(e)};D.useFormState=function(t,e,r){return Z.H.useFormState(t,e,r)};D.useFormStatus=function(){return Z.H.useHostTransitionStatus()};D.version="19.2.0"});var it=le(_=>{"use strict";process.env.NODE_ENV!=="production"&&(function(){function t(){}function e(s){return""+s}function r(s,n,p){var E=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;try{e(E);var g=!1}catch{g=!0}return g&&(console.error("The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",typeof Symbol=="function"&&Symbol.toStringTag&&E[Symbol.toStringTag]||E.constructor.name||"Object"),e(E)),{$$typeof:l,key:E==null?null:""+E,children:s,containerInfo:n,implementation:p}}function o(s,n){if(s==="font")return"";if(typeof n=="string")return n==="use-credentials"?n:""}function i(s){return s===null?"`null`":s===void 0?"`undefined`":s===""?"an empty string":'something with type "'+typeof s+'"'}function u(s){return s===null?"`null`":s===void 0?"`undefined`":s===""?"an empty string":typeof s=="string"?JSON.stringify(s):typeof s=="number"?"`"+s+"`":'something with type "'+typeof s+'"'}function f(){var s=v.H;return s===null&&console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
|
2
|
+
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
3
|
+
2. You might be breaking the Rules of Hooks
|
|
4
|
+
3. You might have more than one copy of React in the same app
|
|
5
|
+
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),s}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var c=_e("react"),a={d:{f:t,r:function(){throw Error("Invalid form element. requestFormReset must be passed a form that was rendered by React.")},D:t,C:t,L:t,m:t,X:t,S:t,M:t},p:0,findDOMNode:null},l=Symbol.for("react.portal"),v=c.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;typeof Map=="function"&&Map.prototype!=null&&typeof Map.prototype.forEach=="function"&&typeof Set=="function"&&Set.prototype!=null&&typeof Set.prototype.clear=="function"&&typeof Set.prototype.forEach=="function"||console.error("React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),_.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,_.createPortal=function(s,n){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)throw Error("Target container is not a DOM element.");return r(s,n,null,p)},_.flushSync=function(s){var n=v.T,p=a.p;try{if(v.T=null,a.p=2,s)return s()}finally{v.T=n,a.p=p,a.d.f()&&console.error("flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task.")}},_.preconnect=function(s,n){typeof s=="string"&&s?n!=null&&typeof n!="object"?console.error("ReactDOM.preconnect(): Expected the `options` argument (second) to be an object but encountered %s instead. The only supported option at this time is `crossOrigin` which accepts a string.",u(n)):n!=null&&typeof n.crossOrigin!="string"&&console.error("ReactDOM.preconnect(): Expected the `crossOrigin` option (second argument) to be a string but encountered %s instead. Try removing this option or passing a string value instead.",i(n.crossOrigin)):console.error("ReactDOM.preconnect(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",i(s)),typeof s=="string"&&(n?(n=n.crossOrigin,n=typeof n=="string"?n==="use-credentials"?n:"":void 0):n=null,a.d.C(s,n))},_.prefetchDNS=function(s){if(typeof s!="string"||!s)console.error("ReactDOM.prefetchDNS(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",i(s));else if(1<arguments.length){var n=arguments[1];typeof n=="object"&&n.hasOwnProperty("crossOrigin")?console.error("ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. It looks like the you are attempting to set a crossOrigin property for this DNS lookup hint. Browsers do not perform DNS queries using CORS and setting this attribute on the resource hint has no effect. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",u(n)):console.error("ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",u(n))}typeof s=="string"&&a.d.D(s)},_.preinit=function(s,n){if(typeof s=="string"&&s?n==null||typeof n!="object"?console.error("ReactDOM.preinit(): Expected the `options` argument (second) to be an object with an `as` property describing the type of resource to be preinitialized but encountered %s instead.",u(n)):n.as!=="style"&&n.as!=="script"&&console.error('ReactDOM.preinit(): Expected the `as` property in the `options` argument (second) to contain a valid value describing the type of resource to be preinitialized but encountered %s instead. Valid values for `as` are "style" and "script".',u(n.as)):console.error("ReactDOM.preinit(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",i(s)),typeof s=="string"&&n&&typeof n.as=="string"){var p=n.as,E=o(p,n.crossOrigin),g=typeof n.integrity=="string"?n.integrity:void 0,y=typeof n.fetchPriority=="string"?n.fetchPriority:void 0;p==="style"?a.d.S(s,typeof n.precedence=="string"?n.precedence:void 0,{crossOrigin:E,integrity:g,fetchPriority:y}):p==="script"&&a.d.X(s,{crossOrigin:E,integrity:g,fetchPriority:y,nonce:typeof n.nonce=="string"?n.nonce:void 0})}},_.preinitModule=function(s,n){var p="";if(typeof s=="string"&&s||(p+=" The `href` argument encountered was "+i(s)+"."),n!==void 0&&typeof n!="object"?p+=" The `options` argument encountered was "+i(n)+".":n&&"as"in n&&n.as!=="script"&&(p+=" The `as` option encountered was "+u(n.as)+"."),p)console.error("ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s",p);else switch(p=n&&typeof n.as=="string"?n.as:"script",p){case"script":break;default:p=u(p),console.error('ReactDOM.preinitModule(): Currently the only supported "as" type for this function is "script" but received "%s" instead. This warning was generated for `href` "%s". In the future other module types will be supported, aligning with the import-attributes proposal. Learn more here: (https://github.com/tc39/proposal-import-attributes)',p,s)}typeof s=="string"&&(typeof n=="object"&&n!==null?(n.as==null||n.as==="script")&&(p=o(n.as,n.crossOrigin),a.d.M(s,{crossOrigin:p,integrity:typeof n.integrity=="string"?n.integrity:void 0,nonce:typeof n.nonce=="string"?n.nonce:void 0})):n==null&&a.d.M(s))},_.preload=function(s,n){var p="";if(typeof s=="string"&&s||(p+=" The `href` argument encountered was "+i(s)+"."),n==null||typeof n!="object"?p+=" The `options` argument encountered was "+i(n)+".":typeof n.as=="string"&&n.as||(p+=" The `as` option encountered was "+i(n.as)+"."),p&&console.error('ReactDOM.preload(): Expected two arguments, a non-empty `href` string and an `options` object with an `as` property valid for a `<link rel="preload" as="..." />` tag.%s',p),typeof s=="string"&&typeof n=="object"&&n!==null&&typeof n.as=="string"){p=n.as;var E=o(p,n.crossOrigin);a.d.L(s,p,{crossOrigin:E,integrity:typeof n.integrity=="string"?n.integrity:void 0,nonce:typeof n.nonce=="string"?n.nonce:void 0,type:typeof n.type=="string"?n.type:void 0,fetchPriority:typeof n.fetchPriority=="string"?n.fetchPriority:void 0,referrerPolicy:typeof n.referrerPolicy=="string"?n.referrerPolicy:void 0,imageSrcSet:typeof n.imageSrcSet=="string"?n.imageSrcSet:void 0,imageSizes:typeof n.imageSizes=="string"?n.imageSizes:void 0,media:typeof n.media=="string"?n.media:void 0})}},_.preloadModule=function(s,n){var p="";typeof s=="string"&&s||(p+=" The `href` argument encountered was "+i(s)+"."),n!==void 0&&typeof n!="object"?p+=" The `options` argument encountered was "+i(n)+".":n&&"as"in n&&typeof n.as!="string"&&(p+=" The `as` option encountered was "+i(n.as)+"."),p&&console.error('ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `<link rel="modulepreload" as="..." />` tag.%s',p),typeof s=="string"&&(n?(p=o(n.as,n.crossOrigin),a.d.m(s,{as:typeof n.as=="string"&&n.as!=="script"?n.as:void 0,crossOrigin:p,integrity:typeof n.integrity=="string"?n.integrity:void 0})):a.d.m(s))},_.requestFormReset=function(s){a.d.r(s)},_.unstable_batchedUpdates=function(s,n){return s(n)},_.useFormState=function(s,n,p){return f().useFormState(s,n,p)},_.useFormStatus=function(){return f().useHostTransitionStatus()},_.version="19.2.0",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var at=le((Bs,xe)=>{"use strict";function ut(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function")){if(process.env.NODE_ENV!=="production")throw new Error("^_^");try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ut)}catch(t){console.error(t)}}}process.env.NODE_ENV==="production"?(ut(),xe.exports=st()):xe.exports=it()});import{useRef as Ft,useCallback as xt}from"react";import{mergeProps as Lt}from"@necto/mergers";function wt({props:t,ref:e,context:r}){let o=fe({context:r,slot:t.slot})||{},{ref:i=null,...u}=o,f=Ft(null),c=xt(l=>{f.current=l,typeof e=="function"?e(l):e&&(e.current=l),typeof i=="function"?i(l):i&&typeof i=="object"&&(i.current=l)},[e,i]),a=Lt(u,t);return"style"in u&&u.style&&"style"in t&&t.style&&(typeof u.style=="function"||typeof t.style=="function"?a.style=l=>{let v=typeof u.style=="function"?u.style(l):u.style,s={...l.defaultStyle,...v},n=typeof t.style=="function"?t.style({...l,defaultStyle:s}):t.style;return{...s,...n}}:a.style={...u.style,...t.style}),[a,c]}import{useRef as Ve,useState as de,useCallback as Mt,useEffect as Pt}from"react";function Ut(t={}){let{partialVisibility:e=!1,threshold:r=0,rootMargin:o="0px",root:i=null,active:u=!0,once:f=!1,onChange:c}=t,[a,l]=de(null),[v,s]=de(!1),[n,p]=de(null),E=Ve(!1),g=Ve(null),y=k(h=>{let T=h[0],F=T.isIntersecting,S={isIntersecting:T.isIntersecting,intersectionRatio:T.intersectionRatio,intersectionRect:T.intersectionRect,boundingClientRect:T.boundingClientRect,rootBounds:T.rootBounds,time:T.time};p(S),s(M=>f&&E.current?!0:F&&f?(E.current=!0,M!==!0&&c&&c(!0),!0):M!==F?(c&&c(F),F):M)}),O=Mt(h=>{l(h)},[]);return Pt(()=>{if(!u||!a)return;let h;return e===!0?h=[0,.1,.25,.5,.75,1]:typeof e=="string"?h=.01:h=r,g.current=new IntersectionObserver(y,{root:i,rootMargin:o,threshold:h}),g.current.observe(a),()=>{g.current&&g.current.disconnect()}},[u,a,i,o,r,e]),[O,v,n]}import{useCallback as pe}from"react";import{getOwnerDocument as Kt,getEventTarget as Dt,getActiveElement as Ae}from"@necto/dom";function $(t={}){let{isDisabled:e,onFocus:r,onBlur:o,onFocusChange:i}=t,u=pe((l,v)=>{l?(r?.(v),i?.(!0)):(o?.(v),i?.(!1))},[r,o,i]),f=pe(l=>{l.target===l.currentTarget&&u(!1,l)},[u]),c=z({onBlur:f}),a=pe(l=>{let v=Kt(l.target),s=v?Ae(v):Ae();l.target===l.currentTarget&&s===Dt(l.nativeEvent)&&(u(!0,l),c(l))},[u,c]);return{focusProps:{...e?{}:{onFocus:a,onBlur:f}}}}import{getOwnerDocument as _t,getActiveElement as Ce,runAfterTransition as Vt,focusWithoutScrolling as ke}from"@necto/dom";import{mergeProps as At}from"@necto/mergers";import{useEffect as Ct,useRef as kt}from"react";function It(t,e){let{autoFocus:r,isDisabled:o,excludeFromTabOrder:i}=t,{focusProps:u}=$(t),{keyboardProps:f}=ye(t),c=kt(r),a=_t(e.current),l=Ce(a);Ct(()=>{if(c.current&&e.current)if(q()==="virtual"){let s=l;Vt(()=>{Ce(a)===s&&e.current?.isConnected&&ke(e.current)})}else ke(e.current);c.current=!1},[e]);let v=i?-1:0;return o&&(v=void 0),{focusableProps:At(u??{},f,{tabIndex:v})}}import{useRef as Ht,useState as Ie,useCallback as He}from"react";var Nt=null;function Bt(t={}){let{within:e=!1,isTextInput:r=!1,autoFocus:o=!1}=t,i=Ht({isFocused:o,isFocusVisible:o||Nt!=="pointer"}),[u,f]=Ie(o),[c,a]=Ie(()=>i.current.isFocused&&i.current.isFocusVisible),l=He(()=>{a(i.current.isFocused&&i.current.isFocusVisible)},[]),v=He(p=>{i.current.isFocused=p,f(p),l()},[l]);Y({fn:p=>{i.current.isFocusVisible=p,l()},deps:[],opts:{isTextInput:r}});let{focusProps:s={}}=$({isDisabled:e,onFocusChange:v})||{},{focusWithinProps:n={}}=me({isDisabled:!e,onFocusWithinChange:v})||{};return{isFocused:u,isFocusVisible:c,focusProps:e?n:s}}import{useState as jt}from"react";function Wt(t={}){let{isTextInput:e,autoFocus:r}=t,[o,i]=jt(r||q()!=="pointer");return Y({fn:u=>i(u),deps:[e],opts:{isTextInput:e}}),{isFocusVisible:o}}var B=new Map,ne=new Set,Ne=!1,ge=null,Be=!1,P={get hasEventBeforeFocus(){return Ne},set hasEventBeforeFocus(t){Ne=t},get hasBlurredWindowRecently(){return Be},set hasBlurredWindowRecently(t){Be=t},get currentModality(){return ge},set currentModality(t){ge=t}};function q(){return ge}import{isMacOS as Gt}from"std-env";import{useEffect as $t}from"react";import{isKeyboardFocusEvent as zt}from"@necto-react/helpers";import{getOwnerDocument as je,getOwnerWindow as We}from"@necto/dom";function Ee(t,e){ne.forEach(r=>r(t,e))}function qt(t){return!(t.metaKey||Gt&&t.altKey||t.ctrlKey||["Control","Shift","Meta"].includes(t.key))}function Ge(t){qt(t)&&(P.hasEventBeforeFocus=!0,P.currentModality="keyboard",Ee("keyboard",t))}function ve(t){["mousedown","pointerdown"].includes(t.type)&&(P.hasEventBeforeFocus=!0,P.currentModality="pointer",Ee("pointer",t))}function $e(t){[window,document].includes(t.target)||!t.isTrusted||!P.hasEventBeforeFocus&&!P.hasBlurredWindowRecently||(!P.hasEventBeforeFocus&&!P.hasBlurredWindowRecently&&(P.currentModality="virtual",Ee("virtual",t)),P.hasEventBeforeFocus=!1,P.hasBlurredWindowRecently=!1)}function ze(){P.hasEventBeforeFocus=!1,P.hasBlurredWindowRecently=!0}function Yt(t){let e=We(t),r=je(t);if(typeof window>"u"||typeof document>"u"||B.has(e))return;let o=e.HTMLElement.prototype.focus;e.HTMLElement.prototype.focus=function(...i){P.hasEventBeforeFocus=!0,o.apply(this,i)},r.addEventListener("keydown",Ge,!0),r.addEventListener("click",ve,!0),e.addEventListener("focus",$e,!0),e.addEventListener("blur",ze,!1),typeof PointerEvent<"u"&&r.addEventListener("pointerdown",ve,!0),B.set(e,{focus:o})}function Xt(t){let e=We(t),r=je(t);if(!B.has(e))return;let{focus:o}=B.get(e);e.HTMLElement.prototype.focus=o,r.removeEventListener("keydown",Ge,!0),r.removeEventListener("click",ve,!0),e.removeEventListener("focus",$e,!0),e.removeEventListener("blur",ze,!1),B.delete(e)}function Y(t){let{fn:e,deps:r,opts:o}=t;typeof window>"u"||typeof document>"u"||(Yt(),$t(()=>{let i=(u,f)=>{zt(!!o?.isTextInput,u,f)&&e(P.currentModality!=="pointer")};return ne.add(i),()=>{ne.delete(i),Xt()}},r))}import{useCallback as qe,useRef as Qt}from"react";import{createSyntheticEvent as Jt}from"@necto-react/helpers";import{getOwnerDocument as Zt,getActiveElement as er,getEventTarget as tr,nodeContains as rr}from"@necto/dom";function me(t){let{isDisabled:e,onFocusWithin:r,onBlurWithin:o,onFocusWithinChange:i}=t,u=Qt({isFocusWithin:!1}),{addGlobalListener:f,removeAllGlobalListeners:c}=X(),a=qe(s=>{s.currentTarget.contains(s.target)&&u.current.isFocusWithin&&!s.currentTarget.contains(s.relatedTarget)&&(u.current.isFocusWithin=!1,c(),o&&o(s),i&&i(!1))},[o,i,c]),l=z({onBlur:a}),v=qe(s=>{if(!s.currentTarget.contains(s.target))return;let n=Zt(s.target),p=er(n);if(!u.current.isFocusWithin&&p===tr(s.nativeEvent)){r&&r(s),i&&i(!0),u.current.isFocusWithin=!0,l(s);let E=s.currentTarget;f(n,"focus",g=>{if(u.current.isFocusWithin&&!rr(E,g.target)&&n.defaultView&&typeof n.defaultView.FocusEvent=="function"){let y=new n.defaultView.FocusEvent("blur",{relatedTarget:g.target});Object.defineProperty(y,"target",{value:E}),Object.defineProperty(y,"currentTarget",{value:E});let O=Jt(y);a(O)}},{capture:!0})}},[r,i,l,f,a]);return e?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:v,onBlur:a}}}import{useRef as nr,useCallback as be,useEffect as or}from"react";function X(){let t=nr(new Map),e=be((i,u,f,c)=>{let a=typeof c=="object"&&c?.once?(...l)=>{t.current.delete(f),f(...l)}:f;t.current.set(f,{type:u,eventTarget:i,options:c}),i.addEventListener(u,a,c)},[]),r=be((i,u,f,c)=>{let a=t.current.get(f),l=a?.options?.once?a.fn:f;i.removeEventListener(u,l,c),t.current.delete(f)},[]),o=be(()=>{t.current.forEach((i,u)=>{i.eventTarget.removeEventListener(i.type,u,i.options)}),t.current.clear()},[]);return or(()=>()=>o(),[o]),{addGlobalListener:e,removeGlobalListener:r,removeAllGlobalListeners:o}}import{isTest as he}from"std-env";import{getOwnerDocument as sr,nodeContains as ir}from"@necto/dom";import{useRef as Ye,useState as ur,useCallback as Te,useEffect as Xe,useMemo as ar}from"react";function cr(t={}){let{onHoverStart:e,onHoverChange:r,onHoverEnd:o,isDisabled:i}=t,[u,f]=ur(!1),c=Ye({hoverCount:0,ignoreEmulated:!1}),a=Ye({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current,{addGlobalListener:l,removeAllGlobalListeners:v}=X(),s=Te(()=>{c.current.ignoreEmulated=!0,setTimeout(()=>{c.current.ignoreEmulated=!1},50)},[]);Xe(()=>{let g=O=>{O.pointerType==="touch"&&s()};if(typeof document>"u")return;let y=c.current;return y.hoverCount++,typeof PointerEvent<"u"?document.addEventListener("pointerup",g):he&&document.addEventListener("touchend",s),()=>{y.hoverCount--,y.hoverCount===0&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",g):he&&document.removeEventListener("touchend",s))}},[s]);let n=Te((g,y)=>{i||y==="touch"||a.isHovered||!(g.currentTarget&&g.currentTarget.contains(g.target))||(a.isHovered=!0,a.pointerType=y,a.target=g.currentTarget,l(sr(g.target instanceof Element?g.target:null),"pointerover",O=>{a.isHovered&&a.target&&!ir(a.target,O.target)&&p(O,O.pointerType)},{capture:!0}),e?.({type:"hoverstart",target:g.currentTarget,pointerType:y}),r?.(!0),f(!0))},[i,e,r,l,a]),p=Te((g,y)=>{y==="touch"||!a.isHovered||!a.target||(a.isHovered=!1,a.pointerType="",a.target=null,v(),o?.({type:"hoverend",target:g.currentTarget,pointerType:y}),r?.(!1),f(!1))},[o,r,v,a.target,a]),E=ar(()=>{let g={};return typeof PointerEvent<"u"?(g.onPointerEnter=y=>{c.current.ignoreEmulated&&y.pointerType==="mouse"||n(y,y.pointerType)},g.onPointerLeave=y=>{!i&&y.currentTarget instanceof Element&&y.currentTarget.contains(y.target)&&p(y,y.pointerType)}):he&&(g.onTouchStart=()=>{a.ignoreEmulatedMouseEvents=!0},g.onMouseEnter=y=>{!a.ignoreEmulatedMouseEvents&&!c.current.ignoreEmulated&&n(y.nativeEvent,"mouse"),a.ignoreEmulatedMouseEvents=!1},g.onMouseLeave=y=>{!i&&y.currentTarget.contains(y.target)&&p(y.nativeEvent,"mouse")}),g},[i,n,p,a]);return Xe(()=>{i&&a.isHovered&&p({currentTarget:a.target},a.pointerType)},[i,p,a.isHovered,a.pointerType,a.target]),{hoverProps:E,isHovered:u}}import{isTest as lr}from"std-env";var Re={prefix:String(Math.round(Math.random()*1e10)),current:0},Q=new Map,J=typeof FinalizationRegistry<"u"?new FinalizationRegistry(t=>{Q.delete(t)}):null;import fr,{useRef as Qe,useState as dr,useEffect as Je,useId as pr}from"react";function yr(t={}){let{prefix:e="necto",defaultId:r}=t,[o,i]=dr(()=>r),u=Qe(null),f=Qe({}),c=(()=>{if(r)return r;let a=typeof fr.useId=="function"?pr():String(++Re.current);return`${lr?e:`${e}${Re.prefix}`}-${a}`})();return Je(()=>{if(typeof window<"u"&&window.document?.createElement){let a=Q.get(c)||[],l={current:u.current};a.some(v=>v===l)||Q.set(c,[...a,l])}return J&&J.register(f.current,c),()=>{J&&J.unregister(f.current),Q.delete(c)}},[c]),Je(()=>{let a=u.current;a&&(i(a),u.current=null)},[]),c}import{createEventHandler as Ze}from"@necto-react/helpers";function ye(t){return{keyboardProps:t.isDisabled?{}:{onKeyDown:t.onKeyDown?Ze(e=>t.onKeyDown?.(e.nativeEvent)):void 0,onKeyUp:t.onKeyUp?Ze(e=>t.onKeyUp?.(e.nativeEvent)):void 0}}}import{useRef as mr,useState as gr,useCallback as vr,useEffect as Er}from"react";function Oe(t={}){let{type:e="function"}=t,r=mr(!1),[o,i]=gr(!1),u=vr(()=>r.current,[]);return Er(()=>(r.current=!0,i(!0),()=>{r.current=!1,i(!1)}),[]),e==="ref"?r:e==="boolean"?o:u}import{getOwnerWindow as et,disableTextSelection as Se,restoreTextSelection as I}from"@necto/dom";import{useState as br,useRef as Fe,useCallback as A,useEffect as tt,useMemo as hr}from"react";function U(t,e,r){return{type:t,pointerType:e,target:r.currentTarget??r.target,shiftKey:r.shiftKey,ctrlKey:r.ctrlKey,metaKey:r.metaKey,altKey:r.altKey}}function Tr(t={}){let{isDisabled:e,preventFocusOnPress:r,allowTextSelectionOnPress:o,ref:i,onPress:u,onPressStart:f,onPressEnd:c,onPressChange:a,onPressUp:l,onClick:v}=t,[s,n]=br(!1),p=Fe(!1),E=Fe(null),g=Fe(!1),y=A(m=>{s!==m&&(n(m),a?.(m))},[s,a]),O=A(m=>{if(!g.current)return;let d=E.current&&E.current instanceof Node&&m.target instanceof Node&&E.current.contains(m.target);if(g.current=!1,y(!1),!o&&E.current instanceof HTMLElement&&I(E.current),m.target){let R={...U("pressend","mouse",m),target:m.target};c?.(R),l?.(R),d&&u?.(R)}},[c,l,u,y,o]),h=A(m=>{if(e||m.button!==0||p.current)return;r&&m.preventDefault(),o||Se(m.currentTarget),g.current=!0,E.current=m.currentTarget,y(!0);let d=U("pressstart","mouse",m);f?.(d),window.addEventListener("mouseup",O,{once:!0})},[e,r,o,f,y,O]),T=A(m=>{if(e||m.button!==0||!g.current)return;g.current=!1,y(!1),!o&&m.currentTarget instanceof HTMLElement&&I(m.currentTarget);let d=U("pressend","mouse",m);c?.(d),l?.(d),m.currentTarget instanceof Node&&m.currentTarget.contains(m.target)&&u?.(U("press","mouse",m))},[e,u,c,l,y,o]),F=A(m=>{s&&(y(!1),c?.(U("pressend","mouse",m)),!o&&m.currentTarget instanceof HTMLElement&&I(m.currentTarget))},[s,y,c,o]),S=A(m=>{g.current&&!s&&(y(!0),f?.(U("pressstart","mouse",m)))},[s,f,y]),M=A(m=>{if(!g.current)return;g.current=!1,y(!1),!o&&E.current instanceof HTMLElement&&I(E.current);let d={...U("pressend","touch",m),target:m.target};c?.(d),l?.(d)},[c,l,y,o]),w=A(m=>{if(!g.current)return;g.current=!1,y(!1),!o&&E.current instanceof HTMLElement&&I(E.current);let d={...U("pressend","touch",m),target:m.target};c?.(d)},[c,y,o]),V=A(m=>{e||(o||Se(m.currentTarget),p.current=!0,setTimeout(()=>{p.current=!1},100),g.current=!0,E.current=m.currentTarget,y(!0),f?.(U("pressstart","touch",m)),window.addEventListener("touchend",M,{once:!0}),window.addEventListener("touchcancel",w,{once:!0}))},[e,f,y,o,M,w]),H=A(m=>{if(e||!g.current)return;g.current=!1,y(!1),!o&&m.currentTarget instanceof HTMLElement&&I(m.currentTarget);let d=U("pressend","touch",m);c?.(d),l?.(d),m.currentTarget instanceof Node&&m.currentTarget.contains(m.target)&&u?.(U("press","touch",m))},[e,u,c,l,y,o]),x=A(m=>{if(e)return;(m.key==="Enter"||m.key===" ")&&!s&&(m.key===" "&&m.preventDefault(),o||Se(),y(!0),g.current=!0,f?.(U("pressstart","keyboard",m)))},[e,s,f,y,o]),te=A(m=>{if(e)return;if((m.key==="Enter"||m.key===" ")&&s){y(!1),g.current=!1,o||I();let R=U("pressend","keyboard",m);c?.(R),l?.(U("pressup","keyboard",m)),u?.(U("press","keyboard",m))}},[e,s,u,c,l,y,o]),re=A(m=>{if(e){m.preventDefault();return}p.current||v?.(m)},[e,v]);tt(()=>()=>{window.removeEventListener("mouseup",O),window.removeEventListener("touchend",M),window.removeEventListener("touchcancel",w)},[O,M,w]);let ce=hr(()=>({onMouseDown:h,onMouseUp:T,onMouseLeave:F,onMouseEnter:S,onTouchStart:V,onTouchEnd:H,onKeyDown:x,onKeyUp:te,onClick:re}),[h,T,F,S,V,H,x,te,re]);return tt(()=>{let m=i?.current;m&&m instanceof et(m).Element&&et(m).getComputedStyle(m).touchAction==="auto"&&(m.style.touchAction="pan-x pan-y pinch-zoom")},[i]),{pressProps:ce,isPressed:s}}import{useMemo as Rr}from"react";function Or(t){let{style:e,values:r,children:o,className:i,defaultStyle:u,defaultChildren:f,defaultClassName:c="necto"}=t;return Rr(()=>{let a=typeof i=="function"?i({...r,defaultClassName:c}):i?`${c} ${i}`:c,l=typeof e=="function"?e({...r,defaultStyle:u||{}}):{...u,...e},v=typeof o=="function"?o({...r,defaultChildren:f}):o??f;return{className:a,style:l,children:v}},[i,e,o,c,f,u,r])}import{useContext as Sr}from"react";function fe(t){let{context:e,slot:r}=t,o=Sr(e);if(r===null)return null;if(o&&typeof o=="object"&&"slots"in o&&o.slots){let i=r||Symbol("default");if(!o.slots[i]){let u=new Intl.ListFormat().format(Object.keys(o.slots).map(c=>`"${c}"`)),f=r?`Invalid slot name: "${r}". This slot is not recognized. Please refer to the component's documentation for valid slot names.`:"A slot prop is required. You must provide a valid slot name to render content in this area.";throw new Error(`${f} Valid slot names are ${u}.`)}return o.slots[i]}return o}import{createSyntheticEvent as Fr}from"@necto-react/helpers";import{useRef as xr,useCallback as Lr,useLayoutEffect as wr}from"react";function z(t){let{onBlur:e}=t,r=xr({isFocused:!1,observer:null});wr(()=>{let i=r.current;return()=>{i.observer&&(i.observer.disconnect(),i.observer=null)}},[]);let o=k(i=>{e?.(i)});return Lr(i=>{if(i.target instanceof HTMLButtonElement||i.target instanceof HTMLInputElement||i.target instanceof HTMLTextAreaElement||i.target instanceof HTMLSelectElement){r.current.isFocused=!0;let u=i.target,f=c=>{if(r.current.isFocused=!1,u.disabled){let a=Fr(c);o(a)}r.current.observer&&(r.current.observer.disconnect(),r.current.observer=null)};u.addEventListener("focusout",f,{once:!0}),r.current.observer=new MutationObserver(()=>{if(r.current.isFocused&&u.disabled){r.current.observer?.disconnect();let c=u===document.activeElement?null:document.activeElement;u.dispatchEvent(new FocusEvent("blur",{relatedTarget:c})),u.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:c}))}}),r.current.observer.observe(u,{attributes:!0,attributeFilter:["disabled"]})}},[o])}import{useCallback as Mr,useRef as Pr,useLayoutEffect as Ur,useEffect as Kr}from"react";function k(t){let e=Pr(t);return(typeof window<"u"?Ur:Kr)(()=>{e.current=t},[t]),Mr(((...r)=>e.current(...r)),[])}import{useEffect as Dr,useState as _r}from"react";function fs(t){let e=Oe(),[r,o]=_r(!1);return Dr(()=>{e()&&o(!!t())},[t,e]),r}import{useRef as rt,useState as Vr,useEffect as Ar}from"react";function Cr(t={}){let{autoLock:e=!1,target:r,widthReflow:o=!0}=t,[i,u]=Vr(!1),f=rt(null),c=rt(null),a=k(()=>{if(typeof window>"u"||!f.current)return;let{overflow:v,paddingRight:s}=f.current.style;if(c.current={overflow:v,paddingRight:s},o){let n=f.current===document.body?window.innerWidth:f.current.offsetWidth,p=parseInt(window.getComputedStyle(f.current).paddingRight,10)||0,E=n-f.current.scrollWidth;f.current.style.paddingRight=`${E+p}px`}f.current.style.overflow="hidden",u(!0)}),l=k(()=>{f.current&&c.current&&(f.current.style.overflow=c.current.overflow,o&&(f.current.style.paddingRight=c.current.paddingRight)),u(!1)});return Ar(()=>{if(!(typeof window>"u"||typeof document>"u"))return r&&(f.current=typeof r=="string"?document.querySelector(r):r),f.current||(f.current=document.body),e&&a(),()=>{l()}},[e,r,o,a,l]),{isLocked:i,lock:a,unlock:l}}import{useMemo as kr}from"react";import{AriaProps as L}from"@necto/dom";function Ir(t={}){let{isInvalid:e,isDisabled:r,isReadOnly:o,isRequired:i,isBusy:u,isPressed:f,isExpanded:c,isSelected:a,isChecked:l,isHidden:v,hasPopup:s,valueCurrent:n,valueMin:p,valueMax:E,valueText:g,label:y,labelledBy:O,describedBy:h,controls:T,owns:F}=t;return kr(()=>{let S={},M=[{value:e,attr:L.Invalid},{value:r,attr:L.Disabled},{value:o,attr:L.Readonly},{value:i,attr:L.Required},{value:u,attr:L.Busy},{value:c,attr:L.Expanded},{value:a,attr:L.Selected},{value:v,attr:L.Hidden}];for(let{value:w,attr:V}of M)w!==void 0&&(S[V]=w||void 0);return f!==void 0&&(S[L.Pressed]=f===!1?void 0:f),l!==void 0&&(S[L.Checked]=l===!1?void 0:l),s!==void 0&&(S[L.Haspopup]=s===!1?void 0:s),n!==void 0&&(S[L.Valuenow]=n),p!==void 0&&(S[L.Valuemin]=p),E!==void 0&&(S[L.Valuemax]=E),g!==void 0&&(S[L.Valuetext]=g),y!==void 0&&(S[L.Label]=y),O!==void 0&&(S[L.Labelledby]=O),h!==void 0&&(S[L.Describedby]=h),T!==void 0&&(S[L.Controls]=T),F!==void 0&&(S[L.Owns]=F),S},[e,r,o,i,u,f,c,a,l,v,s,n,p,E,g,y,O,h,T,F])}import{injectStyle as Hr}from"@necto/dom";function Nr({id:t,css:e,insertionPoint:r,enabled:o=!0,window:i=typeof window<"u"?window:null}){let u=Array.isArray(e)?e.join(`
|
|
6
|
+
`):e;nt(()=>{if(!(!o||!u))return Hr(u,{id:t,window:i,insertionPoint:r})},[t,u,i,r,o])}import{useRef as Br,useLayoutEffect as jr}from"react";function Ms(t){let e=Br(t);return jr(()=>{e.current=t}),e}import Wr,{useLayoutEffect as Gr}from"react";var nt=Wr.useInsertionEffect??Gr;import{defu as zr}from"defu";import{useRef as oe,useCallback as j,useEffect as qr}from"react";function Yr(t={}){let{isDisabled:e,onLongPressStart:r,onLongPressEnd:o,onLongPress:i,accessibilityDescription:u,threshold:f}=zr(t,{threshold:500}),c=oe(null),a=oe(null),l=oe(null),v=oe(!1),s=j(()=>{c.current&&(clearTimeout(c.current),c.current=null)},[]);qr(()=>s,[s]);let n=j(T=>({type:T,pointerType:a.current??"mouse",target:l.current}),[]),p=j(T=>{e||T.button!==0||T.pointerType!=="mouse"&&(a.current=T.pointerType,l.current=T.currentTarget,v.current=!1,r?.(n("longpressstart")),c.current=setTimeout(()=>{v.current=!0,T.currentTarget?.dispatchEvent(new PointerEvent("pointercancel",{bubbles:!0})),i?.(n("longpress")),c.current=null},f))},[e,f,r,i,n]),E=j(()=>{a.current!==null&&(s(),!v.current&&o&&o(n("longpressend")),a.current=null,l.current=null)},[s,o,n]),g=j(()=>{s(),a.current!==null&&o&&o(n("longpressend")),a.current=null,l.current=null},[s,o,n]),y=j(T=>{v.current&&T.preventDefault()},[]);return{longPressProps:e?{}:{onPointerDown:p,onPointerUp:E,onPointerCancel:g,onContextMenu:y,...!e&&!!i&&!!u&&{"aria-description":u}}}}var ft=St(at(),1);import{useCallback as ct,useLayoutEffect as dt,useState as Le}from"react";function Zr(t){let{ref:e,isOpen:r,isReady:o=!0}=t,[i,u]=Le(r),f=i&&o;dt(()=>{if(f&&e.current&&"getAnimations"in e.current)for(let n of e.current.getAnimations())n instanceof CSSTransition&&n.cancel()},[e,f]),lt(e,f,ct(()=>u(!1),[]));let[c,a]=Le(r);r&&!c?(u(!0),a(!0)):!r&&c&&a(!1);let[l,v]=Le(r?"open":"closed");switch(l){case"open":r||v("exiting");break;case"closed":case"exiting":r&&v("open");break}let s=l==="exiting";return lt(e,s,ct(()=>{v(n=>n==="exiting"?"closed":n)},[])),{isEntering:f,isExiting:s,isRendered:r||s}}function lt(t,e,r){dt(()=>{if(e&&t.current){if(!("getAnimations"in t.current)){r();return}let o=t.current.getAnimations();if(o.length===0){r();return}let i=!1;return Promise.all(o.map(u=>u.finished)).then(()=>{i||(0,ft.flushSync)(()=>{r()})}).catch(()=>{}),()=>{i=!0}}},[t,e,r])}import{defu as en}from"defu";import{mergeProps as tn}from"@necto/mergers";import{useCallback as W,useEffect as ie,useRef as ee}from"react";import{isCtrlKeyPressed as we,isMac as rn}from"@necto/platform";import{focusWithoutScrolling as nn,scrollIntoView as on}from"@necto/dom";function sn(t){return rn()?t.metaKey:t.ctrlKey}function pt(t,e){return t.current?.querySelector(`[data-key="${e}"]`)??null}function un(t){let{selectionManager:e,keyboardDelegate:r,ref:o,autoFocus:i,shouldFocusWrap:u,disallowEmptySelection:f,disallowSelectAll:c,escapeBehavior:a,selectOnFocus:l,disallowTypeAhead:v,shouldUseVirtualFocus:s,allowsTabNavigation:n,scrollRef:p,direction:E,orientation:g,onNavigate:y,onFocusItem:O}=en(t,{autoFocus:!1,shouldFocusWrap:!1,disallowEmptySelection:!1,disallowSelectAll:!1,escapeBehavior:"clearSelection",selectOnFocus:!1,disallowTypeAhead:!1,shouldUseVirtualFocus:!1,allowsTabNavigation:!1,isVirtualized:!1,direction:"ltr",orientation:"vertical"}),h=p??o,T=ee({top:0,left:0}),F=ee(e.focusedKey),S=ee(i),M=ee(""),w=ee(null),V=W((d,R,b)=>{d!=null&&(e.setFocusedKey(d,b),y?.(d),R?.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(d):l&&!sn(R)&&e.replaceSelection(d))},[e,l,y]),H=W(d=>{if(O){O(d);return}let R=pt(o,d);R&&!s&&nn(R)},[o,s,O]),x=W(d=>{if(!v&&d.key.length===1&&!d.ctrlKey&&!d.metaKey&&!d.altKey){w.current&&clearTimeout(w.current),M.current+=d.key;let b=r.getKeyForSearch?.(M.current,e.focusedKey)??null;b!=null&&(d.preventDefault(),V(b,d)),w.current=setTimeout(()=>{M.current=""},500);return}let R=E==="rtl";switch(d.key){case"ArrowDown":{if(r.getKeyBelow){let b=e.focusedKey!=null?r.getKeyBelow(e.focusedKey):r.getFirstKey?.()??null;b==null&&u&&(b=r.getFirstKey?.()??null),b!=null&&(d.preventDefault(),V(b,d))}break}case"ArrowUp":{if(r.getKeyAbove){let b=e.focusedKey!=null?r.getKeyAbove(e.focusedKey):r.getLastKey?.()??null;b==null&&u&&(b=r.getLastKey?.()??null),b!=null&&(d.preventDefault(),V(b,d))}break}case"ArrowLeft":{if(r.getKeyLeftOf){let b=e.focusedKey!=null?r.getKeyLeftOf(e.focusedKey):null;b==null&&u&&(b=R?r.getFirstKey?.()??null:r.getLastKey?.()??null),b!=null&&(d.preventDefault(),V(b,d,R?"first":"last"))}break}case"ArrowRight":{if(r.getKeyRightOf){let b=e.focusedKey!=null?r.getKeyRightOf(e.focusedKey):null;b==null&&u&&(b=R?r.getLastKey?.()??null:r.getFirstKey?.()??null),b!=null&&(d.preventDefault(),V(b,d,R?"last":"first"))}break}case"Home":{if(r.getFirstKey){d.preventDefault();let b=r.getFirstKey();e.setFocusedKey(b),b!=null&&(we(d)&&d.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(b):l&&e.replaceSelection(b))}break}case"End":{if(r.getLastKey){d.preventDefault();let b=r.getLastKey();e.setFocusedKey(b),b!=null&&(we(d)&&d.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(b):l&&e.replaceSelection(b))}break}case"PageDown":{if(r.getKeyPageBelow&&e.focusedKey!=null){let b=r.getKeyPageBelow(e.focusedKey);b!=null&&(d.preventDefault(),V(b,d))}break}case"PageUp":{if(r.getKeyPageAbove&&e.focusedKey!=null){let b=r.getKeyPageAbove(e.focusedKey);b!=null&&(d.preventDefault(),V(b,d))}break}case"a":{we(d)&&e.selectionMode==="multiple"&&!c&&(d.preventDefault(),e.selectAll());break}case"Escape":{a==="clearSelection"&&!f&&e.selectedKeys.size>0&&(d.stopPropagation(),d.preventDefault(),e.clearSelection());break}case"Tab":{!n&&o.current&&d.shiftKey&&o.current.focus();break}}},[r,e,o,E,u,l,v,c,f,a,n,V]),te=W(d=>{if(!e.isFocused){if(e.setFocused(!0),e.focusedKey==null){let R=d.relatedTarget,b=R!=null&&!!(d.currentTarget.compareDocumentPosition(R)&Node.DOCUMENT_POSITION_FOLLOWING),N=null;b?N=e.lastSelectedKey??r.getLastKey?.()??null:N=e.firstSelectedKey??r.getFirstKey?.()??null,N!=null&&(e.setFocusedKey(N),l&&!e.isSelected(N)&&e.replaceSelection(N))}else h.current&&(h.current.scrollTop=T.current.top,h.current.scrollLeft=T.current.left);e.focusedKey!=null&&H(e.focusedKey)}},[e,r,l,h,H]),re=W(d=>{let R=d.relatedTarget;d.currentTarget.contains(R)||e.setFocused(!1)},[e]),ce=W(d=>{h.current===d.target&&d.preventDefault()},[h]);ie(()=>{let d=h.current;if(!d)return()=>{};let R=()=>{T.current={top:d.scrollTop,left:d.scrollLeft}};return d.addEventListener("scroll",R,{passive:!0}),()=>{d.removeEventListener("scroll",R)}},[h]),ie(()=>{if(!S.current)return;let d=null;if(S.current==="first"?d=r.getFirstKey?.()??null:S.current==="last"&&(d=r.getLastKey?.()??null),e.selectedKeys.size>0){for(let R of e.selectedKeys)if(e.canSelectItem?.(R)!==!1){d=R;break}}e.setFocused(!0),e.setFocusedKey(d),d==null&&!s&&o.current&&o.current.focus(),S.current=!1},[r,e,o,s]),ie(()=>{if(!e.isFocused||e.focusedKey==null||e.focusedKey===F.current)return;let d=pt(o,e.focusedKey);d&&h.current&&on(h.current,d),F.current=e.focusedKey},[e.isFocused,e.focusedKey,o,h]),ie(()=>()=>{w.current&&clearTimeout(w.current)},[]);let m=s?void 0:e.focusedKey==null?0:-1;return{collectionProps:tn({onKeyDown:x,onFocus:te,onBlur:re,onMouseDown:ce,tabIndex:m,"data-orientation":g})}}import{createContext as an,useContext as cn,useEffect as ln,useMemo as Me,useRef as yt,useState as ue}from"react";var ae={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!0},gt={...ae,customError:!0,valid:!1},G={isInvalid:!1,validationErrors:[],validationDetails:ae},vt=an({}),Ue="__formValidationState"+Date.now();function fn(t){if(t[Ue]){let{realtimeValidation:e,displayValidation:r,updateValidation:o,resetValidation:i,commitValidation:u}=t[Ue];return{realtimeValidation:e,displayValidation:r,updateValidation:o,resetValidation:i,commitValidation:u}}return dn(t)}function dn(t){let{isInvalid:e,validationState:r,name:o,value:i,builtinValidation:u,validate:f,validationBehavior:c="aria"}=t;r&&(e||=r==="invalid");let a=e!==void 0?{isInvalid:e,validationErrors:[],validationDetails:gt}:null,l=Me(()=>{if(!f||i==null)return null;let x=pn(f,i);return mt(x)},[f,i]);u?.validationDetails.valid&&(u=void 0);let v=cn(vt),s=Me(()=>o?Array.isArray(o)?o.flatMap(x=>Ke(v[x])):Ke(v[o]):[],[v,o]),[n,p]=ue(v),[E,g]=ue(!1);v!==n&&(p(v),g(!1));let y=Me(()=>mt(E?[]:s),[E,s]),O=yt(G),[h,T]=ue(G),F=yt(G),S=()=>{if(!M)return;w(!1);let x=l||u||O.current;Pe(x,F.current)||(F.current=x,T(x))},[M,w]=ue(!1);return ln(S),{realtimeValidation:a||y||l||u||G,displayValidation:c==="native"?a||y||h:a||y||l||u||h,updateValidation(x){c==="aria"&&!Pe(h,x)?T(x):O.current=x},resetValidation(){let x=G;Pe(x,F.current)||(F.current=x,T(x)),c==="native"&&w(!1),g(!0)},commitValidation(){c==="native"&&w(!0),g(!0)}}}function Ke(t){return t?Array.isArray(t)?t:[t]:[]}function pn(t,e){if(typeof t=="function"){let r=t(e);if(r&&typeof r!="boolean")return Ke(r)}return[]}function mt(t){return t.length?{isInvalid:!0,validationErrors:t,validationDetails:gt}:null}function Pe(t,e){return t===e?!0:!!t&&!!e&&t.isInvalid===e.isInvalid&&t.validationErrors.length===e.validationErrors.length&&t.validationErrors.every((r,o)=>r===e.validationErrors[o])&&Object.entries(t.validationDetails).every(([r,o])=>e.validationDetails[r]===o)}function yn(...t){let e=new Set,r=!1,o={...ae};for(let i of t){for(let u of i.validationErrors)e.add(u);r||=i.isInvalid;for(let u in o)o[u]||=i.validationDetails[u]}return o.valid=!r,{isInvalid:r,validationErrors:[...e],validationDetails:o}}export{G as DEFAULT_VALIDATION_RESULT,vt as FormValidationContext,ae as VALID_VALIDITY_STATE,q as getInteractionModality,yn as mergeValidation,Ue as privateValidationStateProp,Zr as useAnimation,Ir as useAriaProps,un as useCollectionNavigation,wt as useContextProps,k as useEffectEvent,Ut as useElementVisibility,$ as useFocus,Bt as useFocusRing,Wt as useFocusVisible,Y as useFocusVisibleListener,me as useFocusWithin,It as useFocusable,fn as useFormState,X as useGlobalListeners,cr as useHover,yr as useId,nt as useIsomorphicInsertionEffect,ye as useKeyboard,Ms as useLatestRef,Yr as useLongPress,Oe as useMounted,Tr as usePress,Or as useRenderer,Cr as useScrollLock,fe as useSlottedContext,Nr as useStyleInjection,fs as useSupported,z as useSyntheticBlurEvent};
|
|
7
|
+
/*! Bundled license information:
|
|
8
|
+
|
|
9
|
+
react-dom/cjs/react-dom.production.js:
|
|
10
|
+
(**
|
|
11
|
+
* @license React
|
|
12
|
+
* react-dom.production.js
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*)
|
|
19
|
+
|
|
20
|
+
react-dom/cjs/react-dom.development.js:
|
|
21
|
+
(**
|
|
22
|
+
* @license React
|
|
23
|
+
* react-dom.development.js
|
|
24
|
+
*
|
|
25
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
26
|
+
*
|
|
27
|
+
* This source code is licensed under the MIT license found in the
|
|
28
|
+
* LICENSE file in the root directory of this source tree.
|
|
29
|
+
*)
|
|
30
|
+
*/
|
package/package.json
CHANGED
|
@@ -1,15 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@necto-react/hooks",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Necto's standard library for providing utility hooks for React applications.",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "vitest",
|
|
8
|
+
"build": "tsup ./src/index.ts --minify --format esm,cjs,iife --dts",
|
|
9
|
+
"dev": "tsup ./src/index.ts --watch --minify --format esm,cjs,iife --dts"
|
|
10
|
+
},
|
|
6
11
|
"files": [
|
|
7
12
|
"dist",
|
|
8
13
|
"README.md"
|
|
9
14
|
],
|
|
10
|
-
"types": "dist/index.d.ts",
|
|
11
|
-
"main": "./dist/index.
|
|
12
|
-
"module": "./dist/index.
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"main": "./dist/index.cjs",
|
|
17
|
+
"module": "./dist/index.js",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"import": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"default": "./dist/index.js"
|
|
23
|
+
},
|
|
24
|
+
"require": {
|
|
25
|
+
"types": "./dist/index.d.cts",
|
|
26
|
+
"default": "./dist/index.cjs"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
13
30
|
"author": "Corinvo OSS Team",
|
|
14
31
|
"license": "MIT",
|
|
15
32
|
"devDependencies": {
|
|
@@ -19,27 +36,23 @@
|
|
|
19
36
|
"@types/react-dom": "^19.1.2",
|
|
20
37
|
"jsdom": "^26.1.0",
|
|
21
38
|
"npm-run-all": "^4.1.5",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
39
|
+
"shared": "workspace:*",
|
|
40
|
+
"tsup": "^8.4.0"
|
|
24
41
|
},
|
|
25
42
|
"peerDependencies": {
|
|
26
43
|
"react": "^19.1.0"
|
|
27
44
|
},
|
|
28
45
|
"dependencies": {
|
|
46
|
+
"@necto-react/helpers": "workspace:*",
|
|
47
|
+
"@necto-react/types": "workspace:*",
|
|
48
|
+
"@necto/dom": "workspace:*",
|
|
49
|
+
"@necto/id": "workspace:*",
|
|
50
|
+
"@necto/mergers": "workspace:*",
|
|
51
|
+
"@necto/platform": "workspace:*",
|
|
52
|
+
"@necto/strings": "workspace:*",
|
|
53
|
+
"@necto/types": "workspace:*",
|
|
54
|
+
"defu": "^6.1.4",
|
|
29
55
|
"react-aria": "^3.39.0",
|
|
30
|
-
"std-env": "^3.9.0"
|
|
31
|
-
"@necto/types": "1.3.0",
|
|
32
|
-
"@necto-react/helpers": "2.4.5",
|
|
33
|
-
"@necto-react/contexts": "1.3.0",
|
|
34
|
-
"@necto-react/types": "2.3.0",
|
|
35
|
-
"@necto/dom": "1.4.5",
|
|
36
|
-
"@necto/id": "1.6.3",
|
|
37
|
-
"@necto/mergers": "1.4.0",
|
|
38
|
-
"@necto/platform": "1.4.0"
|
|
39
|
-
},
|
|
40
|
-
"scripts": {
|
|
41
|
-
"test": "vitest",
|
|
42
|
-
"build": "tsup ./src/index.ts --minify --format esm,cjs,iife --dts",
|
|
43
|
-
"dev": "tsup ./src/index.ts --watch --minify --format esm,cjs,iife --dts"
|
|
56
|
+
"std-env": "^3.9.0"
|
|
44
57
|
}
|
|
45
|
-
}
|
|
58
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) Corinvo, LLC. and affiliates. All rights reserved.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|