@bikdotai/bik-component-library 1.1.1-beta.55 → 1.1.1-beta.58
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
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react/jsx-runtime"),s=require("react"),i=require("./PostPicker.styled.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react/jsx-runtime"),s=require("react"),i=require("./PostPicker.styled.js"),r=require("../tag/Tag.js"),a=require("../TypographyStyle.js"),n=require("../../utils/unCamelCase.js"),l=require("../../constants/colors.js"),o=require("../../constants/Theme.js"),d=require("../../assets/icons/instagram.svg.js"),c=require("../../assets/icons/warning.svg.js"),m=require("../modals/styledModal.js"),h=require("../shimmer/ShimmerComponent/BikShimmer.js"),u=require("../shimmer-image/ShimmerImage.js"),g=require("../states/StateComponent.js");exports.MEDIA_TYPES=void 0,(e=exports.MEDIA_TYPES||(exports.MEDIA_TYPES={})).STORY="story",e.POST="post",e.REEL="reel";exports.PostPicker=e=>{var y,p;const[j,x]=s.useState(null!==(y=e.previouslySelected)&&void 0!==y?y:[]),[T,S]=s.useState(""),[v,b]=s.useState(!1);s.useEffect((()=>{e.media.length||(b(!0),setTimeout((()=>{b(!1)}),2e3)),x(e.selected||[])}),[]),s.useEffect((()=>{e.media.length>0&&b(!1)}),[null===(p=null==e?void 0:e.media)||void 0===p?void 0:p.length]),s.useEffect((()=>{j.length>0&&S("")}),[j.length]);return t.jsx(t.Fragment,{children:t.jsx(m.StyledModal,Object.assign({zIndex:201,open:e.showModal,headingTitle:e.title,onClose:e.onClose,centralContainerStyles:{width:1071,height:564},primaryButton:{disabled:!e.media.length,buttonType:"primary",buttonText:`Select ${n.unCamelCase(e.mediaType)}`,onClick:()=>{j.length?e.onSelect(j):S(`Please select a ${e.mediaType} to proceed`)}},secondaryButton:{buttonType:"secondary",buttonText:"Back",onClick:()=>e.onClose()},footerLeftCustomElement:T?t.jsx(r.Tag,{tagText:T,type:"negative",LeadingIcon:c.default}):j.length?t.jsxs(a.BodySecondary,{children:[j.length," selected"]}):null},{children:v?t.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:t.jsx(h.BikShimmer,{boxes:[{width:(e.mediaType==exports.MEDIA_TYPES.POST?148:104)+"px",height:(e.mediaType==exports.MEDIA_TYPES.POST?148:172)+"px"}]})})):t.jsx(t.Fragment,{children:e.media&&e.media.length?t.jsx(i.StyledProductGrid,Object.assign({mediaType:e.mediaType},{children:e.media.map((s=>{return t.jsxs(i.StyledProduct,Object.assign({mediaType:e.mediaType,className:""+(r=s,n=j,n.some((e=>e.id===r.id))?"selected":""),onClick:()=>{return t=s,void x((()=>(console.log("selectedMedia",j),console.log("selectedPost",t),j.includes(t)?j.filter((e=>e!==t)):!e.limit||j.length<e.limit?[...j,t]:(S(`Only ${e.limit} ${e.mediaType}s can be selected`),j))));var t}},{children:[t.jsx(u.ShimmerImage,{imageUrl:s.imageUrl,width:e.mediaType==exports.MEDIA_TYPES.POST?148:104,height:e.mediaType==exports.MEDIA_TYPES.POST?148:172,alt:s.overlayCaption}),t.jsxs("div",Object.assign({className:"overlay"},{children:[t.jsx("a",Object.assign({target:"_blank",rel:"noreferrer",href:s.redirectionUrl},{children:t.jsxs("div",Object.assign({className:"overlay__redirection"},{children:[t.jsx(d.default,{height:22,width:22}),t.jsx(a.BodyPrimary,Object.assign({color:l.PRIMARY,style:{fontWeight:500}},{children:"View"}))]}))})),t.jsx("div",Object.assign({className:"overlay__caption"},{children:t.jsx(a.BodyCaption,Object.assign({color:o.COLORS.content.placeholder},{children:s.overlayCaption}))}))]}))]}),s.id);var r,n}))})):t.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",display:"flex",height:422}},{children:t.jsx(g.StateComponent,{states:g.StateInterface.WARNING,heading:`No ${e.mediaType}s on your account`,subline:`There seems to be no ${e.mediaType}s on your account`,isButtonEnabled:!1,width:400})}))})}))})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,Fragment as t,jsxs as i}from"react/jsx-runtime";import{useState as o,useEffect as n}from"react";import{StyledProductGrid as s,StyledProduct as
|
|
1
|
+
import{jsx as e,Fragment as t,jsxs as i}from"react/jsx-runtime";import{useState as o,useEffect as n}from"react";import{StyledProductGrid as s,StyledProduct as r}from"./PostPicker.styled.js";import{Tag as a}from"../tag/Tag.js";import{BodyPrimary as l,BodyCaption as m,BodySecondary as d}from"../TypographyStyle.js";import{unCamelCase as c}from"../../utils/unCamelCase.js";import{PRIMARY as h}from"../../constants/colors.js";import{COLORS as p}from"../../constants/Theme.js";import g from"../../assets/icons/instagram.svg.js";import y from"../../assets/icons/warning.svg.js";import{StyledModal as T}from"../modals/styledModal.js";import{BikShimmer as u}from"../shimmer/ShimmerComponent/BikShimmer.js";import{ShimmerImage as j}from"../shimmer-image/ShimmerImage.js";import{StateComponent as f,StateInterface as v}from"../states/StateComponent.js";var b;!function(e){e.STORY="story",e.POST="post",e.REEL="reel"}(b||(b={}));const O=O=>{var C,S;const[x,P]=o(null!==(C=O.previouslySelected)&&void 0!==C?C:[]),[w,k]=o(""),[N,$]=o(!1);n((()=>{O.media.length||($(!0),setTimeout((()=>{$(!1)}),2e3)),P(O.selected||[])}),[]),n((()=>{O.media.length>0&&$(!1)}),[null===(S=null==O?void 0:O.media)||void 0===S?void 0:S.length]),n((()=>{x.length>0&&k("")}),[x.length]);return e(t,{children:e(T,Object.assign({zIndex:201,open:O.showModal,headingTitle:O.title,onClose:O.onClose,centralContainerStyles:{width:1071,height:564},primaryButton:{disabled:!O.media.length,buttonType:"primary",buttonText:`Select ${c(O.mediaType)}`,onClick:()=>{x.length?O.onSelect(x):k(`Please select a ${O.mediaType} to proceed`)}},secondaryButton:{buttonType:"secondary",buttonText:"Back",onClick:()=>O.onClose()},footerLeftCustomElement:w?e(a,{tagText:w,type:"negative",LeadingIcon:y}):x.length?i(d,{children:[x.length," selected"]}):null},{children:N?e("div",Object.assign({style:{padding:"0 24px"}},{children:e(u,{boxes:[{width:(O.mediaType==b.POST?148:104)+"px",height:(O.mediaType==b.POST?148:172)+"px"}]})})):e(t,{children:O.media&&O.media.length?e(s,Object.assign({mediaType:O.mediaType},{children:O.media.map((t=>{return i(r,Object.assign({mediaType:O.mediaType,className:""+(o=t,n=x,n.some((e=>e.id===o.id))?"selected":""),onClick:()=>{return e=t,void P((()=>(console.log("selectedMedia",x),console.log("selectedPost",e),x.includes(e)?x.filter((t=>t!==e)):!O.limit||x.length<O.limit?[...x,e]:(k(`Only ${O.limit} ${O.mediaType}s can be selected`),x))));var e}},{children:[e(j,{imageUrl:t.imageUrl,width:O.mediaType==b.POST?148:104,height:O.mediaType==b.POST?148:172,alt:t.overlayCaption}),i("div",Object.assign({className:"overlay"},{children:[e("a",Object.assign({target:"_blank",rel:"noreferrer",href:t.redirectionUrl},{children:i("div",Object.assign({className:"overlay__redirection"},{children:[e(g,{height:22,width:22}),e(l,Object.assign({color:h,style:{fontWeight:500}},{children:"View"}))]}))})),e("div",Object.assign({className:"overlay__caption"},{children:e(m,Object.assign({color:p.content.placeholder},{children:t.overlayCaption}))}))]}))]}),t.id);var o,n}))})):e("div",Object.assign({style:{justifyContent:"center",alignItems:"center",display:"flex",height:422}},{children:e(f,{states:v.WARNING,heading:`No ${O.mediaType}s on your account`,subline:`There seems to be no ${O.mediaType}s on your account`,isButtonEnabled:!1,width:400})}))})}))})};export{b as MEDIA_TYPES,O as PostPicker};
|