(()=>{"use strict";const e=window.wp.blocks,t=window.wp.blockEditor,a=window.React,o=window.wp.element,n=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"alpha-blocks/accordion-item","version":"1.0.1","title":"Accordion Item","category":"alpha-blocks","parent":["alpha-blocks/accordion"],"icon":"editor-ul","attributes":{"blockID":{"type":"string"},"itemTitle":{"type":"string","default":"Accordion Title"},"itemContent":{"type":"string","source":"html","selector":"p"},"itemTitleTag":{"type":"string","default":"h3","inspectorController":{"targetTab":"general","targetAccordionTab":"general","inspectorComponent":"InspectorSelectButton","inspectorLabel":"Title Tag","options":[{"label":"H1","value":"h1"},{"label":"H2","value":"h2"},{"label":"H3","value":"h3"},{"label":"H4","value":"h4"},{"label":"H5","value":"h5"},{"label":"H6","value":"h6"},{"label":"P","value":"p"}]}},"activeIcon":{"type":"object"},"inactiveIcon":{"type":"object"}},"usesContext":["alphablock/accordion/activeIcon","alphablock/accordion/inactiveIcon","alphablock/accordion/questionTag"],"supports":{"html":false,"reusable":false,"customClassName":false},"textdomain":"alpha-blocks","editorScript":"file:./index.js"}');(0,e.registerBlockType)(n.name,{edit:function(e){var c,i,l;const{attributes:r,setAttributes:s,clientId:d,context:m}=e,{blockID:p,itemTitle:u,itemTitleTag:v,activeIcon:b,inactiveIcon:h}=r,{"alphablock/accordion/activeIcon":I,"alphablock/accordion/inactiveIcon":T,"alphablock/accordion/questionTag":g}=m;return(0,o.useEffect)((()=>{g&&v!==g&&s({itemTitleTag:g})}),[g,v,s]),(0,o.useEffect)((()=>{I&&s({activeIcon:I}),T&&s({inactiveIcon:T})}),[I,T,s]),(0,o.useEffect)((()=>{p||s({blockID:`accordion-item-${d}`})}),[p,d,s]),(0,a.createElement)(a.Fragment,null,(0,a.createElement)(window.InspectorGenerator,{props:e,blockJson:n}),(0,a.createElement)("div",{...(0,t.useBlockProps)({className:`block-${p} alpha-accordion-item`})},(0,a.createElement)("div",{className:"alpha-accordion-head",role:"button","aria-controls":"accordion-panel-1","x-bind":"accordionHead"},(0,a.createElement)(t.RichText,{tagName:v,value:u,placeholder:"Write Accordion Title...",onChange:e=>s({itemTitle:e})}),(0,a.createElement)("div",{className:"icon-area"},(0,a.createElement)(window.Icon,{name:null!==(c=T?.iconName)&&void 0!==c?c:"chevron-down",xBind:"closeItem"}),(0,a.createElement)(window.Icon,{name:null!==(i=I?.iconName)&&void 0!==i?i:"chevron-up",xBind:"openItem"}))),(0,a.createElement)("div",{className:"alpha-accordion-content","x-bind":"accordionContent"},(0,a.createElement)(t.RichText,{tagName:"p",value:null!==(l=r?.itemContent)&&void 0!==l?l:"",onChange:e=>{s({...r,itemContent:e})},placeholder:"Write Text Here..."}))))},save:function({attributes:e}){var o,n;const{blockID:c,itemTitle:i,itemTitleTag:l,activeIcon:r,inactiveIcon:s,itemContent:d}=e;return(0,a.createElement)("div",{...t.useBlockProps.save({className:`block-${c} alpha-accordion-item`}),"x-bind":"accordionItem"},(0,a.createElement)("div",{className:"alpha-accordion-head",role:"button","aria-controls":"accordion-panel-1","x-bind":"accordionHead"},(0,a.createElement)(t.RichText.Content,{tagName:l,value:i}),(0,a.createElement)("div",{className:"icon-area"},(0,a.createElement)(window.Icon,{name:null!==(o=s?.iconName)&&void 0!==o?o:"chevron-down",xBind:"closeItem"}),(0,a.createElement)(window.Icon,{name:null!==(n=r?.iconName)&&void 0!==n?n:"chevron-up",xBind:"openItem"}))),(0,a.createElement)("div",{className:"alpha-accordion-content","x-bind":"accordionContent"},(0,a.createElement)(t.RichText.Content,{tagName:"p",value:d})))}})})();
//# sourceMappingURL=index.js.map