import{defineComponent as g,createVNode as a,withDirectives as D,vShow as K,Transition as R}from"vue";import h from"../_util/classNames.mjs";import j from"../_util/props-util/initDefaultProps.mjs";import E from"../config-provider/hooks/useConfigInject.mjs";import N from"../vc-util/devWarning.mjs";import O from"./PanelContent.mjs";import{collapsePanelProps as V}from"./commonProps.mjs";const F=g({compatConfig:{MODE:3},name:"ACollapsePanel",inheritAttrs:!1,props:j(V(),{showArrow:!0,isActive:!1,onItemClick(){},headerClass:"",forceRender:!1}),slots:Object,setup(l,{slots:i,emit:b,attrs:t}){N(l.disabled===void 0,"Collapse.Panel",'`disabled` is deprecated. Please use `collapsible="disabled"` instead.');const{prefixCls:v}=E("collapse",l),r=()=>{b("itemClick",l.panelKey)},x=n=>{(n.key==="Enter"||n.keyCode===13||n.which===13)&&r()};return()=>{const{header:n=i.header?.(),headerClass:d,isActive:o,showArrow:c,destroyInactivePanel:P,accordion:p,forceRender:$,openAnimation:w,expandIcon:f=i.expandIcon,extra:m=i.extra?.(),collapsible:s}=l,u=s==="disabled",e=v.value,y=h(`${e}-header`,{[d]:d,[`${e}-header-collapsible-only`]:s==="header",[`${e}-icon-collapsible-only`]:s==="icon"}),A=h({[`${e}-item`]:!0,[`${e}-item-active`]:o,[`${e}-item-disabled`]:u,[`${e}-no-arrow`]:!c,[`${t.class}`]:!!t.class});let C=a("i",{class:"arrow"},null);c&&typeof f=="function"&&(C=f(l));const k=D(a(O,{prefixCls:e,isActive:o,forceRender:$,role:p?"tabpanel":null},{default:i.default}),[[K,o]]),I={appear:!1,css:!1,...w};return a("div",{...t,class:A},[a("div",{class:y,onClick:()=>!["header","icon"].includes(s)&&r(),role:p?"tab":"button",tabindex:u?-1:0,"aria-expanded":o,onKeypress:x},[c&&C,a("span",{onClick:()=>s==="header"&&r(),class:`${e}-header-text`},[n]),m&&a("div",{class:`${e}-extra`},[m])]),a(R,I,{default:()=>[!P||o?k:null]})])}}});export{V as collapsePanelProps,F as default};
