@planetaexo/design-system 0.93.0 → 0.94.0
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 +102 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -5
- package/dist/index.d.ts +16 -5
- package/dist/index.js +102 -39
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -16451,6 +16451,8 @@ function CategoryPage2({
|
|
|
16451
16451
|
title,
|
|
16452
16452
|
intro,
|
|
16453
16453
|
heroImage,
|
|
16454
|
+
heroImageSrcSet,
|
|
16455
|
+
heroImageSizes,
|
|
16454
16456
|
videoUrl,
|
|
16455
16457
|
trustpilotMini,
|
|
16456
16458
|
breadcrumb,
|
|
@@ -16586,6 +16588,8 @@ function CategoryPage2({
|
|
|
16586
16588
|
"img",
|
|
16587
16589
|
{
|
|
16588
16590
|
src: heroImage,
|
|
16591
|
+
srcSet: heroImageSrcSet,
|
|
16592
|
+
sizes: heroImageSizes,
|
|
16589
16593
|
alt: "",
|
|
16590
16594
|
"aria-hidden": true,
|
|
16591
16595
|
fetchPriority: "high",
|
|
@@ -20227,10 +20231,18 @@ function ReviewsSpotlight({
|
|
|
20227
20231
|
intervalMs = 7e3,
|
|
20228
20232
|
className
|
|
20229
20233
|
}) {
|
|
20234
|
+
const trackRef = React20__namespace.useRef(null);
|
|
20230
20235
|
const [index, setIndex] = React20__namespace.useState(0);
|
|
20231
|
-
const [visible, setVisible] = React20__namespace.useState(true);
|
|
20232
20236
|
const reduced = React20__namespace.useRef(false);
|
|
20233
|
-
const
|
|
20237
|
+
const hoverRef = React20__namespace.useRef(false);
|
|
20238
|
+
const focusRef = React20__namespace.useRef(false);
|
|
20239
|
+
const interactRef = React20__namespace.useRef(false);
|
|
20240
|
+
const programmaticRef = React20__namespace.useRef(false);
|
|
20241
|
+
const rafRef = React20__namespace.useRef(null);
|
|
20242
|
+
const interactTimer = React20__namespace.useRef(null);
|
|
20243
|
+
const programmaticTimer = React20__namespace.useRef(
|
|
20244
|
+
null
|
|
20245
|
+
);
|
|
20234
20246
|
React20__namespace.useEffect(() => {
|
|
20235
20247
|
var _a;
|
|
20236
20248
|
const mq = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
@@ -20244,56 +20256,107 @@ function ReviewsSpotlight({
|
|
|
20244
20256
|
return (_a2 = mq.removeEventListener) == null ? void 0 : _a2.call(mq, "change", onChange);
|
|
20245
20257
|
};
|
|
20246
20258
|
}, []);
|
|
20247
|
-
const
|
|
20248
|
-
|
|
20249
|
-
|
|
20250
|
-
|
|
20259
|
+
const scrollToIndex = React20__namespace.useCallback((i) => {
|
|
20260
|
+
const el = trackRef.current;
|
|
20261
|
+
if (!el) return;
|
|
20262
|
+
const smooth = !reduced.current;
|
|
20263
|
+
programmaticRef.current = true;
|
|
20264
|
+
el.scrollTo({ left: i * el.clientWidth, behavior: smooth ? "smooth" : "auto" });
|
|
20265
|
+
if (programmaticTimer.current) clearTimeout(programmaticTimer.current);
|
|
20266
|
+
programmaticTimer.current = setTimeout(
|
|
20267
|
+
() => {
|
|
20268
|
+
programmaticRef.current = false;
|
|
20269
|
+
},
|
|
20270
|
+
smooth ? 600 : 50
|
|
20271
|
+
);
|
|
20272
|
+
}, []);
|
|
20273
|
+
const onScroll = React20__namespace.useCallback(() => {
|
|
20274
|
+
const el = trackRef.current;
|
|
20275
|
+
if (!el) return;
|
|
20276
|
+
if (rafRef.current) cancelAnimationFrame(rafRef.current);
|
|
20277
|
+
rafRef.current = requestAnimationFrame(() => {
|
|
20278
|
+
const i = Math.round(el.scrollLeft / Math.max(1, el.clientWidth));
|
|
20279
|
+
setIndex((prev) => prev === i ? prev : i);
|
|
20280
|
+
});
|
|
20281
|
+
if (!programmaticRef.current) {
|
|
20282
|
+
interactRef.current = true;
|
|
20283
|
+
if (interactTimer.current) clearTimeout(interactTimer.current);
|
|
20284
|
+
interactTimer.current = setTimeout(() => {
|
|
20285
|
+
interactRef.current = false;
|
|
20286
|
+
}, 1500);
|
|
20251
20287
|
}
|
|
20252
|
-
setVisible(false);
|
|
20253
|
-
swapRef.current = setTimeout(() => {
|
|
20254
|
-
setIndex((i) => resolve(i));
|
|
20255
|
-
setVisible(true);
|
|
20256
|
-
}, 260);
|
|
20257
20288
|
}, []);
|
|
20258
20289
|
React20__namespace.useEffect(() => {
|
|
20259
20290
|
if (items.length <= 1 || intervalMs <= 0) return;
|
|
20260
20291
|
const id = setInterval(() => {
|
|
20261
|
-
if (
|
|
20292
|
+
if (reduced.current) return;
|
|
20293
|
+
if (hoverRef.current || focusRef.current || interactRef.current) return;
|
|
20294
|
+
const el = trackRef.current;
|
|
20295
|
+
if (!el) return;
|
|
20296
|
+
const cur = Math.round(el.scrollLeft / Math.max(1, el.clientWidth));
|
|
20297
|
+
scrollToIndex((cur + 1) % items.length);
|
|
20262
20298
|
}, intervalMs);
|
|
20263
|
-
return () =>
|
|
20264
|
-
|
|
20265
|
-
|
|
20266
|
-
|
|
20267
|
-
|
|
20299
|
+
return () => clearInterval(id);
|
|
20300
|
+
}, [items.length, intervalMs, scrollToIndex]);
|
|
20301
|
+
React20__namespace.useEffect(
|
|
20302
|
+
() => () => {
|
|
20303
|
+
if (rafRef.current) cancelAnimationFrame(rafRef.current);
|
|
20304
|
+
if (interactTimer.current) clearTimeout(interactTimer.current);
|
|
20305
|
+
if (programmaticTimer.current) clearTimeout(programmaticTimer.current);
|
|
20306
|
+
},
|
|
20307
|
+
[]
|
|
20308
|
+
);
|
|
20268
20309
|
if (!items.length) return null;
|
|
20269
|
-
const
|
|
20270
|
-
const review = items[safe];
|
|
20310
|
+
const active = Math.min(index, items.length - 1);
|
|
20271
20311
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
20272
20312
|
"section",
|
|
20273
20313
|
{
|
|
20274
20314
|
className: cn(SURFACE_PRIMARY_9002, "py-24 text-white sm:py-32", className),
|
|
20315
|
+
onMouseEnter: () => {
|
|
20316
|
+
hoverRef.current = true;
|
|
20317
|
+
},
|
|
20318
|
+
onMouseLeave: () => {
|
|
20319
|
+
hoverRef.current = false;
|
|
20320
|
+
},
|
|
20321
|
+
onFocus: () => {
|
|
20322
|
+
focusRef.current = true;
|
|
20323
|
+
},
|
|
20324
|
+
onBlur: () => {
|
|
20325
|
+
focusRef.current = false;
|
|
20326
|
+
},
|
|
20275
20327
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mx-auto w-full max-w-3xl px-6 text-center sm:px-8", children: [
|
|
20276
20328
|
eyebrow && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-ui text-xs font-bold uppercase tracking-[0.22em] text-primary", children: eyebrow }),
|
|
20277
20329
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "sr-only", children: title }),
|
|
20278
|
-
/* @__PURE__ */ jsxRuntime.
|
|
20330
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
20279
20331
|
"div",
|
|
20280
20332
|
{
|
|
20281
|
-
|
|
20282
|
-
|
|
20283
|
-
|
|
20284
|
-
|
|
20285
|
-
|
|
20286
|
-
|
|
20287
|
-
|
|
20288
|
-
|
|
20289
|
-
|
|
20290
|
-
"
|
|
20291
|
-
|
|
20292
|
-
|
|
20293
|
-
|
|
20294
|
-
|
|
20295
|
-
|
|
20296
|
-
|
|
20333
|
+
ref: trackRef,
|
|
20334
|
+
onScroll,
|
|
20335
|
+
"aria-roledescription": "carousel",
|
|
20336
|
+
"aria-label": title,
|
|
20337
|
+
className: "flex snap-x snap-mandatory overflow-x-auto scrollbar-none",
|
|
20338
|
+
children: items.map((review, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
20339
|
+
"div",
|
|
20340
|
+
{
|
|
20341
|
+
role: "group",
|
|
20342
|
+
"aria-roledescription": "slide",
|
|
20343
|
+
"aria-label": `Review ${i + 1} of ${items.length}`,
|
|
20344
|
+
className: "w-full shrink-0 snap-start",
|
|
20345
|
+
children: [
|
|
20346
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-8 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(TrustpilotStars, { stars: review.stars, className: "h-7 w-7" }) }),
|
|
20347
|
+
/* @__PURE__ */ jsxRuntime.jsxs("blockquote", { className: "mx-auto mt-8 flex min-h-[15rem] max-w-[20ch] items-center justify-center font-sans text-3xl font-normal italic leading-[1.3] text-white sm:min-h-[18rem] sm:text-4xl", children: [
|
|
20348
|
+
"\u201C",
|
|
20349
|
+
review.quote,
|
|
20350
|
+
"\u201D"
|
|
20351
|
+
] }),
|
|
20352
|
+
(review.author || review.location) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-6", children: [
|
|
20353
|
+
review.author && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-ui text-base font-bold tracking-wide text-white", children: review.author }),
|
|
20354
|
+
review.location && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 font-sans text-sm text-white/55", children: review.location })
|
|
20355
|
+
] })
|
|
20356
|
+
]
|
|
20357
|
+
},
|
|
20358
|
+
i
|
|
20359
|
+
))
|
|
20297
20360
|
}
|
|
20298
20361
|
),
|
|
20299
20362
|
items.length > 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-10 flex justify-center gap-2.5", children: items.map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -20301,11 +20364,11 @@ function ReviewsSpotlight({
|
|
|
20301
20364
|
{
|
|
20302
20365
|
type: "button",
|
|
20303
20366
|
"aria-label": `Show review ${i + 1} of ${items.length}`,
|
|
20304
|
-
"aria-current": i ===
|
|
20305
|
-
onClick: () =>
|
|
20367
|
+
"aria-current": i === active,
|
|
20368
|
+
onClick: () => scrollToIndex(i),
|
|
20306
20369
|
className: cn(
|
|
20307
20370
|
"h-2 w-2 rounded-full transition-colors",
|
|
20308
|
-
i ===
|
|
20371
|
+
i === active ? "bg-primary" : "bg-white/25 hover:bg-white/45"
|
|
20309
20372
|
)
|
|
20310
20373
|
},
|
|
20311
20374
|
i
|