9176-6e8bd0cc29e9fb0d.js.загрузка 6.7 KB

1
  1. "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9176],{99176:function(e,t,r){r.d(t,{VY:function(){return L},ck:function(){return Y},fC:function(){return S},h4:function(){return B},xz:function(){return K}});var n=r(7896),o=r(2784),a=r(92211),l=r(62172),i=r(62656),c=r(17998),d=r(87695),s=r(72714),u=r(69557),p=r(23372),f=r(59241);let m="Accordion",b=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[g,v,w]=(0,l.B)(m),[E,_]=(0,a.b)(m,[w,u.p_]),h=(0,u.p_)(),y=o.forwardRef((e,t)=>{let{type:r,...a}=e;return o.createElement(g.Provider,{scope:e.__scopeAccordion},"multiple"===r?o.createElement(x,(0,n.Z)({},a,{ref:t})):o.createElement(I,(0,n.Z)({},a,{ref:t})))});y.propTypes={type(e){let t=e.value||e.defaultValue;return e.type&&!["single","multiple"].includes(e.type)?Error("Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`."):"multiple"===e.type&&"string"==typeof t?Error("Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`."):"single"===e.type&&Array.isArray(t)?Error("Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`."):null}};let[C,A]=E(m),[R,k]=E(m,{collapsible:!1}),I=o.forwardRef((e,t)=>{let{value:r,defaultValue:a,onValueChange:l=()=>{},collapsible:i=!1,...c}=e,[s,u]=(0,d.T)({prop:r,defaultProp:a,onChange:l});return o.createElement(C,{scope:e.__scopeAccordion,value:s?[s]:[],onItemOpen:u,onItemClose:o.useCallback(()=>i&&u(""),[i,u])},o.createElement(R,{scope:e.__scopeAccordion,collapsible:i},o.createElement(D,(0,n.Z)({},c,{ref:t}))))}),x=o.forwardRef((e,t)=>{let{value:r,defaultValue:a,onValueChange:l=()=>{},...i}=e,[c=[],s]=(0,d.T)({prop:r,defaultProp:a,onChange:l}),u=o.useCallback(e=>s((t=[])=>[...t,e]),[s]),p=o.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return o.createElement(C,{scope:e.__scopeAccordion,value:c,onItemOpen:u,onItemClose:p},o.createElement(R,{scope:e.__scopeAccordion,collapsible:!0},o.createElement(D,(0,n.Z)({},i,{ref:t}))))}),[V,Z]=E(m),D=o.forwardRef((e,t)=>{let{__scopeAccordion:r,disabled:a,dir:l,orientation:d="vertical",...u}=e,p=o.useRef(null),m=(0,i.e)(p,t),w=v(r),E="ltr"===(0,f.gm)(l),_=(0,c.M)(e.onKeyDown,e=>{var t;if(!b.includes(e.key))return;let r=e.target,n=w().filter(e=>{var t;return!(null!==(t=e.ref.current)&&void 0!==t&&t.disabled)}),o=n.findIndex(e=>e.ref.current===r),a=n.length;if(-1===o)return;e.preventDefault();let l=o,i=a-1,c=()=>{(l=o+1)>i&&(l=0)},s=()=>{(l=o-1)<0&&(l=i)};switch(e.key){case"Home":l=0;break;case"End":l=i;break;case"ArrowRight":"horizontal"===d&&(E?c():s());break;case"ArrowDown":"vertical"===d&&c();break;case"ArrowLeft":"horizontal"===d&&(E?s():c());break;case"ArrowUp":"vertical"===d&&s()}null===(t=n[l%a].ref.current)||void 0===t||t.focus()});return o.createElement(V,{scope:r,disabled:a,direction:l,orientation:d},o.createElement(g.Slot,{scope:r},o.createElement(s.WV.div,(0,n.Z)({},u,{"data-orientation":d,ref:m,onKeyDown:a?void 0:_}))))}),O="AccordionItem",[T,N]=E(O),z=o.forwardRef((e,t)=>{let{__scopeAccordion:r,value:a,...l}=e,i=Z(O,r),c=A(O,r),d=h(r),s=(0,p.M)(),f=a&&c.value.includes(a)||!1,m=i.disabled||e.disabled;return o.createElement(T,{scope:r,open:f,disabled:m,triggerId:s},o.createElement(u.fC,(0,n.Z)({"data-orientation":i.orientation,"data-state":H(f)},d,l,{ref:t,disabled:m,open:f,onOpenChange:e=>{e?c.onItemOpen(a):c.onItemClose(a)}})))}),M=o.forwardRef((e,t)=>{let{__scopeAccordion:r,...a}=e,l=Z(m,r),i=N("AccordionHeader",r);return o.createElement(s.WV.h3,(0,n.Z)({"data-orientation":l.orientation,"data-state":H(i.open),"data-disabled":i.disabled?"":void 0},a,{ref:t}))}),W="AccordionTrigger",P=o.forwardRef((e,t)=>{let{__scopeAccordion:r,...a}=e,l=Z(m,r),i=N(W,r),c=k(W,r),d=h(r);return o.createElement(g.ItemSlot,{scope:r},o.createElement(u.xz,(0,n.Z)({"aria-disabled":i.open&&!c.collapsible||void 0,"data-orientation":l.orientation,id:i.triggerId},d,a,{ref:t})))}),F=o.forwardRef((e,t)=>{let{__scopeAccordion:r,...a}=e,l=Z(m,r),i=N("AccordionContent",r),c=h(r);return o.createElement(u.VY,(0,n.Z)({role:"region","aria-labelledby":i.triggerId,"data-orientation":l.orientation},c,a,{ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}}))});function H(e){return e?"open":"closed"}let S=y,Y=z,B=M,K=P,L=F},69557:function(e,t,r){r.d(t,{Fw:function(){return h},VY:function(){return k},fC:function(){return A},p_:function(){return b},wy:function(){return E},xz:function(){return R}});var n=r(7896),o=r(2784),a=r(17998),l=r(92211),i=r(87695),c=r(61644),d=r(62656),s=r(72714),u=r(79616),p=r(23372);let f="Collapsible",[m,b]=(0,l.b)(f),[g,v]=m(f),w=(0,o.forwardRef)((e,t)=>{let{__scopeCollapsible:r,open:a,defaultOpen:l,disabled:c,onOpenChange:d,...u}=e,[f=!1,m]=(0,i.T)({prop:a,defaultProp:l,onChange:d});return(0,o.createElement)(g,{scope:r,disabled:c,contentId:(0,p.M)(),open:f,onOpenToggle:(0,o.useCallback)(()=>m(e=>!e),[m])},(0,o.createElement)(s.WV.div,(0,n.Z)({"data-state":C(f),"data-disabled":c?"":void 0},u,{ref:t})))}),E=(0,o.forwardRef)((e,t)=>{let{__scopeCollapsible:r,...l}=e,i=v("CollapsibleTrigger",r);return(0,o.createElement)(s.WV.button,(0,n.Z)({type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":C(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled},l,{ref:t,onClick:(0,a.M)(e.onClick,i.onOpenToggle)}))}),_="CollapsibleContent",h=(0,o.forwardRef)((e,t)=>{let{forceMount:r,...a}=e,l=v(_,e.__scopeCollapsible);return(0,o.createElement)(u.z,{present:r||l.open},({present:e})=>(0,o.createElement)(y,(0,n.Z)({},a,{ref:t,present:e})))}),y=(0,o.forwardRef)((e,t)=>{let{__scopeCollapsible:r,present:a,children:l,...i}=e,u=v(_,r),[p,f]=(0,o.useState)(a),m=(0,o.useRef)(null),b=(0,d.e)(t,m),g=(0,o.useRef)(0),w=g.current,E=(0,o.useRef)(0),h=E.current,y=u.open||p,A=(0,o.useRef)(y),R=(0,o.useRef)();return(0,o.useEffect)(()=>{let e=requestAnimationFrame(()=>A.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,c.b)(()=>{let e=m.current;if(e){R.current=R.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";let t=e.getBoundingClientRect();g.current=t.height,E.current=t.width,A.current||(e.style.transitionDuration=R.current.transitionDuration,e.style.animationName=R.current.animationName),f(a)}},[u.open,a]),(0,o.createElement)(s.WV.div,(0,n.Z)({"data-state":C(u.open),"data-disabled":u.disabled?"":void 0,id:u.contentId,hidden:!y},i,{ref:b,style:{"--radix-collapsible-content-height":w?`${w}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,...e.style}}),y&&l)});function C(e){return e?"open":"closed"}let A=w,R=E,k=h}}]);