PageSourceSearch

https://www.builder.io/assets/accordion-CJ_9BmTc.js

js builder.io collected 2026-09-24 07:05:50 UTC 2,436 bytes, 1 lines download raw bytes

1import{r as u,j as b,a as c}from"./components-tbqp4LHE.js";import{B as f}from"./builder-CvCrGSQN.js";import"./render-link-COhm-8b-.js";import"./lib-CNBY53c5.js";import"./errorBoundaries-Cn_iLJG_.js";import"./urls-DKJa5cAz.js";import"./builder-react.es5-EcmpEoh3.js";import"./index-D68R75oZ.js";import"./preload-helper-BXl3LOEh.js";class S extends u.Component{divRef=null;state={open:[]};componentDidMount(){setTimeout(()=>{this.divRef&&this.divRef.dispatchEvent(new CustomEvent("builder:accordion:load",{bubbles:!0,cancelable:!1,detail:{ref:this}}))})}getAccordionItem(n,a,e,s,o){const l=this.state.open.indexOf(e)!==-1,{grid:t}=this.props,r={cursor:"pointer",display:"flex",flexDirection:"column",alignItems:"stretch",...t&&{width:this.props.gridRowWidth,...typeof s=="number"&&{order:e<s?e:e+1}}},i={order:typeof s=="number"?s:void 0,...t&&{width:"100%"}};return b(u.Fragment,{children:[c("div",{className:"builder-accordion-title builder-accordion-title-"+(l?"open":"closed"),style:r,"data-index":e,onClick:()=>{l?this.setState({open:o?[]:this.state.open.filter(d=>d!==e)}):this.setState({open:o?[e]:this.state.open.concat(e)})},children:c(f,{blocks:n,path:"items."+e+".title"})}),l&&c("div",{className:"builder-accordion-detail builder-accordion-detail-open",style:i,children:c(f,{blocks:a,path:"items."+e+".detail"})})]},e)}render(){const{grid:n,oneAtATime:a}=this.props,e=!!(n||a),s=n&&this.state.open.length;let o=null;if(s&&this.divRef){const t=this.state.open[0];let i=this.divRef.querySelector('.builder-accordion-title[data-index="'+t+'"]');if(o=t,i){let p=i.getBoundingClientRect();for(;i=i&&i.nextElementSibling;)if(i){if(i.classList.contains("builder-accordion-detail"))continue;const h=i.getBoundingClientRect();if(h.left>p.left){const m=parseInt(i.getAttribute("data-index")||"",10);isNaN(m)||(p=h,o=m)}else break}}}typeof o=="number"&&(o=o+1);const l={display:"flex",alignItems:"stretch",flexDirection:"column",...n&&{flexDirection:"row",alignItems:"flex-start",flexWrap:"wrap"}};return c("div",{ref:t=>{this.divRef=t},className:"builder-accordion",style:l,children:this.props.useChildrenForItems?this.props.builderBlock&&this.props.builderBlock.children&&this.props.builderBlock.children.map((t,r)=>this.getAccordionItem(t.children?[t.children[0]]:[],t.children?[t.children[1]]:[],r,o,e)):this.props.items&&this.props.items.map((t,r)=>this.getAccordionItem(t.title,t.detail,r,o,e))})}}export{S as AccordionComponent};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.