1 line
8.1 KiB
JavaScript
1 line
8.1 KiB
JavaScript
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5652],{30064:(e,r,t)=>{t.d(r,{UC:()=>J,B8:()=>z,bL:()=>q,l9:()=>Z});var n=t(12115),o=t(85185),a=t(46081),l=t(76589),i=t(6101),u=t(61285),s=t(63540),c=t(39033),f=t(5845),d=t(94315),p=t(95155),m="rovingFocusGroup.onEntryFocus",v={bubbles:!1,cancelable:!0},b="RovingFocusGroup",[w,h,y]=(0,l.N)(b),[g,R]=(0,a.A)(b,[y]),[x,C]=g(b),j=n.forwardRef((e,r)=>(0,p.jsx)(w.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,p.jsx)(w.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,p.jsx)(A,{...e,ref:r})})}));j.displayName=b;var A=n.forwardRef((e,r)=>{let{__scopeRovingFocusGroup:t,orientation:a,loop:l=!1,dir:u,currentTabStopId:b,defaultCurrentTabStopId:w,onCurrentTabStopIdChange:y,onEntryFocus:g,preventScrollOnEntryFocus:R=!1,...C}=e,j=n.useRef(null),A=(0,i.s)(r,j),E=(0,d.jH)(u),[I=null,F]=(0,f.i)({prop:b,defaultProp:w,onChange:y}),[N,M]=n.useState(!1),S=(0,c.c)(g),T=h(t),k=n.useRef(!1),[G,K]=n.useState(0);return n.useEffect(()=>{let e=j.current;if(e)return e.addEventListener(m,S),()=>e.removeEventListener(m,S)},[S]),(0,p.jsx)(x,{scope:t,orientation:a,dir:E,loop:l,currentTabStopId:I,onItemFocus:n.useCallback(e=>F(e),[F]),onItemShiftTab:n.useCallback(()=>M(!0),[]),onFocusableItemAdd:n.useCallback(()=>K(e=>e+1),[]),onFocusableItemRemove:n.useCallback(()=>K(e=>e-1),[]),children:(0,p.jsx)(s.sG.div,{tabIndex:N||0===G?-1:0,"data-orientation":a,...C,ref:A,style:{outline:"none",...e.style},onMouseDown:(0,o.m)(e.onMouseDown,()=>{k.current=!0}),onFocus:(0,o.m)(e.onFocus,e=>{let r=!k.current;if(e.target===e.currentTarget&&r&&!N){let r=new CustomEvent(m,v);if(e.currentTarget.dispatchEvent(r),!r.defaultPrevented){let e=T().filter(e=>e.focusable);D([e.find(e=>e.active),e.find(e=>e.id===I),...e].filter(Boolean).map(e=>e.ref.current),R)}}k.current=!1}),onBlur:(0,o.m)(e.onBlur,()=>M(!1))})})}),E="RovingFocusGroupItem",I=n.forwardRef((e,r)=>{let{__scopeRovingFocusGroup:t,focusable:a=!0,active:l=!1,tabStopId:i,...c}=e,f=(0,u.B)(),d=i||f,m=C(E,t),v=m.currentTabStopId===d,b=h(t),{onFocusableItemAdd:y,onFocusableItemRemove:g}=m;return n.useEffect(()=>{if(a)return y(),()=>g()},[a,y,g]),(0,p.jsx)(w.ItemSlot,{scope:t,id:d,focusable:a,active:l,children:(0,p.jsx)(s.sG.span,{tabIndex:v?0:-1,"data-orientation":m.orientation,...c,ref:r,onMouseDown:(0,o.m)(e.onMouseDown,e=>{a?m.onItemFocus(d):e.preventDefault()}),onFocus:(0,o.m)(e.onFocus,()=>m.onItemFocus(d)),onKeyDown:(0,o.m)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void m.onItemShiftTab();if(e.target!==e.currentTarget)return;let r=function(e,r,t){var n;let o=(n=e.key,"rtl"!==t?n:"ArrowLeft"===n?"ArrowRight":"ArrowRight"===n?"ArrowLeft":n);if(!("vertical"===r&&["ArrowLeft","ArrowRight"].includes(o))&&!("horizontal"===r&&["ArrowUp","ArrowDown"].includes(o)))return F[o]}(e,m.orientation,m.dir);if(void 0!==r){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let t=b().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===r)t.reverse();else if("prev"===r||"next"===r){"prev"===r&&t.reverse();let n=t.indexOf(e.currentTarget);t=m.loop?function(e,r){return e.map((t,n)=>e[(r+n)%e.length])}(t,n+1):t.slice(n+1)}setTimeout(()=>D(t))}})})})});I.displayName=E;var F={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function D(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=document.activeElement;for(let n of e)if(n===t||(n.focus({preventScroll:r}),document.activeElement!==t))return}var N=t(28905),M="Tabs",[S,T]=(0,a.A)(M,[R]),k=R(),[G,K]=S(M),P=n.forwardRef((e,r)=>{let{__scopeTabs:t,value:n,onValueChange:o,defaultValue:a,orientation:l="horizontal",dir:i,activationMode:c="automatic",...m}=e,v=(0,d.jH)(i),[b,w]=(0,f.i)({prop:n,onChange:o,defaultProp:a});return(0,p.jsx)(G,{scope:t,baseId:(0,u.B)(),value:b,onValueChange:w,orientation:l,dir:v,activationMode:c,children:(0,p.jsx)(s.sG.div,{dir:v,"data-orientation":l,...m,ref:r})})});P.displayName=M;var L="TabsList",V=n.forwardRef((e,r)=>{let{__scopeTabs:t,loop:n=!0,...o}=e,a=K(L,t),l=k(t);return(0,p.jsx)(j,{asChild:!0,...l,orientation:a.orientation,dir:a.dir,loop:n,children:(0,p.jsx)(s.sG.div,{role:"tablist","aria-orientation":a.orientation,...o,ref:r})})});V.displayName=L;var _="TabsTrigger",B=n.forwardRef((e,r)=>{let{__scopeTabs:t,value:n,disabled:a=!1,...l}=e,i=K(_,t),u=k(t),c=W(i.baseId,n),f=H(i.baseId,n),d=n===i.value;return(0,p.jsx)(I,{asChild:!0,...u,focusable:!a,active:d,children:(0,p.jsx)(s.sG.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":f,"data-state":d?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:c,...l,ref:r,onMouseDown:(0,o.m)(e.onMouseDown,e=>{a||0!==e.button||!1!==e.ctrlKey?e.preventDefault():i.onValueChange(n)}),onKeyDown:(0,o.m)(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&i.onValueChange(n)}),onFocus:(0,o.m)(e.onFocus,()=>{let e="manual"!==i.activationMode;d||a||!e||i.onValueChange(n)})})})});B.displayName=_;var O="TabsContent",U=n.forwardRef((e,r)=>{let{__scopeTabs:t,value:o,forceMount:a,children:l,...i}=e,u=K(O,t),c=W(u.baseId,o),f=H(u.baseId,o),d=o===u.value,m=n.useRef(d);return n.useEffect(()=>{let e=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,p.jsx)(N.C,{present:a||d,children:t=>{let{present:n}=t;return(0,p.jsx)(s.sG.div,{"data-state":d?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":c,hidden:!n,id:f,tabIndex:0,...i,ref:r,style:{...e.style,animationDuration:m.current?"0s":void 0},children:n&&l})}})});function W(e,r){return"".concat(e,"-trigger-").concat(r)}function H(e,r){return"".concat(e,"-content-").concat(r)}U.displayName=O;var q=P,z=V,Z=B,J=U},45503:(e,r,t)=>{t.d(r,{Z:()=>o});var n=t(12115);function o(e){let r=n.useRef({value:e,previous:e});return n.useMemo(()=>(r.current.value!==e&&(r.current.previous=r.current.value,r.current.value=e),r.current.previous),[e])}},76589:(e,r,t)=>{t.d(r,{N:()=>f});var n=t(12115),o=t(46081),a=t(6101),l=t(95155),i=n.forwardRef((e,r)=>{let{children:t,...o}=e,a=n.Children.toArray(t),i=a.find(c);if(i){let e=i.props.children,t=a.map(r=>r!==i?r:n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null);return(0,l.jsx)(u,{...o,ref:r,children:n.isValidElement(e)?n.cloneElement(e,void 0,t):null})}return(0,l.jsx)(u,{...o,ref:r,children:t})});i.displayName="Slot";var u=n.forwardRef((e,r)=>{let{children:t,...o}=e;if(n.isValidElement(t)){let e=function(e){let r=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,t=r&&"isReactWarning"in r&&r.isReactWarning;return t?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref")?.get)&&"isReactWarning"in r&&r.isReactWarning)?e.props.ref:e.props.ref||e.ref}(t);return n.cloneElement(t,{...function(e,r){let t={...r};for(let n in r){let o=e[n],a=r[n];/^on[A-Z]/.test(n)?o&&a?t[n]=(...e)=>{a(...e),o(...e)}:o&&(t[n]=o):"style"===n?t[n]={...o,...a}:"className"===n&&(t[n]=[o,a].filter(Boolean).join(" "))}return{...e,...t}}(o,t.props),ref:r?(0,a.t)(r,e):e})}return n.Children.count(t)>1?n.Children.only(null):null});u.displayName="SlotClone";var s=({children:e})=>(0,l.jsx)(l.Fragment,{children:e});function c(e){return n.isValidElement(e)&&e.type===s}function f(e){let r=e+"CollectionProvider",[t,u]=(0,o.A)(r),[s,c]=t(r,{collectionRef:{current:null},itemMap:new Map}),f=e=>{let{scope:r,children:t}=e,o=n.useRef(null),a=n.useRef(new Map).current;return(0,l.jsx)(s,{scope:r,itemMap:a,collectionRef:o,children:t})};f.displayName=r;let d=e+"CollectionSlot",p=n.forwardRef((e,r)=>{let{scope:t,children:n}=e,o=c(d,t),u=(0,a.s)(r,o.collectionRef);return(0,l.jsx)(i,{ref:u,children:n})});p.displayName=d;let m=e+"CollectionItemSlot",v="data-radix-collection-item",b=n.forwardRef((e,r)=>{let{scope:t,children:o,...u}=e,s=n.useRef(null),f=(0,a.s)(r,s),d=c(m,t);return n.useEffect(()=>(d.itemMap.set(s,{ref:s,...u}),()=>void d.itemMap.delete(s))),(0,l.jsx)(i,{...{[v]:""},ref:f,children:o})});return b.displayName=m,[{Provider:f,Slot:p,ItemSlot:b},function(r){let t=c(e+"CollectionConsumer",r);return n.useCallback(()=>{let e=t.collectionRef.current;if(!e)return[];let r=Array.from(e.querySelectorAll("[".concat(v,"]")));return Array.from(t.itemMap.values()).sort((e,t)=>r.indexOf(e.ref.current)-r.indexOf(t.ref.current))},[t.collectionRef,t.itemMap])},u]}}}]); |