@ikas/popup-renderer 1.0.1 → 1.0.3
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";import'./../../ext/mobx-react-lite/es/index.js';import{PopupTypeEnum as t,PopupPositonEnum as o}from"../models/modal/index.js";import i from"../assets/x-close.js";import{CloseButtonPositionTypeEnum as n,CloseIconTypeEnum as r,CloseButtonDisplayTypeEnum as l}from"../models/modal/close-settings/index.js";import{PopupElementTypeEnum as s,ComponentVerticalAlignmentEnum as d}from"../models/modal/step/elements/base/index.js";import a from"./text-element-renderer/index.js";import c from"./button-element-renderer/index.js";import m from"./space-element-renderer/index.js";import p from"./divider-element-renderer/index.js";import u from"./social-element-renderer/index.js";import f from"./image-element-renderer/index.js";import x from"./image-column-element-renderer/index.js";import P from"./product-list-renderer/index.js";import E from"./form-element-renderer/index.js";import{ImageColumnPositionEnum as v}from"../models/modal/step/elements/image-column/index.js";import{observer as T}from'./../../ext/mobx-react-lite/es/observer.js';var b=T((function(T){var b,g,y,O,_=T.popup,I=T.dynamicData,h=T.dashboardComponents,C=T.previewMode,M=T.onModalClose,R=_.modal,A=R.teaser,S=!!R.selectedStep.isTeaser,w=R.selectedStep.elements.find((function(e){return e.type===s.IMAGE_COLUMN})),D=S?A.backgroundSettings:R.backgroundSettings,k=S?A.windowSettings:R.windowSettings,j=S?A.closeSettings:R.closeSettings,N=D.allowScrollingWhenPopupOpen,L=_.isPreviewMode||C,U=!!L||R.isVisible;document.body.style.overflow=U&&!N?"hidden":"auto";var B=D.overlay,W=D.border,F="center",H="center";switch(S?t.POPUP:R.type){case t.POPUP:var V=S?A.position:R.position;V===o.POPUP_TOP_LEFT?(F="flex-start",H="flex-start"):V===o.POPUP_TOP_CENTER?(F="center",H="flex-start"):V===o.POPUP_TOP_RIGHT?(F="flex-end",H="flex-start"):V===o.POPUP_MIDDLE_LEFT?(F="flex-start",H="center"):V===o.POPUP_MIDDLE_CENTER?(F="center",H="center"):V===o.POPUP_MIDDLE_RIGHT?(F="flex-end",H="center"):V===o.POPUP_BOTTOM_LEFT?(F="flex-start",H="flex-end"):V===o.POPUP_BOTTOM_CENTER?(F="center",H="flex-end"):V===o.POPUP_BOTTOM_RIGHT&&(F="flex-end",H="flex-end");break;case t.DRAWER:R.position===o.DRAWER_LEFT?(F="flex-start",H="center"):R.position===o.DRAWER_RIGHT&&(F="flex-end",H="center");break;case t.NOTIFICATION_BAR:R.position===o.NOTIFICATION_BAR_UP?(F="center",H="flex-start"):R.position===o.NOTIFICATION_BAR_DOWN&&(F="center",H="flex-end")}var G={position:"fixed",display:"flex",justifyContent:F,alignItems:H,top:0,left:0,right:0,bottom:0,zIndex:
|
|
1
|
+
import e from"react";import'./../../ext/mobx-react-lite/es/index.js';import{PopupTypeEnum as t,PopupPositonEnum as o}from"../models/modal/index.js";import i from"../assets/x-close.js";import{CloseButtonPositionTypeEnum as n,CloseIconTypeEnum as r,CloseButtonDisplayTypeEnum as l}from"../models/modal/close-settings/index.js";import{PopupElementTypeEnum as s,ComponentVerticalAlignmentEnum as d}from"../models/modal/step/elements/base/index.js";import a from"./text-element-renderer/index.js";import c from"./button-element-renderer/index.js";import m from"./space-element-renderer/index.js";import p from"./divider-element-renderer/index.js";import u from"./social-element-renderer/index.js";import f from"./image-element-renderer/index.js";import x from"./image-column-element-renderer/index.js";import P from"./product-list-renderer/index.js";import E from"./form-element-renderer/index.js";import{ImageColumnPositionEnum as v}from"../models/modal/step/elements/image-column/index.js";import{observer as T}from'./../../ext/mobx-react-lite/es/observer.js';var b=T((function(T){var b,g,y,O,_=T.popup,I=T.dynamicData,h=T.dashboardComponents,C=T.previewMode,M=T.onModalClose,R=_.modal,A=R.teaser,S=!!R.selectedStep.isTeaser,w=R.selectedStep.elements.find((function(e){return e.type===s.IMAGE_COLUMN})),D=S?A.backgroundSettings:R.backgroundSettings,k=S?A.windowSettings:R.windowSettings,j=S?A.closeSettings:R.closeSettings,N=D.allowScrollingWhenPopupOpen,L=_.isPreviewMode||C,U=!!L||R.isVisible;document.body.style.overflow=U&&!N?"hidden":"auto";var B=D.overlay,W=D.border,F="center",H="center";switch(S?t.POPUP:R.type){case t.POPUP:var V=S?A.position:R.position;V===o.POPUP_TOP_LEFT?(F="flex-start",H="flex-start"):V===o.POPUP_TOP_CENTER?(F="center",H="flex-start"):V===o.POPUP_TOP_RIGHT?(F="flex-end",H="flex-start"):V===o.POPUP_MIDDLE_LEFT?(F="flex-start",H="center"):V===o.POPUP_MIDDLE_CENTER?(F="center",H="center"):V===o.POPUP_MIDDLE_RIGHT?(F="flex-end",H="center"):V===o.POPUP_BOTTOM_LEFT?(F="flex-start",H="flex-end"):V===o.POPUP_BOTTOM_CENTER?(F="center",H="flex-end"):V===o.POPUP_BOTTOM_RIGHT&&(F="flex-end",H="flex-end");break;case t.DRAWER:R.position===o.DRAWER_LEFT?(F="flex-start",H="center"):R.position===o.DRAWER_RIGHT&&(F="flex-end",H="center");break;case t.NOTIFICATION_BAR:R.position===o.NOTIFICATION_BAR_UP?(F="center",H="flex-start"):R.position===o.NOTIFICATION_BAR_DOWN&&(F="center",H="flex-end")}var G={position:"fixed",display:"flex",justifyContent:F,alignItems:H,top:0,left:0,right:0,bottom:0,zIndex:9995,overflow:"hidden",padding:"".concat(k.outerVerticalPadding,"px ").concat(k.outerHorizontalPadding,"px"),opacity:U?1:0,visibility:U?"visible":"hidden",transition:"opacity 0.3s ease, visibility 0.3s ease"},z={position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:9996,backgroundColor:B?B.bgColor:"",opacity:B?(B.bgOpacity||100)/100:void 0},K={position:"relative",zIndex:9997,display:"flex",flexDirection:w?w.imagePosition===v.LEFT_ALIGN?"row-reverse":"row":"column",backgroundColor:D.bgColor,border:W?"".concat(W.borderWidth,"px ").concat(W.borderStyle," ").concat(W.borderColor):"",borderRadius:"".concat(k.borderRadius,"px"),width:k.takeFullWidth?"100%":void 0,maxWidth:"100%",maxHeight:"100%",height:k.takeFullHeight?"100%":k.maxHeight,boxShadow:D.shadow?"0 0 10px ".concat(D.shadow.color):"",opacity:U?1:0,visibility:U?"visible":"hidden",transition:"opacity 0.3s ease, visibility 0.3s ease"},X="";switch(null==w?void 0:w.verticalAlignment){case d.BOTTOM:X="flex-end";break;case d.MIDDLE:X="center";break;case d.TOP:X="flex-start"}var Y={width:k.takeFullWidth?"100%":k.maxWidth,maxWidth:"100%",overflow:"auto",display:"flex",flexDirection:"column",justifyContent:X,borderRadius:"".concat(k.borderRadius,"px")},q={position:j.closeButtonPositionType===n.TAKE_SPACE?"relative":"absolute",float:j.closeButtonPositionType===n.TAKE_SPACE?"right":"none",top:8,right:8,zIndex:9998},J={position:"sticky",padding:"6px",marginLeft:j.closeButtonPositionType===n.TAKE_SPACE?"14px":void 0,display:"flex",justifyContent:"center",alignItems:"center",border:(null===(b=j.iconSettings)||void 0===b?void 0:b.type)===r.WITH_BORDER?"1px solid ".concat(null===(g=j.iconSettings)||void 0===g?void 0:g.color):"",borderRadius:"50%",backgroundColor:null===(y=j.iconSettings)||void 0===y?void 0:y.backgroundColor},Q={color:null===(O=j.iconSettings)||void 0===O?void 0:O.color,cursor:"pointer"},Z=function(t){var o=t.type,i=h&&h[o]&&h[o].length?h[o][0]:null,n=i&&_.marketingPopupViewModel?e.createElement(i,{element:t,marketingPopupViewModel:_.marketingPopupViewModel}):void 0;switch(o){case s.TEXT:return e.createElement(a,{element:t});case s.IMAGE:return e.createElement(f,{element:t,popup:_,editModeChildren:n});case s.IMAGE_COLUMN:return e.createElement(x,{element:t,popup:_,editModeChildren:n});case s.BUTTON:return e.createElement(c,{element:t});case s.DIVIDER:return e.createElement(p,{element:t});case s.FORM:return e.createElement(E,{element:t,popup:_,isPreviewMode:!!L});case s.PRODUCT_LIST:return e.createElement(P,{element:t,products:I.products[t.id],popup:_,editModeChildren:n});case s.SOCIAL_MEDIA:return e.createElement(u,{element:t,popup:_,editModeChildren:n});case s.SPACE:return e.createElement(m,{element:t})}},$=function(){L||R.isVisible&&(R.isVisible=!1,M&&M())};return e.createElement("div",{className:"ikas-popup-default-styles",id:"ikas-popup-container",style:G},e.createElement("div",{style:K,onClick:function(e){S&&(R.selectedStep=R.steps[0])}},j.closeButtonDisplayType!==l.ALWAYS_HIDDEN&&e.createElement("div",{style:q,onClick:function(){return $()}},e.createElement("div",{style:J,className:j.closeButtonDisplayType===l.VISIBLE_ON_HOVER?"visible-on-hover":""},e.createElement(i,{style:Q}))),e.createElement("div",{style:Y},R.selectedStep.elements.filter((function(e){return e.type!==s.IMAGE_COLUMN})).slice().sort((function(e,t){return e.order-t.order})).map((function(e){return Z(e)}))),w&&Z(w)),e.createElement("div",{style:z,onClick:function(){return $()}}))}));export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{makeObservable as e,observable as t,action as s}from"mobx";import{TextElement as n}from"./elements/text/index.js";import{FormElement as r}from"./elements/form/index.js";import{ImageElement as i}from"./elements/image/index.js";import{ProductListElement as m}from"./elements/product/index.js";import{ButtonElement as o}from"./elements/button/index.js";import{SocialMediaElement as a}from"./elements/social/index.js";import{DividerElement as h}from"./elements/divider/index.js";import{SpaceElement as u}from"./elements/space/index.js";import{PopupElementTypeEnum as p}from"./elements/base/index.js";import{ImageColumnElement as l}from"./elements/image-column/index.js";var d=function(){function d(r){var i=this;this.id=r.id||Date.now().toString(),this.stepNumber=r.stepNumber||0,this.name=r.name||"",this.isThankYouStep=r.isThankYouStep||!1,this.isTeaser=r.isTeaser||!1,this.elements=r.elements&&r.elements.length?r.elements.map((function(e){return i.setContent(e)})):[],this.isTeaser&&!this.elements.length&&this.elements.push(new n({order:0})),e(this,{stepNumber:t,name:t,isThankYouStep:t,isTeaser:t,elements:t,setContent:s.bound,addNewElement:s.bound})}return d.prototype.setContent=function(e){switch(e.type){case p.TEXT:return new n(e||{});case p.FORM:return new r(e||{});case p.IMAGE:return new i(e||{});case p.IMAGE_COLUMN:return new l(e||{});case p.PRODUCT_LIST:return new m(e||{});case p.BUTTON:return new o(e||{});case p.SOCIAL_MEDIA:return new a(e||{});case p.DIVIDER:return new h(e||{});case p.SPACE:return new u(e||{})}},d.prototype.addNewElement=function(e){var t=this.elements.length;switch(e){case p.TEXT:this.elements.push(new n({order:t}));break;case p.FORM:this.elements.push(new r({order:t}));break;case p.IMAGE:this.elements.push(new i({order:t}));break;case p.IMAGE_COLUMN:this.elements.push(new l({order:t}));break;case p.PRODUCT_LIST:this.elements.push(new m({order:t}));break;case p.BUTTON:this.elements.push(new o({order:t}));break;case p.SOCIAL_MEDIA:this.elements.push(new a({order:t}));break;case p.DIVIDER:this.elements.push(new h({order:t}));break;case p.SPACE:this.elements.push(new u({order:t}))}},d}();export{d as PopupStep};
|
|
1
|
+
import{makeObservable as e,observable as t,action as s}from"mobx";import{TextElement as n}from"./elements/text/index.js";import{FormElement as r}from"./elements/form/index.js";import{ImageElement as i}from"./elements/image/index.js";import{ProductListElement as m}from"./elements/product/index.js";import{ButtonElement as o}from"./elements/button/index.js";import{SocialMediaElement as a}from"./elements/social/index.js";import{DividerElement as h}from"./elements/divider/index.js";import{SpaceElement as u}from"./elements/space/index.js";import{PopupElementTypeEnum as p}from"./elements/base/index.js";import{ImageColumnElement as l}from"./elements/image-column/index.js";var d=function(){function d(r){var i=this;this.id=r.id||Date.now().toString(),this.stepNumber=r.stepNumber||0,this.name=r.name||"",this.isThankYouStep=r.isThankYouStep||!1,this.isTeaser=r.isTeaser||!1,this.elements=r.elements&&r.elements.length?r.elements.map((function(e){return i.setContent(e)})):[],this.isTeaser&&(this.id=this.id+"-teaser"),this.isTeaser&&!this.elements.length&&this.elements.push(new n({order:0})),e(this,{stepNumber:t,name:t,isThankYouStep:t,isTeaser:t,elements:t,setContent:s.bound,addNewElement:s.bound})}return d.prototype.setContent=function(e){switch(e.type){case p.TEXT:return new n(e||{});case p.FORM:return new r(e||{});case p.IMAGE:return new i(e||{});case p.IMAGE_COLUMN:return new l(e||{});case p.PRODUCT_LIST:return new m(e||{});case p.BUTTON:return new o(e||{});case p.SOCIAL_MEDIA:return new a(e||{});case p.DIVIDER:return new h(e||{});case p.SPACE:return new u(e||{})}},d.prototype.addNewElement=function(e){var t=this.elements.length;switch(e){case p.TEXT:this.elements.push(new n({order:t}));break;case p.FORM:this.elements.push(new r({order:t}));break;case p.IMAGE:this.elements.push(new i({order:t}));break;case p.IMAGE_COLUMN:this.elements.push(new l({order:t}));break;case p.PRODUCT_LIST:this.elements.push(new m({order:t}));break;case p.BUTTON:this.elements.push(new o({order:t}));break;case p.SOCIAL_MEDIA:this.elements.push(new a({order:t}));break;case p.DIVIDER:this.elements.push(new h({order:t}));break;case p.SPACE:this.elements.push(new u({order:t}))}},d}();export{d as PopupStep};
|