@lanaco/lnc-react-ui 4.0.145 → 4.0.147

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,538 @@
1
+ import { jsxs as o, jsx as r, Fragment as C } from "react/jsx-runtime";
2
+ import { forwardRef as M, useState as le, cloneElement as G, Suspense as de } from "react";
3
+ import { p as me, t as U, o as v, l as X, q as L, G as q, k as pe } from "./utils-BdsZgOUE.js";
4
+ import { s as N } from "./emotion-styled.browser.esm-BNN1dTl3.js";
5
+ import { P as ge } from "./index-CF3HhgvN.js";
6
+ import _ from "./Badge.js";
7
+ import ue from "./Popover.js";
8
+ import he from "./PopoverTrigger.js";
9
+ import fe from "./PopoverContent.js";
10
+ import { u as ve } from "./useDetectMobile-Bkvj0VMa.js";
11
+ import { M as A } from "./consts-BuFChS64.js";
12
+ const Y = N.div`
13
+ display: flex;
14
+ flex-direction: column;
15
+ gap: 0.5rem;
16
+ cursor: pointer;
17
+ overflow: hidden;
18
+ width: 100%;
19
+
20
+ & .wrapper-card-1 {
21
+ display: flex;
22
+ flex-direction: column;
23
+ gap: 0.38rem;
24
+ }
25
+
26
+ & .wrapper-card-2 {
27
+ display: flex;
28
+ flex-direction: column;
29
+ gap: 0;
30
+ }
31
+
32
+ & .wrapper-card-3 {
33
+ display: flex;
34
+ flex-wrap: wrap;
35
+ gap: 0.25rem;
36
+
37
+ & > div {
38
+ & > div {
39
+ width: 100% !important;
40
+ }
41
+ }
42
+ }
43
+
44
+ & .tag {
45
+ height: 1.5rem;
46
+ gap: 0.25rem;
47
+ padding: 0.25rem 0.375rem;
48
+ border-radius: 0.375rem;
49
+ background: #f9fafb;
50
+ border: 1px solid var(--gray-95012, #14161a1f);
51
+ font-weight: 400;
52
+ font-size: 0.75rem;
53
+ line-height: 1rem;
54
+ letter-spacing: 0.025rem;
55
+ color: var(--gray-950, #14161a);
56
+ white-space: nowrap;
57
+ flex: 0 0 auto;
58
+
59
+ & i {
60
+ color: var(--yellow-500, #f59e0b);
61
+ }
62
+ }
63
+
64
+ & .tag-mobile {
65
+ font-weight: 400;
66
+ font-size: 0.75rem;
67
+ line-height: 1rem;
68
+ letter-spacing: 0.025rem;
69
+ color: var(--gray-600, #676e79);
70
+ }
71
+
72
+ & .card-title {
73
+ font-size: 0.875rem;
74
+ font-weight: 600;
75
+ ${me(2)}
76
+ }
77
+
78
+ & .price-text {
79
+ font-size: 1rem;
80
+ font-weight: 600;
81
+ ${U()}
82
+ display: flex;
83
+ align-items: end;
84
+ gap: 0.5rem;
85
+ color: var(--gray-950, #14161a);
86
+
87
+ &.new-price {
88
+ color: var(--danger-600, #e11d48);
89
+ }
90
+
91
+ & .full-price {
92
+ text-decoration: line-through;
93
+ font-size: 0.75rem;
94
+ font-weight: 400;
95
+ padding-bottom: 0.125rem;
96
+ color: var(--gray-600, #676e79);
97
+ }
98
+ }
99
+
100
+ & .location-text {
101
+ font-size: 0.75rem;
102
+ font-weight: 400;
103
+ color: var(--gray-600, #676e79);
104
+ ${U()}
105
+ }
106
+
107
+ & .tags-wrapper {
108
+ display: flex;
109
+ gap: 0.5rem;
110
+ }
111
+
112
+ & .skeleton-img {
113
+ background-color: ${v("-90deg")};
114
+ border-radius: 0.75rem;
115
+ border: 1px solid white;
116
+ }
117
+
118
+ & .skeleton-title {
119
+ background-color: ${v("-90deg")};
120
+ width: 100%;
121
+ height: 2.5rem;
122
+ }
123
+
124
+ & .skeleton-tags {
125
+ background-color: ${v("-90deg")};
126
+ width: 80%;
127
+ height: 1.5rem;
128
+ }
129
+
130
+ & .skeleton-price {
131
+ background-color: ${v("-90deg")};
132
+ width: 50%;
133
+ height: 2.5rem;
134
+ }
135
+
136
+ & .skeleton-sponsored {
137
+ background-color: ${v("-90deg")};
138
+ width: 50%;
139
+ height: 1rem;
140
+ }
141
+
142
+ & .tags-popover__trigger {
143
+ display: flex;
144
+ flex-wrap: wrap;
145
+ gap: 0.25rem;
146
+ }
147
+
148
+ @media (max-width: ${A + "px"}) {
149
+ overflow: visible;
150
+
151
+ & .price-text {
152
+ font-size: 0.875rem;
153
+ font-weight: 600;
154
+
155
+ & .full-price {
156
+ display: none;
157
+ }
158
+ }
159
+ }
160
+
161
+ &:hover .product-image-wrapper img {
162
+ transform: scale(1.1);
163
+ }
164
+ `, we = N.div`
165
+ position: relative;
166
+ overflow: hidden;
167
+ border-radius: 0.75rem;
168
+ width: 100%;
169
+ aspect-ratio: 1 / 1;
170
+ border: 1px solid #0c15201f;
171
+
172
+ & .bookmarking-btn {
173
+ position: absolute;
174
+ right: 0.5rem;
175
+ top: 0.5rem;
176
+ z-index: 1;
177
+
178
+ display: none;
179
+ }
180
+
181
+ &:hover {
182
+ & .bookmarking-btn {
183
+ display: flex;
184
+ }
185
+ }
186
+
187
+ & img {
188
+ display: block;
189
+ width: 100%;
190
+ height: 100%;
191
+ object-fit: cover;
192
+ border-radius: 0.75rem;
193
+ transition: var(--transition, all 0.3s ease);
194
+ }
195
+
196
+ @media (max-width: ${A + "px"}) {
197
+ & img {
198
+ width: 8.875rem;
199
+ height: 8.875rem;
200
+ min-width: 8.875rem;
201
+ min-height: 8.875rem;
202
+ object-fit: cover;
203
+ }
204
+
205
+ & .bookmarking-btn {
206
+ display: flex;
207
+ }
208
+ }
209
+ `, be = N.div`
210
+ background: var(--white, #fff);
211
+ z-index: 1;
212
+
213
+ border: 1px solid var(--gray-200, #dddfe4);
214
+ border-radius: 0.5rem;
215
+ line-height: 1rem;
216
+ position: absolute;
217
+ padding: 0.5rem 0.75rem;
218
+ top: 0.5rem;
219
+ left: 25%;
220
+ transform: translateX(-50%);
221
+ min-width: 13rem;
222
+
223
+ &::before,
224
+ &::after {
225
+ content: "";
226
+ position: absolute;
227
+ left: 50%;
228
+ transform: translateX(-50%);
229
+ border-style: solid;
230
+ border-width: 0.625rem;
231
+ }
232
+
233
+ &::after {
234
+ top: -1.1875rem;
235
+ border-color: transparent transparent var(--white, #fff) transparent;
236
+ }
237
+
238
+ &::before {
239
+ top: -1.25rem;
240
+ border-color: transparent transparent var(--gray-200, #dddfe4) transparent;
241
+ }
242
+
243
+ & .tags-popover__content {
244
+ display: flex;
245
+ flex-wrap: wrap;
246
+ flex-direction: column;
247
+ gap: 0.375rem;
248
+ font-size: 0.75rem;
249
+ font-weight: 400;
250
+
251
+ & .tags-popover__name {
252
+ color: var(--gray-600, #676e79);
253
+ }
254
+
255
+ & .tags-popover__value {
256
+ color: var(--gray-950, #14161a);
257
+ }
258
+ }
259
+ `, ye = N.div`
260
+ display: flex;
261
+ align-items: center;
262
+ gap: 0.25rem;
263
+ color: var(--gray-500);
264
+ font-size: 0.75rem;
265
+ font-weight: 500;
266
+
267
+ & i {
268
+ font-size: 1rem;
269
+ color: var(--warning-500, #F59E0B);
270
+ }
271
+ `, ke = M(({ sponsoredText: s = "Sponsored" }, m) => /* @__PURE__ */ o(ye, { ref: m, className: "sponsored-line", children: [
272
+ /* @__PURE__ */ r("i", { className: "mng-lnc-paw2" }),
273
+ /* @__PURE__ */ r("span", { children: s })
274
+ ] })), _e = "Vehicles_Cars", Ce = "Vehicles_Motorcycles", Ne = "Vehicles_Trucks", Pe = "Vehicles_AgriculturalMachines_Tractors", $e = "Vehicles_ConstructionMachines", Ee = "Vehicles_Bus", Se = "Vehicles_Campers", Ve = "RealEstates_", n = {
275
+ Mileage: {
276
+ icon: "mng-lnc-road",
277
+ measure: "km"
278
+ },
279
+ YearOfProduction: {
280
+ icon: "mng-lnc-calendar",
281
+ measure: ""
282
+ },
283
+ Fuel: {
284
+ icon: "mng-lnc-gas-station",
285
+ measure: ""
286
+ },
287
+ EnginePowerKW: {
288
+ icon: "mng-lnc-engine",
289
+ measure: "kW"
290
+ },
291
+ Transmission: {
292
+ icon: "mng-lnc-transmission",
293
+ measure: ""
294
+ },
295
+ Model: {
296
+ icon: "mng-lnc-application",
297
+ measure: ""
298
+ },
299
+ Brand: {
300
+ icon: "mng-lnc-car--front",
301
+ measure: ""
302
+ },
303
+ SurfaceArea: {
304
+ icon: "mng-lnc-right-angle",
305
+ measure: ""
306
+ },
307
+ Floor: {
308
+ icon: "mng-lnc-elevator",
309
+ measure: ""
310
+ },
311
+ FurnishedCondition: {
312
+ icon: "mng-lnc-sofa-01",
313
+ measure: ""
314
+ },
315
+ AdType: {
316
+ icon: "mng-lnc-notes",
317
+ measure: ""
318
+ },
319
+ NumberOfRooms: {
320
+ icon: "mng-lnc-meeting-room",
321
+ measure: ""
322
+ },
323
+ HeatingType: {
324
+ icon: "mng-lnc-heat",
325
+ measure: ""
326
+ },
327
+ AirConditioning: {
328
+ icon: "mng-lnc-air-conditioner",
329
+ measure: ""
330
+ },
331
+ Type: {
332
+ icon: "mng-lnc-house-building",
333
+ measure: ""
334
+ },
335
+ Parking: {
336
+ icon: "mng-lnc-parking-area-circle",
337
+ measure: ""
338
+ },
339
+ Internet: {
340
+ icon: "mng-lnc-wifi-02",
341
+ measure: ""
342
+ },
343
+ State: {
344
+ icon: "mng-lnc-settings-1",
345
+ measure: ""
346
+ },
347
+ NumberOfPremises: {
348
+ icon: "mng-lnc-meeting-room",
349
+ measure: ""
350
+ },
351
+ Pool: {
352
+ icon: "mng-lnc-pool",
353
+ measure: ""
354
+ },
355
+ Approach: {
356
+ icon: "mng-lnc-driveway",
357
+ measure: ""
358
+ },
359
+ NumberOfBeds: {
360
+ icon: "mng-lnc-bed",
361
+ measure: ""
362
+ },
363
+ Kitchen: {
364
+ icon: "mng-lnc-fridge",
365
+ measure: ""
366
+ },
367
+ BathroomToilet: {
368
+ icon: "mng-lnc-bath",
369
+ measure: ""
370
+ },
371
+ default: {
372
+ icon: " mng-lnc-clock--filled",
373
+ measure: ""
374
+ }
375
+ }, Le = M((s, m) => {
376
+ const {
377
+ uuid: c,
378
+ name: w,
379
+ price: l = 0,
380
+ sellingPrice: b,
381
+ currency: y,
382
+ isNegotiable: P,
383
+ isFree: $,
384
+ imageUrl: K,
385
+ location: H,
386
+ sponsored: Z,
387
+ imageComponent: z,
388
+ onSelectCard: J = () => {
389
+ },
390
+ freeText: Q = "Free",
391
+ negotiableText: x = "Negotiable",
392
+ tags: t = [],
393
+ categoryCode: E,
394
+ condition: S,
395
+ quantity: V,
396
+ trade: B,
397
+ sponsoredText: ee,
398
+ onBookmark: O = () => {
399
+ },
400
+ bookmarkComponent: g,
401
+ bookmarked: R,
402
+ bookmarkLists: re
403
+ } = s, T = ve(), oe = () => {
404
+ var d;
405
+ if (!X(g)) return /* @__PURE__ */ r(C, {});
406
+ const e = g, a = (d = g == null ? void 0 : g.props) == null ? void 0 : d.children, i = G(a, {
407
+ key: `bookmark_pr__${R}`,
408
+ bookmarked: R,
409
+ productUuid: c,
410
+ onAddToBookmark: () => O(!0, c),
411
+ onRemoveFromBookmark: () => O(!1, c),
412
+ bookmarkedUuidList: re
413
+ });
414
+ return G(e, void 0, i);
415
+ }, F = [
416
+ _e,
417
+ Ce,
418
+ Ne,
419
+ Pe,
420
+ $e,
421
+ Ee,
422
+ Se,
423
+ Ve
424
+ ].some(
425
+ (e) => E == null ? void 0 : E.includes(e)
426
+ ), [ne, D] = le(!1), ae = () => {
427
+ D(!0);
428
+ }, te = () => {
429
+ D(!1);
430
+ }, ie = () => /* @__PURE__ */ r("div", { className: "tags-popover__trigger", children: t == null ? void 0 : t.map((e, a) => {
431
+ var u, h, f, j, W;
432
+ const i = ((u = n == null ? void 0 : n[e == null ? void 0 : e.code]) == null ? void 0 : u.icon) ?? ((h = n == null ? void 0 : n.default) == null ? void 0 : h.icon) ?? "", d = ((f = e == null ? void 0 : e.measurementUnit) == null ? void 0 : f.symbol) ?? ((j = n == null ? void 0 : n[e == null ? void 0 : e.code]) == null ? void 0 : j.measure) ?? "", k = [(e == null ? void 0 : e.value) ?? ((W = e == null ? void 0 : e.multiOptions) == null ? void 0 : W[0]) ?? "", d].filter(Boolean).join(" ");
433
+ return T ? /* @__PURE__ */ o("div", { className: "tag-mobile", children: [
434
+ k,
435
+ a < (t == null ? void 0 : t.length) - 1 ? " · " : ""
436
+ ] }) : /* @__PURE__ */ o(
437
+ _,
438
+ {
439
+ className: "tag",
440
+ children: [
441
+ /* @__PURE__ */ r("i", { className: i }),
442
+ k
443
+ ]
444
+ },
445
+ `detailed-products-section-tag__${a + 1}`
446
+ );
447
+ }) }), se = () => /* @__PURE__ */ r("div", { className: "tags-popover__content", children: t == null ? void 0 : t.map((e, a) => {
448
+ var u, h, f;
449
+ const i = ((u = e == null ? void 0 : e.measurementUnit) == null ? void 0 : u.symbol) ?? ((h = n == null ? void 0 : n[e == null ? void 0 : e.code]) == null ? void 0 : h.measure) ?? "", p = [(e == null ? void 0 : e.value) ?? ((f = e == null ? void 0 : e.multiOptions) == null ? void 0 : f[0]) ?? "", i].filter(Boolean).join(" "), k = e == null ? void 0 : e.name;
450
+ return /* @__PURE__ */ o("div", { children: [
451
+ /* @__PURE__ */ r("span", { className: "tags-popover__name", children: `${k}: ` }),
452
+ /* @__PURE__ */ r("span", { className: "tags-popover__value", children: p })
453
+ ] }, `detailed-products-section-tag-dropdown__${a + 1}`);
454
+ }) }), ce = () => {
455
+ var e;
456
+ if (T) {
457
+ const a = [S, V, B];
458
+ return (e = a == null ? void 0 : a.filter((i) => pe(i))) == null ? void 0 : e.map((i, d, p) => /* @__PURE__ */ o("div", { className: "tag-mobile", children: [
459
+ i,
460
+ d < (p == null ? void 0 : p.length) - 1 ? " · " : ""
461
+ ] }));
462
+ }
463
+ return /* @__PURE__ */ o(C, { children: [
464
+ S && /* @__PURE__ */ r(_, { className: "tag", children: S }, "detailed-products-section-tag__condition"),
465
+ V && /* @__PURE__ */ r(_, { className: "tag", children: V }, "detailed-products-section-tag__quantity"),
466
+ B && /* @__PURE__ */ r(_, { className: "tag", children: B }, "detailed-products-section-tag__trade")
467
+ ] });
468
+ }, I = l > 0 && y && P !== !0 && $ !== !0 && l !== b;
469
+ return (
470
+ // <LandingPageProductCardSkeleton />
471
+ /* @__PURE__ */ o(Y, { className: "product-card", onClick: J, children: [
472
+ /* @__PURE__ */ o(we, { className: "product-image-wrapper", children: [
473
+ /* @__PURE__ */ r(oe, {}),
474
+ X(z) ? z : /* @__PURE__ */ r(ge, { src: K })
475
+ ] }),
476
+ /* @__PURE__ */ r("div", { className: "wrapper-card-1", children: /* @__PURE__ */ r("div", { className: "card-title", children: w }) }),
477
+ /* @__PURE__ */ o("div", { className: "wrapper-card-3", children: [
478
+ F && /* @__PURE__ */ r(
479
+ "div",
480
+ {
481
+ ...T ? {} : {
482
+ onMouseEnter: ae,
483
+ onMouseLeave: te
484
+ },
485
+ children: /* @__PURE__ */ o(ue, { placement: "bottom", open: ne, children: [
486
+ /* @__PURE__ */ r(he, { children: ie() }),
487
+ /* @__PURE__ */ r(fe, { style: { all: "unset" }, children: /* @__PURE__ */ r(be, { children: se() }) })
488
+ ] })
489
+ }
490
+ ),
491
+ !F && ce()
492
+ ] }),
493
+ /* @__PURE__ */ o("div", { className: "wrapper-card-2", children: [
494
+ /* @__PURE__ */ o("div", { className: `price-text ${I ? "new-price" : ""}`, children: [
495
+ b > 0 && y && P !== !0 && $ !== !0 && /* @__PURE__ */ r("div", { children: `${L(b)} ${q(y)}` }),
496
+ I && /* @__PURE__ */ r("div", { className: `${b > 0 ? "full-price" : ""}`, children: `${L(l)} ${q(y)}` }),
497
+ P && x,
498
+ $ && Q
499
+ ] }),
500
+ /* @__PURE__ */ r("div", { className: "location-text", children: H })
501
+ ] }),
502
+ Z === !0 && /* @__PURE__ */ r(ke, { sponsoredText: ee })
503
+ ] })
504
+ );
505
+ }), Be = M(({}, s) => /* @__PURE__ */ o(Y, { className: "product-card", children: [
506
+ /* @__PURE__ */ r("img", { className: "skeleton-img" }),
507
+ /* @__PURE__ */ o("div", { className: "wrapper-card-1", children: [
508
+ /* @__PURE__ */ r("div", { className: "skeleton-title" }),
509
+ /* @__PURE__ */ r("div", { className: "skeleton-tags" })
510
+ ] }),
511
+ /* @__PURE__ */ o("div", { className: "wrapper-card-1", children: [
512
+ /* @__PURE__ */ r("div", { className: "skeleton-price" }),
513
+ /* @__PURE__ */ r("div", { className: "skeleton-sponsored" })
514
+ ] })
515
+ ] })), Te = ({ limit: s = 5, isLoading: m = !1, keyPrefix: c }) => /* @__PURE__ */ r(C, { children: Array.from({ length: s }, (w, l) => /* @__PURE__ */ r(
516
+ Be,
517
+ {
518
+ isLoading: m
519
+ },
520
+ `${c}-skeleton-product-card-${l}`
521
+ )) }), qe = ({
522
+ children: s,
523
+ fallbackComponent: m = /* @__PURE__ */ r(C, {}),
524
+ isLoading: c = !1,
525
+ limit: w,
526
+ keyPrefix: l
527
+ }) => /* @__PURE__ */ r(de, { fallbackComponent: m, children: c === !0 ? /* @__PURE__ */ r(
528
+ Te,
529
+ {
530
+ isLoading: c,
531
+ limit: w,
532
+ keyPrefix: l
533
+ }
534
+ ) : s });
535
+ export {
536
+ Le as D,
537
+ qe as S
538
+ };