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