@billgangcom/theme-lib 1.13.0 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abstractions/PageContext.d.ts +103 -4
- package/dist/builder/utils/fetchData.d.ts +9 -3
- package/dist/builder.cjs.js +3 -3
- package/dist/builder.es.js +495 -488
- package/dist/ui/ProductOptions/index.d.ts +6 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui.cjs.js +1 -1
- package/dist/ui.es.js +716 -595
- package/package.json +1 -1
package/dist/ui/index.d.ts
CHANGED
package/dist/ui.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-xDqbV96L.cjs"),m=require("react"),st="_accordion_2tiiw_1",nt="_header_2tiiw_9",ot="_icon_2tiiw_16",it="_open_2tiiw_19",ct="_content_2tiiw_23",H={accordion:st,header:nt,icon:ot,open:it,content:ct},lt=({title:x,content:s})=>{const[n,i]=m.useState(!1),[c,l]=m.useState(0),e=m.useRef(null),o=()=>{i(!n)};return m.useEffect(()=>{e.current&&l(n?e.current.scrollHeight:0)},[n]),t.jsxRuntimeExports.jsxs("div",{className:H.accordion,children:[t.jsxRuntimeExports.jsxs("div",{className:H.header,onClick:o,children:[t.jsxRuntimeExports.jsx("h3",{children:x}),t.jsxRuntimeExports.jsx("div",{className:t.clx(H.icon,{[H.open]:n}),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown"})})]}),t.jsxRuntimeExports.jsx("div",{ref:e,className:H.content,style:{height:`${c}px`},children:t.jsxRuntimeExports.jsx("p",{children:s})})]})},rt="_wrapper_1g82c_2",at="_alignmentBlock_1g82c_8",ut="_title_1g82c_15",xt="_subtitle_1g82c_22",dt="_alignmentContent_1g82c_29",pt="_alignments_1g82c_35",mt="_alignment_1g82c_8",_t="_circle_1g82c_54",ht="_paddings_1g82c_61",gt="_padding_1g82c_61",jt="_input_1g82c_79",T={wrapper:rt,alignmentBlock:at,title:ut,subtitle:xt,alignmentContent:dt,alignments:pt,alignment:mt,circle:_t,paddings:ht,padding:gt,input:jt},bt=["topLeft","top","topRight","left","center","right","bottomLeft","bottom","bottomRight"],ft=["left","top","right","bottom"],Rt=x=>{const{alignment:s,padding:n,setPadding:i,setAlignment:c}=x;function l(){switch(s){case"left":case"topLeft":case"bottomLeft":return"TextAlignLeft";case"right":case"topRight":case"bottomRight":return"TextAlignRight";case"center":case"top":case"bottom":return"TextAlignCenter";default:return"TextAlignCenter"}}function e(o){switch(o){case"left":return"AlignLeft";case"right":return"AlignRight";case"top":return"AlignTop";case"bottom":return"AlignBottom"}}return t.jsxRuntimeExports.jsxs("div",{className:T.layout,children:[t.jsxRuntimeExports.jsx("h3",{className:T.title,children:"Layout"}),t.jsxRuntimeExports.jsxs("div",{className:T.alignmentBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:T.subtitle,children:"Alignment"}),t.jsxRuntimeExports.jsxs("div",{className:T.alignmentContent,children:[t.jsxRuntimeExports.jsx("div",{className:T.alignments,children:bt.map(o=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>{c(o)},className:T.alignment,children:[o!==s&&t.jsxRuntimeExports.jsx("div",{className:T.circle}),o===s&&t.jsxRuntimeExports.jsx(t.Icon,{name:l(),fill:"#FF3F19",width:22,height:22})]},o))}),t.jsxRuntimeExports.jsx("div",{className:T.paddings,children:ft.map(o=>t.jsxRuntimeExports.jsxs("label",{className:T.padding,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:e(o),width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Input,{type:"text",value:String(n[o]),onChange:a=>i({...n,[o]:Number(a)}),paddingless:!0,borderless:!0})]}))})]})]})]})},Et="_subtitle_2zbxx_1",vt="_header_2zbxx_8",kt="_text_2zbxx_9",yt="_top_2zbxx_16",$t="_itemsBlock_2zbxx_23",z={subtitle:Et,header:vt,text:kt,top:yt,itemsBlock:$t},wt="_typeTexts_3zlec_1",It="_block_3zlec_7",Bt="_active_3zlec_18",V={typeTexts:wt,block:It,active:Bt},Ct=["bold","italic","underline","strike-through","code"],K=x=>{const{typesText:s,setTypesText:n}=x;function i(c){switch(c){case"bold":return"TextB";case"italic":return"TextItalic";case"code":return"CodeSimple";case"strike-through":return"TextStrikethrough";case"underline":return"TextUnderline"}}return t.jsxRuntimeExports.jsx("div",{className:V.typeTexts,children:Ct.map(c=>t.jsxRuntimeExports.jsx("div",{className:t.clx(V.block,{[V.active]:s.includes(c)}),onClick:()=>{const l=[...s];if(l.includes(c)){const e=l.filter(o=>o!==c);n(e)}else l.push(c),n(l)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:i(c),fill:s.includes(c)?"#252525":"#757575",width:20,height:20})},String(c)))})},Q=x=>{const{typesText:s,isActiveText:n,setIsActiveText:i,text:c,setText:l,setTypesText:e,title:o,subtitle:a="Items"}=x;return t.jsxRuntimeExports.jsxs("div",{className:z.text,children:[(o||n!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:z.top,children:[o&&t.jsxRuntimeExports.jsx("h3",{className:z.title,children:o}),n!==void 0&&i&&t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:f=>i(f)})]}),t.jsxRuntimeExports.jsxs("div",{className:z.itemsBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:z.subtitle,children:a}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:f=>l(f),value:c,maxLength:150}),t.jsxRuntimeExports.jsx(K,{typesText:s,setTypesText:e})]})]})},Nt="_subtitle_11qr1_1",Tt="_header_11qr1_8",St="_text_11qr1_9",Pt="_productsBlock_11qr1_10",At="_top_11qr1_22",Ot="_itemsBlock_11qr1_29",Dt="_typeTexts_11qr1_35",Lt="_block_11qr1_41",qt="_active_11qr1_52",Mt="_products_11qr1_10",Ht="_product_11qr1_10",zt="_button_11qr1_70",Ft="_disabled_11qr1_80",Gt="_image_11qr1_84",Ut="_info_11qr1_91",Xt="_name_11qr1_102",Yt="_buttons_11qr1_106",Vt="_modal_11qr1_112",Jt="_link_11qr1_130",Kt="_modalOptions_11qr1_136",v={subtitle:Nt,header:Tt,text:St,productsBlock:Pt,top:At,itemsBlock:Ot,typeTexts:Dt,block:Lt,active:qt,products:Mt,product:Ht,button:zt,disabled:Ft,image:Gt,info:Ut,name:Xt,buttons:Yt,modal:Vt,link:Jt,modalOptions:Kt},Qt=x=>{const{activeItem:s,setActiveItem:n,popupPosition:i,modalOptions:c,setIsOpenModal:l}=x;return t.jsxRuntimeExports.jsxs("div",{className:v.modal,onClick:e=>{e.stopPropagation()},style:{top:`${i.top}px`,left:`${i.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:v.top,children:[t.jsxRuntimeExports.jsx("h3",{children:s.name}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{n(null),l(!1)}})]}),t.jsxRuntimeExports.jsx("div",{className:v.modalOptions,children:c.map(e=>{if(e.type==="image")return t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",onChange:o=>{const a={...s,[e.field]:o};n(a)}});if(e.type==="text")return t.jsxRuntimeExports.jsx(Q,{typesText:s[e.field.type],setTypesText:o=>{const a={...s,[e.field.type]:o};n(a)},text:s[e.field.text]||"",setText:o=>{const a={...s,[e.field.text]:o};n(a)},subtitle:e.label});if(e.type==="input")return t.jsxRuntimeExports.jsx(t.Input,{onChange:o=>{const a={...s,[e.field]:o};n(a)},value:s[e.field]||"",label:e.label,placeholder:e.placeholder});if(e.type==="inputSwitch")return t.jsxRuntimeExports.jsxs("div",{className:v.link,children:[t.jsxRuntimeExports.jsx(t.Input,{onChange:o=>{const a={...s,[e.field.text]:o};n(a)},value:s[e.field.text]||"",label:e.inputLabel,placeholder:e.placeholder}),t.jsxRuntimeExports.jsx(t.Switch,{current:!!s[e.field.switch]||!1,label:e.switchLabel,onChange:o=>{const a={...s,[e.field.switch]:o};n(a)}})]});if(e.type==="list")return t.jsxRuntimeExports.jsx(Z,{items:s[e.field]||[],setItems:o=>{const a={...s,[e.field]:o};n(a)},itemsType:"select",draggable:e.draggable||!1,itemsOptions:e.itemsOptions,deletable:e.deletable||!1,editable:!1,subtitle:e.label});if(e.type==="select")return t.jsxRuntimeExports.jsx(t.Select,{options:e.itemsOptions,onChange:o=>{const a={...s,[e.field]:o};n(a)},label:e.label,value:s[e.field]||"String",leftAddon:e.leftAddon&&e.leftAddon==="icon"&&t.jsxRuntimeExports.jsx(t.Icon,{name:s[e.field]})})})})]})},Wt="_other_1wtgi_1",Zt="_subtitle_1wtgi_7",te="_items_1wtgi_14",J={other:Wt,subtitle:Zt,items:te},W=x=>{const{items:s,title:n="Other"}=x;return t.jsxRuntimeExports.jsxs("div",{className:J.other,children:[t.jsxRuntimeExports.jsx("h5",{className:J.subtitle,children:n}),t.jsxRuntimeExports.jsx("div",{className:J.items,children:s.map(i=>t.jsxRuntimeExports.jsx(t.Switch,{current:i.isItem,onChange:c=>i.setIsItem(c),label:i.label,hasBackground:!0,paddingless:!1}))})]})},ee=x=>{const{index:s,moveProduct:n,children:i}=x,[,c]=t.useDrop({accept:"product",hover(o){o.index!==s&&(n(o.index,s),o.index=s)}}),[{isDragging:l},e]=t.useDrag({type:"product",item:{index:s},collect:o=>({isDragging:o.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:o=>e(c(o)),className:`${v.product} ${l?v.dragging:""}`,children:i})},Z=x=>{const{isActiveItems:s,setIsActiveItems:n,items:i,setItems:c,other:l,title:e,subtitle:o,editable:a=!0,draggable:f=!1,withImage:d=!1,deletable:b=!0,addable:g=!0,itemsType:k,itemsPlaceholder:_="",itemsOptions:p,hasRangeSelector:w=!1,rangeSelectorOptions:G,modalOptions:U,addableOptions:q={},limit:C}=x,[P,A]=m.useState(null),[Y,X]=m.useState({top:0,left:0}),[u,h]=m.useState(!1),I=(r,y)=>{const B=[...i],[j]=B.splice(r,1);B.splice(y,0,j),c(B)};m.useEffect(()=>{const r=()=>{A(null),h(!1)};return document.body.addEventListener("click",r),A(null),h(!1),()=>{A(null),h(!1),document.body.removeEventListener("click",r)}},[]),m.useEffect(()=>{if(P){const r=[...i].map(y=>y.id===P.id?P:y);c(r)}},[P]);const R=(r,y)=>{r.stopPropagation(),h(!0);const B=r.target.getBoundingClientRect(),j=500,M=window.innerHeight;let S=B.top+window.scrollY;S+j>M&&(S=M-j-20),X({top:S-80,left:B.left-30}),A(y)};function D(r){if(d)return r?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${r[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const N=(r,y)=>{const B=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[f&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),k==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:j=>{const S=[...i].map(O=>O.id===r.id?{...r,name:j}:O);A({...r,name:j}),c([...S])},value:r.name,options:p,leftAddon:D(r.images)}),k==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:j=>{const S=[...i].map(O=>O.id===r.id?{...r,name:j}:O);c([...S])},value:r.name,placeholder:_}),k==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:j=>{const S=[...i].map(O=>O.id===r.id?{...r,images:j}:O);c([...S])}}),t.jsxRuntimeExports.jsxs("div",{className:v.buttons,children:[a&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:j=>R(j,r)}),b&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>c(i.filter(j=>j.id!==r.id))})]})]});return f?t.jsxRuntimeExports.jsx(ee,{product:r,index:y,moveProduct:I,children:B},r.id):t.jsxRuntimeExports.jsx("div",{className:v.product,children:B},r.id)};return t.jsxRuntimeExports.jsxs("div",{className:v.productsBlock,children:[(e||s!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:v.top,children:[e&&t.jsxRuntimeExports.jsx("h3",{className:v.title,children:e}),s!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:s,onChange:r=>n==null?void 0:n(r)})]}),P&&a&&U&&u&&t.jsxRuntimeExports.jsx(Qt,{activeItem:P,setActiveItem:A,popupPosition:Y,modalOptions:U,setIsOpenModal:h}),w&&G&&t.jsxRuntimeExports.jsx(et,{...G}),t.jsxRuntimeExports.jsxs("div",{className:v.products,children:[o&&t.jsxRuntimeExports.jsx("h5",{className:v.subtitle,children:o}),f?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:i.map((r,y)=>N(r,y))}):i.map((r,y)=>N(r,y)),g&&t.jsxRuntimeExports.jsxs(t.Button,{className:t.clx(v.button,{[v.disabled]:!!(C&&C<=i.length)}),size:"s",disabled:!!(C&&C<=i.length),onClick:()=>{const r=[...i];k==="select"?r.push({name:p[0]||`Product ${i.length+1}`,id:t.v4(),...q}):k==="input"?r.push({name:"",id:t.v4(),...q}):r.push({name:`Image ${i.length+1}`,id:t.v4(),...q}),c(r)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})]}),l!==void 0&&t.jsxRuntimeExports.jsx(W,{items:l})]})},se="_subtitle_41klp_1",ne="_header_41klp_8",oe="_text_41klp_9",ie="_productsBlock_41klp_10",ce="_buttonsBlock_41klp_11",le="_top_41klp_21",re="_itemsBlock_41klp_28",ae="_typeTexts_41klp_34",ue="_block_41klp_40",xe="_active_41klp_51",de="_products_41klp_10",pe="_product_41klp_10",me="_button_41klp_11",_e="_image_41klp_79",he="_info_41klp_86",ge="_name_41klp_97",je="_buttons_41klp_11",be="_modal_41klp_107",fe="_other_41klp_124",Re="_options_41klp_130",L={subtitle:se,header:ne,text:oe,productsBlock:ie,buttonsBlock:ce,top:le,itemsBlock:re,typeTexts:ae,block:ue,active:xe,products:de,product:pe,button:me,image:_e,info:he,name:ge,buttons:je,modal:be,other:fe,options:Re},Ee=x=>{const{activeButton:s,setActiveButton:n,popupPosition:i}=x,[c,l]=m.useState(s.typesText),[e,o]=m.useState(s.destination),[a,f]=m.useState(s.link||""),[d,b]=m.useState(s.text||"");return m.useEffect(()=>{n({...s,...{text:d,link:a,destination:e,typesText:c}})},[c,e,a,d]),t.jsxRuntimeExports.jsxs("div",{className:L.modal,onClick:g=>{g.stopPropagation()},style:{top:`${i.top}px`,left:`${i.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:L.top,children:[t.jsxRuntimeExports.jsx("h3",{children:s.type}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>n(null)})]}),t.jsxRuntimeExports.jsxs("div",{className:L.options,children:[t.jsxRuntimeExports.jsx(t.Select,{label:"Destination",onChange:g=>o(g),options:["Go to Page","Open Link"],value:e}),e==="Go to Page"?t.jsxRuntimeExports.jsx(t.Select,{label:"Go to",onChange:()=>{},options:[],value:"Homepage"}):t.jsxRuntimeExports.jsx(t.Input,{onChange:g=>f(g),value:a,placeholder:"https://",label:"Link"}),t.jsxRuntimeExports.jsx(t.Switch,{current:!1,label:"Open in new tab"}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:g=>b(g),value:d,label:"Text",maxLength:150}),t.jsxRuntimeExports.jsx(K,{typesText:c,setTypesText:l})]})]})},ve="_subtitle_1y5sw_1",ke="_header_1y5sw_8",ye="_text_1y5sw_9",$e="_productsBlock_1y5sw_10",we="_buttonsBlock_1y5sw_11",Ie="_top_1y5sw_22",Be="_itemsBlock_1y5sw_29",Ce="_typeTexts_1y5sw_35",Ne="_block_1y5sw_41",Te="_active_1y5sw_52",Se="_products_1y5sw_10",Pe="_product_1y5sw_10",Ae="_button_1y5sw_11",Oe="_image_1y5sw_80",De="_info_1y5sw_87",Le="_name_1y5sw_98",qe="_buttons_1y5sw_11",Me="_modal_1y5sw_108",He="_other_1y5sw_125",ze="_options_1y5sw_131",F={subtitle:ve,header:ke,text:ye,productsBlock:$e,buttonsBlock:we,top:Ie,itemsBlock:Be,typeTexts:Ce,block:Ne,active:Te,products:Se,product:Pe,button:Ae,image:Oe,info:De,name:Le,buttons:qe,modal:Me,other:He,options:ze},tt=x=>{const{buttons:s,setButtons:n,deletable:i=!0,addable:c=!0}=x,[l,e]=m.useState(null),[o,a]=m.useState({top:0,left:0});m.useEffect(()=>{const d=()=>{e(null)};return document.body.addEventListener("click",d),e(null),()=>{e(null),document.body.removeEventListener("click",d)}},[]),m.useEffect(()=>{if(l){const d=[...s].map(b=>b.id===l.id?l:b);n(d)}},[l]);const f=(d,b)=>{d.stopPropagation();const g=d.target.getBoundingClientRect(),k=490,_=window.innerHeight;let p=g.top+window.scrollY;p+k>_&&(p=_-k-20),a({top:p,left:g.left-30}),e(b)};return t.jsxRuntimeExports.jsxs("div",{className:F.products,children:[t.jsxRuntimeExports.jsx("h5",{className:F.subtitle,children:"Button Type"}),s.map(d=>t.jsxRuntimeExports.jsxs("div",{className:F.product,children:[t.jsxRuntimeExports.jsx(t.Select,{onChange:b=>{const k=[...s].map(_=>_.id===d.id?{...d,type:b}:_);n(k)},value:d.type,options:["Primary","Secondary","Tertiary"]}),t.jsxRuntimeExports.jsxs("div",{className:F.buttons,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:b=>{f(b,d)}}),i&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,onClick:()=>{const b=s.filter(g=>g.id!==d.id);n(b)},width:20,height:20,fill:"#C12A2A"})]})]},d.id)),l&&t.jsxRuntimeExports.jsx(Ee,{activeButton:l,setActiveButton:e,popupPosition:o}),c&&t.jsxRuntimeExports.jsxs(t.Button,{className:F.button,size:"s",onClick:()=>{const d=[...s];d.push({type:"Primary",id:t.v4(),typesText:[],destination:"Go to Page",text:""}),n(d)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})]})},Fe=x=>{const{isActiveButtons:s,setIsActiveButtons:n,buttons:i,setButtons:c}=x;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs("div",{className:L.buttonsBlock,children:[t.jsxRuntimeExports.jsxs("div",{className:L.top,children:[t.jsxRuntimeExports.jsx("h3",{className:L.title,children:"Buttons"}),t.jsxRuntimeExports.jsx(t.Switch,{current:s,onChange:l=>n(l)})]}),t.jsxRuntimeExports.jsx(tt,{buttons:i,setButtons:c})]})})},Ge="_wrapper_tn7gb_1",Ue="_subtitle_tn7gb_7",Xe="_content_tn7gb_14",Ye="_range_tn7gb_21",Ve="_track_tn7gb_26",Je="_progress_tn7gb_35",Ke="_dots_tn7gb_45",Qe="_dot_tn7gb_45",We="_active_tn7gb_62",Ze="_input_tn7gb_74",ts="_countBlock_tn7gb_88",es="_count_tn7gb_88",ss="_controls_tn7gb_103",ns="_button_tn7gb_108",E={wrapper:Ge,subtitle:Ue,content:Xe,range:Ye,track:Ve,progress:Je,dots:Ke,dot:Qe,active:We,input:Ze,countBlock:ts,count:es,controls:ss,button:ns},et=x=>{const{label:s,min:n=1,max:i=4,step:c=1,count:l,setCount:e}=x,[o,a]=m.useState(!1),f=Array.from({length:(i-n)/c+1}),d=(l-n)/(i-n)*100,b=()=>{l<i&&e(l+c)},g=()=>{l>n&&e(l-c)},k=_=>{const p=n+_*c;e(p)};return t.jsxRuntimeExports.jsxs("div",{className:E.wrapper,children:[s&&t.jsxRuntimeExports.jsx("h5",{className:E.subtitle,children:s}),t.jsxRuntimeExports.jsxs("div",{className:E.content,children:[t.jsxRuntimeExports.jsxs("div",{className:E.range,children:[t.jsxRuntimeExports.jsx("div",{className:E.track}),t.jsxRuntimeExports.jsx("div",{className:E.progress,style:{width:`${d}%`}}),t.jsxRuntimeExports.jsx("div",{className:E.dots,children:f.map((_,p)=>{const w=p<=(l-n)/c;return t.jsxRuntimeExports.jsx("button",{onClick:()=>k(p),className:t.clx(E.dot,{[E.active]:w,[E.inactive]:!w,[E.dragging]:o}),"aria-label":`Set value to ${n+p*c}`},p)})}),t.jsxRuntimeExports.jsx("input",{type:"range",min:n,max:i,step:c,value:l,onChange:_=>e(Number(_.target.value)),onMouseDown:()=>a(!0),onMouseUp:()=>a(!1),onTouchStart:()=>a(!0),onTouchEnd:()=>a(!1),className:E.input})]}),t.jsxRuntimeExports.jsxs("div",{className:E.countBlock,children:[t.jsxRuntimeExports.jsx(t.Input,{type:"number",min:n,max:i,paddingless:!0,onChange:_=>{const p=Number(_);p>i?e(i):p<n?e(n):e(p)},value:String(l)}),t.jsxRuntimeExports.jsxs("div",{className:E.controls,children:[t.jsxRuntimeExports.jsx("button",{onClick:b,disabled:l>=i,className:E.button,"aria-label":"Increment count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretUp",width:15,height:15})}),t.jsxRuntimeExports.jsx("button",{onClick:g,disabled:l<=n,className:E.button,"aria-label":"Decrement count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown",width:15,height:15})})]})]})]})]})},os="_subtitle_1nl8x_1",is="_header_1nl8x_8",cs="_text_1nl8x_9",ls="_productsBlock_1nl8x_10",rs="_top_1nl8x_22",as="_itemsBlock_1nl8x_29",us="_typeTexts_1nl8x_35",xs="_block_1nl8x_41",ds="_active_1nl8x_52",ps="_products_1nl8x_10",ms="_product_1nl8x_10",_s="_button_1nl8x_70",hs="_image_1nl8x_80",gs="_info_1nl8x_87",js="_name_1nl8x_98",bs="_buttons_1nl8x_102",fs="_modal_1nl8x_108",Rs="_link_1nl8x_126",Es="_modalOptions_1nl8x_132",$={subtitle:os,header:is,text:cs,productsBlock:ls,top:rs,itemsBlock:as,typeTexts:us,block:xs,active:ds,products:ps,product:ms,button:_s,image:hs,info:gs,name:js,buttons:bs,modal:fs,link:Rs,modalOptions:Es},vs=x=>{const{activeItem:s,setActiveItem:n,popupPosition:i,setIsOpenModal:c}=x;return t.jsxRuntimeExports.jsxs("div",{className:$.modal,onClick:l=>{l.stopPropagation()},style:{top:`${i.top}px`,left:`${i.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:$.top,children:[t.jsxRuntimeExports.jsx("h3",{children:s.name}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{c(!1),n(null)}})]}),t.jsxRuntimeExports.jsx("div",{className:$.modalOptions,children:t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",onChange:l=>{const e={...s,images:l,imagePath:l[0]};n(e)}})})]})},ks=x=>{const{index:s,moveProduct:n,children:i}=x,[,c]=t.useDrop({accept:"product",hover(o){o.index!==s&&(n(o.index,s),o.index=s)}}),[{isDragging:l},e]=t.useDrag({type:"product",item:{index:s},collect:o=>({isDragging:o.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:o=>e(c(o)),className:`${$.product} ${l?$.dragging:""}`,children:i})},ys=x=>{const{isActiveItems:s,setIsActiveItems:n,items:i,setItems:c,other:l,title:e,subtitle:o,editable:a=!0,draggable:f=!1,withImage:d=!1,deletable:b=!0,addable:g=!0,itemsType:k,itemsOptions:_}=x,[p,w]=m.useState(null),[G,U]=m.useState({top:0,left:0}),[q,C]=m.useState(!1),P=(u,h)=>{const I=[...i],[R]=I.splice(u,1);I.splice(h,0,R),c(I)};m.useEffect(()=>{const u=()=>{w(null),C(!1)};return document.body.addEventListener("click",u),w(null),C(!1),()=>{w(null),C(!1),document.body.removeEventListener("click",u)}},[]),m.useEffect(()=>{if(p){const u=[...i].map(h=>h.id===p.id?p:h);c(u)}},[p]);const A=(u,h)=>{u.stopPropagation();const I=u.target.getBoundingClientRect(),R=100,D=window.innerHeight;let N=I.top+window.scrollY;N+R>D&&(N=D-R-20),C(!0),U({top:N-80,left:I.left-30}),w(h)};function Y(u){if(d)return u?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${u}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const X=(u,h)=>{const I=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[f&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),k==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:R=>{const D=[...i],N=Number(R.split(" ")[1]),r=_.find(j=>j.id===N);if(!r)return;const y={...r.productData.stats,newPrice:r.productData.minPrice.amount,oldPrice:r.productData.compareAtPrice.amount},B=D.map(j=>j.id===u.id?{...u,name:R,listingId:N,stats:y}:j);w({...u,name:R,listingId:N}),c([...B])},value:u.name,options:[..._.map(R=>`Product ${R.id}`)],leftAddon:Y(u.images[0])}),t.jsxRuntimeExports.jsxs("div",{className:$.buttons,children:[a&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:R=>A(R,u)}),b&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>c(i.filter(R=>R.id!==u.id))})]})]});return f?t.jsxRuntimeExports.jsx(ks,{product:u,index:h,moveProduct:P,children:I},u.id):t.jsxRuntimeExports.jsx("div",{className:$.product,children:I},u.id)};return t.jsxRuntimeExports.jsxs("div",{className:$.productsBlock,children:[(e||s!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:$.top,children:[e&&t.jsxRuntimeExports.jsx("h3",{className:$.title,children:e}),s!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:s,onChange:u=>n==null?void 0:n(u)})]}),q&&p&&t.jsxRuntimeExports.jsx(vs,{activeItem:p,setActiveItem:w,setIsOpenModal:C,popupPosition:G}),t.jsxRuntimeExports.jsxs("div",{className:$.products,children:[o&&t.jsxRuntimeExports.jsx("h5",{className:$.subtitle,children:o}),f?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:i.map((u,h)=>X(u,h))}):i.map((u,h)=>X(u,h)),g&&t.jsxRuntimeExports.jsxs(t.Button,{className:$.button,size:"s",onClick:()=>{const u=[...i],h=_[0].id;u.push({name:`Product ${h}`,id:t.v4(),listingId:h,imagePath:"",images:[],stats:{..._[0].productData.stats,newPrice:_[0].productData.minPrice.amount,oldPrice:_[0].productData.compareAtPrice.amount}}),c(u)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})]}),l!==void 0&&t.jsxRuntimeExports.jsx(W,{items:l})]})};exports.Button=t.Button;exports.Checkbox=t.Checkbox;exports.ChooseImage=t.ChooseImage;exports.ChooseImageModal=t.ChooseImageModal;exports.ColorPicker=t.ColorPicker;exports.Icon=t.Icon;exports.Input=t.Input;exports.Loader=t.Loader;exports.Modal=t.Modal;exports.Picker=t.Picker;exports.Radio=t.Radio;exports.Select=t.Select;exports.Submodal=t.Submodal;exports.Switch=t.Switch;exports.Textarea=t.Textarea;exports.Tip=t.Tip;exports.Accordion=lt;exports.ButtonTypeSettings=tt;exports.ButtonsSettings=Fe;exports.ItemsSettings=Z;exports.LayoutSettings=Rt;exports.ListingSelector=ys;exports.RangeSelector=et;exports.TextSettings=Q;exports.TypesText=K;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-xDqbV96L.cjs"),p=require("react"),nt="_accordion_2tiiw_1",ot="_header_2tiiw_9",it="_icon_2tiiw_16",ct="_open_2tiiw_19",rt="_content_2tiiw_23",z={accordion:nt,header:ot,icon:it,open:ct,content:rt},at=({title:d,content:o})=>{const[n,i]=p.useState(!1),[c,r]=p.useState(0),e=p.useRef(null),s=()=>{i(!n)};return p.useEffect(()=>{e.current&&r(n?e.current.scrollHeight:0)},[n]),t.jsxRuntimeExports.jsxs("div",{className:z.accordion,children:[t.jsxRuntimeExports.jsxs("div",{className:z.header,onClick:s,children:[t.jsxRuntimeExports.jsx("h3",{children:d}),t.jsxRuntimeExports.jsx("div",{className:t.clx(z.icon,{[z.open]:n}),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown"})})]}),t.jsxRuntimeExports.jsx("div",{ref:e,className:z.content,style:{height:`${c}px`},children:t.jsxRuntimeExports.jsx("p",{children:o})})]})},lt="_wrapper_1g82c_2",xt="_alignmentBlock_1g82c_8",ut="_title_1g82c_15",dt="_subtitle_1g82c_22",mt="_alignmentContent_1g82c_29",pt="_alignments_1g82c_35",_t="_alignment_1g82c_8",ht="_circle_1g82c_54",jt="_paddings_1g82c_61",gt="_padding_1g82c_61",bt="_input_1g82c_79",T={wrapper:lt,alignmentBlock:xt,title:ut,subtitle:dt,alignmentContent:mt,alignments:pt,alignment:_t,circle:ht,paddings:jt,padding:gt,input:bt},ft=["topLeft","top","topRight","left","center","right","bottomLeft","bottom","bottomRight"],Rt=["left","top","right","bottom"],vt=d=>{const{alignment:o,padding:n,setPadding:i,setAlignment:c}=d;function r(){switch(o){case"left":case"topLeft":case"bottomLeft":return"TextAlignLeft";case"right":case"topRight":case"bottomRight":return"TextAlignRight";case"center":case"top":case"bottom":return"TextAlignCenter";default:return"TextAlignCenter"}}function e(s){switch(s){case"left":return"AlignLeft";case"right":return"AlignRight";case"top":return"AlignTop";case"bottom":return"AlignBottom"}}return t.jsxRuntimeExports.jsxs("div",{className:T.layout,children:[t.jsxRuntimeExports.jsx("h3",{className:T.title,children:"Layout"}),t.jsxRuntimeExports.jsxs("div",{className:T.alignmentBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:T.subtitle,children:"Alignment"}),t.jsxRuntimeExports.jsxs("div",{className:T.alignmentContent,children:[t.jsxRuntimeExports.jsx("div",{className:T.alignments,children:ft.map(s=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>{c(s)},className:T.alignment,children:[s!==o&&t.jsxRuntimeExports.jsx("div",{className:T.circle}),s===o&&t.jsxRuntimeExports.jsx(t.Icon,{name:r(),fill:"#FF3F19",width:22,height:22})]},s))}),t.jsxRuntimeExports.jsx("div",{className:T.paddings,children:Rt.map(s=>t.jsxRuntimeExports.jsxs("label",{className:T.padding,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:e(s),width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Input,{type:"text",value:String(n[s]),onChange:l=>i({...n,[s]:Number(l)}),paddingless:!0,borderless:!0})]}))})]})]})]})},Et="_subtitle_2zbxx_1",kt="_header_2zbxx_8",yt="_text_2zbxx_9",$t="_top_2zbxx_16",It="_itemsBlock_2zbxx_23",F={subtitle:Et,header:kt,text:yt,top:$t,itemsBlock:It},wt="_typeTexts_3zlec_1",Nt="_block_3zlec_7",Ct="_active_3zlec_18",J={typeTexts:wt,block:Nt,active:Ct},Bt=["bold","italic","underline","strike-through","code"],Q=d=>{const{typesText:o,setTypesText:n}=d;function i(c){switch(c){case"bold":return"TextB";case"italic":return"TextItalic";case"code":return"CodeSimple";case"strike-through":return"TextStrikethrough";case"underline":return"TextUnderline"}}return t.jsxRuntimeExports.jsx("div",{className:J.typeTexts,children:Bt.map(c=>t.jsxRuntimeExports.jsx("div",{className:t.clx(J.block,{[J.active]:o.includes(c)}),onClick:()=>{const r=[...o];if(r.includes(c)){const e=r.filter(s=>s!==c);n(e)}else r.push(c),n(r)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:i(c),fill:o.includes(c)?"#252525":"#757575",width:20,height:20})},String(c)))})},W=d=>{const{typesText:o,isActiveText:n,setIsActiveText:i,text:c,setText:r,setTypesText:e,title:s,subtitle:l="Items"}=d;return t.jsxRuntimeExports.jsxs("div",{className:F.text,children:[(s||n!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:F.top,children:[s&&t.jsxRuntimeExports.jsx("h3",{className:F.title,children:s}),n!==void 0&&i&&t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:R=>i(R)})]}),t.jsxRuntimeExports.jsxs("div",{className:F.itemsBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:F.subtitle,children:l}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:R=>r(R),value:c,maxLength:150}),t.jsxRuntimeExports.jsx(Q,{typesText:o,setTypesText:e})]})]})},Pt="_subtitle_11qr1_1",Tt="_header_11qr1_8",St="_text_11qr1_9",At="_productsBlock_11qr1_10",Ot="_top_11qr1_22",Dt="_itemsBlock_11qr1_29",Lt="_typeTexts_11qr1_35",qt="_block_11qr1_41",Mt="_active_11qr1_52",Ht="_products_11qr1_10",zt="_product_11qr1_10",Ft="_button_11qr1_70",Vt="_disabled_11qr1_80",Gt="_image_11qr1_84",Ut="_info_11qr1_91",Xt="_name_11qr1_102",Yt="_buttons_11qr1_106",Jt="_modal_11qr1_112",Kt="_link_11qr1_130",Qt="_modalOptions_11qr1_136",k={subtitle:Pt,header:Tt,text:St,productsBlock:At,top:Ot,itemsBlock:Dt,typeTexts:Lt,block:qt,active:Mt,products:Ht,product:zt,button:Ft,disabled:Vt,image:Gt,info:Ut,name:Xt,buttons:Yt,modal:Jt,link:Kt,modalOptions:Qt},Wt=d=>{const{activeItem:o,setActiveItem:n,popupPosition:i,modalOptions:c,setIsOpenModal:r}=d;return t.jsxRuntimeExports.jsxs("div",{className:k.modal,onClick:e=>{e.stopPropagation()},style:{top:`${i.top}px`,left:`${i.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:k.top,children:[t.jsxRuntimeExports.jsx("h3",{children:o.name}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{n(null),r(!1)}})]}),t.jsxRuntimeExports.jsx("div",{className:k.modalOptions,children:c.map(e=>{if(e.type==="image")return t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",onChange:s=>{const l={...o,[e.field]:s};n(l)}});if(e.type==="text")return t.jsxRuntimeExports.jsx(W,{typesText:o[e.field.type],setTypesText:s=>{const l={...o,[e.field.type]:s};n(l)},text:o[e.field.text]||"",setText:s=>{const l={...o,[e.field.text]:s};n(l)},subtitle:e.label});if(e.type==="input")return t.jsxRuntimeExports.jsx(t.Input,{onChange:s=>{const l={...o,[e.field]:s};n(l)},value:o[e.field]||"",label:e.label,placeholder:e.placeholder});if(e.type==="inputSwitch")return t.jsxRuntimeExports.jsxs("div",{className:k.link,children:[t.jsxRuntimeExports.jsx(t.Input,{onChange:s=>{const l={...o,[e.field.text]:s};n(l)},value:o[e.field.text]||"",label:e.inputLabel,placeholder:e.placeholder}),t.jsxRuntimeExports.jsx(t.Switch,{current:!!o[e.field.switch]||!1,label:e.switchLabel,onChange:s=>{const l={...o,[e.field.switch]:s};n(l)}})]});if(e.type==="list")return t.jsxRuntimeExports.jsx(tt,{items:o[e.field]||[],setItems:s=>{const l={...o,[e.field]:s};n(l)},itemsType:"select",draggable:e.draggable||!1,itemsOptions:e.itemsOptions,deletable:e.deletable||!1,editable:!1,subtitle:e.label});if(e.type==="select")return t.jsxRuntimeExports.jsx(t.Select,{options:e.itemsOptions,onChange:s=>{const l={...o,[e.field]:s};n(l)},label:e.label,value:o[e.field]||"String",leftAddon:e.leftAddon&&e.leftAddon==="icon"&&t.jsxRuntimeExports.jsx(t.Icon,{name:o[e.field]})})})})]})},Zt="_other_1wtgi_1",te="_subtitle_1wtgi_7",ee="_items_1wtgi_14",K={other:Zt,subtitle:te,items:ee},Z=d=>{const{items:o,title:n="Other"}=d;return t.jsxRuntimeExports.jsxs("div",{className:K.other,children:[t.jsxRuntimeExports.jsx("h5",{className:K.subtitle,children:n}),t.jsxRuntimeExports.jsx("div",{className:K.items,children:o.map(i=>t.jsxRuntimeExports.jsx(t.Switch,{current:i.isItem,onChange:c=>i.setIsItem(c),label:i.label,hasBackground:!0,paddingless:!1}))})]})},se=d=>{const{index:o,moveProduct:n,children:i}=d,[,c]=t.useDrop({accept:"product",hover(s){s.index!==o&&(n(s.index,o),s.index=o)}}),[{isDragging:r},e]=t.useDrag({type:"product",item:{index:o},collect:s=>({isDragging:s.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:s=>e(c(s)),className:`${k.product} ${r?k.dragging:""}`,children:i})},tt=d=>{const{isActiveItems:o,setIsActiveItems:n,items:i,setItems:c,other:r,title:e,subtitle:s,editable:l=!0,draggable:R=!1,withImage:m=!1,deletable:f=!0,addable:u=!0,itemsType:y,itemsPlaceholder:j="",itemsOptions:_,hasRangeSelector:w=!1,rangeSelectorOptions:G,modalOptions:U,addableOptions:M={},limit:B}=d,[A,O]=p.useState(null),[Y,X]=p.useState({top:0,left:0}),[x,g]=p.useState(!1),N=(a,$)=>{const C=[...i],[b]=C.splice(a,1);C.splice($,0,b),c(C)};p.useEffect(()=>{const a=()=>{O(null),g(!1)};return document.body.addEventListener("click",a),O(null),g(!1),()=>{O(null),g(!1),document.body.removeEventListener("click",a)}},[]),p.useEffect(()=>{if(A){const a=[...i].map($=>$.id===A.id?A:$);c(a)}},[A]);const v=(a,$)=>{a.stopPropagation(),g(!0);const C=a.target.getBoundingClientRect(),b=500,H=window.innerHeight;let S=C.top+window.scrollY;S+b>H&&(S=H-b-20),X({top:S-80,left:C.left-30}),O($)};function L(a){if(m)return a?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${a[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const P=(a,$)=>{const C=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[R&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),y==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:b=>{const S=[...i].map(D=>D.id===a.id?{...a,name:b}:D);O({...a,name:b}),c([...S])},value:a.name,options:_,leftAddon:L(a.images)}),y==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:b=>{const S=[...i].map(D=>D.id===a.id?{...a,name:b}:D);c([...S])},value:a.name,placeholder:j}),y==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:b=>{const S=[...i].map(D=>D.id===a.id?{...a,images:b}:D);c([...S])}}),t.jsxRuntimeExports.jsxs("div",{className:k.buttons,children:[l&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:b=>v(b,a)}),f&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>c(i.filter(b=>b.id!==a.id))})]})]});return R?t.jsxRuntimeExports.jsx(se,{product:a,index:$,moveProduct:N,children:C},a.id):t.jsxRuntimeExports.jsx("div",{className:k.product,children:C},a.id)};return t.jsxRuntimeExports.jsxs("div",{className:k.productsBlock,children:[(e||o!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:k.top,children:[e&&t.jsxRuntimeExports.jsx("h3",{className:k.title,children:e}),o!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:o,onChange:a=>n==null?void 0:n(a)})]}),A&&l&&U&&x&&t.jsxRuntimeExports.jsx(Wt,{activeItem:A,setActiveItem:O,popupPosition:Y,modalOptions:U,setIsOpenModal:g}),w&&G&&t.jsxRuntimeExports.jsx(st,{...G}),t.jsxRuntimeExports.jsxs("div",{className:k.products,children:[s&&t.jsxRuntimeExports.jsx("h5",{className:k.subtitle,children:s}),R?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:i.map((a,$)=>P(a,$))}):i.map((a,$)=>P(a,$)),u&&t.jsxRuntimeExports.jsxs(t.Button,{className:t.clx(k.button,{[k.disabled]:!!(B&&B<=i.length)}),size:"s",disabled:!!(B&&B<=i.length),onClick:()=>{const a=[...i];y==="select"?a.push({name:_[0]||`Product ${i.length+1}`,id:t.v4(),...M}):y==="input"?a.push({name:"",id:t.v4(),...M}):a.push({name:`Image ${i.length+1}`,id:t.v4(),...M}),c(a)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})]}),r!==void 0&&t.jsxRuntimeExports.jsx(Z,{items:r})]})},ne="_subtitle_41klp_1",oe="_header_41klp_8",ie="_text_41klp_9",ce="_productsBlock_41klp_10",re="_buttonsBlock_41klp_11",ae="_top_41klp_21",le="_itemsBlock_41klp_28",xe="_typeTexts_41klp_34",ue="_block_41klp_40",de="_active_41klp_51",me="_products_41klp_10",pe="_product_41klp_10",_e="_button_41klp_11",he="_image_41klp_79",je="_info_41klp_86",ge="_name_41klp_97",be="_buttons_41klp_11",fe="_modal_41klp_107",Re="_other_41klp_124",ve="_options_41klp_130",q={subtitle:ne,header:oe,text:ie,productsBlock:ce,buttonsBlock:re,top:ae,itemsBlock:le,typeTexts:xe,block:ue,active:de,products:me,product:pe,button:_e,image:he,info:je,name:ge,buttons:be,modal:fe,other:Re,options:ve},Ee=d=>{const{activeButton:o,setActiveButton:n,popupPosition:i}=d,[c,r]=p.useState(o.typesText),[e,s]=p.useState(o.destination),[l,R]=p.useState(o.link||""),[m,f]=p.useState(o.text||"");return p.useEffect(()=>{n({...o,...{text:m,link:l,destination:e,typesText:c}})},[c,e,l,m]),t.jsxRuntimeExports.jsxs("div",{className:q.modal,onClick:u=>{u.stopPropagation()},style:{top:`${i.top}px`,left:`${i.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:q.top,children:[t.jsxRuntimeExports.jsx("h3",{children:o.type}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>n(null)})]}),t.jsxRuntimeExports.jsxs("div",{className:q.options,children:[t.jsxRuntimeExports.jsx(t.Select,{label:"Destination",onChange:u=>s(u),options:["Go to Page","Open Link"],value:e}),e==="Go to Page"?t.jsxRuntimeExports.jsx(t.Select,{label:"Go to",onChange:()=>{},options:[],value:"Homepage"}):t.jsxRuntimeExports.jsx(t.Input,{onChange:u=>R(u),value:l,placeholder:"https://",label:"Link"}),t.jsxRuntimeExports.jsx(t.Switch,{current:!1,label:"Open in new tab"}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:u=>f(u),value:m,label:"Text",maxLength:150}),t.jsxRuntimeExports.jsx(Q,{typesText:c,setTypesText:r})]})]})},ke="_subtitle_1y5sw_1",ye="_header_1y5sw_8",$e="_text_1y5sw_9",Ie="_productsBlock_1y5sw_10",we="_buttonsBlock_1y5sw_11",Ne="_top_1y5sw_22",Ce="_itemsBlock_1y5sw_29",Be="_typeTexts_1y5sw_35",Pe="_block_1y5sw_41",Te="_active_1y5sw_52",Se="_products_1y5sw_10",Ae="_product_1y5sw_10",Oe="_button_1y5sw_11",De="_image_1y5sw_80",Le="_info_1y5sw_87",qe="_name_1y5sw_98",Me="_buttons_1y5sw_11",He="_modal_1y5sw_108",ze="_other_1y5sw_125",Fe="_options_1y5sw_131",V={subtitle:ke,header:ye,text:$e,productsBlock:Ie,buttonsBlock:we,top:Ne,itemsBlock:Ce,typeTexts:Be,block:Pe,active:Te,products:Se,product:Ae,button:Oe,image:De,info:Le,name:qe,buttons:Me,modal:He,other:ze,options:Fe},et=d=>{const{buttons:o,setButtons:n,deletable:i=!0,addable:c=!0}=d,[r,e]=p.useState(null),[s,l]=p.useState({top:0,left:0});p.useEffect(()=>{const m=()=>{e(null)};return document.body.addEventListener("click",m),e(null),()=>{e(null),document.body.removeEventListener("click",m)}},[]),p.useEffect(()=>{if(r){const m=[...o].map(f=>f.id===r.id?r:f);n(m)}},[r]);const R=(m,f)=>{m.stopPropagation();const u=m.target.getBoundingClientRect(),y=490,j=window.innerHeight;let _=u.top+window.scrollY;_+y>j&&(_=j-y-20),l({top:_,left:u.left-30}),e(f)};return t.jsxRuntimeExports.jsxs("div",{className:V.products,children:[t.jsxRuntimeExports.jsx("h5",{className:V.subtitle,children:"Button Type"}),o.map(m=>t.jsxRuntimeExports.jsxs("div",{className:V.product,children:[t.jsxRuntimeExports.jsx(t.Select,{onChange:f=>{const y=[...o].map(j=>j.id===m.id?{...m,type:f}:j);n(y)},value:m.type,options:["Primary","Secondary","Tertiary"]}),t.jsxRuntimeExports.jsxs("div",{className:V.buttons,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:f=>{R(f,m)}}),i&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,onClick:()=>{const f=o.filter(u=>u.id!==m.id);n(f)},width:20,height:20,fill:"#C12A2A"})]})]},m.id)),r&&t.jsxRuntimeExports.jsx(Ee,{activeButton:r,setActiveButton:e,popupPosition:s}),c&&t.jsxRuntimeExports.jsxs(t.Button,{className:V.button,size:"s",onClick:()=>{const m=[...o];m.push({type:"Primary",id:t.v4(),typesText:[],destination:"Go to Page",text:""}),n(m)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})]})},Ve=d=>{const{isActiveButtons:o,setIsActiveButtons:n,buttons:i,setButtons:c}=d;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs("div",{className:q.buttonsBlock,children:[t.jsxRuntimeExports.jsxs("div",{className:q.top,children:[t.jsxRuntimeExports.jsx("h3",{className:q.title,children:"Buttons"}),t.jsxRuntimeExports.jsx(t.Switch,{current:o,onChange:r=>n(r)})]}),t.jsxRuntimeExports.jsx(et,{buttons:i,setButtons:c})]})})},Ge="_wrapper_tn7gb_1",Ue="_subtitle_tn7gb_7",Xe="_content_tn7gb_14",Ye="_range_tn7gb_21",Je="_track_tn7gb_26",Ke="_progress_tn7gb_35",Qe="_dots_tn7gb_45",We="_dot_tn7gb_45",Ze="_active_tn7gb_62",ts="_input_tn7gb_74",es="_countBlock_tn7gb_88",ss="_count_tn7gb_88",ns="_controls_tn7gb_103",os="_button_tn7gb_108",E={wrapper:Ge,subtitle:Ue,content:Xe,range:Ye,track:Je,progress:Ke,dots:Qe,dot:We,active:Ze,input:ts,countBlock:es,count:ss,controls:ns,button:os},st=d=>{const{label:o,min:n=1,max:i=4,step:c=1,count:r,setCount:e}=d,[s,l]=p.useState(!1),R=Array.from({length:(i-n)/c+1}),m=(r-n)/(i-n)*100,f=()=>{r<i&&e(r+c)},u=()=>{r>n&&e(r-c)},y=j=>{const _=n+j*c;e(_)};return t.jsxRuntimeExports.jsxs("div",{className:E.wrapper,children:[o&&t.jsxRuntimeExports.jsx("h5",{className:E.subtitle,children:o}),t.jsxRuntimeExports.jsxs("div",{className:E.content,children:[t.jsxRuntimeExports.jsxs("div",{className:E.range,children:[t.jsxRuntimeExports.jsx("div",{className:E.track}),t.jsxRuntimeExports.jsx("div",{className:E.progress,style:{width:`${m}%`}}),t.jsxRuntimeExports.jsx("div",{className:E.dots,children:R.map((j,_)=>{const w=_<=(r-n)/c;return t.jsxRuntimeExports.jsx("button",{onClick:()=>y(_),className:t.clx(E.dot,{[E.active]:w,[E.inactive]:!w,[E.dragging]:s}),"aria-label":`Set value to ${n+_*c}`},_)})}),t.jsxRuntimeExports.jsx("input",{type:"range",min:n,max:i,step:c,value:r,onChange:j=>e(Number(j.target.value)),onMouseDown:()=>l(!0),onMouseUp:()=>l(!1),onTouchStart:()=>l(!0),onTouchEnd:()=>l(!1),className:E.input})]}),t.jsxRuntimeExports.jsxs("div",{className:E.countBlock,children:[t.jsxRuntimeExports.jsx(t.Input,{type:"number",min:n,max:i,paddingless:!0,onChange:j=>{const _=Number(j);_>i?e(i):_<n?e(n):e(_)},value:String(r)}),t.jsxRuntimeExports.jsxs("div",{className:E.controls,children:[t.jsxRuntimeExports.jsx("button",{onClick:f,disabled:r>=i,className:E.button,"aria-label":"Increment count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretUp",width:15,height:15})}),t.jsxRuntimeExports.jsx("button",{onClick:u,disabled:r<=n,className:E.button,"aria-label":"Decrement count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown",width:15,height:15})})]})]})]})]})},is="_subtitle_1nl8x_1",cs="_header_1nl8x_8",rs="_text_1nl8x_9",as="_productsBlock_1nl8x_10",ls="_top_1nl8x_22",xs="_itemsBlock_1nl8x_29",us="_typeTexts_1nl8x_35",ds="_block_1nl8x_41",ms="_active_1nl8x_52",ps="_products_1nl8x_10",_s="_product_1nl8x_10",hs="_button_1nl8x_70",js="_image_1nl8x_80",gs="_info_1nl8x_87",bs="_name_1nl8x_98",fs="_buttons_1nl8x_102",Rs="_modal_1nl8x_108",vs="_link_1nl8x_126",Es="_modalOptions_1nl8x_132",I={subtitle:is,header:cs,text:rs,productsBlock:as,top:ls,itemsBlock:xs,typeTexts:us,block:ds,active:ms,products:ps,product:_s,button:hs,image:js,info:gs,name:bs,buttons:fs,modal:Rs,link:vs,modalOptions:Es},ks=d=>{const{activeItem:o,setActiveItem:n,popupPosition:i,setIsOpenModal:c}=d;return t.jsxRuntimeExports.jsxs("div",{className:I.modal,onClick:r=>{r.stopPropagation()},style:{top:`${i.top}px`,left:`${i.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:I.top,children:[t.jsxRuntimeExports.jsx("h3",{children:o.name}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{c(!1),n(null)}})]}),t.jsxRuntimeExports.jsx("div",{className:I.modalOptions,children:t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",onChange:r=>{const e={...o,images:r,imagePath:r[0]};n(e)}})})]})},ys=d=>{const{index:o,moveProduct:n,children:i}=d,[,c]=t.useDrop({accept:"product",hover(s){s.index!==o&&(n(s.index,o),s.index=o)}}),[{isDragging:r},e]=t.useDrag({type:"product",item:{index:o},collect:s=>({isDragging:s.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:s=>e(c(s)),className:`${I.product} ${r?I.dragging:""}`,children:i})},$s=d=>{const{isActiveItems:o,setIsActiveItems:n,items:i,setItems:c,other:r,title:e,subtitle:s,editable:l=!0,draggable:R=!1,withImage:m=!1,deletable:f=!0,addable:u=!0,itemsType:y,itemsOptions:j}=d,[_,w]=p.useState(null),[G,U]=p.useState({top:0,left:0}),[M,B]=p.useState(!1),A=(x,g)=>{const N=[...i],[v]=N.splice(x,1);N.splice(g,0,v),c(N)};p.useEffect(()=>{const x=()=>{w(null),B(!1)};return document.body.addEventListener("click",x),w(null),B(!1),()=>{w(null),B(!1),document.body.removeEventListener("click",x)}},[]),p.useEffect(()=>{if(_){const x=[...i].map(g=>g.id===_.id?_:g);c(x)}},[_]);const O=(x,g)=>{x.stopPropagation();const N=x.target.getBoundingClientRect(),v=100,L=window.innerHeight;let P=N.top+window.scrollY;P+v>L&&(P=L-v-20),B(!0),U({top:P-80,left:N.left-30}),w(g)};function Y(x){if(m)return x?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${x}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const X=(x,g)=>{const N=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[R&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),y==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:v=>{const L=[...i],P=Number(v.split(" ")[1]),a=j.find(b=>b.id===P);if(!a)return;const $={...a.productData.stats,newPrice:a.productData.minPrice.amount,oldPrice:a.productData.compareAtPrice.amount},C=L.map(b=>b.id===x.id?{...x,name:v,listingId:P,stats:$}:b);w({...x,name:v,listingId:P}),c([...C])},value:x.name,options:[...j.map(v=>`Product ${v.id}`)],leftAddon:Y(x.images[0])}),t.jsxRuntimeExports.jsxs("div",{className:I.buttons,children:[l&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:v=>O(v,x)}),f&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>c(i.filter(v=>v.id!==x.id))})]})]});return R?t.jsxRuntimeExports.jsx(ys,{product:x,index:g,moveProduct:A,children:N},x.id):t.jsxRuntimeExports.jsx("div",{className:I.product,children:N},x.id)};return t.jsxRuntimeExports.jsxs("div",{className:I.productsBlock,children:[(e||o!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:I.top,children:[e&&t.jsxRuntimeExports.jsx("h3",{className:I.title,children:e}),o!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:o,onChange:x=>n==null?void 0:n(x)})]}),M&&_&&t.jsxRuntimeExports.jsx(ks,{activeItem:_,setActiveItem:w,setIsOpenModal:B,popupPosition:G}),t.jsxRuntimeExports.jsxs("div",{className:I.products,children:[s&&t.jsxRuntimeExports.jsx("h5",{className:I.subtitle,children:s}),R?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:i.map((x,g)=>X(x,g))}):i.map((x,g)=>X(x,g)),u&&t.jsxRuntimeExports.jsxs(t.Button,{className:I.button,size:"s",onClick:()=>{const x=[...i],g=j[0].id;x.push({name:`Product ${g}`,id:t.v4(),listingId:g,imagePath:"",images:[],stats:{...j[0].productData.stats,newPrice:j[0].productData.minPrice.amount,oldPrice:j[0].productData.compareAtPrice.amount}}),c(x)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})]}),r!==void 0&&t.jsxRuntimeExports.jsx(Z,{items:r})]})},Is="_options_163bj_1",ws="_price_163bj_12",Ns="_oldPrice_163bj_18",Cs="_newPrice_163bj_26",Bs="_meta_163bj_33",Ps="_info_163bj_39",Ts="_infoRight_163bj_46",Ss="_buttons_163bj_52",As="_variants_163bj_59",Os="_variant_163bj_59",Ds="_stock_163bj_74",Ls="_variantInfo_163bj_81",qs="_quantity_163bj_87",Ms="_count_163bj_93",Hs="_button_163bj_52",zs="_activeVariant_163bj_110",Fs="_chargeTypes_163bj_114",Vs="_charge_163bj_114",Gs="_chargeActive_163bj_131",h={options:Is,price:ws,oldPrice:Ns,newPrice:Cs,meta:Bs,info:Ps,infoRight:Ts,buttons:Ss,variants:As,variant:Os,stock:Ds,variantInfo:Ls,quantity:qs,count:Ms,button:Hs,activeVariant:zs,chargeTypes:Fs,charge:Vs,chargeActive:Gs},Us=d=>{const{variants:o}=d,[n,i]=p.useState(o[0]),[c,r]=p.useState(1);function e(s){if(s>=864e5){const u=Math.floor(s/864e5);return`${u} ${u===1?"day":"days"}`}else if(s>=36e5){const u=Math.floor(s/36e5);return`${u} ${u===1?"hour":"hours"}`}else if(s>=6e4){const u=Math.floor(s/6e4);return`${u} ${u===1?"minute":"minutes"}`}else{const u=Math.floor(s/1e3);return`${u} ${u===1?"second":"seconds"}`}}return t.jsxRuntimeExports.jsxs("div",{className:h.options,children:[t.jsxRuntimeExports.jsx("div",{className:h.chargeTypes,children:n.chargeTypes?n.chargeTypes.map(s=>t.jsxRuntimeExports.jsx("div",{children:s})):t.jsxRuntimeExports.jsx("div",{className:t.clx(h.charge,h.chargeActive),children:"One-Time"})}),t.jsxRuntimeExports.jsx("div",{className:h.variants,children:o.map(s=>t.jsxRuntimeExports.jsxs("div",{className:t.clx(h.variant,{[h.activeVariant]:n.id===s.id}),onClick:()=>i(s),children:[t.jsxRuntimeExports.jsxs("div",{className:h.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:h.title,children:s.name}),t.jsxRuntimeExports.jsxs("span",{children:["$",s.price.amount]})]}),t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsxs("span",{className:h.stock,children:[s.quantity.restrictions.max||0," in stock"]})})]}))}),t.jsxRuntimeExports.jsxs("div",{className:h.quantity,children:[t.jsxRuntimeExports.jsx("div",{onClick:()=>{c>0?r(s=>s-1):r(0)},className:h.button,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus"})}),t.jsxRuntimeExports.jsx("div",{className:h.count,children:c}),t.jsxRuntimeExports.jsx("div",{onClick:()=>r(s=>s+1),className:h.button,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus"})})]}),t.jsxRuntimeExports.jsxs("div",{className:h.meta,children:[t.jsxRuntimeExports.jsxs("div",{className:h.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Delivery"}),t.jsxRuntimeExports.jsxs("div",{className:h.infoRight,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Lightning",fill:"#FF3F19",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{children:n.deliveryTime===0?"Instant":e(n.deliveryTime)})]})]}),t.jsxRuntimeExports.jsxs("div",{className:h.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Price"}),t.jsxRuntimeExports.jsx("div",{className:h.infoRight,children:n.compareAtPrice&&(n.compareAtPrice.amount||0)-(n.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:h.price,children:[t.jsxRuntimeExports.jsxs("span",{className:h.newPrice,children:["$ ",(n.price.amount||0)*c]}),t.jsxRuntimeExports.jsxs("span",{className:h.oldPrice,children:["$ ",(n.compareAtPrice.amount||0)*c]})]}):t.jsxRuntimeExports.jsxs("span",{className:h.newPrice,children:["$ ",(n.price.amount||0)*c]})})]})]}),t.jsxRuntimeExports.jsxs("div",{className:h.buttons,children:[t.jsxRuntimeExports.jsx(t.Button,{type:"Primary",children:"Buy Now"}),t.jsxRuntimeExports.jsx(t.Button,{type:"Secondary",children:"Add to Cart"})]})]})};exports.Button=t.Button;exports.Checkbox=t.Checkbox;exports.ChooseImage=t.ChooseImage;exports.ChooseImageModal=t.ChooseImageModal;exports.ColorPicker=t.ColorPicker;exports.Icon=t.Icon;exports.Input=t.Input;exports.Loader=t.Loader;exports.Modal=t.Modal;exports.Picker=t.Picker;exports.Radio=t.Radio;exports.Select=t.Select;exports.Submodal=t.Submodal;exports.Switch=t.Switch;exports.Textarea=t.Textarea;exports.Tip=t.Tip;exports.Accordion=at;exports.ButtonTypeSettings=et;exports.ButtonsSettings=Ve;exports.ItemsSettings=tt;exports.LayoutSettings=vt;exports.ListingSelector=$s;exports.ProductOptions=Us;exports.RangeSelector=st;exports.TextSettings=W;exports.TypesText=Q;
|