@lanaco/lnc-react-ui 4.0.119 → 4.0.120
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,4 +1,4 @@
|
|
|
1
|
-
"use strict";const t=require("react/jsx-runtime"),g=require("react"),u=require("./emotion-styled.browser.esm-BtEseadx.cjs"),_=require("./utils-CZynEOC_.cjs"),F=require("./consts-goSZX3xP.cjs"),Q=require("./motion-B_VPZaJq.cjs"),a=require("./index-BpbMKBf_.cjs"),ee=require("./Icon.cjs"),
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),g=require("react"),u=require("./emotion-styled.browser.esm-BtEseadx.cjs"),_=require("./utils-CZynEOC_.cjs"),F=require("./consts-goSZX3xP.cjs"),Q=require("./motion-B_VPZaJq.cjs"),a=require("./index-BpbMKBf_.cjs"),ee=require("./Icon.cjs"),he=require("./Badge.cjs"),V=require("./emotion-element-f0de968e.browser.esm-B7k6i6lC.cjs"),G=require("./IconButton.cjs"),re=require("./useDetectMobile-zkbzoOGV.cjs"),fe=u.styled.div`
|
|
2
2
|
cursor: pointer;
|
|
3
3
|
display: flex;
|
|
4
4
|
gap: 1rem;
|
|
@@ -77,8 +77,14 @@
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
& .timestamp-text {
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
font-size: 0.875rem;
|
|
83
|
+
font-style: normal;
|
|
84
|
+
font-weight: 400;
|
|
85
|
+
line-height: 1.25rem;
|
|
86
|
+
letter-spacing: 0.01563rem;
|
|
87
|
+
gap: 0.25rem;
|
|
82
88
|
padding-top: 0.75rem;
|
|
83
89
|
color: var(--gray-700, #4e555f);
|
|
84
90
|
|
|
@@ -96,7 +102,6 @@
|
|
|
96
102
|
|
|
97
103
|
& .countdown-timer {
|
|
98
104
|
color: var(--primary-500, #f59e0b);
|
|
99
|
-
font-weight: 600;
|
|
100
105
|
}
|
|
101
106
|
}
|
|
102
107
|
|
|
@@ -226,7 +231,7 @@
|
|
|
226
231
|
& i {
|
|
227
232
|
font-size: 0.813rem;
|
|
228
233
|
}
|
|
229
|
-
`,te=e=>{const{uuid:n,hasPermission:o=!0,isUser:l,image:
|
|
234
|
+
`,te=e=>{const{uuid:n,hasPermission:o=!0,isUser:l,image:h,name:m,notifications:f=0,color:i="primary",size:p="large",style:c,disabled:S,onClick:v=()=>{},isActive:T,className:j,shopCategory:$,themeData:x}=e,b={theme:V.useTheme(),color:i,size:p,style:c,disabled:S};return g.createElement(ve,{onClick:C=>{C.stopPropagation(),o===!0&&(v==null||v())},...b,key:m,className:`profile-item ${j}`,hasPermission:o,isActive:T,themeColor:(x==null?void 0:x.code)||"transparent"},t.jsx("div",{className:"logo-wrapper",children:h}),t.jsxs("div",{children:[t.jsx("div",{className:"name",children:m}),!l&&t.jsx("div",{className:"description",children:$}),f>0&&t.jsx("div",{className:"notifications-number",children:t.jsx(he,{className:"badge",color:"danger",size:"small",children:f>99?"99+":f})})]}))};te.propTypes={id:a.PropTypes.any,isUserProfile:a.PropTypes.bool,themeColor:a.PropTypes.string,image:a.PropTypes.any,name:a.PropTypes.string,notifications:a.PropTypes.number,style:a.PropTypes.object,className:a.PropTypes.string,color:a.PropTypes.oneOf(["primary","secondary","success","warning","danger","information","neutral"]),size:a.PropTypes.oneOf(["large"]),onSelect:a.PropTypes.func,hasPermission:a.PropTypes.bool};const H=(e,n)=>{if(!e||!n)return null;let o=Math.floor((e==null?void 0:e.getTime())-(n==null?void 0:n.getTime())),l=1e3*60*60*24;return Math.floor(o/l)},J=e=>{if(e!==void 0){const n=new Date(e),o=n.getFullYear(),l=n.getMonth()+1;return`${String(n.getDate()).padStart(2)}. ${l}. ${o}.`}},ne=g.forwardRef((e,n)=>{var Z;const o=V.useTheme(),{shopUuid:l,title:h="",coverPhoto:m,onSelect:f,startDate:i,endDate:p,salesPackages:c,shopName:S,shopCategory:v,shopImage:T,className:j,onSelectCard:$=()=>{},onSelectShop:x=()=>{},upcoming:P=!1,upcomingCampaignText:b,campaignSingleText:C,salesCampaignTypes:y=[],startsInPrefixTextPlural:N,startsinSuffixTextPlural:B,startsInPrefixTextSingular:M,startsinSuffixTextSingular:R,endsInPrefixTextPlural:s,endsinSuffixTextPlural:d,endsInPrefixTextSingular:z,endsinSuffixTextSingular:r,themeData:q,numberOfListings:W,numberOfListingsTextSingular:ae,numberOfListingsTextPlural:oe,...ie}=e,le=i?new Date(i)<=new Date:!1,ce=H(i?new Date(i):null,new Date),I=H(p?new Date(p):null,new Date),de=I!==null&&I<=3&&I>0,O=I!==null&&I<=1&&I>=0,X=(D,L,w,k,E)=>w===1?`${D} ${w} ${k}`:`${L} ${w} ${E}`,ge=()=>{if(!p)return null;const D=ue,w=new Date(p).getTime()-D.getTime();if(w<=0)return null;const k=Math.floor(w/(1e3*60*60)),E=Math.floor(w%(1e3*60*60)/(1e3*60)),pe=Math.floor(w%(1e3*60)/1e3);return{hours:k,minutes:E,seconds:pe}},[ue,me]=g.useState(new Date);g.useEffect(()=>{if(!O)return;const D=setInterval(()=>{me(new Date)},1e3);return()=>clearInterval(D)},[O]);const A=O?ge():null;return t.jsxs(fe,{ref:n,theme:o,className:j,onClick:$,...ie,children:[t.jsxs(xe,{theme:o,onClick:()=>f==null?void 0:f(),children:[t.jsx("img",{src:m}),t.jsx(be,{children:c==null?void 0:c.map((D,L)=>{var w,k;return t.jsx(_e,{color:(w=y==null?void 0:y.find(E=>E.value===D))==null?void 0:w.color,theme:o,children:t.jsx(ee,{icon:(k=y==null?void 0:y.find(E=>E.value===D))==null?void 0:k.icon})},`package__${L}`)})})]}),t.jsxs(ye,{theme:o,children:[t.jsx("div",{className:"text-block-wrapper",children:t.jsxs("div",{className:"title-block-wrapper",children:[t.jsx("div",{className:"campaign-title",children:(Z=P?b:C)==null?void 0:Z.toUpperCase()}),t.jsx("div",{className:"campaign-title-text",children:h}),p&&i&&t.jsxs("div",{children:[J(i)," - ",J(p)]}),t.jsxs("div",{className:"timestamp-text",children:[W>0&&t.jsxs("span",{className:"listings-text",children:[W," ",W===1?ae:oe," ","∙"," "]}),t.jsx("span",{className:`duration-text ${de?"urgent":""}`,children:O&&A?t.jsxs("div",{className:"countdown-timer",children:[z," ",A.hours.toString().padStart(2,"0"),":",A.minutes.toString().padStart(2,"0"),":",A.seconds.toString().padStart(2,"0")]}):le?X(z,s,I,r,d):X(M,N,ce,R,B)})]})]})}),t.jsx(te,{hasPermission:!0,image:t.jsx("img",{src:T,className:`${T?"":"no-image"}`}),themeData:q,isActive:!0,isUser:!1,name:S,shopCategory:v,onClick:()=>x(l)})]})]})});ne.propTypes={title:a.PropTypes.oneOfType([a.PropTypes.string,a.PropTypes.element]),numberOfListings:a.PropTypes.number,dropdown:a.PropTypes.any,color:a.PropTypes.string};u.styled.div`
|
|
230
235
|
display: flex;
|
|
231
236
|
flex-direction: column;
|
|
232
237
|
gap: 1.5rem;
|
|
@@ -325,7 +330,7 @@
|
|
|
325
330
|
`,$e=u.styled.div`
|
|
326
331
|
display: flex;
|
|
327
332
|
gap: 1.5rem;
|
|
328
|
-
`,De=g.forwardRef(({},e)=>{const n=V.useTheme();return t.jsxs(je,{ref:e,theme:n,children:[t.jsx("div",{className:"campaign__left-section",children:t.jsx(K,{theme:n,width:"15rem",height:"15rem",borderRadius:"edged"})}),t.jsxs("div",{className:"campaign__right-section",children:[t.jsxs(Te,{theme:n,children:[t.jsx(U,{heightCoeff:.75,theme:n,width:"35%"}),t.jsx(U,{heightCoeff:1.25,theme:n}),t.jsx(U,{heightCoeff:3,theme:n})]}),t.jsxs("div",{className:"campaign__user",children:[t.jsx(K,{theme:n,width:"2.5rem",height:"2.5rem",borderRadius:"curved"}),t.jsx(U,{theme:n,width:"75%"})]})]})]})}),Se=({itemsCount:e=5,keyPrefix:n})=>t.jsx($e,{children:Array.from({length:e},(o,l)=>t.jsx(De,{},`${n}-skeleton-campaign-card-${l}`))}),Pe=({children:e,fallbackComponent:n=t.jsx(t.Fragment,{}),isLoading:o=!1,itemsCount:l=5,keyPrefix:
|
|
333
|
+
`,De=g.forwardRef(({},e)=>{const n=V.useTheme();return t.jsxs(je,{ref:e,theme:n,children:[t.jsx("div",{className:"campaign__left-section",children:t.jsx(K,{theme:n,width:"15rem",height:"15rem",borderRadius:"edged"})}),t.jsxs("div",{className:"campaign__right-section",children:[t.jsxs(Te,{theme:n,children:[t.jsx(U,{heightCoeff:.75,theme:n,width:"35%"}),t.jsx(U,{heightCoeff:1.25,theme:n}),t.jsx(U,{heightCoeff:3,theme:n})]}),t.jsxs("div",{className:"campaign__user",children:[t.jsx(K,{theme:n,width:"2.5rem",height:"2.5rem",borderRadius:"curved"}),t.jsx(U,{theme:n,width:"75%"})]})]})]})}),Se=({itemsCount:e=5,keyPrefix:n})=>t.jsx($e,{children:Array.from({length:e},(o,l)=>t.jsx(De,{},`${n}-skeleton-campaign-card-${l}`))}),Pe=({children:e,fallbackComponent:n=t.jsx(t.Fragment,{}),isLoading:o=!1,itemsCount:l=5,keyPrefix:h})=>t.jsx(g.Suspense,{fallback:n,children:o===!0?t.jsx(Se,{itemsCount:l,keyPrefix:h}):e}),Ce=u.styled.div`
|
|
329
334
|
margin: 0 auto;
|
|
330
335
|
display: flex;
|
|
331
336
|
flex-direction: column;
|
|
@@ -374,4 +379,4 @@
|
|
|
374
379
|
@media (max-width: ${F.MOBILE_SIZE_PX+"px"}) {
|
|
375
380
|
grid-template-columns: repeat(${e=>e==null?void 0:e.numOfColumnsForMobile}, 1fr);
|
|
376
381
|
}
|
|
377
|
-
`,se=g.forwardRef(({icon:e,title:n,numOfSlides:o=2,numOfSlidesForMobile:l=1,showNavigation:
|
|
382
|
+
`,se=g.forwardRef(({icon:e,title:n,numOfSlides:o=2,numOfSlidesForMobile:l=1,showNavigation:h=!0,children:m},f)=>{const[i,p]=g.useState(0),[c,S]=g.useState(1),[v,T]=g.useState(null),[j,$]=g.useState(null),x=re.useDetectMobile(),P=50,b=(m==null?void 0:m.length)??1;g.useEffect(()=>{const s=()=>{S(x?l:o)};return window.addEventListener("resize",s),s(),()=>window.removeEventListener("resize",s)},[]);const C=m==null?void 0:m.slice(i,i+c),y=s=>{var d;(d=s==null?void 0:s.target)==null||d.blur(),i+c<b&&p(i+c)},N=s=>{var d;(d=s==null?void 0:s.target)==null||d.blur(),i-c>=0&&p(i-c)},B=s=>{var d;$(null),T((d=s==null?void 0:s.targetTouches["0"])==null?void 0:d.clientX)},M=s=>{var d;$((d=s==null?void 0:s.targetTouches["0"])==null?void 0:d.clientX)},R=()=>{if(!v||!j)return;const s=v-j;s>P&&y(),s<-P&&N()};return t.jsxs(Ce,{ref:f,...x?{onTouchStart:B,onTouchMove:M,onTouchEnd:R}:{},children:[t.jsx("div",{className:"scrollable-section__header",children:t.jsxs("div",{className:"scrollable-section__title",children:[_.isDefinedNotEmptyString(e)&&t.jsx(ee,{icon:e,color:"primary",sizeInUnits:"1.5rem",className:"title__icon"}),_.isDefinedNotEmptyString(n)&&t.jsx("div",{className:"title__text",children:n})]})}),t.jsx(Ie,{numOfColumns:o,numOfColumnsForMobile:l,animate:{x:0,opacity:1},initial:{x:10,opacity:0},children:C},`scrollable-section__content-${i}`),h&&b>c&&!x&&t.jsxs("div",{className:"scrollable-section__navigation",children:[t.jsx(G,{icon:"angle-left",borderRadius:"curved",btnType:"tinted",color:"neutral",className:"navigation__arrow",disabled:i===0,onClick:N}),t.jsx(G,{icon:"angle-right",borderRadius:"curved",btnType:"tinted",color:"neutral",className:"navigation__arrow",disabled:i+c>=b,onClick:y})]})]})});se.propTypes={icon:a.PropTypes.string,title:a.PropTypes.string,numOfSlides:a.PropTypes.number,numOfSlidesForMobile:a.PropTypes.number,showNavigation:a.PropTypes.bool};const Ee=g.memo(ne),Ne=g.forwardRef(({sellerType:e="Shop",items:n=[],title:o,icon:l,isLoading:h,onSelectCard:m=()=>{},onSelectShop:f=()=>{},getImage:i=()=>{},campaignSingleText:p,upcomingCampaignText:c,salesCampaignTypes:S=[],startsInPrefixTextPlural:v,startsinSuffixTextPlural:T,startsInPrefixTextSingular:j,startsinSuffixTextSingular:$,endsInPrefixTextPlural:x,endsinSuffixTextPlural:P,endsInPrefixTextSingular:b,endsinSuffixTextSingular:C,numOfSlides:y=2,numOfSlidesForMobile:N=1,showNavigation:B=!0,numberOfListingsTextSingular:M,numberOfListingsTextPlural:R},s)=>{const d=re.useDetectMobile(),z=g.useMemo(()=>n==null?void 0:n.map((r,q)=>t.jsx(Ee,{className:"campaign-item",coverPhoto:i(r==null?void 0:r.coverPhoto,(r==null?void 0:r.uuid)||(r==null?void 0:r.campaignUuid)),description:r==null?void 0:r.description,endDate:r==null?void 0:r.endDate,salesPackages:r==null?void 0:r.salesPackages,sellerType:e,shopImage:r==null?void 0:r.profileImage,shopName:r==null?void 0:r.shopName,shopUuid:r==null?void 0:r.shopUuid,shopCategory:r==null?void 0:r.shopCategory,startDate:r==null?void 0:r.startDate,title:r==null?void 0:r.name,uuid:r==null?void 0:r.campaignUuid,onSelectCard:()=>m(r==null?void 0:r.campaignUuid,r==null?void 0:r.shopUuid),onSelectShop:()=>f(r==null?void 0:r.shopUuid),campaignSingleText:p,upcomingCampaignText:c,upcoming:r==null?void 0:r.upcoming,salesCampaignTypes:S,startsInPrefixTextPlural:v,startsinSuffixTextPlural:T,startsInPrefixTextSingular:j,startsinSuffixTextSingular:$,endsInPrefixTextPlural:x,endsinSuffixTextPlural:P,endsInPrefixTextSingular:b,endsinSuffixTextSingular:C,themeData:r==null?void 0:r.themeData,numberOfListings:r==null?void 0:r.numberOfListings,numberOfListingsTextSingular:M,numberOfListingsTextPlural:R},`campaign__item__${q}__${r==null?void 0:r.startDate}___${r==null?void 0:r.endDate}`)),[n]);return t.jsx(Pe,{isLoading:h,itemsCount:d?1:2,keyPrefix:"sales-camp",children:t.jsx(se,{icon:l,title:o,numOfSlides:y,numOfSlidesForMobile:N,showNavigation:B,children:z})})});module.exports=Ne;
|
|
@@ -89,8 +89,14 @@ const Se = m.div`
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
& .timestamp-text {
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
display: flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
font-size: 0.875rem;
|
|
95
|
+
font-style: normal;
|
|
96
|
+
font-weight: 400;
|
|
97
|
+
line-height: 1.25rem;
|
|
98
|
+
letter-spacing: 0.01563rem;
|
|
99
|
+
gap: 0.25rem;
|
|
94
100
|
padding-top: 0.75rem;
|
|
95
101
|
color: var(--gray-700, #4e555f);
|
|
96
102
|
|
|
@@ -108,7 +114,6 @@ const Se = m.div`
|
|
|
108
114
|
|
|
109
115
|
& .countdown-timer {
|
|
110
116
|
color: var(--primary-500, #f59e0b);
|
|
111
|
-
font-weight: 600;
|
|
112
117
|
}
|
|
113
118
|
}
|
|
114
119
|
|