@lanaco/lnc-react-ui 4.0.139 → 4.0.141

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.
@@ -0,0 +1,265 @@
1
+ "use strict";const e=require("react/jsx-runtime"),l=require("react"),o=require("./utils-Dl9xPH4c.cjs"),x=require("./emotion-styled.browser.esm-BtEseadx.cjs"),le=require("./index-BueKsXT8.cjs"),_=require("./Badge.cjs"),de=require("./Popover.cjs"),me=require("./PopoverTrigger.cjs"),pe=require("./PopoverContent.cjs"),ge=require("./useDetectMobile-zkbzoOGV.cjs"),A=require("./consts-goSZX3xP.cjs"),X=x.styled.div`
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 0.5rem;
5
+ cursor: pointer;
6
+ overflow: hidden;
7
+ width: 100%;
8
+
9
+ & .wrapper-card-1 {
10
+ display: flex;
11
+ flex-direction: column;
12
+ gap: 0.38rem;
13
+ }
14
+
15
+ & .wrapper-card-2 {
16
+ display: flex;
17
+ flex-direction: column;
18
+ gap: 0;
19
+ }
20
+
21
+ & .wrapper-card-3 {
22
+ display: flex;
23
+ flex-wrap: wrap;
24
+ gap: 0.25rem;
25
+
26
+ & > div {
27
+ & > div {
28
+ width: 100% !important;
29
+ }
30
+ }
31
+ }
32
+
33
+ & .tag {
34
+ height: 1.5rem;
35
+ gap: 0.25rem;
36
+ padding: 0.25rem 0.375rem;
37
+ border-radius: 0.375rem;
38
+ background: #f9fafb;
39
+ border: 1px solid var(--gray-95012, #14161a1f);
40
+ font-weight: 400;
41
+ font-size: 0.75rem;
42
+ line-height: 1rem;
43
+ letter-spacing: 0.025rem;
44
+ color: var(--gray-950, #14161a);
45
+ white-space: nowrap;
46
+ flex: 0 0 auto;
47
+
48
+ &.tag-sponsored {
49
+ & i {
50
+ color: var(--yellow-500, #f59e0b);
51
+ }
52
+ }
53
+ }
54
+
55
+ & .tag-mobile {
56
+ font-weight: 400;
57
+ font-size: 0.75rem;
58
+ line-height: 1rem;
59
+ letter-spacing: 0.025rem;
60
+ color: var(--gray-600, #676e79);
61
+ }
62
+
63
+ & .card-title {
64
+ font-size: 0.875rem;
65
+ font-weight: 600;
66
+ ${o.truncateTextInRows(2)}
67
+ }
68
+
69
+ & .price-text {
70
+ font-size: 1rem;
71
+ font-weight: 600;
72
+ ${o.truncateText()}
73
+ display: flex;
74
+ align-items: end;
75
+ gap: 0.5rem;
76
+ color: var(--gray-950, #14161a);
77
+
78
+ &.new-price {
79
+ color: var(--danger-600, #e11d48);
80
+ }
81
+
82
+ & .full-price {
83
+ text-decoration: line-through;
84
+ font-size: 0.75rem;
85
+ font-weight: 400;
86
+ padding-bottom: 0.125rem;
87
+ color: var(--gray-600, #676e79);
88
+ }
89
+ }
90
+
91
+ & .location-text {
92
+ font-size: 0.75rem;
93
+ font-weight: 400;
94
+ color: var(--gray-600, #676e79);
95
+ ${o.truncateText()}
96
+ }
97
+
98
+ & .tags-wrapper {
99
+ display: flex;
100
+ gap: 0.5rem;
101
+ }
102
+
103
+ & .skeleton-img {
104
+ background-color: ${o.linearGradientAnimation("-90deg")};
105
+ border-radius: 0.75rem;
106
+ border: 1px solid white;
107
+ }
108
+
109
+ & .skeleton-title {
110
+ background-color: ${o.linearGradientAnimation("-90deg")};
111
+ width: 100%;
112
+ height: 2.5rem;
113
+ }
114
+
115
+ & .skeleton-tags {
116
+ background-color: ${o.linearGradientAnimation("-90deg")};
117
+ width: 80%;
118
+ height: 1.5rem;
119
+ }
120
+
121
+ & .skeleton-price {
122
+ background-color: ${o.linearGradientAnimation("-90deg")};
123
+ width: 50%;
124
+ height: 2.5rem;
125
+ }
126
+
127
+ & .skeleton-sponsored {
128
+ background-color: ${o.linearGradientAnimation("-90deg")};
129
+ width: 50%;
130
+ height: 1rem;
131
+ }
132
+
133
+ & .tags-popover__trigger {
134
+ display: flex;
135
+ gap: 0.25rem;
136
+ }
137
+
138
+ @media (max-width: ${A.MOBILE_SIZE_PX+"px"}) {
139
+ overflow: visible;
140
+
141
+ & .tags-popover__trigger {
142
+ flex-wrap: wrap;
143
+ }
144
+
145
+ & .price-text {
146
+ font-size: 0.875rem;
147
+ font-weight: 600;
148
+
149
+ & .full-price {
150
+ display: none;
151
+ }
152
+ }
153
+ }
154
+
155
+ &:hover .product-image-wrapper img {
156
+ transform: scale(1.1);
157
+ }
158
+ `,ue=x.styled.div`
159
+ position: relative;
160
+ overflow: hidden;
161
+ border-radius: 0.75rem;
162
+ width: 100%;
163
+ aspect-ratio: 1 / 1;
164
+ border: 1px solid #0c15201f;
165
+
166
+ & .bookmarking-btn {
167
+ position: absolute;
168
+ right: 0.5rem;
169
+ top: 0.5rem;
170
+ z-index: 1;
171
+
172
+ display: none;
173
+ }
174
+
175
+ &:hover {
176
+ & .bookmarking-btn {
177
+ display: flex;
178
+ }
179
+ }
180
+
181
+ & img {
182
+ display: block;
183
+ width: 100%;
184
+ height: 100%;
185
+ object-fit: cover;
186
+ border-radius: 0.75rem;
187
+ transition: var(--transition, all 0.3s ease);
188
+ }
189
+
190
+ @media (max-width: ${A.MOBILE_SIZE_PX+"px"}) {
191
+ & img {
192
+ width: 8.875rem;
193
+ height: 8.875rem;
194
+ min-width: 8.875rem;
195
+ min-height: 8.875rem;
196
+ object-fit: cover;
197
+ }
198
+
199
+ & .bookmarking-btn {
200
+ display: flex;
201
+ }
202
+ }
203
+ `,he=x.styled.div`
204
+ background: var(--white, #fff);
205
+ z-index: 1;
206
+
207
+ border: 1px solid var(--gray-200, #dddfe4);
208
+ border-radius: 0.5rem;
209
+ line-height: 1rem;
210
+ position: absolute;
211
+ padding: 0.5rem 0.75rem;
212
+ top: 0.5rem;
213
+ left: 25%;
214
+ transform: translateX(-50%);
215
+ min-width: 13rem;
216
+
217
+ &::before,
218
+ &::after {
219
+ content: "";
220
+ position: absolute;
221
+ left: 50%;
222
+ transform: translateX(-50%);
223
+ border-style: solid;
224
+ border-width: 0.625rem;
225
+ }
226
+
227
+ &::after {
228
+ top: -1.1875rem;
229
+ border-color: transparent transparent var(--white, #fff) transparent;
230
+ }
231
+
232
+ &::before {
233
+ top: -1.25rem;
234
+ border-color: transparent transparent var(--gray-200, #dddfe4) transparent;
235
+ }
236
+
237
+ & .tags-popover__content {
238
+ display: flex;
239
+ flex-wrap: wrap;
240
+ flex-direction: column;
241
+ gap: 0.375rem;
242
+ font-size: 0.75rem;
243
+ font-weight: 400;
244
+
245
+ & .tags-popover__name {
246
+ color: var(--gray-600, #676e79);
247
+ }
248
+
249
+ & .tags-popover__value {
250
+ color: var(--gray-950, #14161a);
251
+ }
252
+ }
253
+ `,fe=x.styled.div`
254
+ display: flex;
255
+ align-items: center;
256
+ gap: 0.25rem;
257
+ color: var(--gray-500);
258
+ font-size: 0.75rem;
259
+ font-weight: 500;
260
+
261
+ & i {
262
+ font-size: 1rem;
263
+ color: var(--warning-500, #F59E0B);
264
+ }
265
+ `,ve=l.forwardRef(({sponsoredText:m="Sponsored"},w)=>e.jsxs(fe,{ref:w,className:"sponsored-line",children:[e.jsx("i",{className:"mng-lnc-paw2"}),e.jsx("span",{children:m})]})),we="Vehicles_Cars",be="Vehicles_Motorcycles",ye="Vehicles_Trucks",ke="Vehicles_AgriculturalMachines_Tractors",je="Vehicles_ConstructionMachines",_e="Vehicles_Bus",xe="Vehicles_Campers",Ne="RealEstates_",i={Mileage:{icon:"mng-lnc-road",measure:"km"},YearOfProduction:{icon:"mng-lnc-calendar",measure:""},Fuel:{icon:"mng-lnc-gas-station",measure:""},EnginePowerKW:{icon:"mng-lnc-engine",measure:"kW"},Transmission:{icon:"mng-lnc-transmission",measure:""},Model:{icon:"mng-lnc-application",measure:""},Brand:{icon:"mng-lnc-car--front",measure:""},SurfaceArea:{icon:"mng-lnc-right-angle",measure:""},Floor:{icon:"mng-lnc-elevator",measure:""},FurnishedCondition:{icon:"mng-lnc-sofa-01",measure:""},AdType:{icon:"mng-lnc-notes",measure:""},NumberOfRooms:{icon:"mng-lnc-meeting-room",measure:""},HeatingType:{icon:"mng-lnc-heat",measure:""},AirConditioning:{icon:"mng-lnc-air-conditioner",measure:""},Type:{icon:"mng-lnc-house-building",measure:""},Parking:{icon:"mng-lnc-parking-area-circle",measure:""},Internet:{icon:"mng-lnc-wifi-02",measure:""},State:{icon:"mng-lnc-settings-1",measure:""},NumberOfPremises:{icon:"mng-lnc-meeting-room",measure:""},Pool:{icon:"mng-lnc-pool",measure:""},Approach:{icon:"mng-lnc-driveway",measure:""},NumberOfBeds:{icon:"mng-lnc-bed",measure:""},Kitchen:{icon:"mng-lnc-fridge",measure:""},BathroomToilet:{icon:"mng-lnc-bath",measure:""},default:{icon:" mng-lnc-clock--filled",measure:""}},Ce=l.forwardRef((m,w)=>{const{uuid:p,title:y,price:u=0,sellingPrice:k,currency:j,isNegotiable:N,isFree:C,imageUrl:L,location:U,sponsored:O,imageComponent:V,onSelectCard:Y=()=>{},freeText:K="Free",negotiableText:Z="Negotiable",tags:t=[],categoryCode:P,condition:$,quantity:S,trade:E,sponsoredText:H,onBookmark:B=()=>{},bookmarkComponent:z,bookmarked:M,bookmarkLists:J}=m,T=ge.useDetectMobile(),Q=()=>o.isDefined(z)?l.cloneElement(z,{key:`bookmark_pr__${M}`,bookmarked:M,productUuid:p,onAddToBookmark:()=>B(!0,p),onRemoveFromBookmark:()=>B(!1,p),bookmarkedUuidList:J}):e.jsx(e.Fragment,{}),q=[we,be,ye,ke,je,_e,xe,Ne].some(r=>P==null?void 0:P.includes(r)),[ee,F]=l.useState(!1),re=()=>{F(!0)},ne=()=>{F(!1)},a=l.useRef(null),h=l.useRef([]),[W,oe]=l.useState(t==null?void 0:t.length),te=()=>{var f,c,b;if(!(a!=null&&a.current)||((f=h==null?void 0:h.current)==null?void 0:f.length)===0)return;const r=(c=a==null?void 0:a.current)==null?void 0:c.offsetWidth;let n=0,s=0;for(let d=0;d<(t==null?void 0:t.length);d++){const v=((b=h==null?void 0:h.current[d])==null?void 0:b.offsetWidth)||0,g=n+v+4;if(g<=r)n+=g,s++;else break}oe(s)};l.useEffect(()=>{const r=a==null?void 0:a.current;if(!r)return;const n=new ResizeObserver(()=>{te()});return n.observe(r),()=>{n.disconnect()}},[t]);const se=()=>{var r;return e.jsx("div",{className:"tags-popover__trigger",children:(r=t==null?void 0:t.slice(0,W))==null?void 0:r.map((n,s)=>{var v,g,I,R,G;const f=((v=i==null?void 0:i[n==null?void 0:n.code])==null?void 0:v.icon)??((g=i==null?void 0:i.default)==null?void 0:g.icon)??"",c=((I=n==null?void 0:n.measurementUnit)==null?void 0:I.symbol)??((R=i==null?void 0:i[n==null?void 0:n.code])==null?void 0:R.measure)??"",d=[(n==null?void 0:n.value)??((G=n==null?void 0:n.multiOptions)==null?void 0:G[0])??"",c].filter(Boolean).join(" ");return T?e.jsxs("div",{className:"tag-mobile",children:[d,s<W-1?" · ":""]}):e.jsxs(_,{ref:ce=>h.current[s]=ce,className:`tag ${O?"tag-sponsored":""}`,children:[e.jsx("i",{className:f}),d]},`detailed-products-section-tag__${s+1}`)})})},ie=()=>e.jsx("div",{className:"tags-popover__content",children:t==null?void 0:t.map((r,n)=>{var d,v,g;const s=((d=r==null?void 0:r.measurementUnit)==null?void 0:d.symbol)??((v=i==null?void 0:i[r==null?void 0:r.code])==null?void 0:v.measure)??"",c=[(r==null?void 0:r.value)??((g=r==null?void 0:r.multiOptions)==null?void 0:g[0])??"",s].filter(Boolean).join(" "),b=r==null?void 0:r.name;return e.jsxs("div",{children:[e.jsx("span",{className:"tags-popover__name",children:`${b}: `}),e.jsx("span",{className:"tags-popover__value",children:c})]},`detailed-products-section-tag-dropdown__${n+1}`)})}),ae=()=>{var r;if(T){const n=[$,S,E];return(r=n==null?void 0:n.filter(s=>o.isDefinedNotEmptyString(s)))==null?void 0:r.map((s,f,c)=>e.jsxs("div",{className:"tag-mobile",children:[s,f<(c==null?void 0:c.length)-1?" · ":""]}))}return e.jsxs(e.Fragment,{children:[$&&e.jsx(_,{className:"tag",children:$},"detailed-products-section-tag__condition"),S&&e.jsx(_,{className:"tag",children:S},"detailed-products-section-tag__quantity"),E&&e.jsx(_,{className:"tag",children:E},"detailed-products-section-tag__trade")]})},D=u>0&&j&&N!==!0&&C!==!0&&u!==k;return e.jsxs(X,{ref:a,className:"product-card",onClick:Y,children:[e.jsxs(ue,{className:"product-image-wrapper",children:[e.jsx(Q,{}),o.isDefined(V)?V:e.jsx(le.ProductImageWrapper,{src:L})]}),e.jsx("div",{className:"wrapper-card-1",children:e.jsx("div",{className:"card-title",children:y})}),e.jsxs("div",{className:"wrapper-card-3",children:[q&&e.jsx("div",{...T?{}:{onMouseEnter:re,onMouseLeave:ne},children:e.jsxs(de,{placement:"bottom",open:ee,children:[e.jsx(me,{children:se()}),e.jsx(pe,{style:{all:"unset"},children:e.jsx(he,{children:ie()})})]})}),!q&&ae()]}),e.jsxs("div",{className:"wrapper-card-2",children:[e.jsxs("div",{className:`price-text ${D?"new-price":""}`,children:[k>0&&j&&N!==!0&&C!==!0&&e.jsx("div",{children:`${o.formatPrice(k)} ${o.GetCurrencySymbol(j)}`}),D&&e.jsx("div",{className:`${k>0?"full-price":""}`,children:`${o.formatPrice(u)} ${o.GetCurrencySymbol(j)}`}),N&&Z,C&&K]}),e.jsx("div",{className:"location-text",children:U})]}),O===!0&&e.jsx(ve,{sponsoredText:H})]})}),Pe=l.forwardRef(({},m)=>e.jsxs(X,{className:"product-card",children:[e.jsx("img",{className:"skeleton-img"}),e.jsxs("div",{className:"wrapper-card-1",children:[e.jsx("div",{className:"skeleton-title"}),e.jsx("div",{className:"skeleton-tags"})]}),e.jsxs("div",{className:"wrapper-card-1",children:[e.jsx("div",{className:"skeleton-price"}),e.jsx("div",{className:"skeleton-sponsored"})]})]})),$e=({limit:m=5,isLoading:w=!1,keyPrefix:p})=>e.jsx(e.Fragment,{children:Array.from({length:m},(y,u)=>e.jsx(Pe,{isLoading:w},`${p}-skeleton-product-card-${u}`))}),Se=({children:m,fallbackComponent:w=e.jsx(e.Fragment,{}),isLoading:p=!1,limit:y,keyPrefix:u})=>e.jsx(l.Suspense,{fallbackComponent:w,children:p===!0?e.jsx($e,{isLoading:p,limit:y,keyPrefix:u}):m});exports.DetailedProductCard=Ce;exports.SuspenseDetailedProductCard=Se;