File: /home/alfouzantranspor/public_html/wp-content/plugins/gutena-forms/build/field-label/index.js
(()=>{"use strict";const e=window.wp.blocks,t=window.wp.element,l=window.wp.blockEditor,s=window.wp.data,a=e=>null==e||""===e,r=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"gutena/field-label","version":"1.0.0","title":"Form Labels","category":"widgets","icon":"editor-justify","parent":["gutena/field-group"],"description":"A block to display form labels in Gutena Forms.","supports":{"html":false},"attributes":{"content":{"type":"string","default":"Default Label"},"htmlFor":{"type":"string","default":"","description":"The ID of the form element this label is associated with."},"isRequired":{"type":"boolean","default":false},"placeholder":{"type":"string","default":""},"className":{"type":"string","default":""}},"editorScript":"file:./index.js","style":"file:./style.css"}');(0,e.registerBlockType)(r,{edit:({attributes:e,setAttributes:r,clientId:o})=>{const n=(e,t=-1)=>{if(++t,a(e[t]))return"";var l=(0,s.select)("core/block-editor").getBlocksByClientId(e[t]),r=l[0]?.innerBlocks[0]?.innerBlocks[1]?.attributes?.nameAttr;return a(r)?n(e,t):r};let{content:c,htmlFor:i,placeholder:d,className:p}=e;return(0,t.useEffect)(()=>{const e=(0,s.select)("core/block-editor").getBlockParents(o);a(i)&&(i=n(e,-1),a(i)||r({htmlFor:i}))},[o]),(0,t.createElement)("div",(0,l.useBlockProps)({className:p}),(0,t.createElement)("label",{htmlFor:i},(0,t.createElement)(l.RichText,{tagName:"p",placeholder:d,value:c,onChange:e=>r({content:e})})))},save:({attributes:e})=>{let{content:s,htmlFor:a,placeholder:r,className:o}=e;const n=l.useBlockProps.save({className:o});return(0,t.createElement)("div",n,(0,t.createElement)("label",{htmlFor:a},(0,t.createElement)(l.RichText.Content,{tagName:"p",value:s,placeholder:r})))}})})();