@ikas/popup-renderer 0.0.10 → 0.0.12
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
|
|
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 g}from"../models/modal/step/elements/image-column/index.js";import{observer as v}from'./../../ext/mobx-react-lite/es/observer.js';var T=v((function(v){var T,b,y,O,_=v.popup,I=v.dynamicData,h=v.dashboardComponents,C=v.onModalClose,M=_.modal,R=M.teaser,A=!!M.selectedStep.isTeaser,S=M.selectedStep.elements.find((function(e){return e.type===s.IMAGE_COLUMN})),D=A?R.backgroundSettings:M.backgroundSettings,w=A?R.windowSettings:M.windowSettings,k=A?R.closeSettings:M.closeSettings,N=D.allowScrollingWhenPopupOpen,j=!!_.isPreviewMode||M.isVisible;j&&(document.body.style.overflow=N?"auto":"hidden");var L=D.overlay,U=D.border,B="center",W="center";switch(A?t.POPUP:M.type){case t.POPUP:var F=A?R.position:M.position;F===o.POPUP_TOP_LEFT?(B="flex-start",W="flex-start"):F===o.POPUP_TOP_CENTER?(B="center",W="flex-start"):F===o.POPUP_TOP_RIGHT?(B="flex-end",W="flex-start"):F===o.POPUP_MIDDLE_LEFT?(B="flex-start",W="center"):F===o.POPUP_MIDDLE_CENTER?(B="center",W="center"):F===o.POPUP_MIDDLE_RIGHT?(B="flex-end",W="center"):F===o.POPUP_BOTTOM_LEFT?(B="flex-start",W="flex-end"):F===o.POPUP_BOTTOM_CENTER?(B="center",W="flex-end"):F===o.POPUP_BOTTOM_RIGHT&&(B="flex-end",W="flex-end");break;case t.DRAWER:M.position===o.DRAWER_LEFT?(B="flex-start",W="center"):M.position===o.DRAWER_RIGHT&&(B="flex-end",W="center");break;case t.NOTIFICATION_BAR:M.position===o.NOTIFICATION_BAR_UP?(B="center",W="flex-start"):M.position===o.NOTIFICATION_BAR_DOWN&&(B="center",W="flex-end")}var H={position:"fixed",display:"flex",justifyContent:B,alignItems:W,top:0,left:0,right:0,bottom:0,zIndex:1e3,overflow:"hidden",padding:"".concat(w.outerVerticalPadding,"px ").concat(w.outerHorizontalPadding,"px"),opacity:j?1:0,visibility:j?"visible":"hidden",transition:"opacity 0.3s ease, visibility 0.3s ease"},V={position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1001,backgroundColor:L?L.bgColor:"",opacity:L?(L.bgOpacity||100)/100:void 0},G={position:"relative",zIndex:1002,display:"flex",flexDirection:S?S.imagePosition===g.LEFT_ALIGN?"row-reverse":"row":"column",backgroundColor:D.bgColor,border:U?"".concat(U.borderWidth,"px ").concat(U.borderStyle," ").concat(U.borderColor):"",borderRadius:"".concat(w.borderRadius,"px"),width:w.takeFullWidth?"100%":void 0,maxWidth:"100%",maxHeight:"100%",height:w.takeFullHeight?"100%":w.maxHeight,boxShadow:D.shadow?"0 0 10px ".concat(D.shadow.color):"",opacity:j?1:0,visibility:j?"visible":"hidden",transition:"opacity 0.3s ease, visibility 0.3s ease"},z="";switch(null==S?void 0:S.verticalAlignment){case d.BOTTOM:z="flex-end";break;case d.MIDDLE:z="center";break;case d.TOP:z="flex-start"}var K={width:w.takeFullWidth?"100%":w.maxWidth,maxWidth:"100%",overflow:"auto",display:"flex",flexDirection:"column",alignItems:z,borderRadius:"".concat(w.borderRadius,"px")},X={position:k.closeButtonPositionType===n.TAKE_SPACE?"relative":"absolute",float:k.closeButtonPositionType===n.TAKE_SPACE?"right":"none",top:8,right:8,zIndex:1003},Y={position:"sticky",padding:"6px",marginLeft:k.closeButtonPositionType===n.TAKE_SPACE?"14px":void 0,display:"flex",justifyContent:"center",alignItems:"center",border:(null===(T=k.iconSettings)||void 0===T?void 0:T.type)===r.WITH_BORDER?"1px solid ".concat(null===(b=k.iconSettings)||void 0===b?void 0:b.color):"",borderRadius:"50%",backgroundColor:null===(y=k.iconSettings)||void 0===y?void 0:y.backgroundColor},q={color:null===(O=k.iconSettings)||void 0===O?void 0:O.color,cursor:"pointer"},J=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});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})}},Q=function(){_.isPreviewMode||M.isVisible&&(M.isVisible=!1,C&&C())};return e.createElement("div",{className:"ikas-popup-default-styles",id:"ikas-popup-container",style:H,onClick:function(e){A&&(M.selectedStep=M.steps[0])}},e.createElement("div",{style:G},k.closeButtonDisplayType!==l.ALWAYS_HIDDEN&&e.createElement("div",{style:X,onClick:function(){return Q()}},e.createElement("div",{style:Y,className:k.closeButtonDisplayType===l.VISIBLE_ON_HOVER?"visible-on-hover":""},e.createElement(i,{style:q}))),e.createElement("div",{style:K},M.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 J(e)}))),S&&J(S)),e.createElement("div",{style:V,onClick:function(){return Q()}}))}));export{T as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{makeObservable as t,observable as i,computed as e,action as P}from"mobx";import{PopupStep as n}from"./step/index.js";import{Teaser as s}from"./teaser/index.js";import{WindowSettings as o}from"./window-settings/index.js";import{Border as O,BackgroundSettings as T}from"./background-settings/index.js";import{CloseSettings as _}from"./close-settings/index.js";var I,r;!function(t){t.POPUP="POPUP",t.NOTIFICATION_BAR="NOTIFICATION_BAR",t.DRAWER="DRAWER"}(I||(I={})),function(t){t.POPUP_TOP_LEFT="POPUP_TOP_LEFT",t.POPUP_TOP_CENTER="POPUP_TOP_CENTER",t.POPUP_TOP_RIGHT="POPUP_TOP_RIGHT",t.POPUP_MIDDLE_LEFT="POPUP_MIDDLE_LEFT",t.POPUP_MIDDLE_CENTER="POPUP_MIDDLE_CENTER",t.POPUP_MIDDLE_RIGHT="POPUP_MIDDLE_RIGHT",t.POPUP_BOTTOM_LEFT="POPUP_BOTTOM_LEFT",t.POPUP_BOTTOM_CENTER="POPUP_BOTTOM_CENTER",t.POPUP_BOTTOM_RIGHT="POPUP_BOTTOM_RIGHT",t.NOTIFICATION_BAR_UP="NOTIFICATION_BAR_UP",t.NOTIFICATION_BAR_DOWN="NOTIFICATION_BAR_DOWN",t.DRAWER_RIGHT="DRAWER_RIGHT",t.DRAWER_LEFT="DRAWER_LEFT"}(r||(r={}));var R=function(){function R(O){this.type=O.type||I.POPUP,this.teaser=O.teaser?new s(O.teaser):new s({backgroundSettings:new T({allowScrollingWhenPopupOpen:!0})}),this.windowSettings=O.windowSettings?new o(O.windowSettings):new o({}),this.backgroundSettings=new T(O.backgroundSettings||{}),this.closeSettings=new _(O.closeSettings||{}),this.steps=O.steps&&O.steps.length?O.steps.map((function(t){return new n(t)})):[new n({stepNumber:1,name:"TODO",isThankYouStep:!1})],this.isVisible=!1,this.selectedStep=this.steps[0],this.position=O.position?O.position:r.POPUP_MIDDLE_CENTER,t(this,{type:i,position:i,teaser:i,windowSettings:i,backgroundSettings:i,closeSettings:i,steps:i,selectedStep:i,availablePositions:e,setInitialSettings:P,setInitialPosition:P,setInitialWindowSettings:P})}return R.prototype.setInitialSettings=function(t){void 0===t&&(t=!1),this.setInitialPosition(t),this.setInitialWindowSettings(t)},R.prototype.setInitialPosition=function(t){switch(this.type){case I.POPUP:this.position=t?r.POPUP_BOTTOM_RIGHT:r.POPUP_MIDDLE_CENTER;break;case I.NOTIFICATION_BAR:this.position=r.NOTIFICATION_BAR_UP;break;case I.DRAWER:this.position=r.DRAWER_RIGHT}},R.prototype.setInitialWindowSettings=function(t){switch(this.type){case I.POPUP:this.windowSettings=new o({}),t&&(this.backgroundSettings.allowScrollingWhenPopupOpen=!0,this.backgroundSettings.overlay=null,this.backgroundSettings.border=new O({}));break;case I.NOTIFICATION_BAR:this.windowSettings=new o({outerHorizontalPadding:0,outerVerticalPadding:0,takeFullWidth:!0});break;case I.DRAWER:this.windowSettings=new o({outerHorizontalPadding:0,outerVerticalPadding:0,takeFullHeight:!0})}},Object.defineProperty(R.prototype,"availablePositions",{get:function(){var t;return(t={})[I.POPUP]=[r.POPUP_TOP_LEFT,r.POPUP_TOP_CENTER,r.POPUP_TOP_RIGHT,r.POPUP_MIDDLE_LEFT,r.POPUP_MIDDLE_CENTER,r.POPUP_MIDDLE_RIGHT,r.POPUP_BOTTOM_LEFT,r.POPUP_BOTTOM_CENTER,r.POPUP_BOTTOM_RIGHT],t[I.NOTIFICATION_BAR]=[r.NOTIFICATION_BAR_UP,r.NOTIFICATION_BAR_DOWN],t[I.DRAWER]=[r.DRAWER_RIGHT,r.DRAWER_LEFT],t},enumerable:!1,configurable:!0}),R}();export{R as Modal,r as PopupPositonEnum,I as PopupTypeEnum};
|
|
1
|
+
import{makeObservable as t,observable as i,computed as e,action as P}from"mobx";import{PopupStep as n}from"./step/index.js";import{Teaser as s}from"./teaser/index.js";import{WindowSettings as o}from"./window-settings/index.js";import{Border as O,BackgroundSettings as T}from"./background-settings/index.js";import{CloseSettings as _}from"./close-settings/index.js";var I,r;!function(t){t.POPUP="POPUP",t.NOTIFICATION_BAR="NOTIFICATION_BAR",t.DRAWER="DRAWER"}(I||(I={})),function(t){t.POPUP_TOP_LEFT="POPUP_TOP_LEFT",t.POPUP_TOP_CENTER="POPUP_TOP_CENTER",t.POPUP_TOP_RIGHT="POPUP_TOP_RIGHT",t.POPUP_MIDDLE_LEFT="POPUP_MIDDLE_LEFT",t.POPUP_MIDDLE_CENTER="POPUP_MIDDLE_CENTER",t.POPUP_MIDDLE_RIGHT="POPUP_MIDDLE_RIGHT",t.POPUP_BOTTOM_LEFT="POPUP_BOTTOM_LEFT",t.POPUP_BOTTOM_CENTER="POPUP_BOTTOM_CENTER",t.POPUP_BOTTOM_RIGHT="POPUP_BOTTOM_RIGHT",t.NOTIFICATION_BAR_UP="NOTIFICATION_BAR_UP",t.NOTIFICATION_BAR_DOWN="NOTIFICATION_BAR_DOWN",t.DRAWER_RIGHT="DRAWER_RIGHT",t.DRAWER_LEFT="DRAWER_LEFT"}(r||(r={}));var R=function(){function R(O){this.type=O.type||I.POPUP,this.teaser=O.teaser?new s(O.teaser):new s({backgroundSettings:new T({allowScrollingWhenPopupOpen:!0})}),this.windowSettings=O.windowSettings?new o(O.windowSettings):new o({}),this.backgroundSettings=new T(O.backgroundSettings||{}),this.closeSettings=new _(O.closeSettings||{}),this.steps=O.steps&&O.steps.length?O.steps.map((function(t){return new n(t)})):[new n({stepNumber:1,name:"TODO",isThankYouStep:!1})],this.isVisible=!1,this.selectedStep=this.steps[0],this.position=O.position?O.position:r.POPUP_MIDDLE_CENTER,t(this,{isVisible:i,type:i,position:i,teaser:i,windowSettings:i,backgroundSettings:i,closeSettings:i,steps:i,selectedStep:i,availablePositions:e,setInitialSettings:P,setInitialPosition:P,setInitialWindowSettings:P})}return R.prototype.setInitialSettings=function(t){void 0===t&&(t=!1),this.setInitialPosition(t),this.setInitialWindowSettings(t)},R.prototype.setInitialPosition=function(t){switch(this.type){case I.POPUP:this.position=t?r.POPUP_BOTTOM_RIGHT:r.POPUP_MIDDLE_CENTER;break;case I.NOTIFICATION_BAR:this.position=r.NOTIFICATION_BAR_UP;break;case I.DRAWER:this.position=r.DRAWER_RIGHT}},R.prototype.setInitialWindowSettings=function(t){switch(this.type){case I.POPUP:this.windowSettings=new o({}),t&&(this.backgroundSettings.allowScrollingWhenPopupOpen=!0,this.backgroundSettings.overlay=null,this.backgroundSettings.border=new O({}));break;case I.NOTIFICATION_BAR:this.windowSettings=new o({outerHorizontalPadding:0,outerVerticalPadding:0,takeFullWidth:!0});break;case I.DRAWER:this.windowSettings=new o({outerHorizontalPadding:0,outerVerticalPadding:0,takeFullHeight:!0})}},Object.defineProperty(R.prototype,"availablePositions",{get:function(){var t;return(t={})[I.POPUP]=[r.POPUP_TOP_LEFT,r.POPUP_TOP_CENTER,r.POPUP_TOP_RIGHT,r.POPUP_MIDDLE_LEFT,r.POPUP_MIDDLE_CENTER,r.POPUP_MIDDLE_RIGHT,r.POPUP_BOTTOM_LEFT,r.POPUP_BOTTOM_CENTER,r.POPUP_BOTTOM_RIGHT],t[I.NOTIFICATION_BAR]=[r.NOTIFICATION_BAR_UP,r.NOTIFICATION_BAR_DOWN],t[I.DRAWER]=[r.DRAWER_RIGHT,r.DRAWER_LEFT],t},enumerable:!1,configurable:!0}),R}();export{R as Modal,r as PopupPositonEnum,I as PopupTypeEnum};
|