| 1 |
import{r as t,a as T,j as s,E as $,I as k,c8 as B,p as O,ca as P}from"./main-634.js";import{B as z,g as D}from"./bf-25-81.js";function F({title:o,customTitle:m,subtitle:r,children:g,titleEditable:a,onTitleChange:j,cls:v,notScroll:K,header:p,onExpand:l,onCollapse:d,toggle:b,tag:u,action:y,checked:N,isPro:w,proProperty:E,isExpanded:x}){const[e,S]=t.useState(x||!1),[A,n]=t.useState(x?"auto":0),h=t.useRef(null),c=t.useRef(null),{css:C}=T(),f=i=>{i.target.classList.contains("edit")||S(!e)},I=i=>{i.stopPropagation(),h.current.focus()},R=()=>{n("auto"),l&&l()},H=()=>{n(c.current.offsetHeight),d&&d()};return s.jsxs("div",{className:`btcd-accr sh-sm ${v}`,children:[s.jsxs("div",{className:`btcd-accr-btn ${e&&"tertiary active"} flx flx-between`,onClick:f,onKeyDown:f,role:"button",tabIndex:0,children:[s.jsxs("div",{className:"btcd-accr-title w-10",children:[s.jsxs("div",{className:C({flx:"align-center"}),children:[m,o!==void 0&&s.jsx("input",{"aria-label":"accrodions",title:o,ref:h,className:a&&"edit",style:{color:e?"white":"inherit",width:e?"70%":"auto"},type:"text",onChange:j,value:o,readOnly:a===void 0}),a&&s.jsx("button",{type:"button",className:"edit-icn",onClick:I,"aria-label":"focus edit",style:{color:e?"white":"gray"},children:s.jsx($,{size:16})}),!e&&p,u&&s.jsx("span",{className:"btcd-badge btcd-badge-light ml-2",children:u}),w&&!k&&s.jsx(B,{proProperty:E})]}),r!==void 0&&s.jsx("small",{children:r})]}),b&&s.jsx(O,{action:y,checked:N||!1,className:"flx"}),s.jsx(z,{icn:!0,children:s.jsx(D,{size:"20",rotate:!!e})})]}),s.jsx("div",{className:`o-h ${e&&"delay-overflow"}`,style:{height:A,transition:"height 300ms"},children:s.jsx(P,{nodeRef:c,in:e,timeout:300,onEntering:()=>n(c.current.offsetHeight),onEntered:R,onExiting:()=>n(0),onExit:H,unmountOnExit:!0,children:s.jsx("div",{className:"p-2",ref:c,children:g})})})]})}var q=t.memo(F);export{q as A}; |