| 1 |
var pe=Object.defineProperty,ue=Object.defineProperties;var xe=Object.getOwnPropertyDescriptors;var W=Object.getOwnPropertySymbols;var be=Object.prototype.hasOwnProperty,fe=Object.prototype.propertyIsEnumerable;var P=(e,s,o)=>s in e?pe(e,s,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[s]=o,u=(e,s)=>{for(var o in s||(s={}))be.call(s,o)&&P(e,o,s[o]);if(W)for(var o of W(s))fe.call(s,o)&&P(e,o,s[o]);return e},C=(e,s)=>ue(e,xe(s));import{j as t,en as ge,a as ve,q as ye,D as je,g as Ce,r as O,i as z,u as j,ap as N,_ as l,s as $e,K as we,h as B,W as G,eo as Te,E as H,I as Z,c8 as q,am as Se,f as ze,ba as U,bG as X,cu as Y,cv as k,ah as Ne,aX as Be,aH as ke,cm as Ie,cl as Re,a$ as Fe,b0 as Ve,b1 as Ae,cy as Ee}from"./main-634.js";import{k as Le}from"./bf-25-81.js";import{D as J,R as De,c as Me,b as _e,a as We,$ as Pe}from"./bf-400-72.js";import{o as Oe,a3 as Ge}from"./bf-692-111.js";import{O as $}from"./bf-982-242.js";import{C as Q}from"./bf-297-103.js";function He({size:e}){return t.jsxs("svg",{stroke:"currentColor",fill:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",width:e,height:e,viewBox:"0 0 14 14",children:[t.jsx("path",{d:"M6.99999 7.58334C7.32216 7.58334 7.58332 7.32217 7.58332 7.00001C7.58332 6.67784 7.32216 6.41667 6.99999 6.41667C6.67782 6.41667 6.41666 6.67784 6.41666 7.00001C6.41666 7.32217 6.67782 7.58334 6.99999 7.58334Z"}),t.jsx("path",{d:"M6.91666 3.33333C7.1928 3.33333 7.41666 3.10947 7.41666 2.83333C7.41666 2.55719 7.1928 2.33333 6.91666 2.33333C6.64051 2.33333 6.41666 2.55719 6.41666 2.83333C6.41666 3.10947 6.64051 3.33333 6.91666 3.33333Z"}),t.jsx("path",{d:"M6.99999 11.6667C7.32216 11.6667 7.58332 11.4055 7.58332 11.0833C7.58332 10.7612 7.32216 10.5 6.99999 10.5C6.67782 10.5 6.41666 10.7612 6.41666 11.0833C6.41666 11.4055 6.67782 11.6667 6.99999 11.6667Z"})]})}function Ze({fk:e,type:s,direction:o,breakpoint:n,colorScheme:c}){if(n==="lg"&&c==="light")return u(u(C(u({},ge(e)),{[`.${e}-cks`]:{position:"absolute",width:0,height:0,"pointer-events":"none","user-select":"none"},[`.${e}-cc`]:{display:"grid","grid-template-columns":"1",width:"100%","grid-row-gap":"10px","column-gap":"10px"},[`.${e}-cw`]:{},[`.${e}-cl`]:{cursor:"pointer",display:"flex","align-items":"center",color:"red",padding:"5px"},[`.${e}-ct`]:{},[`.${e}-ci`]:{position:"absolute",opacity:"0!important"},[`.${e}-ci:checked ~ .${e}-cl .${e}-bx`]:{background:"var(--global-accent-color)","border-color":"var(--global-accent-color)"},[`.${e}-ci:checked ~ .${e}-other-inp-wrp`]:{display:"block !important"},[`.${e}-ci:focus ~ .${e}-cl .${e}-bx`]:{"box-shadow":"0 0 0 3px hsla(var(--gah), var(--gas), var(--gal), 0.3)"},[`.${e}-ci:focus-visible ~ .${e}-cl .${e}-bx`]:{"box-shadow":"0 0 0 2px var(--global-fld-bg-color),0 0 0 4px var(--global-accent-color)"},[`.${e}-ci:active ~ .${e}-cl .${e}-bx`]:{transform:"scale(0.9)"},[`.${e}-ci:disabled ~ .${e}-cl`]:{opacity:.6,"pointer-events":"none",cursor:"not-allowed"},[`.${e}-bx`]:C(u(u({position:"relative",height:"18px",width:"18px",border:"solid hsl(0, 0%, 50%, 100)","border-width":"2px",display:"inline-flex"},o==="rtl"&&{"margin-left":"10px"}),o!=="rtl"&&{"margin-right":"10px"}),{transition:"all 0.2s","justify-content":"center","align-items":"center","flex-shrink":0}),[`.${e}-other-inp-wrp`]:{display:"none"},[`.${e}-other-inp`]:{display:"inline-block !important",direction:"inherit !important","font-family":"var(--g-font-family)",margin:"0px 0px 0px 33px",width:"calc(100% - 33px) !important",outline:"none !important","background-color":"var(--global-fld-bg-color) !important","border-style":"var(--global-fld-bdr) !important","border-color":"var(--global-fld-bdr-clr) !important","border-radius":"var(--g-bdr-rad) !important","border-width":"var(--g-bdr-width) !important","font-size":"var(--fld-fs) !important","font-weight":"var(--fld-f-w) !important","font-style":"var(--fld-f-style) !important",color:"var(--fld-inp-c) !important",padding:"10px 8px 10px 8px!important","line-height":"1.4 !important",height:"40px"},[`.${e}-other-inp:focus`]:{"box-shadow":"0 0 0 3px hsla(var(--gah), var(--gas), var(--gal), 0.30) !important","border-color":"var(--global-accent-color) !important"},[`.${e}-other-inp:hover`]:{"border-color":"var(--global-accent-color) !important"}}),s==="check"&&{[`.${e}-ck`]:{"border-radius":"5px"},[`.${e}-svgwrp`]:{height:"12px",width:"10px",filter:"drop-shadow(0px 1px 1px hsl(var(--gah), var(--gas), 13%))"},[`.${e}-ck-icn`]:{"stroke-dashoffset":"16px"},[`.${e}-ck-svgline`]:{stroke:"white",fill:"none","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2px","stroke-dasharray":"16px"},[`.${e}-ci:checked ~ .${e}-cl .${e}-ck-icn`]:{"stroke-dashoffset":0}}),s==="radio"&&{[`.${e}-bx::before`]:{content:'""',position:"absolute",left:"50%",height:0,width:0},[`.${e}-rdo`]:{"border-radius":"50%"},[`.${e}-rdo::before`]:{"border-radius":"50%",transition:"all 0.2s cubic-bezier(0.25, 0.1, 0.59, 1.82)",top:"50%",background:"white","box-shadow":"0 1px 3px 0px grey",transform:"translate(-50%, -50%)"},[`.${e}-ci:checked ~ .${e}-cl .${e}-rdo::before`]:{width:"50%",height:"50%"}})}function qe({fieldKey:e,type:s,direction:o,breakpoint:n="lg",colorScheme:c="light"}){const g={};switch(s){case"check":case"radio":return Ue({type:s,fk:e,direction:o,breakpoint:n,colorScheme:c});default:return g}}const Ue=({type:e,fk:s,direction:o,breakpoint:n,colorScheme:c})=>n==="lg"&&c==="light"?{theme:"individual",fieldType:e,overrideGlobalTheme:[],fieldSize:"medium",classes:Ze({fk:s,type:e,direction:o,breakpoint:n,colorScheme:c})}:{};function ot({currentThemeName:e,onCreateNew:s,onImport:o,onRename:n,onReset:c,onSave:g,onSaveAsNew:w}){const{css:r}=ve(),v=ye();je();const{fieldKey:K,formType:I,formID:R,element:ee}=Ce(),te=O.useRef(null),[T,F]=O.useState("initial"),[x,se]=z(Be),re=j(Me),b=j(_e),V=j(ke),oe=Object.entries(V),[Xe,ae]=z(Ie),[Ye,ie]=z(Re),A=j(We),le=j(Pe),ne=N(Fe),ce=N(Ve),de=N(Ae),S=v.pathname.includes("/theme")&&!v.pathname.includes("/theme-customize"),E=v.pathname.includes("/theme-customize"),L=v.pathname.includes("/field-theme-customize");E&&v.pathname.split("/theme-customize/")[1];const D=i=>L?l("Individual Customize"):l("Global Customize"),me=(i,m,h,d)=>i!=="individual"?Ee(i,m,h,{breakpoint:"lg",colorScheme:"light",direction:d}):qe({fieldKey:m,type:h,direction:d}),M=(i=T)=>{if(i==="initial"){const m=Object.keys(x.fields),h=Object.keys(b.fields);se(d=>ze(d,f=>{m.forEach(p=>{h.includes(p)?f.fields[p]=b.fields[p]:f.fields[p]=me(x.fields[p].theme,p,V[p].typ,A["--dir"])}),f.font=b.font,f.theme=b.theme,f.fieldSize=b.fieldSize,f.form=b.form})),ae(A),ie(le),U(),X(Y(ee,K,"Reset All Styles","",{styles:k("styles"),themeVars:k("themeVars"),themeColors:k("themeColors")}))}else if(i==="theme"){const{themeColors:m,themeVars:h,styles:d}=Ne(x.theme,oe,R,re);x.confirmations&&d.lgLightStyles&&(d.lgLightStyles.confirmations=[...x.confirmations]),ne(m),ce(h),de(d),X(Y("","","Theme",x.theme,{allThemeColors:m,allThemeVars:h,allStyles:d})),U()}Le()},y=i=>{i&&i()},he=()=>{c?c():(F("theme"),setTimeout(()=>{M("theme")},0))},_=i=>{F(i.target.value)};return t.jsxs("div",{className:r(a.header),children:[t.jsx("div",{className:r(a.content),children:S?t.jsx("h2",{className:r(a.title),children:l("Select Your Theme")}):t.jsxs("nav",{className:r(a.breadcrumb),"aria-label":"Breadcrumb",children:[t.jsxs($e,{to:`/form/builder/${I}/${R}/themes`,className:r(a.breadcrumbLink),children:[t.jsx(we,{size:"14"}),"Themes /"]}),t.jsx("span",{className:r(a.breadcrumbCurrent,{td:"underline"}),title:D(),children:`${D()}`})]})}),I==="edit"&&(E||L)&&t.jsx("div",{className:r(B.flxcb),children:t.jsxs(J,{children:[t.jsxs(G,{dataTestId:"style-reset-btn",className:r(a.resetBtn),size:"sm",gap:5,variant:"tertiary-outline",children:[t.jsx(Oe,{size:12}),l("Reset")]}),t.jsxs("div",{children:[t.jsx("div",{className:r({mt:5,ml:8},B.fw500),children:"Confirm reset style?"}),t.jsxs("div",{className:r(B.flxClm),children:[t.jsx(Q,{radio:!0,name:"reset",onChange:_,checked:T==="initial",title:t.jsx("small",{className:"txt-dp",children:t.jsx("b",{children:"Restore all saved style"})}),value:"initial"}),t.jsx(Q,{radio:!0,name:"reset",onChange:_,checked:T==="theme",title:t.jsx("small",{className:"txt-dp",children:t.jsx("b",{children:"Reset Style as theme default"})}),value:"theme"})]}),t.jsx(G,{onClick:()=>M(),width:"100%",dataTestId:"style-reset-confirm",size:"sm",className:r({my:5,mx:"auto"}),variant:"tertiary",children:"Confirm"})]})]})}),S&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:r($.border_right)}),t.jsxs("button",{className:r(a.iconButton),onClick:()=>y(s),children:[t.jsx(Ge,{size:20}),l("Create")]}),t.jsx("span",{className:r($.border_right)}),t.jsxs("button",{className:r(a.iconButton),onClick:()=>y(o),children:[t.jsx(Te,{size:20}),l("Import")]}),t.jsx("span",{className:r($.border_right)})]}),!S&&t.jsx("div",{className:r(a.menuWrapper),ref:te,children:t.jsxs(J,{children:[t.jsx("button",{className:r(a.menuButton),"aria-label":"More options",children:t.jsx(He,{size:"20"})}),t.jsxs("div",{className:r(a.dropdownMenu),children:[n&&t.jsxs("button",{onClick:()=>y(n),children:[t.jsx(H,{size:16,stroke:2}),t.jsx("span",{children:l("Rename")})]}),t.jsxs("button",{onClick:he,children:[t.jsx(De,{size:16}),t.jsx("span",{children:l("Reset Theme Style")})]}),(g||w)&&t.jsx("div",{className:r(a.menuDivider)}),g&&t.jsxs("button",{onClick:()=>y(g),children:[t.jsx(H,{size:16}),t.jsx("span",{children:l("Update Theme Style")}),!Z&&t.jsx(q,{proProperty:"customThemes"})]}),w&&t.jsxs("button",{onClick:()=>y(w),children:[t.jsx(Se,{size:16}),t.jsx("span",{children:l("Save as New Theme")}),!Z&&t.jsx(q,{proProperty:"customThemes"})]})]})]})})]})}const a={header:{display:"flex",alignItems:"center",justifyContent:"space-between",top:0,p:15,bb:"1px solid var(--bf-stroke-clr)",h:"var(--bf-option-toolbar-height)",bd:"var(--bf-bg-offwhite)",pn:"sticky",w:"100%",zx:10},content:{flex:1},title:{fs:"var(--bf-font-lg)",fw:"var(--bf-font-semibold)",cr:"var(--bf-text-clr-dark)",m:0},breadcrumb:{display:"flex",alignItems:"center",gap:"2px",cr:"var(--bf-text-clr-gray)",fs:"var(--bf-font-base)",fw:"var(--bf-font-medium)",ws:"nowrap"},breadcrumbLink:{cr:"var(--bf-text-clr-tertiary)",bd:"none",b:"none",p:0,curp:1,tn:"color 0.2s",dy:"inline-flex",ai:"center",":hover":{cr:"var(--bf-tertiary-800)",td:"underline !important"}},breadcrumbSeparator:{color:"#9CA3AF",flexShrink:0},breadcrumbCurrent:{mxw:"150px",fw:"var(--bf-font-semibold)",to:"ellipsis",ow:"hidden"},resetBtn:{p:"7px 10px !important",minWidth:"auto",fs:"var(--bf-font-sm)",fw:"var(--bf-font-medium)",ai:"center",b:"1px solid var(--bf-stroke-clr) !important"},menuWrapper:{position:"relative",marginLeft:"5px"},iconButton:C(u({},$.icn_btn),{pn:"relative",w:62,fs:"var(--bf-font-md)",gp:3,px:4,cr:"var(--bf-text-clr-darkgray)","::before":{ct:'""',zx:-1,pn:"absolute",size:0,tp:"50%",lt:"50%",brs:"50%",tm:"translate(-50%,-50%)",tn:"400ms border, opacity 300ms",oy:0,b:"0px solid var(--white-0-81-32)"},":hover::before":{b:"40px solid var(--white-0-81-32)",oy:1},":disabled::before":{dy:"none"}}),menuButton:{display:"flex",alignItems:"center",justifyContent:"center",width:"20px",height:"30px",padding:0,border:"1px solid #E5E7EB",brs:"var(--bf-bdr-radius-sm)",backgroundColor:"#ffffff",color:"#6B7280",cursor:"pointer",transition:"all 0.2s",":hover":{backgroundColor:"#F9FAFB",borderColor:"#D1D5DB",color:"#374151"}},dropdownMenu:{minWidth:"220px","& button":{display:"flex",alignItems:"center",gap:"12px",width:"100%",padding:"10px 16px",fontSize:"14px",fontWeight:500,color:"#374151",border:"none",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.15s",textAlign:"left",":hover":{backgroundColor:"#F3F4F6"}}},menuDivider:{height:"1px",backgroundColor:"#E5E7EB",margin:"4px 0"}};export{He as M,ot as R}; |