"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[1370],{41370:(e,t,l)=>{l.r(t),l.d(t,{default:()=>p});var n=l(51609),i=l(27723),a=l(45111),o=l(10790);const p=(0,n.memo)(({label:e,id:t,value:l,onChange:p,required:s,defaultValue:r,disabled:c,options:d={},units:u=["px"]})=>{const m=r.type||l.type||u[0],[h,g]=(0,n.useState)(m),[b,z]=(0,n.useState)(!1),k={top:(0,i.__)("Top","complianz-gdpr"),right:(0,i.__)("Right","complianz-gdpr"),bottom:(0,i.__)("Bottom","complianz-gdpr"),left:(0,i.__)("Left","complianz-gdpr")};(0,n.useEffect)(()=>{l.top===l.right&&l.top===l.bottom&&l.top===l.left&&z(!0)},[]),(0,n.useEffect)(()=>{b&&_(l.top,"top")},[b]);const _=(e,t)=>{let n={...l};b?n=j(e):n[t]=e,p(n)},j=e=>{let t={...l};return t.top=e,t.right=e,t.bottom=e,t.left=e,t};return(0,o.jsxs)("div",{className:"cmplz-border-input",children:[Object.keys(k).map(e=>{const t=k[e],i=l.hasOwnProperty(e)?l[e]:r[e];return(0,o.jsxs)(n.Fragment,{children:[(0,o.jsx)("input",{className:"cmplz-border-input-side",type:"number",onChange:t=>_(t.target.value,e),value:i},e),(0,o.jsx)("p",{className:"cmplz-border-input-side-label",children:t})]},e)}),b&&(0,o.jsx)("button",{className:"cmplz-border-input-link linked",onClick:()=>z(!b),children:(0,o.jsx)(a.default,{name:"linked",size:16,tooltip:(0,i.__)("Unlink values","complianz-gdpr")})}),!b&&(0,o.jsx)("button",{className:"cmplz-border-input-link",onClick:()=>z(!b),children:(0,o.jsx)(a.default,{name:"unlinked",size:16,tooltip:(0,i.__)("Link values together","complianz-gdpr")})}),u.length>1&&(0,o.jsx)("div",{className:"cmplz-border-input-unit",children:(0,o.jsx)("select",{value:h,onChange:e=>(e=>{g(e);let t={...l};t.type=e,p(t)})(e.target.value),children:u.map((e,t)=>(0,o.jsx)("option",{value:e,children:e},t))})}),1===u.length&&(0,o.jsx)("div",{className:"cmplz-border-input-unit",children:h})]})})}}]);