PageSourceSearch

https://greenfund.rw/build/assets/EditableButton-C6tdugvM.js

js greenfund.rw collected 2026-10-02 10:17:40 UTC 7,319 bytes, 1 lines download raw bytes

1import{c,a,f as e,d as p,b as V,g as E,t as x,i as v,r as d,w as $,o as I,m as N,u as g,e as R,h as B,v as L,n as T,N as U}from"./app-B3q2SnoA.js";import{u as F}from"./useCmsEditMode-Bv6mgqrK.js";import{_ as P}from"./_plugin-vue_export-helper-DlAUqK2U.js";const W={name:"MainButton",props:{label:{type:String,default:""},customClasses:{type:String,default:""},showIcon:{type:Boolean,default:!0},iconHoverClass:{type:String,default:""},onClick:{type:Function,default:()=>{}}}},X={class:"pt-1 pl-2"};function Y(o,s,l,k,M,n){return a(),c("button",{class:v(["bg-primary hover:bg-secondary hover:text-primary transition-all duration-300 transform text-white flex gap-x-6 mt-6 px-2.5 py-2 text-sm rounded-full group",l.customClasses]),onClick:s[0]||(s[0]=(...i)=>l.onClick&&l.onClick(...i))},[e("p",X,[V(o.$slots,"default",{},()=>[E(x(l.label),1)],!0)]),l.showIcon?(a(),c("div",{key:0,class:v(["p-1.5 rounded-full text-white group-hover:text-white group-hover:bg-primary transition-all duration-300",l.iconHoverClass])},[...s[1]||(s[1]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-4"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3"})],-1)])],2)):p("",!0)],2)}const q=P(W,[["render",Y],["__scopeId","data-v-ad7dae57"]]),A={class:"text-sm font-medium"},G={class:"text-sm font-medium"},J={class:"text-sm font-medium"},K={key:4,class:"absolute -top-2 -right-2 bg-blue-500 text-white text-xs px-2 py-1 rounded shadow-lg opacity-0 group-hover:opacity-100 transition-opacity z-10 pointer-events-none"},O={class:"px-6 py-5"},Q={class:"mb-4"},Z={class:"mb-2"},_={class:"flex justify-end gap-3 px-6 py-4 border-t border-gray-200 bg-gray-50 rounded-b-xl"},le={__name:"EditableButton",props:{name:{type:String,required:!0},defaultLabel:{type:String,default:"Learn More"},defaultLink:{type:String,default:"#"},customClasses:{type:String,default:""},showIcon:{type:Boolean,default:!0},variant:{type:String,default:"default"}},setup(o){const s=o,{isEditMode:l,getContentValue:k,updateContent:M}=F(),n=d(k(s.name,{label:s.defaultLabel,link:s.defaultLink}));$(()=>k(s.name,{label:s.defaultLabel,link:s.defaultLink}),r=>{n.value=r},{deep:!0});const i=d(!1),u=d({label:"",link:""}),S=d(null),j=d(null),m=d({x:0,y:0}),y=d(!1),w=d({x:0,y:0}),H=r=>{y.value=!0,w.value={x:r.clientX-m.value.x,y:r.clientY-m.value.y},document.addEventListener("mousemove",h),document.addEventListener("mouseup",C)},h=r=>{y.value&&(m.value={x:r.clientX-w.value.x,y:r.clientY-w.value.y})},C=()=>{y.value=!1,document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",C)};I(()=>{document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",C)});const z=()=>{l.value&&(u.value={...n.value},m.value={x:0,y:0},i.value=!0)},D=()=>{M(s.name,{label:u.value.label,link:u.value.link}),n.value={...u.value},i.value=!1},b=r=>{l.value?(r.preventDefault(),r.stopPropagation(),z()):n.value.link&&n.value.link!=="#"&&(n.value.link.startsWith("http")||n.value.link.startsWith("//")?window.location.href=n.value.link:U.visit(n.value.link))};return(r,t)=>(a(),c("div",{class:v(["relative group",o.variant==="link-arrow"||o.variant==="stat-card"||o.variant==="learn-more-arrow"?"block w-full":"inline-block"])},[o.variant==="default"?(a(),N(q,{key:0,label:n.value.label,"show-icon":o.showIcon,"custom-classes":o.customClasses,onClick:b,class:v([g(l)?"cursor-pointer hover:ring-2 hover:ring-blue-500":""])},null,8,["label","show-icon","custom-classes","class"])):o.variant==="link-arrow"?(a(),c("button",{key:1,onClick:b,class:v(["flex justify-between text-primary w-full transition-colors duration-300",[g(l)?"cursor-pointer hover:ring-2 hover:ring-blue-500 rounded":"",o.customClasses]])},[e("p",A,x(n.value.label),1),t[5]||(t[5]=e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-5"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3"})],-1))],2)):o.variant==="stat-card"?(a(),c("button",{key:2,onClick:b,class:v(["flex justify-between w-full transition-colors duration-300",[g(l)?"cursor-pointer hover:ring-2 hover:ring-blue-500 rounded":"",o.customClasses]])},[e("p",G,x(n.value.label),1),t[6]||(t[6]=e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-5"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3"})],-1))],2)):o.variant==="learn-more-arrow"?(a(),c("button",{key:3,onClick:b,class:v(["flex items-center gap-2 transition-colors",[g(l)?"cursor-pointer hover:ring-2 hover:ring-blue-500 rounded":"",o.customClasses]])}
1,[e("span",J,x(n.value.label),1),t[7]||(t[7]=e("svg",{class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17 8l4 4m0 0l-4 4m4-4H3"})],-1))],2)):p("",!0),g(l)?(a(),c("div",K," Edit Button ")):p("",!0),i.value?(a(),c("div",{key:5,class:"fixed inset-0 z-[9999] flex items-center justify-center bg-black bg-opacity-50",onClick:t[4]||(t[4]=R(f=>i.value=!1,["self"]))},[e("div",{ref_key:"modalRef",ref:S,class:"bg-white text-gray-900 rounded-xl shadow-2xl w-96 transform transition-shadow",style:T({transform:`translate(${m.value.x}px, ${m.value.y}px)`})},[e("div",{ref_key:"dragHeaderRef",ref:j,onMousedown:H,class:"flex items-center justify-between px-6 py-4 border-b border-gray-200 cursor-move select-none rounded-t-xl bg-gray-50"},[t[9]||(t[9]=e("h3",{class:"text-lg font-bold text-gray-900 flex items-center gap-2"},[e("svg",{class:"w-5 h-5 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 8h16M4 16h16"})]),E(" Edit Button ")],-1)),e("button",{onClick:t[0]||(t[0]=f=>i.value=!1),class:"text-gray-400 hover:text-gray-600 transition-colors"},[...t[8]||(t[8]=[e("svg",{class:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])],544),e("div",O,[e("div",Q,[t[10]||(t[10]=e("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Button Text",-1)),B(e("input",{"onUpdate:modelValue":t[1]||(t[1]=f=>u.value.label=f),type:"text",class:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors"},null,512),[[L,u.value.label]])]),e("div",Z,[t[11]||(t[11]=e("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Button Link",-1)),B(e("input",{"onUpdate:modelValue":t[2]||(t[2]=f=>u.value.link=f),type:"text",class:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors"},null,512),[[L,u.value.link]])])]),e("div",_,[e("button",{onClick:t[3]||(t[3]=f=>i.value=!1),class:"px-4 py-2 text-gray-600 hover:bg-gray-200 rounded-lg transition-colors"}," Cancel "),e("button",{onClick:D,class:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors"}," Save ")])],4)])):p("",!0)],2))}};export{q as M,le as _};

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.