@harshit-wander/component-lib 1.1.10 → 1.1.12
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.
- package/dist/index.cjs +118 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +118 -24
- package/dist/index.js.map +1 -1
- package/package.json +24 -22
package/dist/index.cjs
CHANGED
|
@@ -274,31 +274,65 @@ var DestinationCard = react.forwardRef(
|
|
|
274
274
|
DestinationCard.displayName = "DestinationCard";
|
|
275
275
|
var frameClass = "block w-full h-[300px] overflow-hidden rounded-md no-underline text-inherit focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2";
|
|
276
276
|
var EventBanner = react.forwardRef(
|
|
277
|
-
({ imageUrl, alt, href, className, ...rest }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("shrink-0 w-full snap-start", className), ...rest, children: href ? /* @__PURE__ */ jsxRuntime.jsx("a", { href, className: frameClass, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
277
|
+
({ imageUrl, alt, href, className, ...rest }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("shrink-0 w-full snap-start", className), ...rest, children: href ? /* @__PURE__ */ jsxRuntime.jsx("a", { href, className: frameClass, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
278
|
+
"img",
|
|
279
|
+
{
|
|
280
|
+
src: imageUrl,
|
|
281
|
+
alt,
|
|
282
|
+
loading: "lazy",
|
|
283
|
+
decoding: "async",
|
|
284
|
+
className: "block w-full h-full object-cover"
|
|
285
|
+
}
|
|
286
|
+
) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: frameClass, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
287
|
+
"img",
|
|
288
|
+
{
|
|
289
|
+
src: imageUrl,
|
|
290
|
+
alt,
|
|
291
|
+
loading: "lazy",
|
|
292
|
+
decoding: "async",
|
|
293
|
+
className: "block w-full h-full object-cover"
|
|
294
|
+
}
|
|
295
|
+
) }) })
|
|
278
296
|
);
|
|
279
297
|
EventBanner.displayName = "EventBanner";
|
|
280
298
|
var frameClass2 = "block w-full h-[300px] overflow-hidden rounded-md no-underline text-inherit focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2";
|
|
281
299
|
var mediaClass = "block w-full h-full object-cover";
|
|
282
300
|
var EventVideoBanner = react.forwardRef(
|
|
283
|
-
({
|
|
301
|
+
({
|
|
302
|
+
posterUrl,
|
|
303
|
+
videoUrl,
|
|
304
|
+
alt,
|
|
305
|
+
href,
|
|
306
|
+
mobileVideoUrl,
|
|
307
|
+
mobilePosterUrl,
|
|
308
|
+
isActive = true,
|
|
309
|
+
className,
|
|
310
|
+
...rest
|
|
311
|
+
}, ref) => {
|
|
284
312
|
const videoRef = react.useRef(null);
|
|
285
313
|
react.useEffect(() => {
|
|
286
314
|
if (!isActive) return;
|
|
287
315
|
const video = videoRef.current;
|
|
288
316
|
if (!video || !videoUrl) return;
|
|
289
|
-
|
|
290
|
-
|
|
317
|
+
const isMobileViewport = typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(max-width: 767px)").matches;
|
|
318
|
+
const activeUrl = isMobileViewport && mobileVideoUrl ? mobileVideoUrl : videoUrl;
|
|
319
|
+
const activePoster = isMobileViewport && mobilePosterUrl ? mobilePosterUrl : posterUrl;
|
|
320
|
+
if (activePoster && video.poster !== activePoster) {
|
|
321
|
+
video.poster = activePoster;
|
|
322
|
+
}
|
|
323
|
+
if (!activeUrl.includes(".m3u8")) {
|
|
324
|
+
video.src = activeUrl;
|
|
291
325
|
return;
|
|
292
326
|
}
|
|
293
327
|
if (video.canPlayType("application/vnd.apple.mpegurl")) {
|
|
294
|
-
video.src =
|
|
328
|
+
video.src = activeUrl;
|
|
295
329
|
return;
|
|
296
330
|
}
|
|
297
331
|
let cancelled = false;
|
|
298
332
|
import('hls.js').then(({ default: Hls }) => {
|
|
299
333
|
if (cancelled || !Hls.isSupported()) return;
|
|
300
334
|
const hls = new Hls({ autoStartLoad: true, startLevel: -1 });
|
|
301
|
-
hls.loadSource(
|
|
335
|
+
hls.loadSource(activeUrl);
|
|
302
336
|
hls.attachMedia(video);
|
|
303
337
|
video._hls = hls;
|
|
304
338
|
});
|
|
@@ -307,12 +341,11 @@ var EventVideoBanner = react.forwardRef(
|
|
|
307
341
|
const stored = video._hls;
|
|
308
342
|
stored?.destroy();
|
|
309
343
|
};
|
|
310
|
-
}, [videoUrl, isActive]);
|
|
344
|
+
}, [videoUrl, mobileVideoUrl, posterUrl, mobilePosterUrl, isActive]);
|
|
311
345
|
const mediaEl = isActive ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
312
346
|
"video",
|
|
313
347
|
{
|
|
314
348
|
ref: videoRef,
|
|
315
|
-
src: videoUrl?.includes(".m3u8") ? void 0 : videoUrl,
|
|
316
349
|
poster: posterUrl,
|
|
317
350
|
"aria-label": alt,
|
|
318
351
|
muted: true,
|
|
@@ -322,7 +355,13 @@ var EventVideoBanner = react.forwardRef(
|
|
|
322
355
|
preload: "metadata",
|
|
323
356
|
className: mediaClass
|
|
324
357
|
}
|
|
325
|
-
) :
|
|
358
|
+
) : (
|
|
359
|
+
// <picture> lets the browser pick mobile/desktop poster via CSS, no JS
|
|
360
|
+
/* @__PURE__ */ jsxRuntime.jsxs("picture", { children: [
|
|
361
|
+
mobilePosterUrl ? /* @__PURE__ */ jsxRuntime.jsx("source", { media: "(max-width: 767px)", srcSet: mobilePosterUrl }) : null,
|
|
362
|
+
/* @__PURE__ */ jsxRuntime.jsx("img", { src: posterUrl, alt, loading: "lazy", decoding: "async", className: mediaClass })
|
|
363
|
+
] })
|
|
364
|
+
);
|
|
326
365
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("shrink-0 w-full snap-start", className), ...rest, children: href ? /* @__PURE__ */ jsxRuntime.jsx("a", { href, className: frameClass2, children: mediaEl }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: frameClass2, children: mediaEl }) });
|
|
327
366
|
}
|
|
328
367
|
);
|
|
@@ -396,7 +435,16 @@ var cardClass2 = "shrink-0 w-[132px] flex flex-col bg-surface border border-bord
|
|
|
396
435
|
var ExploreCard = react.forwardRef(
|
|
397
436
|
({ image, alt, label, href, className, ...rest }, ref) => {
|
|
398
437
|
const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
399
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
438
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
439
|
+
"img",
|
|
440
|
+
{
|
|
441
|
+
src: image,
|
|
442
|
+
alt,
|
|
443
|
+
loading: "lazy",
|
|
444
|
+
decoding: "async",
|
|
445
|
+
className: "block w-full h-[102px] object-cover"
|
|
446
|
+
}
|
|
447
|
+
),
|
|
400
448
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex items-center justify-center min-h-[56px] py-sm px-md text-md font-medium leading-card text-secondary text-center", children: label })
|
|
401
449
|
] });
|
|
402
450
|
if (href) {
|
|
@@ -519,7 +567,16 @@ var GalleryPhoto = react.forwardRef(
|
|
|
519
567
|
),
|
|
520
568
|
...rest,
|
|
521
569
|
children: [
|
|
522
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
570
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
571
|
+
"img",
|
|
572
|
+
{
|
|
573
|
+
src: image,
|
|
574
|
+
alt,
|
|
575
|
+
loading: "lazy",
|
|
576
|
+
decoding: "async",
|
|
577
|
+
className: "block w-full h-full object-cover"
|
|
578
|
+
}
|
|
579
|
+
),
|
|
523
580
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute bottom-12 left-sm inline-flex items-center gap-xs py-[2px] px-[6px] bg-black/40 border-[0.5px] border-secondary rounded-full text-on-dark text-xs font-normal leading-4 max-md:bottom-8", children: [
|
|
524
581
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
525
582
|
"span",
|
|
@@ -775,7 +832,7 @@ var TestimonialCard = react.forwardRef(
|
|
|
775
832
|
({ thumbnail, thumbnailAlt, logo, logoAlt, caption, videoHref, onPlayClick, className, ...rest }, ref) => {
|
|
776
833
|
const playLabel = `Play testimonial: ${caption}`;
|
|
777
834
|
const inner = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
778
|
-
/* @__PURE__ */ jsxRuntime.jsx("img", { src: thumbnail, alt: thumbnailAlt }),
|
|
835
|
+
/* @__PURE__ */ jsxRuntime.jsx("img", { src: thumbnail, alt: thumbnailAlt, loading: "lazy", decoding: "async" }),
|
|
779
836
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 inline-flex items-center justify-center w-[56px] h-[56px] pointer-events-none z-[1] text-white", children: /* @__PURE__ */ jsxRuntime.jsx(PlaySvg, {}) })
|
|
780
837
|
] });
|
|
781
838
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -810,7 +867,16 @@ var TestimonialCard = react.forwardRef(
|
|
|
810
867
|
}
|
|
811
868
|
),
|
|
812
869
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-sm w-full py-md", children: [
|
|
813
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
870
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
871
|
+
"img",
|
|
872
|
+
{
|
|
873
|
+
src: logo,
|
|
874
|
+
alt: logoAlt,
|
|
875
|
+
loading: "lazy",
|
|
876
|
+
decoding: "async",
|
|
877
|
+
className: "w-[60px] h-[60px] object-contain shrink-0"
|
|
878
|
+
}
|
|
879
|
+
),
|
|
814
880
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "m-0 text-md font-medium leading-8 text-secondary", children: caption })
|
|
815
881
|
] })
|
|
816
882
|
]
|
|
@@ -821,17 +887,21 @@ var TestimonialCard = react.forwardRef(
|
|
|
821
887
|
TestimonialCard.displayName = "TestimonialCard";
|
|
822
888
|
var cardClass4 = "relative flex flex-col justify-end shrink-0 w-[200px] h-[316px] p-[20px] border-2 border-surface rounded-lg overflow-hidden no-underline text-inherit snap-start focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2";
|
|
823
889
|
var TripCategoryCard = react.forwardRef(
|
|
824
|
-
({ image, alt, destination, startingPrice, href, className, ...rest }, ref) => {
|
|
890
|
+
({ image, mobileImage, alt, destination, startingPrice, href, className, ...rest }, ref) => {
|
|
825
891
|
const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
826
|
-
/* @__PURE__ */ jsxRuntime.
|
|
827
|
-
"
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
892
|
+
/* @__PURE__ */ jsxRuntime.jsxs("picture", { className: "absolute inset-0 pointer-events-none", children: [
|
|
893
|
+
mobileImage ? /* @__PURE__ */ jsxRuntime.jsx("source", { media: "(max-width: 767px)", srcSet: mobileImage }) : null,
|
|
894
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
895
|
+
"img",
|
|
896
|
+
{
|
|
897
|
+
src: image,
|
|
898
|
+
alt,
|
|
899
|
+
loading: "lazy",
|
|
900
|
+
decoding: "async",
|
|
901
|
+
className: "absolute inset-0 w-full h-full object-cover"
|
|
902
|
+
}
|
|
903
|
+
)
|
|
904
|
+
] }),
|
|
835
905
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
836
906
|
"span",
|
|
837
907
|
{
|
|
@@ -1684,6 +1754,8 @@ var EventCarousel = react.forwardRef(
|
|
|
1684
1754
|
{
|
|
1685
1755
|
posterUrl: event.posterUrl,
|
|
1686
1756
|
videoUrl: event.videoUrl,
|
|
1757
|
+
mobileVideoUrl: event.mobileVideoUrl,
|
|
1758
|
+
mobilePosterUrl: event.mobilePosterUrl,
|
|
1687
1759
|
alt: event.alt,
|
|
1688
1760
|
href: event.href,
|
|
1689
1761
|
isActive: index === activeIndex
|
|
@@ -2228,9 +2300,28 @@ var useTypewriter = (phrases, options) => {
|
|
|
2228
2300
|
return text;
|
|
2229
2301
|
};
|
|
2230
2302
|
var HomeHero = react.forwardRef(
|
|
2231
|
-
({
|
|
2303
|
+
({
|
|
2304
|
+
videoUrl,
|
|
2305
|
+
posterUrl,
|
|
2306
|
+
mobilePosterUrl,
|
|
2307
|
+
title,
|
|
2308
|
+
cyclingPhrases,
|
|
2309
|
+
typewriter,
|
|
2310
|
+
reviews,
|
|
2311
|
+
className,
|
|
2312
|
+
...rest
|
|
2313
|
+
}, ref) => {
|
|
2232
2314
|
const currentPhrase = useTypewriter(cyclingPhrases, typewriter);
|
|
2233
2315
|
const hasReviews = reviews !== void 0 && reviews.length > 0;
|
|
2316
|
+
const videoRef = react.useRef(null);
|
|
2317
|
+
react.useEffect(() => {
|
|
2318
|
+
const video = videoRef.current;
|
|
2319
|
+
if (!video || !mobilePosterUrl) return;
|
|
2320
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
2321
|
+
if (window.matchMedia("(max-width: 767px)").matches) {
|
|
2322
|
+
video.poster = mobilePosterUrl;
|
|
2323
|
+
}
|
|
2324
|
+
}, [mobilePosterUrl]);
|
|
2234
2325
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2235
2326
|
"section",
|
|
2236
2327
|
{
|
|
@@ -2241,6 +2332,7 @@ var HomeHero = react.forwardRef(
|
|
|
2241
2332
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2242
2333
|
"video",
|
|
2243
2334
|
{
|
|
2335
|
+
ref: videoRef,
|
|
2244
2336
|
src: videoUrl,
|
|
2245
2337
|
poster: posterUrl,
|
|
2246
2338
|
muted: true,
|
|
@@ -2864,6 +2956,7 @@ var TripsCategorySection = react.forwardRef(
|
|
|
2864
2956
|
TripCategoryCard,
|
|
2865
2957
|
{
|
|
2866
2958
|
image: trip.image,
|
|
2959
|
+
mobileImage: trip.mobileImage,
|
|
2867
2960
|
alt: trip.alt,
|
|
2868
2961
|
destination: trip.destination,
|
|
2869
2962
|
startingPrice: trip.startingPrice,
|
|
@@ -2919,6 +3012,7 @@ var TripsCategorySection = react.forwardRef(
|
|
|
2919
3012
|
TripCategoryCard,
|
|
2920
3013
|
{
|
|
2921
3014
|
image: trip.image,
|
|
3015
|
+
mobileImage: trip.mobileImage,
|
|
2922
3016
|
alt: trip.alt,
|
|
2923
3017
|
destination: trip.destination,
|
|
2924
3018
|
startingPrice: trip.startingPrice,
|