@lanaco/lnc-react-ui 4.0.139 → 4.0.140

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