(()=>{"use strict";var e,t={688:()=>{const e=window.wp.element,t=window.wp.blockEditor,a=window.wp.components,{__}=wp.i18n;function n(n){const{attributes:o,setAttributes:l}=n;return(0,e.createElement)(t.InspectorControls,null,(0,e.createElement)(a.PanelBody,{title:__("Settings","faq-block-element-for-wp")},(0,e.createElement)(t.PanelColorSettings,{title:__("Header title color","faq-block-element-for-wp"),colorSettings:[{label:__("Select a color","faq-block-element-for-wp"),value:o.headertitleColor,onChange:e=>{l({headertitleColor:e})}}]}),(0,e.createElement)(a.TextControl,{label:__("FAQ Container Width","faq-block-element-for-wp"),value:o.faqwidth,onChange:e=>{l({faqwidth:e})}}),(0,e.createElement)(a.TextControl,{label:__("FAQ Container Padding","faq-block-element-for-wp"),value:o.faqpadding,onChange:e=>{l({faqpadding:e})}}),(0,e.createElement)(t.PanelColorSettings,{title:__("Inner header title color","faq-block-element-for-wp"),colorSettings:[{label:__("Select a color","faq-block-element-for-wp"),value:o.innerheadertitleColor,onChange:e=>{l({innerheadertitleColor:e})}}]}),(0,e.createElement)(t.PanelColorSettings,{title:__("Inner header hover and active color","faq-block-element-for-wp"),colorSettings:[{label:__("Select a color","faq-block-element-for-wp"),value:o.innerheaderhoveractiveColor,onChange:e=>{l({innerheaderhoveractiveColor:e})}}]}),(0,e.createElement)(t.PanelColorSettings,{title:__("Inner text color","faq-block-element-for-wp"),colorSettings:[{label:__("Select a color","faq-block-element-for-wp"),value:o.innertextColor,onChange:e=>{l({innertextColor:e})}}]})))}const{Component:o}=wp.element,{TextareaControl:l,Button:r,TextControl:s,Notice:i}=wp.components;class c extends o{removeQuestions(){this.props.setAttributes({faqDatas:[]}),wp.data.dispatch("core/notices").createNotice("success","All questions have been removed",{type:"snackbar",isDismissible:!0})}render(){let{attributes:t,setAttributes:a}=this.props;return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n,this.props),(0,e.createElement)("div",{className:"adeleye-faq-block-element"},(0,e.createElement)(s,{label:"Header Title",placeholder:"Header Title",value:t.headerTitle,onChange:e=>a({headerTitle:e}),style:{fontSize:"20px"}}),(0,e.createElement)("div",{className:"faq-questions-container"},(0,e.createElement)("div",{className:"faq-questions-container--header"},(0,e.createElement)("p",{className:"faq-questions-container--header--title"},"Add a question and answer"),t.faqDatas.length>0?(0,e.createElement)("p",{className:"faq-questions-container--header--remove",onClick:()=>{this.removeQuestions()}},(0,e.createElement)("span",{className:"dashicons dashicons-trash"})," Remove Questions"):null),t.faqDatas.map(((t,n)=>(0,e.createElement)("div",{className:"faq-questions-container--single-faq"},(0,e.createElement)(s,{label:"Question:",value:t.question,placeholder:"Question",onChange:e=>{let t=[...this.props.attributes.faqDatas];t[n]={...t[n],question:e},a({faqDatas:t})}}),(0,e.createElement)(l,{label:"Answer:",value:t.answer,placeholder:"Answer",onChange:e=>{let t=[...this.props.attributes.faqDatas];t[n]={...t[n],answer:e},a({faqDatas:t})}}),(0,e.createElement)("p",{className:"faq-questions-container--single-faq--remove",onClick:()=>{let e=[...this.props.attributes.faqDatas];e.splice(n,1),a({faqDatas:e}),wp.data.dispatch("core/notices").createNotice("success","Question has been removed",{type:"snackbar",isDismissible:!0})}},(0,e.createElement)("span",{className:"dashicons dashicons-trash"})," Remove Question"))))),(0,e.createElement)(r,{isPrimary:!0,onClick:()=>{a({faqDatas:t.faqDatas.concat({question:"",answer:""})})}},"Add FAQ")))}}const{__:f}=wp.i18n,{Fragment:p}=wp.element,{registerBlockType:d}=wp.blocks;d("adeleyeayodeji/faq-block-element-for-wp",{title:f("FAQ Block","faq-block-element-for-wp"),description:f("Easily insert FAQ block into your post or page using the new FAQ block","faq-block-element-for-wp"),keywords:[f("faq block","faq-block-element-for-wp"),f("faq","faq-block-element-for-wp"),f("faq block element","faq-block-element-for-wp"),f("faq","faq-block-element-for-wp"),f("frequently asked questions","faq-block-element-for-wp"),f("accordion","faq-block-element-for-wp")],category:"widgets",icon:"dashicons dashicons-editor-help",supports:{anchor:!0,className:!0},attributes:{headerTitle:{type:"string",default:"Frequently Asked Questions"},faqDatas:{type:"array",default:[{question:"",answer:""}]},headertitleColor:{type:"string",default:"#333333"},faqwidth:{type:"string",default:"48rem"},faqpadding:{type:"string",default:"4rem"},innerheadertitleColor:{type:"string",default:"#7288a2"},innerheaderhoveractiveColor:{type:"string",default:"#03b5d2"},innertextColor:{type:"string",default:"#4d5974"}},edit:function(t){const{attributes:a}=t;return(0,e.createElement)(p,null,(0,e.createElement)(c,t))},save:function(e){return null}})}},a={};function n(e){var o=a[e];if(void 0!==o)return o.exports;var l=a[e]={exports:{}};return t[e](l,l.exports,n),l.exports}n.m=t,e=[],n.O=(t,a,o,l)=>{if(!a){var r=1/0;for(f=0;f<e.length;f++){for(var[a,o,l]=e[f],s=!0,i=0;i<a.length;i++)(!1&l||r>=l)&&Object.keys(n.O).every((e=>n.O[e](a[i])))?a.splice(i--,1):(s=!1,l<r&&(r=l));if(s){e.splice(f--,1);var c=o();void 0!==c&&(t=c)}}return t}l=l||0;for(var f=e.length;f>0&&e[f-1][2]>l;f--)e[f]=e[f-1];e[f]=[a,o,l]},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={826:0,431:0};n.O.j=t=>0===e[t];var t=(t,a)=>{var o,l,[r,s,i]=a,c=0;if(r.some((t=>0!==e[t]))){for(o in s)n.o(s,o)&&(n.m[o]=s[o]);if(i)var f=i(n)}for(t&&t(a);c<r.length;c++)l=r[c],n.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return n.O(f)},a=globalThis.webpackChunkfaq_block_element_for_wp=globalThis.webpackChunkfaq_block_element_for_wp||[];a.forEach(t.bind(null,0)),a.push=t.bind(null,a.push.bind(a))})();var o=n.O(void 0,[431],(()=>n(688)));o=n.O(o)})();
|