@snowcone-app/ui 0.11.13 → 0.11.14
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/CHANGELOG.md +6 -0
- package/dist/index.cjs +704 -672
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.js +352 -324
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/composed/HeroProductImage.tsx +22 -11
- package/src/composed/__tests__/HeroProductImage.placement-art.test.tsx +102 -0
- package/src/index.ts +8 -0
- package/src/patterns/PlacementArt.tsx +49 -0
package/dist/index.js
CHANGED
|
@@ -18,7 +18,8 @@ import {
|
|
|
18
18
|
useUiSearchParams
|
|
19
19
|
} from "./chunk-UVWV63VW.js";
|
|
20
20
|
import {
|
|
21
|
-
heroMockupUrl
|
|
21
|
+
heroMockupUrl,
|
|
22
|
+
slugifyPlacementKey
|
|
22
23
|
} from "./chunk-MFDCHCN6.js";
|
|
23
24
|
import {
|
|
24
25
|
checkComponentStyles,
|
|
@@ -9912,8 +9913,25 @@ var LoadingOverlayPrismCandyInline = memo2(
|
|
|
9912
9913
|
import { useRealtimeMockup as useRealtimeMockup3 } from "@snowcone-app/sdk/react";
|
|
9913
9914
|
import { getProduct as getProduct3, listProducts as listProducts4, getMockupUrl } from "@snowcone-app/sdk";
|
|
9914
9915
|
|
|
9915
|
-
// src/patterns/
|
|
9916
|
+
// src/patterns/PlacementArt.tsx
|
|
9917
|
+
import { createContext as createContext10, useContext as useContext8, useMemo as useMemo13 } from "react";
|
|
9916
9918
|
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
9919
|
+
var PlacementArtContext = createContext10(null);
|
|
9920
|
+
function PlacementArt({ art, children }) {
|
|
9921
|
+
const key = art ? JSON.stringify(art) : "";
|
|
9922
|
+
const value = useMemo13(() => key ? JSON.parse(key) : null, [key]);
|
|
9923
|
+
return /* @__PURE__ */ jsx57(PlacementArtContext.Provider, { value, children });
|
|
9924
|
+
}
|
|
9925
|
+
function usePlacementArtOptional() {
|
|
9926
|
+
return useContext8(PlacementArtContext);
|
|
9927
|
+
}
|
|
9928
|
+
function placementArtFor(art, placement, fallback) {
|
|
9929
|
+
if (!art) return fallback;
|
|
9930
|
+
return art[placement.key || slugifyPlacementKey(placement.label)] ?? fallback;
|
|
9931
|
+
}
|
|
9932
|
+
|
|
9933
|
+
// src/patterns/ProductPageProvider.tsx
|
|
9934
|
+
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
9917
9935
|
function ProductPageProvider({
|
|
9918
9936
|
children,
|
|
9919
9937
|
productId,
|
|
@@ -9927,12 +9945,12 @@ function ProductPageProvider({
|
|
|
9927
9945
|
realtimeGrantUrl,
|
|
9928
9946
|
enablePriority = true
|
|
9929
9947
|
}) {
|
|
9930
|
-
let content = /* @__PURE__ */
|
|
9948
|
+
let content = /* @__PURE__ */ jsx58(Product, { productId, productData, children });
|
|
9931
9949
|
if (enablePriority) {
|
|
9932
|
-
content = /* @__PURE__ */
|
|
9950
|
+
content = /* @__PURE__ */ jsx58(MockupPriorityProvider, { children: content });
|
|
9933
9951
|
}
|
|
9934
9952
|
if (enableRealtime) {
|
|
9935
|
-
content = /* @__PURE__ */
|
|
9953
|
+
content = /* @__PURE__ */ jsx58(
|
|
9936
9954
|
RealtimeProvider,
|
|
9937
9955
|
{
|
|
9938
9956
|
wsUrl: realtimeWsUrl,
|
|
@@ -9942,7 +9960,7 @@ function ProductPageProvider({
|
|
|
9942
9960
|
}
|
|
9943
9961
|
);
|
|
9944
9962
|
}
|
|
9945
|
-
return /* @__PURE__ */
|
|
9963
|
+
return /* @__PURE__ */ jsx58(
|
|
9946
9964
|
Shop,
|
|
9947
9965
|
{
|
|
9948
9966
|
endpoint,
|
|
@@ -9962,14 +9980,14 @@ function ProductPageProviderMinimal({
|
|
|
9962
9980
|
shop,
|
|
9963
9981
|
initialArtwork
|
|
9964
9982
|
}) {
|
|
9965
|
-
return /* @__PURE__ */
|
|
9983
|
+
return /* @__PURE__ */ jsx58(
|
|
9966
9984
|
Shop,
|
|
9967
9985
|
{
|
|
9968
9986
|
endpoint,
|
|
9969
9987
|
mockupUrl,
|
|
9970
9988
|
shop,
|
|
9971
9989
|
initialArtwork,
|
|
9972
|
-
children: /* @__PURE__ */
|
|
9990
|
+
children: /* @__PURE__ */ jsx58(Product, { productId, productData, children })
|
|
9973
9991
|
}
|
|
9974
9992
|
);
|
|
9975
9993
|
}
|
|
@@ -9979,14 +9997,14 @@ import {
|
|
|
9979
9997
|
useRef as useRef21,
|
|
9980
9998
|
useState as useState28,
|
|
9981
9999
|
useEffect as useEffect29,
|
|
9982
|
-
useMemo as
|
|
10000
|
+
useMemo as useMemo14
|
|
9983
10001
|
} from "react";
|
|
9984
10002
|
import { useDrag } from "@use-gesture/react";
|
|
9985
10003
|
import {
|
|
9986
10004
|
describeProductArtAlignment,
|
|
9987
10005
|
getSnapPoints
|
|
9988
10006
|
} from "@snowcone-app/sdk";
|
|
9989
|
-
import { Fragment as Fragment12, jsx as
|
|
10007
|
+
import { Fragment as Fragment12, jsx as jsx59, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
9990
10008
|
function ArtAlignment({
|
|
9991
10009
|
src: propSrc,
|
|
9992
10010
|
artworkAspectRatio: propAspectRatio,
|
|
@@ -10029,7 +10047,7 @@ function ArtAlignment({
|
|
|
10029
10047
|
const [detectedAspectRatio, setDetectedAspectRatio] = useState28();
|
|
10030
10048
|
const effectiveAspectRatio = artworkAspectRatio || detectedAspectRatio;
|
|
10031
10049
|
const alignment = placementDesign?.alignment || propAlignment || "center";
|
|
10032
|
-
const descriptor =
|
|
10050
|
+
const descriptor = useMemo14(
|
|
10033
10051
|
() => describeProductArtAlignment(
|
|
10034
10052
|
{
|
|
10035
10053
|
src,
|
|
@@ -10051,7 +10069,7 @@ function ArtAlignment({
|
|
|
10051
10069
|
productContext
|
|
10052
10070
|
]
|
|
10053
10071
|
);
|
|
10054
|
-
const containerStyle =
|
|
10072
|
+
const containerStyle = useMemo14(() => {
|
|
10055
10073
|
const style = {};
|
|
10056
10074
|
if (height !== void 0) {
|
|
10057
10075
|
const heightValue = typeof height === "number" ? height : parseFloat(height);
|
|
@@ -10133,7 +10151,7 @@ function ArtAlignment({
|
|
|
10133
10151
|
img.removeEventListener("load", handleLoad);
|
|
10134
10152
|
};
|
|
10135
10153
|
}, [descriptor?.src, artworkAspectRatio]);
|
|
10136
|
-
const maskDimensions =
|
|
10154
|
+
const maskDimensions = useMemo14(() => {
|
|
10137
10155
|
if (!isReady || containerSize.width === 0 || !descriptor) {
|
|
10138
10156
|
return { width: 0, height: 0 };
|
|
10139
10157
|
}
|
|
@@ -10148,7 +10166,7 @@ function ArtAlignment({
|
|
|
10148
10166
|
descriptor?.effectiveAlignment,
|
|
10149
10167
|
isReady
|
|
10150
10168
|
]);
|
|
10151
|
-
const clipPathCoords =
|
|
10169
|
+
const clipPathCoords = useMemo14(() => {
|
|
10152
10170
|
const halfMaskW = maskDimensions.width / 2;
|
|
10153
10171
|
const halfMaskH = maskDimensions.height / 2;
|
|
10154
10172
|
const halfContainerW = containerSize.width / 2;
|
|
@@ -10177,7 +10195,7 @@ function ArtAlignment({
|
|
|
10177
10195
|
maskDimensions.height,
|
|
10178
10196
|
isReady
|
|
10179
10197
|
]);
|
|
10180
|
-
const overlayStyle =
|
|
10198
|
+
const overlayStyle = useMemo14(() => {
|
|
10181
10199
|
const { halfMaskW, halfMaskH, halfContainerW, halfContainerH } = clipPathCoords;
|
|
10182
10200
|
const cx = position.x + halfContainerW;
|
|
10183
10201
|
const cy = position.y + halfContainerH;
|
|
@@ -10198,7 +10216,7 @@ function ArtAlignment({
|
|
|
10198
10216
|
clipPath: isReady ? `polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 0%, ${right}px ${bottom}px, ${right}px ${top}px, ${left}px ${top}px, ${left}px ${bottom}px, ${right}px ${bottom}px)` : "none"
|
|
10199
10217
|
};
|
|
10200
10218
|
}, [isReady, position.x, position.y, clipPathCoords]);
|
|
10201
|
-
const maskStyle =
|
|
10219
|
+
const maskStyle = useMemo14(() => ({
|
|
10202
10220
|
width: `${maskDimensions.width}px`,
|
|
10203
10221
|
height: `${maskDimensions.height}px`,
|
|
10204
10222
|
boxShadow: `0 0 0 2px var(--color-background), 0 0 0 4px var(--color-primary)`,
|
|
@@ -10213,7 +10231,7 @@ function ArtAlignment({
|
|
|
10213
10231
|
// GPU acceleration for smoother drag
|
|
10214
10232
|
borderRadius: "var(--radius-image, 4px)"
|
|
10215
10233
|
}), [maskDimensions.width, maskDimensions.height]);
|
|
10216
|
-
const clearImageClipPath =
|
|
10234
|
+
const clearImageClipPath = useMemo14(() => {
|
|
10217
10235
|
if (!isReady) return "none";
|
|
10218
10236
|
const { halfMaskW, halfMaskH, halfContainerW, halfContainerH } = clipPathCoords;
|
|
10219
10237
|
const cx = position.x + halfContainerW;
|
|
@@ -10224,7 +10242,7 @@ function ArtAlignment({
|
|
|
10224
10242
|
const top = cy - halfMaskH;
|
|
10225
10243
|
return `polygon(${left}px ${top}px, ${right}px ${top}px, ${right}px ${bottom}px, ${left}px ${bottom}px)`;
|
|
10226
10244
|
}, [isReady, position.x, position.y, clipPathCoords]);
|
|
10227
|
-
const maskTransform =
|
|
10245
|
+
const maskTransform = useMemo14(() => {
|
|
10228
10246
|
return descriptor?.effectiveAlignment === "horizontal" ? `translate(calc(-50% + ${position.x}px), -50%)` : `translate(-50%, calc(-50% + ${position.y}px))`;
|
|
10229
10247
|
}, [descriptor?.effectiveAlignment, position.x, position.y]);
|
|
10230
10248
|
const lastContextUpdateTimeRef = useRef21(0);
|
|
@@ -10324,7 +10342,7 @@ function ArtAlignment({
|
|
|
10324
10342
|
if (!descriptor) {
|
|
10325
10343
|
return null;
|
|
10326
10344
|
}
|
|
10327
|
-
return /* @__PURE__ */
|
|
10345
|
+
return /* @__PURE__ */ jsx59(
|
|
10328
10346
|
"div",
|
|
10329
10347
|
{
|
|
10330
10348
|
className: `relative ${className || ""}`,
|
|
@@ -10333,8 +10351,8 @@ function ArtAlignment({
|
|
|
10333
10351
|
width: "fit-content",
|
|
10334
10352
|
maxWidth: "100%"
|
|
10335
10353
|
},
|
|
10336
|
-
children: /* @__PURE__ */
|
|
10337
|
-
/* @__PURE__ */
|
|
10354
|
+
children: /* @__PURE__ */ jsx59("div", { className: "overflow-hidden p-1", children: /* @__PURE__ */ jsxs36("div", { ref: containerRef, className: "relative", style: containerStyle, children: [
|
|
10355
|
+
/* @__PURE__ */ jsx59(
|
|
10338
10356
|
"img",
|
|
10339
10357
|
{
|
|
10340
10358
|
ref: imageRef,
|
|
@@ -10360,8 +10378,8 @@ function ArtAlignment({
|
|
|
10360
10378
|
}
|
|
10361
10379
|
),
|
|
10362
10380
|
isReady && maskDimensions.width > 0 && /* @__PURE__ */ jsxs36(Fragment12, { children: [
|
|
10363
|
-
/* @__PURE__ */
|
|
10364
|
-
/* @__PURE__ */
|
|
10381
|
+
/* @__PURE__ */ jsx59("div", { style: overlayStyle }),
|
|
10382
|
+
/* @__PURE__ */ jsx59(
|
|
10365
10383
|
"img",
|
|
10366
10384
|
{
|
|
10367
10385
|
src: descriptor.src,
|
|
@@ -10389,7 +10407,7 @@ function ArtAlignment({
|
|
|
10389
10407
|
loading: "eager"
|
|
10390
10408
|
}
|
|
10391
10409
|
),
|
|
10392
|
-
/* @__PURE__ */
|
|
10410
|
+
/* @__PURE__ */ jsx59(
|
|
10393
10411
|
"div",
|
|
10394
10412
|
{
|
|
10395
10413
|
...bind(),
|
|
@@ -10407,7 +10425,7 @@ function ArtAlignment({
|
|
|
10407
10425
|
|
|
10408
10426
|
// src/composed/ArtworkCustomizer.tsx
|
|
10409
10427
|
import { useEffect as useEffect30 } from "react";
|
|
10410
|
-
import { jsx as
|
|
10428
|
+
import { jsx as jsx60, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
10411
10429
|
function ArtworkCustomizer(props) {
|
|
10412
10430
|
const designContext = useDesign();
|
|
10413
10431
|
const artwork = props.artwork || designContext.selectedArtwork;
|
|
@@ -10432,10 +10450,10 @@ function ArtworkCustomizer(props) {
|
|
|
10432
10450
|
useEffect30(() => {
|
|
10433
10451
|
}, [selectedPlacement]);
|
|
10434
10452
|
if (!artwork) {
|
|
10435
|
-
return /* @__PURE__ */
|
|
10453
|
+
return /* @__PURE__ */ jsx60("div", { className: `text-sm text-muted-foreground ${props.className || ""}`, children: "Select artwork to customize" });
|
|
10436
10454
|
}
|
|
10437
10455
|
if (artwork.type === "pattern") {
|
|
10438
|
-
return /* @__PURE__ */
|
|
10456
|
+
return /* @__PURE__ */ jsx60(
|
|
10439
10457
|
TileCount,
|
|
10440
10458
|
{
|
|
10441
10459
|
artwork,
|
|
@@ -10447,7 +10465,7 @@ function ArtworkCustomizer(props) {
|
|
|
10447
10465
|
}
|
|
10448
10466
|
const isCanvasEditorMode = props.mode === "canvas" || !!props.children && props.mode !== "alignment";
|
|
10449
10467
|
return /* @__PURE__ */ jsxs37("div", { className: "flex flex-col gap-4", children: [
|
|
10450
|
-
placements.length > 1 && /* @__PURE__ */
|
|
10468
|
+
placements.length > 1 && /* @__PURE__ */ jsx60("div", { className: "text-sm leading-relaxed", children: placements.map((p) => /* @__PURE__ */ jsx60(
|
|
10451
10469
|
"button",
|
|
10452
10470
|
{
|
|
10453
10471
|
onClick: () => setSelectedPlacement?.(p.label),
|
|
@@ -10456,7 +10474,7 @@ function ArtworkCustomizer(props) {
|
|
|
10456
10474
|
},
|
|
10457
10475
|
p.label
|
|
10458
10476
|
)) }),
|
|
10459
|
-
isColorPlacement ? /* @__PURE__ */
|
|
10477
|
+
isColorPlacement ? /* @__PURE__ */ jsx60(ColorPicker2, { placement: selectedPlacement }) : isFitMode ? null : /* @__PURE__ */ jsx60("div", { className: "relative", children: props.children || /* @__PURE__ */ jsx60(
|
|
10460
10478
|
ArtAlignment,
|
|
10461
10479
|
{
|
|
10462
10480
|
artwork: { src: artwork.src },
|
|
@@ -10477,7 +10495,7 @@ import {
|
|
|
10477
10495
|
Shapes as LucideShapes,
|
|
10478
10496
|
Upload as LucideUpload
|
|
10479
10497
|
} from "lucide-react";
|
|
10480
|
-
import { jsx as
|
|
10498
|
+
import { jsx as jsx61, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
10481
10499
|
var ImageIcon = LucideImage;
|
|
10482
10500
|
var TypeIcon = LucideType;
|
|
10483
10501
|
var ShapesIcon = LucideShapes;
|
|
@@ -10489,35 +10507,35 @@ function CanvasEditor({
|
|
|
10489
10507
|
children
|
|
10490
10508
|
}) {
|
|
10491
10509
|
return /* @__PURE__ */ jsxs38("div", { className: "flex flex-col gap-6", children: [
|
|
10492
|
-
/* @__PURE__ */
|
|
10510
|
+
/* @__PURE__ */ jsx61("div", { className: "bg-background border-2 border-border rounded-lg aspect-square overflow-hidden relative", children: children || /* @__PURE__ */ jsx61("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ jsx61("div", { className: "text-muted-foreground text-sm", children: "No editor provided" }) }) }),
|
|
10493
10511
|
/* @__PURE__ */ jsxs38("div", { className: "flex items-center justify-center gap-8 py-2", children: [
|
|
10494
|
-
/* @__PURE__ */
|
|
10512
|
+
/* @__PURE__ */ jsx61(
|
|
10495
10513
|
"button",
|
|
10496
10514
|
{
|
|
10497
10515
|
onClick: onOpenImageGallery,
|
|
10498
10516
|
className: "flex flex-col items-center gap-2 text-muted-foreground hover:text-foreground transition-colors",
|
|
10499
10517
|
"aria-label": "Open image gallery",
|
|
10500
|
-
children: /* @__PURE__ */
|
|
10518
|
+
children: /* @__PURE__ */ jsx61("div", { className: "w-10 h-10 flex items-center justify-center", children: /* @__PURE__ */ jsx61(ImageIcon, { className: "w-6 h-6" }) })
|
|
10501
10519
|
}
|
|
10502
10520
|
),
|
|
10503
|
-
/* @__PURE__ */
|
|
10521
|
+
/* @__PURE__ */ jsx61(
|
|
10504
10522
|
"button",
|
|
10505
10523
|
{
|
|
10506
10524
|
onClick: onOpenTypography,
|
|
10507
10525
|
className: "flex flex-col items-center gap-2 text-muted-foreground hover:text-foreground transition-colors",
|
|
10508
10526
|
"aria-label": "Add text",
|
|
10509
|
-
children: /* @__PURE__ */
|
|
10527
|
+
children: /* @__PURE__ */ jsx61("div", { className: "w-10 h-10 flex items-center justify-center", children: /* @__PURE__ */ jsx61(TypeIcon, { className: "w-6 h-6" }) })
|
|
10510
10528
|
}
|
|
10511
10529
|
),
|
|
10512
|
-
/* @__PURE__ */
|
|
10513
|
-
/* @__PURE__ */
|
|
10530
|
+
/* @__PURE__ */ jsx61("button", { className: "flex flex-col items-center gap-2 text-muted-foreground hover:text-foreground transition-colors", children: /* @__PURE__ */ jsx61("div", { className: "w-10 h-10 flex items-center justify-center", children: /* @__PURE__ */ jsx61(ShapesIcon, { className: "w-6 h-6" }) }) }),
|
|
10531
|
+
/* @__PURE__ */ jsx61("button", { className: "flex flex-col items-center gap-2 text-muted-foreground hover:text-foreground transition-colors", children: /* @__PURE__ */ jsx61("div", { className: "w-10 h-10 flex items-center justify-center", children: /* @__PURE__ */ jsx61(UploadIcon, { className: "w-6 h-6" }) }) })
|
|
10514
10532
|
] })
|
|
10515
10533
|
] });
|
|
10516
10534
|
}
|
|
10517
10535
|
|
|
10518
10536
|
// src/composed/HeroProductImage.tsx
|
|
10519
10537
|
import {
|
|
10520
|
-
useMemo as
|
|
10538
|
+
useMemo as useMemo15,
|
|
10521
10539
|
useState as useState31,
|
|
10522
10540
|
useEffect as useEffect32,
|
|
10523
10541
|
useRef as useRef23,
|
|
@@ -10568,11 +10586,14 @@ function useContainerWidth(containerRef, maxWidth = 3e3) {
|
|
|
10568
10586
|
}
|
|
10569
10587
|
|
|
10570
10588
|
// src/composed/HeroProductImage.tsx
|
|
10571
|
-
import { jsx as
|
|
10589
|
+
import { jsx as jsx62, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
10572
10590
|
function buildHeroMockupUrl(args) {
|
|
10573
10591
|
const snow = typeof window !== "undefined" && window.snowcone || {};
|
|
10574
10592
|
return heroMockupUrl({ ...args, shop: snow.shop, resolver: snow.resolver });
|
|
10575
10593
|
}
|
|
10594
|
+
function artIdentity(src, placementArtKey) {
|
|
10595
|
+
return placementArtKey ? `${src ?? ""}|${placementArtKey}` : src;
|
|
10596
|
+
}
|
|
10576
10597
|
function isCrop(stripView) {
|
|
10577
10598
|
return stripView !== void 0;
|
|
10578
10599
|
}
|
|
@@ -10632,18 +10653,20 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10632
10653
|
const realtimeContext = useRealtimeOptional();
|
|
10633
10654
|
const priorityContext = useMockupPriorityOptional();
|
|
10634
10655
|
const mockupBg = useMockupBackgroundOptional();
|
|
10656
|
+
const placementArt = usePlacementArtOptional();
|
|
10657
|
+
const placementArtKey = placementArt ? JSON.stringify(placementArt) : "";
|
|
10635
10658
|
const priorityContextRef = useRef23(priorityContext);
|
|
10636
10659
|
priorityContextRef.current = priorityContext;
|
|
10637
10660
|
const contextRef = useRef23(context);
|
|
10638
10661
|
contextRef.current = context;
|
|
10639
10662
|
const actualProductId = product?.id || productId || context?.product?.id;
|
|
10640
|
-
const selectedGvid =
|
|
10663
|
+
const selectedGvid = useMemo15(() => {
|
|
10641
10664
|
return resolveVariantId(context, gvid, variantId);
|
|
10642
10665
|
}, [gvid, variantId, context?.selection, context?.combinations]);
|
|
10643
|
-
const actualMockupId =
|
|
10666
|
+
const actualMockupId = useMemo15(() => {
|
|
10644
10667
|
return resolveMockupId(context, selectedGvid, mockupId);
|
|
10645
10668
|
}, [mockupId, selectedGvid, context]);
|
|
10646
|
-
const actualGvid =
|
|
10669
|
+
const actualGvid = useMemo15(() => {
|
|
10647
10670
|
return gvid || variantId ? selectedGvid : resolvePreviewVariantId2(context, selectedGvid, actualMockupId);
|
|
10648
10671
|
}, [gvid, variantId, selectedGvid, actualMockupId, context]);
|
|
10649
10672
|
const unavailable = actualMockupId ? realtimeContext?.unavailableMockups?.get(actualMockupId) ?? null : null;
|
|
@@ -10653,7 +10676,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10653
10676
|
const containerRef = useRef23(null);
|
|
10654
10677
|
const measuredWidth = useContainerWidth(containerRef);
|
|
10655
10678
|
const width = widthProp ?? measuredWidth;
|
|
10656
|
-
const initialStaticUrl =
|
|
10679
|
+
const initialStaticUrl = useMemo15(() => {
|
|
10657
10680
|
if (realtimeUrl) return null;
|
|
10658
10681
|
if (mode === "realtime") return null;
|
|
10659
10682
|
if (typeof window !== "undefined" && window.snowcone?.signMockupUrl) {
|
|
@@ -10665,12 +10688,12 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10665
10688
|
const allPlacements = product?.placements || context?.product?.placements || [];
|
|
10666
10689
|
if (allPlacements.length === 0) return null;
|
|
10667
10690
|
const placementDesigns = {};
|
|
10668
|
-
if (designContext?.getPlacementDesign && allPlacements) {
|
|
10691
|
+
if ((designContext?.getPlacementDesign || placementArt) && allPlacements) {
|
|
10669
10692
|
for (const p of allPlacements) {
|
|
10670
10693
|
if (p.type === "color") continue;
|
|
10671
|
-
const design2 = designContext
|
|
10694
|
+
const design2 = designContext?.getPlacementDesign(p.label);
|
|
10672
10695
|
placementDesigns[p.label] = {
|
|
10673
|
-
imageUrl: effectiveArtworkSrc,
|
|
10696
|
+
imageUrl: placementArtFor(placementArt, p, effectiveArtworkSrc),
|
|
10674
10697
|
alignment: design2?.alignment || "center"
|
|
10675
10698
|
};
|
|
10676
10699
|
}
|
|
@@ -10705,6 +10728,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10705
10728
|
images,
|
|
10706
10729
|
width,
|
|
10707
10730
|
effects,
|
|
10731
|
+
placementArt,
|
|
10708
10732
|
// Include placements to trigger recomputation when alignment changes
|
|
10709
10733
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
10710
10734
|
JSON.stringify(designContext?.placements)
|
|
@@ -10770,7 +10794,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10770
10794
|
if (!realtimeUrl) return;
|
|
10771
10795
|
if (realtimeUrl === lastUrlRef.current) return;
|
|
10772
10796
|
lastUrlRef.current = realtimeUrl;
|
|
10773
|
-
realtimeArtworkSrcRef.current = artworkSrc || selectedArtworkSrc;
|
|
10797
|
+
realtimeArtworkSrcRef.current = artIdentity(artworkSrc || selectedArtworkSrc, placementArtKey);
|
|
10774
10798
|
const isInitialLoad = layersLengthRef.current === 0;
|
|
10775
10799
|
addLayerDirectly(realtimeUrl, { skipTransition: isInitialLoad });
|
|
10776
10800
|
}, [realtimeUrl, addLayerDirectly, actualMockupId, placement]);
|
|
@@ -10986,7 +11010,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10986
11010
|
const selectedArtworkType = designContext?.selectedArtwork?.type;
|
|
10987
11011
|
const selectedArtworkTileCount = designContext?.selectedArtwork?.type === "pattern" ? designContext?.selectedArtwork?.tileCount : void 0;
|
|
10988
11012
|
useEffect32(() => {
|
|
10989
|
-
const currentSrc = artworkSrc || selectedArtworkSrc;
|
|
11013
|
+
const currentSrc = artIdentity(artworkSrc || selectedArtworkSrc, placementArtKey);
|
|
10990
11014
|
if (currentSrc !== prevArtworkSrcRef.current) {
|
|
10991
11015
|
lastUrlRef.current = null;
|
|
10992
11016
|
prevArtworkSrcRef.current = currentSrc;
|
|
@@ -10994,7 +11018,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10994
11018
|
hasReceivedRealtimeRef.current = false;
|
|
10995
11019
|
realtimeArtworkSrcRef.current = void 0;
|
|
10996
11020
|
}
|
|
10997
|
-
}, [artworkSrc, selectedArtworkSrc]);
|
|
11021
|
+
}, [artworkSrc, selectedArtworkSrc, placementArtKey]);
|
|
10998
11022
|
const contextSelectionRef = useRef23(context?.selection);
|
|
10999
11023
|
const contextOptionAttributesRef = useRef23(context?.optionAttributes);
|
|
11000
11024
|
contextSelectionRef.current = context?.selection;
|
|
@@ -11006,12 +11030,12 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11006
11030
|
return [];
|
|
11007
11031
|
}
|
|
11008
11032
|
const placementDesigns = {};
|
|
11009
|
-
if (getPlacementDesign && placements) {
|
|
11033
|
+
if ((getPlacementDesign || placementArt) && placements) {
|
|
11010
11034
|
for (const p of placements) {
|
|
11011
11035
|
if (p.type === "color") continue;
|
|
11012
|
-
const design = getPlacementDesign(p.label);
|
|
11036
|
+
const design = getPlacementDesign?.(p.label);
|
|
11013
11037
|
placementDesigns[p.label] = {
|
|
11014
|
-
imageUrl: effectiveArtworkSrc2,
|
|
11038
|
+
imageUrl: placementArtFor(placementArt, p, effectiveArtworkSrc2),
|
|
11015
11039
|
alignment: design?.alignment || "center"
|
|
11016
11040
|
};
|
|
11017
11041
|
}
|
|
@@ -11030,6 +11054,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11030
11054
|
},
|
|
11031
11055
|
[
|
|
11032
11056
|
getPlacementDesign,
|
|
11057
|
+
placementArt,
|
|
11033
11058
|
artworkSrc,
|
|
11034
11059
|
artworkType,
|
|
11035
11060
|
artworkTileCount,
|
|
@@ -11075,7 +11100,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11075
11100
|
lastUrlRef.current = url;
|
|
11076
11101
|
const hasExistingImage = !!realtimeUrl || layersLengthRef.current > 0;
|
|
11077
11102
|
setError(null);
|
|
11078
|
-
const currentArtworkSrc = artworkSrc || selectedArtworkSrc;
|
|
11103
|
+
const currentArtworkSrc = artIdentity(artworkSrc || selectedArtworkSrc, placementArtKey);
|
|
11079
11104
|
const isRealtimeUrlFresh = realtimeUrl && realtimeArtworkSrcRef.current === currentArtworkSrc;
|
|
11080
11105
|
if (isRealtimeUrlFresh) {
|
|
11081
11106
|
onUrlGeneratedRef.current?.(realtimeUrl);
|
|
@@ -11204,20 +11229,20 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11204
11229
|
}, []);
|
|
11205
11230
|
const handleLoaderExited = useCallback18(() => setLoaderMounted(false), []);
|
|
11206
11231
|
if (!hasArtwork) {
|
|
11207
|
-
return /* @__PURE__ */
|
|
11232
|
+
return /* @__PURE__ */ jsx62(
|
|
11208
11233
|
"div",
|
|
11209
11234
|
{
|
|
11210
11235
|
className: `bg-gray-100 flex items-center justify-center ${className || ""}`,
|
|
11211
11236
|
style,
|
|
11212
11237
|
children: /* @__PURE__ */ jsxs39("div", { className: "text-gray-400 text-center p-4", children: [
|
|
11213
|
-
/* @__PURE__ */
|
|
11238
|
+
/* @__PURE__ */ jsx62(
|
|
11214
11239
|
"svg",
|
|
11215
11240
|
{
|
|
11216
11241
|
className: "w-8 h-8 mx-auto mb-2",
|
|
11217
11242
|
fill: "none",
|
|
11218
11243
|
stroke: "currentColor",
|
|
11219
11244
|
viewBox: "0 0 24 24",
|
|
11220
|
-
children: /* @__PURE__ */
|
|
11245
|
+
children: /* @__PURE__ */ jsx62(
|
|
11221
11246
|
"path",
|
|
11222
11247
|
{
|
|
11223
11248
|
strokeLinecap: "round",
|
|
@@ -11228,18 +11253,18 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11228
11253
|
)
|
|
11229
11254
|
}
|
|
11230
11255
|
),
|
|
11231
|
-
/* @__PURE__ */
|
|
11256
|
+
/* @__PURE__ */ jsx62("p", { className: "text-xs", children: emptyText })
|
|
11232
11257
|
] })
|
|
11233
11258
|
}
|
|
11234
11259
|
);
|
|
11235
11260
|
}
|
|
11236
11261
|
if (error) {
|
|
11237
|
-
return /* @__PURE__ */
|
|
11262
|
+
return /* @__PURE__ */ jsx62(
|
|
11238
11263
|
"div",
|
|
11239
11264
|
{
|
|
11240
11265
|
className: `bg-red-50 flex items-center justify-center ${className || ""}`,
|
|
11241
11266
|
style,
|
|
11242
|
-
children: /* @__PURE__ */
|
|
11267
|
+
children: /* @__PURE__ */ jsx62("div", { className: "text-red-600 text-center p-4", children: /* @__PURE__ */ jsx62("p", { className: "text-xs", children: errorText }) })
|
|
11243
11268
|
}
|
|
11244
11269
|
);
|
|
11245
11270
|
}
|
|
@@ -11259,7 +11284,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11259
11284
|
"data-picture-failed-src": failedSrc,
|
|
11260
11285
|
"data-mockup-unavailable": unavailable ? unavailable.code : void 0,
|
|
11261
11286
|
children: [
|
|
11262
|
-
unavailable && /* @__PURE__ */
|
|
11287
|
+
unavailable && /* @__PURE__ */ jsx62(
|
|
11263
11288
|
"div",
|
|
11264
11289
|
{
|
|
11265
11290
|
role: "status",
|
|
@@ -11268,7 +11293,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11268
11293
|
children: "Mockup unavailable"
|
|
11269
11294
|
}
|
|
11270
11295
|
),
|
|
11271
|
-
renderedUrl && !imgFailed && /* @__PURE__ */
|
|
11296
|
+
renderedUrl && !imgFailed && /* @__PURE__ */ jsx62(
|
|
11272
11297
|
"img",
|
|
11273
11298
|
{
|
|
11274
11299
|
alt: `Product mockup${placement ? ` - ${placement}` : ""}`,
|
|
@@ -11317,8 +11342,8 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11317
11342
|
},
|
|
11318
11343
|
retryNonce
|
|
11319
11344
|
),
|
|
11320
|
-
imgFailed && !prevUrl && /* @__PURE__ */
|
|
11321
|
-
realtimeContext?.renderError && /* @__PURE__ */
|
|
11345
|
+
imgFailed && !prevUrl && /* @__PURE__ */ jsx62("div", { className: "absolute inset-0 flex items-center justify-center bg-muted", children: /* @__PURE__ */ jsx62("p", { className: "text-muted-foreground text-xs", children: unavailableText }) }),
|
|
11346
|
+
realtimeContext?.renderError && /* @__PURE__ */ jsx62(
|
|
11322
11347
|
"div",
|
|
11323
11348
|
{
|
|
11324
11349
|
role: realtimeContext.renderError.retryable ? "status" : "alert",
|
|
@@ -11328,7 +11353,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11328
11353
|
children: realtimeContext.renderError.retryable ? realtimeContext.renderError.message : `Render blocked: ${realtimeContext.renderError.code} \u2014 ${realtimeContext.renderError.message}`
|
|
11329
11354
|
}
|
|
11330
11355
|
),
|
|
11331
|
-
prevUrl && /* @__PURE__ */
|
|
11356
|
+
prevUrl && /* @__PURE__ */ jsx62(
|
|
11332
11357
|
"img",
|
|
11333
11358
|
{
|
|
11334
11359
|
alt: "",
|
|
@@ -11343,7 +11368,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11343
11368
|
onTransitionEnd: handleCrossfadeEnd
|
|
11344
11369
|
}
|
|
11345
11370
|
),
|
|
11346
|
-
loaderMounted && /* @__PURE__ */
|
|
11371
|
+
loaderMounted && /* @__PURE__ */ jsx62(
|
|
11347
11372
|
LoadingOverlayPrismCandyInline,
|
|
11348
11373
|
{
|
|
11349
11374
|
visible: !firstImageLoaded,
|
|
@@ -11357,16 +11382,16 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11357
11382
|
});
|
|
11358
11383
|
|
|
11359
11384
|
// src/composed/SafeImg.tsx
|
|
11360
|
-
import
|
|
11361
|
-
import { Fragment as Fragment13, jsx as
|
|
11362
|
-
var SafeImg =
|
|
11385
|
+
import React46, { useEffect as useEffect33, useState as useState32 } from "react";
|
|
11386
|
+
import { Fragment as Fragment13, jsx as jsx63 } from "react/jsx-runtime";
|
|
11387
|
+
var SafeImg = React46.forwardRef(
|
|
11363
11388
|
function SafeImg2({ fallback = null, onError, src, ...rest }, ref) {
|
|
11364
11389
|
const [failed, setFailed] = useState32(false);
|
|
11365
11390
|
useEffect33(() => {
|
|
11366
11391
|
setFailed(false);
|
|
11367
11392
|
}, [src]);
|
|
11368
|
-
if (failed) return /* @__PURE__ */
|
|
11369
|
-
return /* @__PURE__ */
|
|
11393
|
+
if (failed) return /* @__PURE__ */ jsx63(Fragment13, { children: fallback });
|
|
11394
|
+
return /* @__PURE__ */ jsx63(
|
|
11370
11395
|
"img",
|
|
11371
11396
|
{
|
|
11372
11397
|
...rest,
|
|
@@ -11405,7 +11430,7 @@ var { searchClient } = instantMeiliSearch(
|
|
|
11405
11430
|
|
|
11406
11431
|
// src/composed/search/SearchProvider.tsx
|
|
11407
11432
|
import { useEffect as useEffect34 } from "react";
|
|
11408
|
-
import { jsx as
|
|
11433
|
+
import { jsx as jsx64, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
11409
11434
|
function InitialSearchTrigger() {
|
|
11410
11435
|
const { refine } = useSearchBox();
|
|
11411
11436
|
useEffect34(() => {
|
|
@@ -11460,7 +11485,7 @@ function SearchProvider({
|
|
|
11460
11485
|
}
|
|
11461
11486
|
},
|
|
11462
11487
|
children: [
|
|
11463
|
-
/* @__PURE__ */
|
|
11488
|
+
/* @__PURE__ */ jsx64(
|
|
11464
11489
|
Configure,
|
|
11465
11490
|
{
|
|
11466
11491
|
hitsPerPage,
|
|
@@ -11469,7 +11494,7 @@ function SearchProvider({
|
|
|
11469
11494
|
attributesToRetrieve
|
|
11470
11495
|
}
|
|
11471
11496
|
),
|
|
11472
|
-
/* @__PURE__ */
|
|
11497
|
+
/* @__PURE__ */ jsx64(InitialSearchTrigger, {}),
|
|
11473
11498
|
children
|
|
11474
11499
|
]
|
|
11475
11500
|
}
|
|
@@ -11480,7 +11505,7 @@ function SearchProvider({
|
|
|
11480
11505
|
import { useSearchBox as useSearchBox2 } from "react-instantsearch";
|
|
11481
11506
|
import { Search, X } from "lucide-react";
|
|
11482
11507
|
import { useEffect as useEffect35, useRef as useRef24, useState as useState33 } from "react";
|
|
11483
|
-
import { jsx as
|
|
11508
|
+
import { jsx as jsx65, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
11484
11509
|
function SearchBox() {
|
|
11485
11510
|
const { query, refine, clear } = useSearchBox2();
|
|
11486
11511
|
const searchParams = useUiSearchParams();
|
|
@@ -11514,8 +11539,8 @@ function SearchBox() {
|
|
|
11514
11539
|
return () => clearTimeout(timer);
|
|
11515
11540
|
}
|
|
11516
11541
|
}, [searchParams, router]);
|
|
11517
|
-
return /* @__PURE__ */
|
|
11518
|
-
/* @__PURE__ */
|
|
11542
|
+
return /* @__PURE__ */ jsx65("form", { role: "search", onSubmit: (e) => e.preventDefault(), children: /* @__PURE__ */ jsxs41("div", { className: "relative", children: [
|
|
11543
|
+
/* @__PURE__ */ jsx65(
|
|
11519
11544
|
Input,
|
|
11520
11545
|
{
|
|
11521
11546
|
ref: inputRef,
|
|
@@ -11524,15 +11549,15 @@ function SearchBox() {
|
|
|
11524
11549
|
value: query,
|
|
11525
11550
|
onChange: (e) => refine(e.target.value),
|
|
11526
11551
|
placeholder: "Search products...",
|
|
11527
|
-
startContent: /* @__PURE__ */
|
|
11528
|
-
endContent: query ? /* @__PURE__ */
|
|
11552
|
+
startContent: /* @__PURE__ */ jsx65(Search, { className: "w-5 h-5", strokeWidth: 1.5, "aria-hidden": "true" }),
|
|
11553
|
+
endContent: query ? /* @__PURE__ */ jsx65(
|
|
11529
11554
|
"button",
|
|
11530
11555
|
{
|
|
11531
11556
|
type: "button",
|
|
11532
11557
|
onClick: clear,
|
|
11533
11558
|
className: "hover:text-foreground transition-colors",
|
|
11534
11559
|
"aria-label": "Clear search",
|
|
11535
|
-
children: /* @__PURE__ */
|
|
11560
|
+
children: /* @__PURE__ */ jsx65(X, { className: "w-4 h-4", strokeWidth: 2, "aria-hidden": "true" })
|
|
11536
11561
|
}
|
|
11537
11562
|
) : void 0,
|
|
11538
11563
|
"aria-label": "Search products",
|
|
@@ -11542,11 +11567,11 @@ function SearchBox() {
|
|
|
11542
11567
|
className: "[&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden"
|
|
11543
11568
|
}
|
|
11544
11569
|
),
|
|
11545
|
-
showShimmer && /* @__PURE__ */
|
|
11570
|
+
showShimmer && /* @__PURE__ */ jsx65(
|
|
11546
11571
|
"div",
|
|
11547
11572
|
{
|
|
11548
11573
|
className: "absolute inset-0 pointer-events-none rounded-input z-20 overflow-hidden",
|
|
11549
|
-
children: /* @__PURE__ */
|
|
11574
|
+
children: /* @__PURE__ */ jsx65(
|
|
11550
11575
|
"div",
|
|
11551
11576
|
{
|
|
11552
11577
|
className: "absolute inset-0",
|
|
@@ -11559,13 +11584,13 @@ function SearchBox() {
|
|
|
11559
11584
|
)
|
|
11560
11585
|
}
|
|
11561
11586
|
),
|
|
11562
|
-
/* @__PURE__ */
|
|
11587
|
+
/* @__PURE__ */ jsx65("style", { dangerouslySetInnerHTML: { __html: `
|
|
11563
11588
|
@keyframes searchShimmer {
|
|
11564
11589
|
0% { transform: translateX(-100%); }
|
|
11565
11590
|
100% { transform: translateX(100%); }
|
|
11566
11591
|
}
|
|
11567
11592
|
` } }),
|
|
11568
|
-
/* @__PURE__ */
|
|
11593
|
+
/* @__PURE__ */ jsx65("span", { id: descriptionId, className: "sr-only", children: "Search results will update as you type" })
|
|
11569
11594
|
] }) });
|
|
11570
11595
|
}
|
|
11571
11596
|
|
|
@@ -11573,7 +11598,7 @@ function SearchBox() {
|
|
|
11573
11598
|
import { Hits, useStats, useInstantSearch } from "react-instantsearch";
|
|
11574
11599
|
|
|
11575
11600
|
// src/composed/search/ProductHit.tsx
|
|
11576
|
-
import { jsx as
|
|
11601
|
+
import { jsx as jsx66 } from "react/jsx-runtime";
|
|
11577
11602
|
function ProductHitComponent({
|
|
11578
11603
|
hit: product,
|
|
11579
11604
|
variant = "overlay"
|
|
@@ -11590,12 +11615,12 @@ function ProductHitComponent({
|
|
|
11590
11615
|
}
|
|
11591
11616
|
return "";
|
|
11592
11617
|
};
|
|
11593
|
-
return /* @__PURE__ */
|
|
11618
|
+
return /* @__PURE__ */ jsx66(
|
|
11594
11619
|
Product,
|
|
11595
11620
|
{
|
|
11596
11621
|
productId,
|
|
11597
11622
|
productData: product,
|
|
11598
|
-
children: /* @__PURE__ */
|
|
11623
|
+
children: /* @__PURE__ */ jsx66(
|
|
11599
11624
|
ProductCard,
|
|
11600
11625
|
{
|
|
11601
11626
|
variant,
|
|
@@ -11617,9 +11642,9 @@ function ProductHitComponent({
|
|
|
11617
11642
|
|
|
11618
11643
|
// src/composed/search/ProductGrid.tsx
|
|
11619
11644
|
import { useState as useState34, useEffect as useEffect36, useCallback as useCallback19 } from "react";
|
|
11620
|
-
import { jsx as
|
|
11645
|
+
import { jsx as jsx67, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
11621
11646
|
function ProductGridSkeletonItem() {
|
|
11622
|
-
return /* @__PURE__ */
|
|
11647
|
+
return /* @__PURE__ */ jsx67("div", { className: "aspect-square bg-muted animate-pulse" });
|
|
11623
11648
|
}
|
|
11624
11649
|
function ProductGrid({
|
|
11625
11650
|
className = "",
|
|
@@ -11638,7 +11663,7 @@ function ProductGrid({
|
|
|
11638
11663
|
}, 1e3);
|
|
11639
11664
|
return () => clearTimeout(timer);
|
|
11640
11665
|
}, [nbHits]);
|
|
11641
|
-
const HitComponent = useCallback19(({ hit }) => /* @__PURE__ */
|
|
11666
|
+
const HitComponent = useCallback19(({ hit }) => /* @__PURE__ */ jsx67(
|
|
11642
11667
|
ProductHitComponent,
|
|
11643
11668
|
{
|
|
11644
11669
|
hit,
|
|
@@ -11646,9 +11671,9 @@ function ProductGrid({
|
|
|
11646
11671
|
}
|
|
11647
11672
|
), [variant]);
|
|
11648
11673
|
return /* @__PURE__ */ jsxs42("div", { className, children: [
|
|
11649
|
-
/* @__PURE__ */
|
|
11650
|
-
showSkeleton && /* @__PURE__ */
|
|
11651
|
-
/* @__PURE__ */
|
|
11674
|
+
/* @__PURE__ */ jsx67("div", { className: "sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", children: announcement }),
|
|
11675
|
+
showSkeleton && /* @__PURE__ */ jsx67("div", { className: `grid ${gridClassName}`, children: Array.from({ length: skeletonCount }).map((_, i) => /* @__PURE__ */ jsx67(ProductGridSkeletonItem, {}, i)) }),
|
|
11676
|
+
/* @__PURE__ */ jsx67("div", { className: showSkeleton ? "hidden" : "", children: /* @__PURE__ */ jsx67(
|
|
11652
11677
|
Hits,
|
|
11653
11678
|
{
|
|
11654
11679
|
hitComponent: HitComponent,
|
|
@@ -11667,7 +11692,7 @@ import { useState as useState36 } from "react";
|
|
|
11667
11692
|
|
|
11668
11693
|
// src/composed/search/FiltersButton.tsx
|
|
11669
11694
|
import { SlidersHorizontal as LucideSlidersHorizontal } from "lucide-react";
|
|
11670
|
-
import { jsx as
|
|
11695
|
+
import { jsx as jsx68, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
11671
11696
|
var SlidersHorizontalIcon = LucideSlidersHorizontal;
|
|
11672
11697
|
function FiltersButton({
|
|
11673
11698
|
onClick,
|
|
@@ -11682,8 +11707,8 @@ function FiltersButton({
|
|
|
11682
11707
|
className,
|
|
11683
11708
|
"aria-label": "Open filters",
|
|
11684
11709
|
children: [
|
|
11685
|
-
/* @__PURE__ */
|
|
11686
|
-
/* @__PURE__ */
|
|
11710
|
+
/* @__PURE__ */ jsx68(SlidersHorizontalIcon, { className: "w-4 h-4" }),
|
|
11711
|
+
/* @__PURE__ */ jsx68("span", { children })
|
|
11687
11712
|
]
|
|
11688
11713
|
}
|
|
11689
11714
|
);
|
|
@@ -11694,7 +11719,7 @@ import { useRefinementList, useRange, useStats as useStats2 } from "react-instan
|
|
|
11694
11719
|
import { X as LucideX2, SlidersHorizontal as LucideSlidersHorizontal2 } from "lucide-react";
|
|
11695
11720
|
import { useState as useState35, useEffect as useEffect37 } from "react";
|
|
11696
11721
|
import * as Slider2 from "@radix-ui/react-slider";
|
|
11697
|
-
import { Fragment as Fragment14, jsx as
|
|
11722
|
+
import { Fragment as Fragment14, jsx as jsx69, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
11698
11723
|
var XIcon2 = LucideX2;
|
|
11699
11724
|
function FiltersDrawer({ isOpen, onClose }) {
|
|
11700
11725
|
const [showCounts, setShowCounts] = useState35(false);
|
|
@@ -11720,7 +11745,7 @@ function FiltersDrawer({ isOpen, onClose }) {
|
|
|
11720
11745
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
11721
11746
|
}, [isOpen, onClose]);
|
|
11722
11747
|
return /* @__PURE__ */ jsxs44(Fragment14, { children: [
|
|
11723
|
-
/* @__PURE__ */
|
|
11748
|
+
/* @__PURE__ */ jsx69(
|
|
11724
11749
|
"div",
|
|
11725
11750
|
{
|
|
11726
11751
|
className: `fixed inset-0 bg-black/50 z-40 transition-opacity ${isOpen ? "opacity-100" : "opacity-0 pointer-events-none"}`,
|
|
@@ -11738,25 +11763,25 @@ function FiltersDrawer({ isOpen, onClose }) {
|
|
|
11738
11763
|
"aria-labelledby": "filters-drawer-title",
|
|
11739
11764
|
children: [
|
|
11740
11765
|
/* @__PURE__ */ jsxs44("div", { className: "flex items-center justify-between px-4 py-4", children: [
|
|
11741
|
-
/* @__PURE__ */
|
|
11742
|
-
/* @__PURE__ */
|
|
11766
|
+
/* @__PURE__ */ jsx69("h2", { id: "filters-drawer-title", className: "text-xl font-bold", children: "Filters" }),
|
|
11767
|
+
/* @__PURE__ */ jsx69(
|
|
11743
11768
|
"button",
|
|
11744
11769
|
{
|
|
11745
11770
|
onClick: onClose,
|
|
11746
11771
|
className: "p-2 hover:bg-foreground/5 rounded-full transition-colors",
|
|
11747
11772
|
"aria-label": "Close filters",
|
|
11748
|
-
children: /* @__PURE__ */
|
|
11773
|
+
children: /* @__PURE__ */ jsx69(XIcon2, { className: "w-5 h-5" })
|
|
11749
11774
|
}
|
|
11750
11775
|
)
|
|
11751
11776
|
] }),
|
|
11752
|
-
/* @__PURE__ */
|
|
11777
|
+
/* @__PURE__ */ jsx69("div", { className: "px-4 pb-4", children: /* @__PURE__ */ jsxs44("p", { className: "text-sm font-caption text-foreground/60", role: "status", "aria-live": "polite", children: [
|
|
11753
11778
|
nbHits.toLocaleString(),
|
|
11754
11779
|
" ",
|
|
11755
11780
|
nbHits === 1 ? "result" : "results"
|
|
11756
11781
|
] }) }),
|
|
11757
|
-
/* @__PURE__ */
|
|
11758
|
-
/* @__PURE__ */
|
|
11759
|
-
/* @__PURE__ */
|
|
11782
|
+
/* @__PURE__ */ jsx69("div", { className: "flex-1 overflow-y-auto px-4 pb-4", children: /* @__PURE__ */ jsxs44("div", { className: "flex flex-col gap-8", children: [
|
|
11783
|
+
/* @__PURE__ */ jsx69(TagsSection, { showCounts, setShowCounts }),
|
|
11784
|
+
/* @__PURE__ */ jsx69(PriceSection, {})
|
|
11760
11785
|
] }) })
|
|
11761
11786
|
]
|
|
11762
11787
|
}
|
|
@@ -11782,8 +11807,8 @@ function TagsSection({
|
|
|
11782
11807
|
"aria-expanded": isExpanded,
|
|
11783
11808
|
"aria-controls": "tags-content",
|
|
11784
11809
|
children: [
|
|
11785
|
-
/* @__PURE__ */
|
|
11786
|
-
/* @__PURE__ */
|
|
11810
|
+
/* @__PURE__ */ jsx69("h3", { className: "text-base font-semibold text-primary", children: "Tags" }),
|
|
11811
|
+
/* @__PURE__ */ jsx69(
|
|
11787
11812
|
"svg",
|
|
11788
11813
|
{
|
|
11789
11814
|
className: `w-5 h-5 transition-transform text-foreground/40 group-hover:text-foreground/60 ${isExpanded ? "rotate-180" : ""}`,
|
|
@@ -11792,14 +11817,14 @@ function TagsSection({
|
|
|
11792
11817
|
stroke: "currentColor",
|
|
11793
11818
|
strokeWidth: 2.5,
|
|
11794
11819
|
"aria-hidden": "true",
|
|
11795
|
-
children: /* @__PURE__ */
|
|
11820
|
+
children: /* @__PURE__ */ jsx69("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
|
|
11796
11821
|
}
|
|
11797
11822
|
)
|
|
11798
11823
|
]
|
|
11799
11824
|
}
|
|
11800
11825
|
),
|
|
11801
11826
|
isExpanded && /* @__PURE__ */ jsxs44("div", { className: "space-y-4", id: "tags-content", children: [
|
|
11802
|
-
/* @__PURE__ */
|
|
11827
|
+
/* @__PURE__ */ jsx69("div", { className: "flex flex-wrap gap-2", role: "group", "aria-label": "Product tags filter", children: items.map((item) => /* @__PURE__ */ jsxs44(
|
|
11803
11828
|
"button",
|
|
11804
11829
|
{
|
|
11805
11830
|
onClick: () => refine(item.value),
|
|
@@ -11810,15 +11835,15 @@ function TagsSection({
|
|
|
11810
11835
|
"aria-label": `${item.isRefined ? "Remove" : "Apply"} ${item.label} filter${showCounts ? ` (${item.count} products)` : ""}`,
|
|
11811
11836
|
"aria-pressed": item.isRefined,
|
|
11812
11837
|
children: [
|
|
11813
|
-
/* @__PURE__ */
|
|
11814
|
-
showCounts && /* @__PURE__ */
|
|
11838
|
+
/* @__PURE__ */ jsx69("span", { "aria-hidden": "true", children: item.label }),
|
|
11839
|
+
showCounts && /* @__PURE__ */ jsx69("span", { className: `text-xs font-caption ${item.isRefined ? "opacity-80" : "opacity-60"}`, "aria-hidden": "true", children: item.count })
|
|
11815
11840
|
]
|
|
11816
11841
|
},
|
|
11817
11842
|
item.value
|
|
11818
11843
|
)) }),
|
|
11819
11844
|
/* @__PURE__ */ jsxs44("div", { className: "flex items-center justify-between pt-2", children: [
|
|
11820
|
-
/* @__PURE__ */
|
|
11821
|
-
/* @__PURE__ */
|
|
11845
|
+
/* @__PURE__ */ jsx69("span", { className: "text-sm font-label text-foreground/60", id: "show-counts-label", children: "Show counts" }),
|
|
11846
|
+
/* @__PURE__ */ jsx69(
|
|
11822
11847
|
"button",
|
|
11823
11848
|
{
|
|
11824
11849
|
onClick: () => setShowCounts(!showCounts),
|
|
@@ -11826,7 +11851,7 @@ function TagsSection({
|
|
|
11826
11851
|
role: "switch",
|
|
11827
11852
|
"aria-checked": showCounts,
|
|
11828
11853
|
"aria-labelledby": "show-counts-label",
|
|
11829
|
-
children: /* @__PURE__ */
|
|
11854
|
+
children: /* @__PURE__ */ jsx69(
|
|
11830
11855
|
"span",
|
|
11831
11856
|
{
|
|
11832
11857
|
className: `inline-block h-4 w-4 transform rounded-full bg-background shadow-sm transition-transform ${showCounts ? "translate-x-6" : "translate-x-1"}`,
|
|
@@ -11881,8 +11906,8 @@ function PriceSection() {
|
|
|
11881
11906
|
"aria-expanded": isExpanded,
|
|
11882
11907
|
"aria-controls": "price-content",
|
|
11883
11908
|
children: [
|
|
11884
|
-
/* @__PURE__ */
|
|
11885
|
-
/* @__PURE__ */
|
|
11909
|
+
/* @__PURE__ */ jsx69("h3", { className: "text-base font-semibold text-primary", children: "Price" }),
|
|
11910
|
+
/* @__PURE__ */ jsx69(
|
|
11886
11911
|
"svg",
|
|
11887
11912
|
{
|
|
11888
11913
|
className: `w-5 h-5 transition-transform text-foreground/40 group-hover:text-foreground/60 ${isExpanded ? "rotate-180" : ""}`,
|
|
@@ -11891,7 +11916,7 @@ function PriceSection() {
|
|
|
11891
11916
|
stroke: "currentColor",
|
|
11892
11917
|
strokeWidth: 2.5,
|
|
11893
11918
|
"aria-hidden": "true",
|
|
11894
|
-
children: /* @__PURE__ */
|
|
11919
|
+
children: /* @__PURE__ */ jsx69("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
|
|
11895
11920
|
}
|
|
11896
11921
|
)
|
|
11897
11922
|
]
|
|
@@ -11899,14 +11924,14 @@ function PriceSection() {
|
|
|
11899
11924
|
),
|
|
11900
11925
|
isExpanded && /* @__PURE__ */ jsxs44("div", { className: "space-y-6", id: "price-content", children: [
|
|
11901
11926
|
/* @__PURE__ */ jsxs44("div", { className: "flex items-center justify-between text-sm font-display", children: [
|
|
11902
|
-
/* @__PURE__ */
|
|
11903
|
-
/* @__PURE__ */
|
|
11927
|
+
/* @__PURE__ */ jsx69("span", { children: formatPrice2(localRange[0]) }),
|
|
11928
|
+
/* @__PURE__ */ jsx69("span", { className: "text-foreground/70", children: formatPrice2(localRange[1]) })
|
|
11904
11929
|
] }),
|
|
11905
|
-
/* @__PURE__ */
|
|
11930
|
+
/* @__PURE__ */ jsx69("div", { className: "relative h-24 flex items-end justify-between gap-0.5 px-1", "aria-hidden": "true", role: "presentation", children: [60, 40, 80, 50, 60, 30, 20, 15, 10, 5, 30, 20, 15, 10, 5, 3, 3, 60, 40].map((height, i) => {
|
|
11906
11931
|
const totalBars = 19;
|
|
11907
11932
|
const barPrice = rangeMin + (rangeMax - rangeMin) / totalBars * i;
|
|
11908
11933
|
const isInRange = barPrice >= localRange[0] && barPrice <= localRange[1];
|
|
11909
|
-
return /* @__PURE__ */
|
|
11934
|
+
return /* @__PURE__ */ jsx69(
|
|
11910
11935
|
"div",
|
|
11911
11936
|
{
|
|
11912
11937
|
className: `flex-1 rounded-t-sm transition-opacity ${isInRange ? "bg-foreground" : "bg-foreground/20"}`,
|
|
@@ -11915,7 +11940,7 @@ function PriceSection() {
|
|
|
11915
11940
|
i
|
|
11916
11941
|
);
|
|
11917
11942
|
}) }),
|
|
11918
|
-
/* @__PURE__ */
|
|
11943
|
+
/* @__PURE__ */ jsx69("div", { style: { touchAction: "none" }, className: "my-6", children: /* @__PURE__ */ jsxs44(
|
|
11919
11944
|
Slider2.Root,
|
|
11920
11945
|
{
|
|
11921
11946
|
className: "relative flex w-full touch-none select-none items-center",
|
|
@@ -11933,8 +11958,8 @@ function PriceSection() {
|
|
|
11933
11958
|
step: 1,
|
|
11934
11959
|
minStepsBetweenThumbs: 1,
|
|
11935
11960
|
children: [
|
|
11936
|
-
/* @__PURE__ */
|
|
11937
|
-
/* @__PURE__ */
|
|
11961
|
+
/* @__PURE__ */ jsx69(Slider2.Track, { className: "relative h-3 w-full grow overflow-hidden rounded-full bg-foreground/20", children: /* @__PURE__ */ jsx69(Slider2.Range, { className: "absolute h-full bg-foreground" }) }),
|
|
11962
|
+
/* @__PURE__ */ jsx69(
|
|
11938
11963
|
Slider2.Thumb,
|
|
11939
11964
|
{
|
|
11940
11965
|
className: "block h-6 w-6 rounded-full bg-background shadow transition-all focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:pointer-events-none disabled:opacity-50 cursor-grab active:cursor-grabbing hover:scale-105 border-2 border-primary",
|
|
@@ -11948,7 +11973,7 @@ function PriceSection() {
|
|
|
11948
11973
|
"aria-valuetext": formatPrice2(localRange[0])
|
|
11949
11974
|
}
|
|
11950
11975
|
),
|
|
11951
|
-
/* @__PURE__ */
|
|
11976
|
+
/* @__PURE__ */ jsx69(
|
|
11952
11977
|
Slider2.Thumb,
|
|
11953
11978
|
{
|
|
11954
11979
|
className: "block h-6 w-6 rounded-full bg-background shadow transition-all focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:pointer-events-none disabled:opacity-50 cursor-grab active:cursor-grabbing hover:scale-105 border-2 border-primary",
|
|
@@ -11967,8 +11992,8 @@ function PriceSection() {
|
|
|
11967
11992
|
) }),
|
|
11968
11993
|
/* @__PURE__ */ jsxs44("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
11969
11994
|
/* @__PURE__ */ jsxs44("div", { children: [
|
|
11970
|
-
/* @__PURE__ */
|
|
11971
|
-
/* @__PURE__ */
|
|
11995
|
+
/* @__PURE__ */ jsx69("label", { htmlFor: "price-min", className: "text-xs font-label text-foreground/60 mb-1.5 block", children: "Min" }),
|
|
11996
|
+
/* @__PURE__ */ jsx69(
|
|
11972
11997
|
"input",
|
|
11973
11998
|
{
|
|
11974
11999
|
id: "price-min",
|
|
@@ -11987,8 +12012,8 @@ function PriceSection() {
|
|
|
11987
12012
|
)
|
|
11988
12013
|
] }),
|
|
11989
12014
|
/* @__PURE__ */ jsxs44("div", { children: [
|
|
11990
|
-
/* @__PURE__ */
|
|
11991
|
-
/* @__PURE__ */
|
|
12015
|
+
/* @__PURE__ */ jsx69("label", { htmlFor: "price-max", className: "text-xs font-label text-foreground/60 mb-1.5 block", children: "Max" }),
|
|
12016
|
+
/* @__PURE__ */ jsx69(
|
|
11992
12017
|
"input",
|
|
11993
12018
|
{
|
|
11994
12019
|
id: "price-max",
|
|
@@ -12012,11 +12037,11 @@ function PriceSection() {
|
|
|
12012
12037
|
}
|
|
12013
12038
|
|
|
12014
12039
|
// src/composed/search/Filters.tsx
|
|
12015
|
-
import { Fragment as Fragment15, jsx as
|
|
12040
|
+
import { Fragment as Fragment15, jsx as jsx70, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
12016
12041
|
function Filters({ buttonClassName, buttonText }) {
|
|
12017
12042
|
const [isOpen, setIsOpen] = useState36(false);
|
|
12018
12043
|
return /* @__PURE__ */ jsxs45(Fragment15, { children: [
|
|
12019
|
-
/* @__PURE__ */
|
|
12044
|
+
/* @__PURE__ */ jsx70(
|
|
12020
12045
|
FiltersButton,
|
|
12021
12046
|
{
|
|
12022
12047
|
onClick: () => setIsOpen(true),
|
|
@@ -12024,14 +12049,14 @@ function Filters({ buttonClassName, buttonText }) {
|
|
|
12024
12049
|
children: buttonText
|
|
12025
12050
|
}
|
|
12026
12051
|
),
|
|
12027
|
-
/* @__PURE__ */
|
|
12052
|
+
/* @__PURE__ */ jsx70(FiltersDrawer, { isOpen, onClose: () => setIsOpen(false) })
|
|
12028
12053
|
] });
|
|
12029
12054
|
}
|
|
12030
12055
|
|
|
12031
12056
|
// src/composed/search/CurrentRefinements.tsx
|
|
12032
12057
|
import { useCurrentRefinements } from "react-instantsearch";
|
|
12033
12058
|
import { X as LucideX3 } from "lucide-react";
|
|
12034
|
-
import { jsx as
|
|
12059
|
+
import { jsx as jsx71, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
12035
12060
|
var XIcon3 = LucideX3;
|
|
12036
12061
|
var MIN_PRICE = new RegExp("[\u2265>=]+\\s*(\\d+)");
|
|
12037
12062
|
var MAX_PRICE = new RegExp("[\u2264<=]+\\s*(\\d+)");
|
|
@@ -12079,15 +12104,15 @@ function CurrentRefinements() {
|
|
|
12079
12104
|
if (allRefinements.length === 0) {
|
|
12080
12105
|
return null;
|
|
12081
12106
|
}
|
|
12082
|
-
return /* @__PURE__ */
|
|
12107
|
+
return /* @__PURE__ */ jsx71("div", { className: "flex flex-wrap items-center gap-2 mb-4 -mt-1", role: "group", "aria-label": "Active filters", children: allRefinements.map((refinement, index) => /* @__PURE__ */ jsxs46(
|
|
12083
12108
|
"button",
|
|
12084
12109
|
{
|
|
12085
12110
|
className: "bg-primary text-on-primary hover:bg-primary/90 inline-flex h-7 items-center gap-1.5 rounded-full px-3 text-sm transition-colors",
|
|
12086
12111
|
onClick: () => refinement.refine(),
|
|
12087
12112
|
"aria-label": `Remove filter: ${refinement.displayLabel}`,
|
|
12088
12113
|
children: [
|
|
12089
|
-
/* @__PURE__ */
|
|
12090
|
-
/* @__PURE__ */
|
|
12114
|
+
/* @__PURE__ */ jsx71("span", { className: "truncate", children: refinement.displayLabel }),
|
|
12115
|
+
/* @__PURE__ */ jsx71(XIcon3, { className: "w-3 h-3" })
|
|
12091
12116
|
]
|
|
12092
12117
|
},
|
|
12093
12118
|
`${refinement.attribute}-${refinement.value}-${index}`
|
|
@@ -12116,7 +12141,7 @@ import { useState as useState39, useEffect as useEffect39 } from "react";
|
|
|
12116
12141
|
// src/composed/zoom/ZoomOverlay.tsx
|
|
12117
12142
|
import { useState as useState37, useCallback as useCallback20 } from "react";
|
|
12118
12143
|
import { Plus as LucidePlus2, Minus as LucideMinus2 } from "lucide-react";
|
|
12119
|
-
import { Fragment as Fragment16, jsx as
|
|
12144
|
+
import { Fragment as Fragment16, jsx as jsx72, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
12120
12145
|
var PlusIcon2 = LucidePlus2;
|
|
12121
12146
|
var MinusIcon2 = LucideMinus2;
|
|
12122
12147
|
function ZoomOverlay({
|
|
@@ -12176,8 +12201,8 @@ function ZoomOverlay({
|
|
|
12176
12201
|
const isHovered = hoveredImageIndex === imageIndex;
|
|
12177
12202
|
const cursorStyle = isLargeTouchDevice ? "pointer" : isTouchDevice ? "default" : "none";
|
|
12178
12203
|
return /* @__PURE__ */ jsxs47(Fragment16, { children: [
|
|
12179
|
-
/* @__PURE__ */
|
|
12180
|
-
/* @__PURE__ */
|
|
12204
|
+
/* @__PURE__ */ jsx72("div", { className: "sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", children: announcement }),
|
|
12205
|
+
/* @__PURE__ */ jsx72(
|
|
12181
12206
|
"div",
|
|
12182
12207
|
{
|
|
12183
12208
|
className,
|
|
@@ -12185,7 +12210,7 @@ function ZoomOverlay({
|
|
|
12185
12210
|
...style,
|
|
12186
12211
|
position: "relative"
|
|
12187
12212
|
},
|
|
12188
|
-
children: /* @__PURE__ */
|
|
12213
|
+
children: /* @__PURE__ */ jsx72(
|
|
12189
12214
|
"div",
|
|
12190
12215
|
{
|
|
12191
12216
|
style: {
|
|
@@ -12208,7 +12233,7 @@ function ZoomOverlay({
|
|
|
12208
12233
|
handleZoomClick(e);
|
|
12209
12234
|
}
|
|
12210
12235
|
},
|
|
12211
|
-
children: /* @__PURE__ */
|
|
12236
|
+
children: /* @__PURE__ */ jsx72(
|
|
12212
12237
|
"div",
|
|
12213
12238
|
{
|
|
12214
12239
|
style: {
|
|
@@ -12224,7 +12249,7 @@ function ZoomOverlay({
|
|
|
12224
12249
|
)
|
|
12225
12250
|
}
|
|
12226
12251
|
),
|
|
12227
|
-
isHovered && !isTouchDevice && /* @__PURE__ */
|
|
12252
|
+
isHovered && !isTouchDevice && /* @__PURE__ */ jsx72(
|
|
12228
12253
|
"div",
|
|
12229
12254
|
{
|
|
12230
12255
|
className: "fixed pointer-events-none z-50 hidden md:block",
|
|
@@ -12234,7 +12259,7 @@ function ZoomOverlay({
|
|
|
12234
12259
|
transform: "translate(-50%, -50%)"
|
|
12235
12260
|
},
|
|
12236
12261
|
"aria-hidden": "true",
|
|
12237
|
-
children: /* @__PURE__ */
|
|
12262
|
+
children: /* @__PURE__ */ jsx72("div", { className: "bg-white dark:bg-gray-800 rounded-full p-2 shadow-sm dark:shadow-gray-950/50", children: isZoomed ? /* @__PURE__ */ jsx72(
|
|
12238
12263
|
MinusIcon2,
|
|
12239
12264
|
{
|
|
12240
12265
|
size: 20,
|
|
@@ -12242,7 +12267,7 @@ function ZoomOverlay({
|
|
|
12242
12267
|
strokeWidth: 1.5,
|
|
12243
12268
|
"aria-hidden": "true"
|
|
12244
12269
|
}
|
|
12245
|
-
) : /* @__PURE__ */
|
|
12270
|
+
) : /* @__PURE__ */ jsx72(
|
|
12246
12271
|
PlusIcon2,
|
|
12247
12272
|
{
|
|
12248
12273
|
size: 20,
|
|
@@ -12270,7 +12295,7 @@ import {
|
|
|
12270
12295
|
TransformComponent as OriginalTransformComponent
|
|
12271
12296
|
} from "react-zoom-pan-pinch";
|
|
12272
12297
|
import { X as X2 } from "lucide-react";
|
|
12273
|
-
import { Fragment as Fragment17, jsx as
|
|
12298
|
+
import { Fragment as Fragment17, jsx as jsx73, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
12274
12299
|
var TransformWrapper = OriginalTransformWrapper;
|
|
12275
12300
|
var TransformComponent = OriginalTransformComponent;
|
|
12276
12301
|
var EnhancedImageViewer = ({
|
|
@@ -12410,12 +12435,12 @@ var EnhancedImageViewer = ({
|
|
|
12410
12435
|
);
|
|
12411
12436
|
if (!isMounted || !isClient) {
|
|
12412
12437
|
return createPortal3(
|
|
12413
|
-
/* @__PURE__ */
|
|
12438
|
+
/* @__PURE__ */ jsx73(
|
|
12414
12439
|
"div",
|
|
12415
12440
|
{
|
|
12416
12441
|
className: "fixed inset-0 bg-black flex items-center justify-center",
|
|
12417
12442
|
style: { zIndex: 999999 },
|
|
12418
|
-
children: /* @__PURE__ */
|
|
12443
|
+
children: /* @__PURE__ */ jsx73(
|
|
12419
12444
|
"div",
|
|
12420
12445
|
{
|
|
12421
12446
|
style: {
|
|
@@ -12440,7 +12465,7 @@ var EnhancedImageViewer = ({
|
|
|
12440
12465
|
"aria-modal": "true",
|
|
12441
12466
|
"aria-label": "Image viewer",
|
|
12442
12467
|
children: [
|
|
12443
|
-
/* @__PURE__ */
|
|
12468
|
+
/* @__PURE__ */ jsx73(
|
|
12444
12469
|
"button",
|
|
12445
12470
|
{
|
|
12446
12471
|
onClick: (e) => {
|
|
@@ -12466,10 +12491,10 @@ var EnhancedImageViewer = ({
|
|
|
12466
12491
|
touchAction: "manipulation",
|
|
12467
12492
|
marginBottom: "env(safe-area-inset-bottom, 0px)"
|
|
12468
12493
|
},
|
|
12469
|
-
children: /* @__PURE__ */
|
|
12494
|
+
children: /* @__PURE__ */ jsx73(X2, { className: "w-7 h-7", strokeWidth: 2.5 })
|
|
12470
12495
|
}
|
|
12471
12496
|
),
|
|
12472
|
-
/* @__PURE__ */
|
|
12497
|
+
/* @__PURE__ */ jsx73(
|
|
12473
12498
|
TransformWrapper,
|
|
12474
12499
|
{
|
|
12475
12500
|
initialScale: scale.initial,
|
|
@@ -12516,14 +12541,14 @@ var EnhancedImageViewer = ({
|
|
|
12516
12541
|
onTouchStart: handleTouchStart,
|
|
12517
12542
|
onTouchEnd: handleTouchEnd,
|
|
12518
12543
|
children: [
|
|
12519
|
-
/* @__PURE__ */
|
|
12544
|
+
/* @__PURE__ */ jsx73(
|
|
12520
12545
|
TransformComponent,
|
|
12521
12546
|
{
|
|
12522
12547
|
wrapperStyle: {
|
|
12523
12548
|
width: "100%",
|
|
12524
12549
|
height: "100%"
|
|
12525
12550
|
},
|
|
12526
|
-
children: /* @__PURE__ */
|
|
12551
|
+
children: /* @__PURE__ */ jsx73(
|
|
12527
12552
|
"div",
|
|
12528
12553
|
{
|
|
12529
12554
|
style: {
|
|
@@ -12534,7 +12559,7 @@ var EnhancedImageViewer = ({
|
|
|
12534
12559
|
alignItems: "center",
|
|
12535
12560
|
justifyContent: "center"
|
|
12536
12561
|
},
|
|
12537
|
-
children: /* @__PURE__ */
|
|
12562
|
+
children: /* @__PURE__ */ jsx73(
|
|
12538
12563
|
SafeImg,
|
|
12539
12564
|
{
|
|
12540
12565
|
ref: imgRef,
|
|
@@ -12556,7 +12581,7 @@ var EnhancedImageViewer = ({
|
|
|
12556
12581
|
}
|
|
12557
12582
|
),
|
|
12558
12583
|
/* @__PURE__ */ jsxs48("div", { className: "fixed bottom-5 left-0 right-0 z-50", children: [
|
|
12559
|
-
/* @__PURE__ */
|
|
12584
|
+
/* @__PURE__ */ jsx73("div", { className: "flex justify-center gap-2", children: (() => {
|
|
12560
12585
|
let currentIndex = propCurrentIndex !== void 0 ? propCurrentIndex : -1;
|
|
12561
12586
|
if (currentIndex === -1) {
|
|
12562
12587
|
currentIndex = images.findIndex(
|
|
@@ -12590,7 +12615,7 @@ var EnhancedImageViewer = ({
|
|
|
12590
12615
|
const nextIndex = findNextAvailableIndex(currentIndex, 1);
|
|
12591
12616
|
const prevIndex = findNextAvailableIndex(currentIndex, -1);
|
|
12592
12617
|
return /* @__PURE__ */ jsxs48(Fragment17, { children: [
|
|
12593
|
-
/* @__PURE__ */
|
|
12618
|
+
/* @__PURE__ */ jsx73(
|
|
12594
12619
|
"button",
|
|
12595
12620
|
{
|
|
12596
12621
|
onClick: () => {
|
|
@@ -12603,7 +12628,7 @@ var EnhancedImageViewer = ({
|
|
|
12603
12628
|
className: `w-10 h-10 rounded-full shadow-lg flex items-center justify-center transition-all duration-200 ${prevIndex === -1 ? "bg-white/40 text-black opacity-50 cursor-not-allowed" : "bg-white/90 hover:bg-white text-black"}`,
|
|
12604
12629
|
style: { touchAction: "manipulation" },
|
|
12605
12630
|
"aria-label": "Previous image",
|
|
12606
|
-
children: /* @__PURE__ */
|
|
12631
|
+
children: /* @__PURE__ */ jsx73(
|
|
12607
12632
|
"svg",
|
|
12608
12633
|
{
|
|
12609
12634
|
className: "w-4 h-4",
|
|
@@ -12611,7 +12636,7 @@ var EnhancedImageViewer = ({
|
|
|
12611
12636
|
stroke: "currentColor",
|
|
12612
12637
|
viewBox: "0 0 24 24",
|
|
12613
12638
|
"aria-hidden": "true",
|
|
12614
|
-
children: /* @__PURE__ */
|
|
12639
|
+
children: /* @__PURE__ */ jsx73(
|
|
12615
12640
|
"path",
|
|
12616
12641
|
{
|
|
12617
12642
|
strokeLinecap: "round",
|
|
@@ -12624,7 +12649,7 @@ var EnhancedImageViewer = ({
|
|
|
12624
12649
|
)
|
|
12625
12650
|
}
|
|
12626
12651
|
),
|
|
12627
|
-
/* @__PURE__ */
|
|
12652
|
+
/* @__PURE__ */ jsx73(
|
|
12628
12653
|
"button",
|
|
12629
12654
|
{
|
|
12630
12655
|
onClick: () => {
|
|
@@ -12637,7 +12662,7 @@ var EnhancedImageViewer = ({
|
|
|
12637
12662
|
className: `w-10 h-10 rounded-full shadow-lg flex items-center justify-center transition-all duration-200 ${nextIndex === -1 ? "bg-white/40 text-black opacity-50 cursor-not-allowed" : "bg-white/90 hover:bg-white text-black"}`,
|
|
12638
12663
|
style: { touchAction: "manipulation" },
|
|
12639
12664
|
"aria-label": "Next image",
|
|
12640
|
-
children: /* @__PURE__ */
|
|
12665
|
+
children: /* @__PURE__ */ jsx73(
|
|
12641
12666
|
"svg",
|
|
12642
12667
|
{
|
|
12643
12668
|
className: "w-4 h-4",
|
|
@@ -12645,7 +12670,7 @@ var EnhancedImageViewer = ({
|
|
|
12645
12670
|
stroke: "currentColor",
|
|
12646
12671
|
viewBox: "0 0 24 24",
|
|
12647
12672
|
"aria-hidden": "true",
|
|
12648
|
-
children: /* @__PURE__ */
|
|
12673
|
+
children: /* @__PURE__ */ jsx73(
|
|
12649
12674
|
"path",
|
|
12650
12675
|
{
|
|
12651
12676
|
strokeLinecap: "round",
|
|
@@ -12660,7 +12685,7 @@ var EnhancedImageViewer = ({
|
|
|
12660
12685
|
)
|
|
12661
12686
|
] });
|
|
12662
12687
|
})() }),
|
|
12663
|
-
/* @__PURE__ */
|
|
12688
|
+
/* @__PURE__ */ jsx73("div", { style: { position: "fixed", bottom: 20, left: 24, zIndex: 10, marginBottom: "env(safe-area-inset-bottom, 0px)" }, className: "h-10 px-3 rounded-full bg-white/90 text-black text-sm font-medium flex items-center justify-center shadow-lg", children: (() => {
|
|
12664
12689
|
const total = Math.max(images.length, 1);
|
|
12665
12690
|
const current = propCurrentIndex !== void 0 ? Math.min(propCurrentIndex + 1, total) : 1;
|
|
12666
12691
|
return `${current} / ${total}`;
|
|
@@ -12672,7 +12697,7 @@ var EnhancedImageViewer = ({
|
|
|
12672
12697
|
},
|
|
12673
12698
|
`${scale.initial}-${scale.min}-${scale.max}`
|
|
12674
12699
|
),
|
|
12675
|
-
/* @__PURE__ */
|
|
12700
|
+
/* @__PURE__ */ jsx73(
|
|
12676
12701
|
"div",
|
|
12677
12702
|
{
|
|
12678
12703
|
className: "absolute inset-0 bg-black",
|
|
@@ -12691,7 +12716,7 @@ var EnhancedImageViewer = ({
|
|
|
12691
12716
|
};
|
|
12692
12717
|
|
|
12693
12718
|
// src/composed/zoom/ResponsiveZoom.tsx
|
|
12694
|
-
import { Fragment as Fragment18, jsx as
|
|
12719
|
+
import { Fragment as Fragment18, jsx as jsx74, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
12695
12720
|
function ResponsiveZoom({
|
|
12696
12721
|
imageIndex,
|
|
12697
12722
|
children,
|
|
@@ -12733,7 +12758,7 @@ function ResponsiveZoom({
|
|
|
12733
12758
|
}
|
|
12734
12759
|
};
|
|
12735
12760
|
return /* @__PURE__ */ jsxs49(Fragment18, { children: [
|
|
12736
|
-
isTouchDevice ? /* @__PURE__ */
|
|
12761
|
+
isTouchDevice ? /* @__PURE__ */ jsx74(
|
|
12737
12762
|
"div",
|
|
12738
12763
|
{
|
|
12739
12764
|
className,
|
|
@@ -12750,7 +12775,7 @@ function ResponsiveZoom({
|
|
|
12750
12775
|
},
|
|
12751
12776
|
children
|
|
12752
12777
|
}
|
|
12753
|
-
) : /* @__PURE__ */
|
|
12778
|
+
) : /* @__PURE__ */ jsx74(
|
|
12754
12779
|
ZoomOverlay,
|
|
12755
12780
|
{
|
|
12756
12781
|
imageIndex,
|
|
@@ -12761,7 +12786,7 @@ function ResponsiveZoom({
|
|
|
12761
12786
|
children
|
|
12762
12787
|
}
|
|
12763
12788
|
),
|
|
12764
|
-
showEnhancedViewer && isTouchDevice && currentImageUrl && /* @__PURE__ */
|
|
12789
|
+
showEnhancedViewer && isTouchDevice && currentImageUrl && /* @__PURE__ */ jsx74(
|
|
12765
12790
|
EnhancedImageViewer,
|
|
12766
12791
|
{
|
|
12767
12792
|
imageUrl: currentImageUrl,
|
|
@@ -12789,7 +12814,7 @@ import {
|
|
|
12789
12814
|
useRef as useRef26,
|
|
12790
12815
|
useEffect as useEffect40,
|
|
12791
12816
|
useCallback as useCallback22,
|
|
12792
|
-
useMemo as
|
|
12817
|
+
useMemo as useMemo16,
|
|
12793
12818
|
memo as memo4
|
|
12794
12819
|
} from "react";
|
|
12795
12820
|
|
|
@@ -12802,7 +12827,7 @@ function zoomFit(galleryRole) {
|
|
|
12802
12827
|
}
|
|
12803
12828
|
|
|
12804
12829
|
// src/composed/carousels/MobileProductCarousel.tsx
|
|
12805
|
-
import { jsx as
|
|
12830
|
+
import { jsx as jsx75, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
12806
12831
|
function StaticCarouselImage({
|
|
12807
12832
|
src,
|
|
12808
12833
|
alt,
|
|
@@ -12810,9 +12835,9 @@ function StaticCarouselImage({
|
|
|
12810
12835
|
}) {
|
|
12811
12836
|
const [failed, setFailed] = useState40(false);
|
|
12812
12837
|
if (failed || !src) {
|
|
12813
|
-
return /* @__PURE__ */
|
|
12838
|
+
return /* @__PURE__ */ jsx75("div", { className: `bg-muted ${className ?? ""}`, role: "img", "aria-label": alt });
|
|
12814
12839
|
}
|
|
12815
|
-
return /* @__PURE__ */
|
|
12840
|
+
return /* @__PURE__ */ jsx75(
|
|
12816
12841
|
"img",
|
|
12817
12842
|
{
|
|
12818
12843
|
src,
|
|
@@ -12896,16 +12921,16 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
12896
12921
|
});
|
|
12897
12922
|
return unsubscribe;
|
|
12898
12923
|
}, [realtimeContext?.subscribeMockupResults]);
|
|
12899
|
-
const mockupIds =
|
|
12924
|
+
const mockupIds = useMemo16(() => {
|
|
12900
12925
|
return images.filter((img) => img.isRealMockup && img.mockupId).map((img) => img.mockupId);
|
|
12901
12926
|
}, [images]);
|
|
12902
|
-
const realtimeMockupUrls =
|
|
12927
|
+
const realtimeMockupUrls = useMemo16(() => {
|
|
12903
12928
|
if (!realtimeContext?.getMockupUrls || mockupIds.length === 0) {
|
|
12904
12929
|
return {};
|
|
12905
12930
|
}
|
|
12906
12931
|
return realtimeContext.getMockupUrls(mockupIds);
|
|
12907
12932
|
}, [realtimeContext?.getMockupUrls, mockupIds, urlUpdateCounter]);
|
|
12908
|
-
const imagesWithRealtimeUrls =
|
|
12933
|
+
const imagesWithRealtimeUrls = useMemo16(() => {
|
|
12909
12934
|
return images.map((img) => {
|
|
12910
12935
|
if (img.isRealMockup && img.mockupId && realtimeMockupUrls[img.mockupId]) {
|
|
12911
12936
|
return {
|
|
@@ -13306,14 +13331,14 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13306
13331
|
);
|
|
13307
13332
|
useEffect40(() => {
|
|
13308
13333
|
if (stickyHeroContext?.setCarouselIndicator && images.length > 1) {
|
|
13309
|
-
const indicator = /* @__PURE__ */
|
|
13334
|
+
const indicator = /* @__PURE__ */ jsx75(
|
|
13310
13335
|
"div",
|
|
13311
13336
|
{
|
|
13312
13337
|
className: "w-full",
|
|
13313
13338
|
role: "group",
|
|
13314
13339
|
"aria-label": "Product image navigation",
|
|
13315
13340
|
children: /* @__PURE__ */ jsxs50("div", { className: "relative h-1", children: [
|
|
13316
|
-
/* @__PURE__ */
|
|
13341
|
+
/* @__PURE__ */ jsx75("div", { className: "flex h-full", children: images.map((_, index) => /* @__PURE__ */ jsx75(
|
|
13317
13342
|
"button",
|
|
13318
13343
|
{
|
|
13319
13344
|
onClick: () => goToSlide(index),
|
|
@@ -13323,7 +13348,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13323
13348
|
},
|
|
13324
13349
|
index
|
|
13325
13350
|
)) }),
|
|
13326
|
-
/* @__PURE__ */
|
|
13351
|
+
/* @__PURE__ */ jsx75(
|
|
13327
13352
|
"div",
|
|
13328
13353
|
{
|
|
13329
13354
|
className: "absolute top-0 h-full bg-primary transition-all duration-300 ease-out",
|
|
@@ -13346,10 +13371,10 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13346
13371
|
};
|
|
13347
13372
|
}, [activeIndex, images.length, goToSlide, stickyHeroContext]);
|
|
13348
13373
|
if (!images || images.length === 0) {
|
|
13349
|
-
return /* @__PURE__ */
|
|
13374
|
+
return /* @__PURE__ */ jsx75("div", { className: "w-full aspect-video bg-muted rounded-lg" });
|
|
13350
13375
|
}
|
|
13351
13376
|
return /* @__PURE__ */ jsxs50("div", { className: `relative w-full h-full ${className}`, children: [
|
|
13352
|
-
/* @__PURE__ */
|
|
13377
|
+
/* @__PURE__ */ jsx75(
|
|
13353
13378
|
"div",
|
|
13354
13379
|
{
|
|
13355
13380
|
ref: carouselRef,
|
|
@@ -13367,7 +13392,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13367
13392
|
role: "region",
|
|
13368
13393
|
"aria-roledescription": "carousel",
|
|
13369
13394
|
"aria-label": "Product images",
|
|
13370
|
-
children: /* @__PURE__ */
|
|
13395
|
+
children: /* @__PURE__ */ jsx75(
|
|
13371
13396
|
"div",
|
|
13372
13397
|
{
|
|
13373
13398
|
className: `flex h-full ${isPeekReturning ? "transition-transform duration-300 ease-[cubic-bezier(0,0,0.2,1)]" : isPeeking ? "transition-transform duration-500 ease-[cubic-bezier(0.4,0,0.2,1)]" : isTransitioning || !isDragging ? "transition-transform duration-300 ease-[cubic-bezier(0.25,0.46,0.45,0.94)]" : ""}`,
|
|
@@ -13384,11 +13409,11 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13384
13409
|
"data-gallery-role": image.galleryRole,
|
|
13385
13410
|
"data-mockup-id": image.galleryRole ? image.mockupId : void 0,
|
|
13386
13411
|
children: [
|
|
13387
|
-
!isWithinDecodeWindow ? /* @__PURE__ */
|
|
13412
|
+
!isWithinDecodeWindow ? /* @__PURE__ */ jsx75("div", { className: "w-full h-full bg-muted" }) : image.isPlaceholder ? (
|
|
13388
13413
|
// Rainbow prism loader (same as the /create route) instead of
|
|
13389
13414
|
// a flat pulse; fills this relative slide via inset:0.
|
|
13390
|
-
/* @__PURE__ */
|
|
13391
|
-
) : image.isRealMockup && currentArtwork ? /* @__PURE__ */
|
|
13415
|
+
/* @__PURE__ */ jsx75(LoadingOverlayPrismCandyInline, { visible: true, variant: "light" })
|
|
13416
|
+
) : image.isRealMockup && currentArtwork ? /* @__PURE__ */ jsx75(
|
|
13392
13417
|
HeroProductImage,
|
|
13393
13418
|
{
|
|
13394
13419
|
productId,
|
|
@@ -13405,7 +13430,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13405
13430
|
viewportPolicy: true,
|
|
13406
13431
|
fit: slideFit(image.galleryRole)
|
|
13407
13432
|
}
|
|
13408
|
-
) : image.isRealMockup && !currentArtwork ? /* @__PURE__ */
|
|
13433
|
+
) : image.isRealMockup && !currentArtwork ? /* @__PURE__ */ jsx75(LoadingOverlayPrismCandyInline, { visible: true, variant: "light" }) : /* @__PURE__ */ jsx75(
|
|
13409
13434
|
StaticCarouselImage,
|
|
13410
13435
|
{
|
|
13411
13436
|
src: image.src,
|
|
@@ -13415,7 +13440,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13415
13440
|
),
|
|
13416
13441
|
isWithinDecodeWindow && (() => {
|
|
13417
13442
|
const action = renderImageAction?.(image, index);
|
|
13418
|
-
return action ? /* @__PURE__ */
|
|
13443
|
+
return action ? /* @__PURE__ */ jsx75(
|
|
13419
13444
|
"div",
|
|
13420
13445
|
{
|
|
13421
13446
|
className: "absolute top-3 right-3 z-10",
|
|
@@ -13436,7 +13461,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13436
13461
|
)
|
|
13437
13462
|
}
|
|
13438
13463
|
),
|
|
13439
|
-
showIndicators && images.length > 1 && /* @__PURE__ */
|
|
13464
|
+
showIndicators && images.length > 1 && /* @__PURE__ */ jsx75(
|
|
13440
13465
|
"div",
|
|
13441
13466
|
{
|
|
13442
13467
|
ref: indicatorRef,
|
|
@@ -13445,7 +13470,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13445
13470
|
role: "group",
|
|
13446
13471
|
"aria-label": "Product image navigation",
|
|
13447
13472
|
children: /* @__PURE__ */ jsxs50("div", { className: "relative h-1", children: [
|
|
13448
|
-
/* @__PURE__ */
|
|
13473
|
+
/* @__PURE__ */ jsx75("div", { className: "flex h-full absolute inset-0", children: images.map((_, index) => /* @__PURE__ */ jsx75(
|
|
13449
13474
|
"button",
|
|
13450
13475
|
{
|
|
13451
13476
|
onClick: () => goToSlide(index),
|
|
@@ -13455,7 +13480,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13455
13480
|
},
|
|
13456
13481
|
index
|
|
13457
13482
|
)) }),
|
|
13458
|
-
/* @__PURE__ */
|
|
13483
|
+
/* @__PURE__ */ jsx75(
|
|
13459
13484
|
"div",
|
|
13460
13485
|
{
|
|
13461
13486
|
className: `absolute top-0 h-full bg-foreground ${isPeekReturning ? "transition-all duration-300 ease-[cubic-bezier(0,0,0.2,1)]" : isPeeking ? "transition-all duration-500 ease-[cubic-bezier(0.4,0,0.2,1)]" : isDragging ? "" : "transition-all duration-300 ease-out"}`,
|
|
@@ -13491,7 +13516,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13491
13516
|
...zoomFit(img.galleryRole) === "whole" ? { fit: "whole" } : {}
|
|
13492
13517
|
} : null;
|
|
13493
13518
|
}).filter((img) => img !== null);
|
|
13494
|
-
return /* @__PURE__ */
|
|
13519
|
+
return /* @__PURE__ */ jsx75(
|
|
13495
13520
|
EnhancedImageViewer,
|
|
13496
13521
|
{
|
|
13497
13522
|
imageUrl,
|
|
@@ -13531,7 +13556,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13531
13556
|
|
|
13532
13557
|
// src/composed/carousels/HeroCarousel.tsx
|
|
13533
13558
|
import { useState as useState41, useRef as useRef27, useCallback as useCallback23, useEffect as useEffect41 } from "react";
|
|
13534
|
-
import { jsx as
|
|
13559
|
+
import { jsx as jsx76, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
13535
13560
|
function HeroCarousel({
|
|
13536
13561
|
images,
|
|
13537
13562
|
currentIndex = 0,
|
|
@@ -13610,7 +13635,7 @@ function HeroCarousel({
|
|
|
13610
13635
|
};
|
|
13611
13636
|
}, [activeIndex, images.length, goToSlide, onImageTap]);
|
|
13612
13637
|
if (!images || images.length === 0) {
|
|
13613
|
-
return /* @__PURE__ */
|
|
13638
|
+
return /* @__PURE__ */ jsx76("div", { className: "w-full h-full bg-muted" });
|
|
13614
13639
|
}
|
|
13615
13640
|
return /* @__PURE__ */ jsxs51(
|
|
13616
13641
|
"div",
|
|
@@ -13623,7 +13648,7 @@ function HeroCarousel({
|
|
|
13623
13648
|
overflow: "hidden"
|
|
13624
13649
|
},
|
|
13625
13650
|
children: [
|
|
13626
|
-
/* @__PURE__ */
|
|
13651
|
+
/* @__PURE__ */ jsx76(
|
|
13627
13652
|
"div",
|
|
13628
13653
|
{
|
|
13629
13654
|
className: "flex h-full transition-transform duration-300 ease-out",
|
|
@@ -13634,14 +13659,14 @@ function HeroCarousel({
|
|
|
13634
13659
|
backfaceVisibility: "hidden",
|
|
13635
13660
|
WebkitBackfaceVisibility: "hidden"
|
|
13636
13661
|
},
|
|
13637
|
-
children: images.map((image, index) => /* @__PURE__ */
|
|
13662
|
+
children: images.map((image, index) => /* @__PURE__ */ jsx76(
|
|
13638
13663
|
"div",
|
|
13639
13664
|
{
|
|
13640
13665
|
className: "w-full h-full flex-shrink-0",
|
|
13641
13666
|
style: {
|
|
13642
13667
|
contain: "layout paint"
|
|
13643
13668
|
},
|
|
13644
|
-
children: image.isRealMockup && currentArtwork ? /* @__PURE__ */
|
|
13669
|
+
children: image.isRealMockup && currentArtwork ? /* @__PURE__ */ jsx76(
|
|
13645
13670
|
HeroProductImage,
|
|
13646
13671
|
{
|
|
13647
13672
|
productId,
|
|
@@ -13650,7 +13675,7 @@ function HeroCarousel({
|
|
|
13650
13675
|
mockupId: image.mockupId,
|
|
13651
13676
|
className: "w-full h-full object-cover"
|
|
13652
13677
|
}
|
|
13653
|
-
) : /* @__PURE__ */
|
|
13678
|
+
) : /* @__PURE__ */ jsx76(
|
|
13654
13679
|
"img",
|
|
13655
13680
|
{
|
|
13656
13681
|
src: image.src,
|
|
@@ -13667,12 +13692,12 @@ function HeroCarousel({
|
|
|
13667
13692
|
))
|
|
13668
13693
|
}
|
|
13669
13694
|
),
|
|
13670
|
-
images.length > 1 && /* @__PURE__ */
|
|
13695
|
+
images.length > 1 && /* @__PURE__ */ jsx76(
|
|
13671
13696
|
"div",
|
|
13672
13697
|
{
|
|
13673
13698
|
className: "absolute bottom-4 left-0 right-0 flex justify-center gap-2 z-10",
|
|
13674
13699
|
style: { contain: "layout style" },
|
|
13675
|
-
children: images.map((_, index) => /* @__PURE__ */
|
|
13700
|
+
children: images.map((_, index) => /* @__PURE__ */ jsx76(
|
|
13676
13701
|
"button",
|
|
13677
13702
|
{
|
|
13678
13703
|
onClick: () => goToSlide(index),
|
|
@@ -13689,8 +13714,8 @@ function HeroCarousel({
|
|
|
13689
13714
|
}
|
|
13690
13715
|
|
|
13691
13716
|
// src/composed/grids/MasonryGrid.tsx
|
|
13692
|
-
import { useState as useState42, useEffect as useEffect42, useMemo as
|
|
13693
|
-
import { Fragment as Fragment19, jsx as
|
|
13717
|
+
import { useState as useState42, useEffect as useEffect42, useMemo as useMemo17 } from "react";
|
|
13718
|
+
import { Fragment as Fragment19, jsx as jsx77 } from "react/jsx-runtime";
|
|
13694
13719
|
var BREAKPOINTS = {
|
|
13695
13720
|
sm: 640,
|
|
13696
13721
|
md: 768,
|
|
@@ -13756,30 +13781,30 @@ function MasonryGrid({
|
|
|
13756
13781
|
window.addEventListener("resize", updateColumnCount);
|
|
13757
13782
|
return () => window.removeEventListener("resize", updateColumnCount);
|
|
13758
13783
|
}, [columns]);
|
|
13759
|
-
const distributedColumns =
|
|
13784
|
+
const distributedColumns = useMemo17(
|
|
13760
13785
|
() => distributeItems(items, columnCount),
|
|
13761
13786
|
[items, columnCount]
|
|
13762
13787
|
);
|
|
13763
13788
|
if (items.length === 0) {
|
|
13764
13789
|
if (emptyContent) {
|
|
13765
|
-
return /* @__PURE__ */
|
|
13790
|
+
return /* @__PURE__ */ jsx77(Fragment19, { children: emptyContent });
|
|
13766
13791
|
}
|
|
13767
13792
|
return null;
|
|
13768
13793
|
}
|
|
13769
|
-
return /* @__PURE__ */
|
|
13794
|
+
return /* @__PURE__ */ jsx77(
|
|
13770
13795
|
"div",
|
|
13771
13796
|
{
|
|
13772
13797
|
className: `flex ${className}`,
|
|
13773
13798
|
style: { gap: `${gap}px` },
|
|
13774
13799
|
role: "list",
|
|
13775
|
-
children: distributedColumns.map((columnItems, columnIndex) => /* @__PURE__ */
|
|
13800
|
+
children: distributedColumns.map((columnItems, columnIndex) => /* @__PURE__ */ jsx77(
|
|
13776
13801
|
"div",
|
|
13777
13802
|
{
|
|
13778
13803
|
className: "flex-1 flex flex-col",
|
|
13779
13804
|
style: { gap: `${gap}px` },
|
|
13780
13805
|
children: columnItems.map((item, itemIndex) => {
|
|
13781
13806
|
const originalIndex = itemIndex * columnCount + columnIndex;
|
|
13782
|
-
return /* @__PURE__ */
|
|
13807
|
+
return /* @__PURE__ */ jsx77("div", { role: "listitem", children: renderItem(item, originalIndex) }, originalIndex);
|
|
13783
13808
|
})
|
|
13784
13809
|
},
|
|
13785
13810
|
columnIndex
|
|
@@ -13878,7 +13903,7 @@ function useHeroZoomScales(config = {}) {
|
|
|
13878
13903
|
}
|
|
13879
13904
|
|
|
13880
13905
|
// src/layouts/hero-zoom/HeroZoomLayout.tsx
|
|
13881
|
-
import { jsx as
|
|
13906
|
+
import { jsx as jsx78, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
13882
13907
|
function HeroZoomLayout({
|
|
13883
13908
|
config = {},
|
|
13884
13909
|
header,
|
|
@@ -14051,8 +14076,8 @@ function HeroZoomLayout({
|
|
|
14051
14076
|
"--hero-zoom-final-transform": 1 / activeRender
|
|
14052
14077
|
},
|
|
14053
14078
|
children: [
|
|
14054
|
-
/* @__PURE__ */
|
|
14055
|
-
/* @__PURE__ */
|
|
14079
|
+
/* @__PURE__ */ jsx78("style", { dangerouslySetInnerHTML: { __html: scopedStyles } }),
|
|
14080
|
+
/* @__PURE__ */ jsx78(
|
|
14056
14081
|
"div",
|
|
14057
14082
|
{
|
|
14058
14083
|
style: {
|
|
@@ -14060,7 +14085,7 @@ function HeroZoomLayout({
|
|
|
14060
14085
|
}
|
|
14061
14086
|
}
|
|
14062
14087
|
),
|
|
14063
|
-
header && /* @__PURE__ */
|
|
14088
|
+
header && /* @__PURE__ */ jsx78(
|
|
14064
14089
|
"div",
|
|
14065
14090
|
{
|
|
14066
14091
|
ref: headerRef,
|
|
@@ -14073,7 +14098,7 @@ function HeroZoomLayout({
|
|
|
14073
14098
|
children: header
|
|
14074
14099
|
}
|
|
14075
14100
|
),
|
|
14076
|
-
/* @__PURE__ */
|
|
14101
|
+
/* @__PURE__ */ jsx78(
|
|
14077
14102
|
"div",
|
|
14078
14103
|
{
|
|
14079
14104
|
ref: imageContainerRef,
|
|
@@ -14093,7 +14118,7 @@ function HeroZoomLayout({
|
|
|
14093
14118
|
children: hero
|
|
14094
14119
|
}
|
|
14095
14120
|
),
|
|
14096
|
-
/* @__PURE__ */
|
|
14121
|
+
/* @__PURE__ */ jsx78("div", { className: "relative z-10", children })
|
|
14097
14122
|
]
|
|
14098
14123
|
}
|
|
14099
14124
|
);
|
|
@@ -14101,7 +14126,7 @@ function HeroZoomLayout({
|
|
|
14101
14126
|
|
|
14102
14127
|
// src/layouts/hero-zoom/HeroShrinkLayout.tsx
|
|
14103
14128
|
import { useEffect as useEffect45, useRef as useRef29, useState as useState44 } from "react";
|
|
14104
|
-
import { jsx as
|
|
14129
|
+
import { jsx as jsx79, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
14105
14130
|
var DEFAULT_CONFIG = {
|
|
14106
14131
|
aspectRatio: 16 / 9,
|
|
14107
14132
|
initialHeightPercent: 70,
|
|
@@ -14220,9 +14245,9 @@ function HeroShrinkLayout({
|
|
|
14220
14245
|
className: `relative min-h-screen ${className}`,
|
|
14221
14246
|
style: { ...style, ...cssVars },
|
|
14222
14247
|
children: [
|
|
14223
|
-
/* @__PURE__ */
|
|
14224
|
-
/* @__PURE__ */
|
|
14225
|
-
header && /* @__PURE__ */
|
|
14248
|
+
/* @__PURE__ */ jsx79("style", { dangerouslySetInnerHTML: { __html: scopedStyles } }),
|
|
14249
|
+
/* @__PURE__ */ jsx79("div", { style: { height: spacerHeight } }),
|
|
14250
|
+
header && /* @__PURE__ */ jsx79(
|
|
14226
14251
|
"div",
|
|
14227
14252
|
{
|
|
14228
14253
|
ref: headerRef,
|
|
@@ -14231,7 +14256,7 @@ function HeroShrinkLayout({
|
|
|
14231
14256
|
children: header
|
|
14232
14257
|
}
|
|
14233
14258
|
),
|
|
14234
|
-
/* @__PURE__ */
|
|
14259
|
+
/* @__PURE__ */ jsx79(
|
|
14235
14260
|
"div",
|
|
14236
14261
|
{
|
|
14237
14262
|
ref: heroRef,
|
|
@@ -14239,15 +14264,15 @@ function HeroShrinkLayout({
|
|
|
14239
14264
|
children: hero
|
|
14240
14265
|
}
|
|
14241
14266
|
),
|
|
14242
|
-
/* @__PURE__ */
|
|
14267
|
+
/* @__PURE__ */ jsx79("div", { className: "relative z-10 bg-background", children })
|
|
14243
14268
|
]
|
|
14244
14269
|
}
|
|
14245
14270
|
);
|
|
14246
14271
|
}
|
|
14247
14272
|
|
|
14248
14273
|
// src/layouts/pdp/ImageEdgeBlur.tsx
|
|
14249
|
-
import
|
|
14250
|
-
import { jsx as
|
|
14274
|
+
import React53 from "react";
|
|
14275
|
+
import { jsx as jsx80 } from "react/jsx-runtime";
|
|
14251
14276
|
var BLUR_CONFIG = {
|
|
14252
14277
|
blur: 24,
|
|
14253
14278
|
crossfade: 68
|
|
@@ -14271,7 +14296,7 @@ var BLUR_LAYERS = [
|
|
|
14271
14296
|
{ blur: Math.round(BLUR_CONFIG.blur * 0.5), zone: 0.6 },
|
|
14272
14297
|
{ blur: BLUR_CONFIG.blur, zone: 1 }
|
|
14273
14298
|
];
|
|
14274
|
-
var ImageEdgeBlur =
|
|
14299
|
+
var ImageEdgeBlur = React53.memo(
|
|
14275
14300
|
function ImageEdgeBlur2({
|
|
14276
14301
|
imageSrc,
|
|
14277
14302
|
imageCapInfo,
|
|
@@ -14302,7 +14327,7 @@ var ImageEdgeBlur = React52.memo(
|
|
|
14302
14327
|
viewportWidth / LAYOUT_CONFIG2.IMAGE.ASPECT_RATIO,
|
|
14303
14328
|
maxWidthPx / LAYOUT_CONFIG2.IMAGE.ASPECT_RATIO
|
|
14304
14329
|
);
|
|
14305
|
-
return /* @__PURE__ */
|
|
14330
|
+
return /* @__PURE__ */ jsx80(
|
|
14306
14331
|
"div",
|
|
14307
14332
|
{
|
|
14308
14333
|
className: `absolute inset-0 pointer-events-none overflow-hidden ${className}`,
|
|
@@ -14310,7 +14335,7 @@ var ImageEdgeBlur = React52.memo(
|
|
|
14310
14335
|
children: BLUR_LAYERS.map((layer, index) => {
|
|
14311
14336
|
const layerMask = index === BLUR_LAYERS.length - 1 ? void 0 : `linear-gradient(to right, black 0%, black ${layer.zone * 100}%, transparent ${layer.zone * 100 + 10}%)`;
|
|
14312
14337
|
const blurScale = 1 + layer.blur * 3 / containerHeightPx;
|
|
14313
|
-
return /* @__PURE__ */
|
|
14338
|
+
return /* @__PURE__ */ jsx80(
|
|
14314
14339
|
"img",
|
|
14315
14340
|
{
|
|
14316
14341
|
src: imageSrc,
|
|
@@ -14357,7 +14382,7 @@ var ImageEdgeBlur = React52.memo(
|
|
|
14357
14382
|
);
|
|
14358
14383
|
|
|
14359
14384
|
// src/layouts/pdp/PDPLayout.tsx
|
|
14360
|
-
import { jsx as
|
|
14385
|
+
import { jsx as jsx81, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
14361
14386
|
function PDPLayout({
|
|
14362
14387
|
renderHeroImage,
|
|
14363
14388
|
renderContent,
|
|
@@ -14387,13 +14412,13 @@ function PDPLayout({
|
|
|
14387
14412
|
};
|
|
14388
14413
|
return /* @__PURE__ */ jsxs54("div", { className: `pdp-layout ${className}`, children: [
|
|
14389
14414
|
(isDesktop === false || isDesktop === null) && /* @__PURE__ */ jsxs54("div", { className: "md:hidden", children: [
|
|
14390
|
-
renderMobileCarousel && /* @__PURE__ */
|
|
14391
|
-
/* @__PURE__ */
|
|
14415
|
+
renderMobileCarousel && /* @__PURE__ */ jsx81("div", { className: "mobile-carousel-container", children: renderMobileCarousel({ images: carouselImages }) }),
|
|
14416
|
+
/* @__PURE__ */ jsx81("div", { className: "mobile-content p-4", children: renderContent(contentProps) })
|
|
14392
14417
|
] }),
|
|
14393
14418
|
(isDesktop === true || isDesktop === null) && /* @__PURE__ */ jsxs54("div", { className: "hidden md:block relative", children: [
|
|
14394
14419
|
/* @__PURE__ */ jsxs54("div", { className: "desktop-hero relative", children: [
|
|
14395
14420
|
renderHeroImage(heroProps),
|
|
14396
|
-
showEdgeBlur && blurImageSrc && isWideMonitor2 && /* @__PURE__ */
|
|
14421
|
+
showEdgeBlur && blurImageSrc && isWideMonitor2 && /* @__PURE__ */ jsx81(
|
|
14397
14422
|
ImageEdgeBlur,
|
|
14398
14423
|
{
|
|
14399
14424
|
imageSrc: blurImageSrc,
|
|
@@ -14404,7 +14429,7 @@ function PDPLayout({
|
|
|
14404
14429
|
}
|
|
14405
14430
|
)
|
|
14406
14431
|
] }),
|
|
14407
|
-
/* @__PURE__ */
|
|
14432
|
+
/* @__PURE__ */ jsx81(
|
|
14408
14433
|
"div",
|
|
14409
14434
|
{
|
|
14410
14435
|
className: "desktop-sidebar",
|
|
@@ -14421,8 +14446,8 @@ function PDPLayout({
|
|
|
14421
14446
|
}
|
|
14422
14447
|
|
|
14423
14448
|
// src/layouts/pdp/SimpleImageBlur.tsx
|
|
14424
|
-
import
|
|
14425
|
-
import { jsx as
|
|
14449
|
+
import React54 from "react";
|
|
14450
|
+
import { jsx as jsx82 } from "react/jsx-runtime";
|
|
14426
14451
|
var BLUR_CONFIG2 = {
|
|
14427
14452
|
blur: 24,
|
|
14428
14453
|
crossfade: 60
|
|
@@ -14445,7 +14470,7 @@ function getFadeInMask(crossfadeWidth) {
|
|
|
14445
14470
|
black ${crossfadeWidth + 10}px
|
|
14446
14471
|
)`;
|
|
14447
14472
|
}
|
|
14448
|
-
var SimpleImageBlur =
|
|
14473
|
+
var SimpleImageBlur = React54.memo(function SimpleImageBlur2({
|
|
14449
14474
|
imageSrc,
|
|
14450
14475
|
width,
|
|
14451
14476
|
height = "100%",
|
|
@@ -14455,7 +14480,7 @@ var SimpleImageBlur = React53.memo(function SimpleImageBlur2({
|
|
|
14455
14480
|
if (!imageSrc || width <= 0) return null;
|
|
14456
14481
|
const fadeInMask = getFadeInMask(BLUR_CONFIG2.crossfade);
|
|
14457
14482
|
const extendedWidth = width + BLUR_CONFIG2.blur * 2;
|
|
14458
|
-
return /* @__PURE__ */
|
|
14483
|
+
return /* @__PURE__ */ jsx82(
|
|
14459
14484
|
"div",
|
|
14460
14485
|
{
|
|
14461
14486
|
className: `relative overflow-hidden ${className}`,
|
|
@@ -14468,7 +14493,7 @@ var SimpleImageBlur = React53.memo(function SimpleImageBlur2({
|
|
|
14468
14493
|
black 0%,
|
|
14469
14494
|
black ${layer.zone * 100}%,
|
|
14470
14495
|
transparent ${layer.zone * 100 + 10}%)`;
|
|
14471
|
-
return /* @__PURE__ */
|
|
14496
|
+
return /* @__PURE__ */ jsx82(
|
|
14472
14497
|
"img",
|
|
14473
14498
|
{
|
|
14474
14499
|
src: imageSrc,
|
|
@@ -14498,8 +14523,8 @@ var SimpleImageBlur = React53.memo(function SimpleImageBlur2({
|
|
|
14498
14523
|
});
|
|
14499
14524
|
|
|
14500
14525
|
// src/layouts/pdp/EdgeBlurBox.tsx
|
|
14501
|
-
import
|
|
14502
|
-
import { jsx as
|
|
14526
|
+
import React55 from "react";
|
|
14527
|
+
import { jsx as jsx83, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
14503
14528
|
var BLUR_CONFIG3 = {
|
|
14504
14529
|
blur: 24,
|
|
14505
14530
|
crossfade: 60
|
|
@@ -14523,7 +14548,7 @@ function getFadeOutMask(crossfadeWidth) {
|
|
|
14523
14548
|
transparent 100%
|
|
14524
14549
|
)`;
|
|
14525
14550
|
}
|
|
14526
|
-
var EdgeBlurBox =
|
|
14551
|
+
var EdgeBlurBox = React55.memo(function EdgeBlurBox2({
|
|
14527
14552
|
imageSrc,
|
|
14528
14553
|
width,
|
|
14529
14554
|
height = "100%",
|
|
@@ -14549,7 +14574,7 @@ var EdgeBlurBox = React54.memo(function EdgeBlurBox2({
|
|
|
14549
14574
|
overflow: hasOverlap ? "visible" : "hidden"
|
|
14550
14575
|
},
|
|
14551
14576
|
children: [
|
|
14552
|
-
/* @__PURE__ */
|
|
14577
|
+
/* @__PURE__ */ jsx83(
|
|
14553
14578
|
"div",
|
|
14554
14579
|
{
|
|
14555
14580
|
style: {
|
|
@@ -14563,7 +14588,7 @@ var EdgeBlurBox = React54.memo(function EdgeBlurBox2({
|
|
|
14563
14588
|
transparent ${100 - (layer.zone * 100 + 10)}%,
|
|
14564
14589
|
black ${100 - layer.zone * 100}%,
|
|
14565
14590
|
black 100%)`;
|
|
14566
|
-
return /* @__PURE__ */
|
|
14591
|
+
return /* @__PURE__ */ jsx83(
|
|
14567
14592
|
"img",
|
|
14568
14593
|
{
|
|
14569
14594
|
src: imageSrc,
|
|
@@ -14591,7 +14616,7 @@ var EdgeBlurBox = React54.memo(function EdgeBlurBox2({
|
|
|
14591
14616
|
})
|
|
14592
14617
|
}
|
|
14593
14618
|
),
|
|
14594
|
-
/* @__PURE__ */
|
|
14619
|
+
/* @__PURE__ */ jsx83(
|
|
14595
14620
|
"img",
|
|
14596
14621
|
{
|
|
14597
14622
|
src: imageSrc,
|
|
@@ -14619,8 +14644,8 @@ var EdgeBlurBox = React54.memo(function EdgeBlurBox2({
|
|
|
14619
14644
|
});
|
|
14620
14645
|
|
|
14621
14646
|
// src/layouts/pdp/ImageBlurExtension.tsx
|
|
14622
|
-
import
|
|
14623
|
-
import { jsx as
|
|
14647
|
+
import React56 from "react";
|
|
14648
|
+
import { jsx as jsx84, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
14624
14649
|
var BLUR_CONFIG4 = {
|
|
14625
14650
|
blur: 24,
|
|
14626
14651
|
crossfadeWidth: 80
|
|
@@ -14643,7 +14668,7 @@ function getFadeOutMask2(crossfadeWidth) {
|
|
|
14643
14668
|
transparent 100%
|
|
14644
14669
|
)`;
|
|
14645
14670
|
}
|
|
14646
|
-
var ImageBlurExtension =
|
|
14671
|
+
var ImageBlurExtension = React56.memo(function ImageBlurExtension2({
|
|
14647
14672
|
imageSrc,
|
|
14648
14673
|
width,
|
|
14649
14674
|
height,
|
|
@@ -14666,7 +14691,7 @@ var ImageBlurExtension = React55.memo(function ImageBlurExtension2({
|
|
|
14666
14691
|
height: heightValue
|
|
14667
14692
|
},
|
|
14668
14693
|
children: [
|
|
14669
|
-
BLUR_LAYERS4.map((layer, index) => /* @__PURE__ */
|
|
14694
|
+
BLUR_LAYERS4.map((layer, index) => /* @__PURE__ */ jsx84(
|
|
14670
14695
|
"img",
|
|
14671
14696
|
{
|
|
14672
14697
|
src: imageSrc,
|
|
@@ -14690,7 +14715,7 @@ var ImageBlurExtension = React55.memo(function ImageBlurExtension2({
|
|
|
14690
14715
|
},
|
|
14691
14716
|
`blur-${index}`
|
|
14692
14717
|
)),
|
|
14693
|
-
/* @__PURE__ */
|
|
14718
|
+
/* @__PURE__ */ jsx84(
|
|
14694
14719
|
"img",
|
|
14695
14720
|
{
|
|
14696
14721
|
src: imageSrc,
|
|
@@ -14718,23 +14743,23 @@ var ImageBlurExtension = React55.memo(function ImageBlurExtension2({
|
|
|
14718
14743
|
});
|
|
14719
14744
|
|
|
14720
14745
|
// src/design-system/ColorSwatch.tsx
|
|
14721
|
-
import { jsx as
|
|
14746
|
+
import { jsx as jsx85, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
14722
14747
|
function ColorTokenSwatch({ name, cssVar, className = "" }) {
|
|
14723
14748
|
return /* @__PURE__ */ jsxs57("div", { className: `flex flex-col gap-1 ${className}`, children: [
|
|
14724
|
-
/* @__PURE__ */
|
|
14749
|
+
/* @__PURE__ */ jsx85(
|
|
14725
14750
|
"div",
|
|
14726
14751
|
{
|
|
14727
14752
|
className: "h-16 w-full rounded-lg border border-border shadow-sm",
|
|
14728
14753
|
style: { backgroundColor: `var(${cssVar})` }
|
|
14729
14754
|
}
|
|
14730
14755
|
),
|
|
14731
|
-
/* @__PURE__ */
|
|
14732
|
-
/* @__PURE__ */
|
|
14756
|
+
/* @__PURE__ */ jsx85("div", { className: "text-sm font-medium text-foreground", children: name }),
|
|
14757
|
+
/* @__PURE__ */ jsx85("code", { className: "text-xs text-muted-foreground font-mono", children: cssVar })
|
|
14733
14758
|
] });
|
|
14734
14759
|
}
|
|
14735
14760
|
function ColorRow({ name, cssVar, description }) {
|
|
14736
14761
|
return /* @__PURE__ */ jsxs57("div", { className: "flex items-center gap-4 py-2", children: [
|
|
14737
|
-
/* @__PURE__ */
|
|
14762
|
+
/* @__PURE__ */ jsx85(
|
|
14738
14763
|
"div",
|
|
14739
14764
|
{
|
|
14740
14765
|
className: "h-10 w-10 rounded-lg border border-border shadow-sm flex-shrink-0",
|
|
@@ -14742,15 +14767,15 @@ function ColorRow({ name, cssVar, description }) {
|
|
|
14742
14767
|
}
|
|
14743
14768
|
),
|
|
14744
14769
|
/* @__PURE__ */ jsxs57("div", { className: "flex-1 min-w-0", children: [
|
|
14745
|
-
/* @__PURE__ */
|
|
14746
|
-
description && /* @__PURE__ */
|
|
14770
|
+
/* @__PURE__ */ jsx85("div", { className: "text-sm font-medium text-foreground", children: name }),
|
|
14771
|
+
description && /* @__PURE__ */ jsx85("div", { className: "text-xs text-muted-foreground", children: description })
|
|
14747
14772
|
] }),
|
|
14748
|
-
/* @__PURE__ */
|
|
14773
|
+
/* @__PURE__ */ jsx85("code", { className: "text-xs text-muted-foreground font-mono bg-muted px-2 py-1 rounded", children: cssVar })
|
|
14749
14774
|
] });
|
|
14750
14775
|
}
|
|
14751
14776
|
|
|
14752
14777
|
// src/design-system/ColorPalette.tsx
|
|
14753
|
-
import { jsx as
|
|
14778
|
+
import { jsx as jsx86, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
14754
14779
|
var COLOR_GROUPS = [
|
|
14755
14780
|
{
|
|
14756
14781
|
name: "Base",
|
|
@@ -14831,17 +14856,17 @@ var COLOR_GROUPS = [
|
|
|
14831
14856
|
}
|
|
14832
14857
|
];
|
|
14833
14858
|
function ColorPalette({ layout = "list", className = "" }) {
|
|
14834
|
-
return /* @__PURE__ */
|
|
14835
|
-
/* @__PURE__ */
|
|
14836
|
-
/* @__PURE__ */
|
|
14837
|
-
layout === "grid" ? /* @__PURE__ */
|
|
14859
|
+
return /* @__PURE__ */ jsx86("div", { className: `space-y-8 ${className}`, children: COLOR_GROUPS.map((group) => /* @__PURE__ */ jsxs58("section", { children: [
|
|
14860
|
+
/* @__PURE__ */ jsx86("h3", { className: "text-lg font-semibold text-foreground mb-1", children: group.name }),
|
|
14861
|
+
/* @__PURE__ */ jsx86("p", { className: "text-sm text-muted-foreground mb-4", children: group.description }),
|
|
14862
|
+
layout === "grid" ? /* @__PURE__ */ jsx86("div", { className: "grid grid-cols-2 sm:grid-cols-4 gap-4", children: group.colors.map((color) => /* @__PURE__ */ jsx86(
|
|
14838
14863
|
ColorTokenSwatch,
|
|
14839
14864
|
{
|
|
14840
14865
|
name: color.name,
|
|
14841
14866
|
cssVar: color.cssVar
|
|
14842
14867
|
},
|
|
14843
14868
|
color.cssVar
|
|
14844
|
-
)) }) : /* @__PURE__ */
|
|
14869
|
+
)) }) : /* @__PURE__ */ jsx86("div", { className: "bg-card rounded-lg border border-border p-4 divide-y divide-border", children: group.colors.map((color) => /* @__PURE__ */ jsx86(
|
|
14845
14870
|
ColorRow,
|
|
14846
14871
|
{
|
|
14847
14872
|
name: color.name,
|
|
@@ -14854,7 +14879,7 @@ function ColorPalette({ layout = "list", className = "" }) {
|
|
|
14854
14879
|
}
|
|
14855
14880
|
|
|
14856
14881
|
// src/design-system/TypographyScale.tsx
|
|
14857
|
-
import { jsx as
|
|
14882
|
+
import { jsx as jsx87, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
14858
14883
|
var FONT_SAMPLES = [
|
|
14859
14884
|
{
|
|
14860
14885
|
name: "Heading",
|
|
@@ -14888,14 +14913,14 @@ var FONT_SAMPLES = [
|
|
|
14888
14913
|
}
|
|
14889
14914
|
];
|
|
14890
14915
|
function TypographyScale({ className = "" }) {
|
|
14891
|
-
return /* @__PURE__ */
|
|
14916
|
+
return /* @__PURE__ */ jsx87("div", { className: `space-y-8 ${className}`, children: FONT_SAMPLES.map((font) => /* @__PURE__ */ jsxs59("section", { className: "bg-card rounded-lg border border-border p-6", children: [
|
|
14892
14917
|
/* @__PURE__ */ jsxs59("div", { className: "flex items-center justify-between mb-4", children: [
|
|
14893
|
-
/* @__PURE__ */
|
|
14894
|
-
/* @__PURE__ */
|
|
14918
|
+
/* @__PURE__ */ jsx87("h3", { className: "text-lg font-semibold text-foreground", children: font.name }),
|
|
14919
|
+
/* @__PURE__ */ jsx87("code", { className: "text-xs text-muted-foreground font-mono bg-muted px-2 py-1 rounded", children: font.cssVar })
|
|
14895
14920
|
] }),
|
|
14896
|
-
/* @__PURE__ */
|
|
14897
|
-
/* @__PURE__ */
|
|
14898
|
-
/* @__PURE__ */
|
|
14921
|
+
/* @__PURE__ */ jsx87("div", { className: "space-y-4", children: font.sizes.map((size) => /* @__PURE__ */ jsxs59("div", { className: "flex items-baseline gap-4", children: [
|
|
14922
|
+
/* @__PURE__ */ jsx87("span", { className: "text-xs text-muted-foreground w-20 flex-shrink-0", children: size }),
|
|
14923
|
+
/* @__PURE__ */ jsx87(
|
|
14899
14924
|
"p",
|
|
14900
14925
|
{
|
|
14901
14926
|
className: `${size} text-foreground`,
|
|
@@ -14914,8 +14939,8 @@ var RADIUS_SAMPLES = [
|
|
|
14914
14939
|
{ name: "Full", value: "9999px" }
|
|
14915
14940
|
];
|
|
14916
14941
|
function RadiusScale({ className = "" }) {
|
|
14917
|
-
return /* @__PURE__ */
|
|
14918
|
-
/* @__PURE__ */
|
|
14942
|
+
return /* @__PURE__ */ jsx87("div", { className: `space-y-4 ${className}`, children: /* @__PURE__ */ jsx87("div", { className: "grid grid-cols-5 gap-4", children: RADIUS_SAMPLES.map((radius) => /* @__PURE__ */ jsxs59("div", { className: "flex flex-col items-center gap-2", children: [
|
|
14943
|
+
/* @__PURE__ */ jsx87(
|
|
14919
14944
|
"div",
|
|
14920
14945
|
{
|
|
14921
14946
|
className: "h-16 w-16 bg-primary",
|
|
@@ -14924,14 +14949,14 @@ function RadiusScale({ className = "" }) {
|
|
|
14924
14949
|
}
|
|
14925
14950
|
}
|
|
14926
14951
|
),
|
|
14927
|
-
/* @__PURE__ */
|
|
14928
|
-
/* @__PURE__ */
|
|
14952
|
+
/* @__PURE__ */ jsx87("span", { className: "text-sm font-medium text-foreground", children: radius.name }),
|
|
14953
|
+
/* @__PURE__ */ jsx87("code", { className: "text-xs text-muted-foreground font-mono", children: radius.cssVar || radius.value })
|
|
14929
14954
|
] }, radius.name)) }) });
|
|
14930
14955
|
}
|
|
14931
14956
|
|
|
14932
14957
|
// src/design-system/ThemeSwitcher.tsx
|
|
14933
14958
|
import { useState as useState45, useEffect as useEffect46 } from "react";
|
|
14934
|
-
import { Fragment as Fragment20, jsx as
|
|
14959
|
+
import { Fragment as Fragment20, jsx as jsx88, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
14935
14960
|
function readThemeFromDOM() {
|
|
14936
14961
|
if (typeof document === "undefined") {
|
|
14937
14962
|
return { themeName: "Linear", isDark: false };
|
|
@@ -14999,35 +15024,35 @@ function ThemeSwitcher({ className = "", showBaseThemesOnly = true }) {
|
|
|
14999
15024
|
onClick: () => setIsOpen(!isOpen),
|
|
15000
15025
|
className: "flex items-center gap-2 px-4 py-2 bg-card border border-border rounded-lg hover:bg-muted transition-colors text-foreground",
|
|
15001
15026
|
children: [
|
|
15002
|
-
/* @__PURE__ */
|
|
15003
|
-
/* @__PURE__ */
|
|
15004
|
-
/* @__PURE__ */
|
|
15027
|
+
/* @__PURE__ */ jsx88("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ jsx88("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M7 21a4 4 0 01-4-4V5a2 2 0 012-2h4a2 2 0 012 2v12a4 4 0 01-4 4zm0 0h12a2 2 0 002-2v-4a2 2 0 00-2-2h-2.343M11 7.343l1.657-1.657a2 2 0 012.828 0l2.829 2.829a2 2 0 010 2.828l-8.486 8.485M7 17h.01" }) }),
|
|
15028
|
+
/* @__PURE__ */ jsx88("span", { className: "font-medium", children: currentTheme }),
|
|
15029
|
+
/* @__PURE__ */ jsx88("svg", { className: `w-4 h-4 transition-transform ${isOpen ? "rotate-180" : ""}`, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ jsx88("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) })
|
|
15005
15030
|
]
|
|
15006
15031
|
}
|
|
15007
15032
|
),
|
|
15008
15033
|
isOpen && /* @__PURE__ */ jsxs60(Fragment20, { children: [
|
|
15009
|
-
/* @__PURE__ */
|
|
15034
|
+
/* @__PURE__ */ jsx88(
|
|
15010
15035
|
"div",
|
|
15011
15036
|
{
|
|
15012
15037
|
className: "fixed inset-0 z-40",
|
|
15013
15038
|
onClick: () => setIsOpen(false)
|
|
15014
15039
|
}
|
|
15015
15040
|
),
|
|
15016
|
-
/* @__PURE__ */
|
|
15041
|
+
/* @__PURE__ */ jsx88("div", { className: "absolute top-full left-0 mt-2 w-56 max-h-80 overflow-auto bg-card border border-border rounded-lg shadow-lg z-50", children: themes.map((theme) => /* @__PURE__ */ jsxs60(
|
|
15017
15042
|
"button",
|
|
15018
15043
|
{
|
|
15019
15044
|
onClick: () => handleThemeSelect(theme.name),
|
|
15020
15045
|
className: `w-full px-4 py-2 text-left hover:bg-muted transition-colors flex items-center gap-3 ${currentTheme === theme.name ? "bg-muted" : ""}`,
|
|
15021
15046
|
children: [
|
|
15022
|
-
/* @__PURE__ */
|
|
15047
|
+
/* @__PURE__ */ jsx88(
|
|
15023
15048
|
"div",
|
|
15024
15049
|
{
|
|
15025
15050
|
className: "w-4 h-4 rounded-full border border-border",
|
|
15026
15051
|
style: { backgroundColor: theme.primaryColor || "#888" }
|
|
15027
15052
|
}
|
|
15028
15053
|
),
|
|
15029
|
-
/* @__PURE__ */
|
|
15030
|
-
currentTheme === theme.name && /* @__PURE__ */
|
|
15054
|
+
/* @__PURE__ */ jsx88("span", { className: "text-foreground", children: theme.name }),
|
|
15055
|
+
currentTheme === theme.name && /* @__PURE__ */ jsx88("svg", { className: "w-4 h-4 ml-auto text-primary", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ jsx88("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" }) })
|
|
15031
15056
|
]
|
|
15032
15057
|
},
|
|
15033
15058
|
theme.name
|
|
@@ -15042,10 +15067,10 @@ function ThemeSwitcher({ className = "", showBaseThemesOnly = true }) {
|
|
|
15042
15067
|
title: `Switch to ${isDark ? "light" : "dark"} mode`,
|
|
15043
15068
|
children: [
|
|
15044
15069
|
isDark ? /* @__PURE__ */ jsxs60("svg", { className: "w-5 h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: [
|
|
15045
|
-
/* @__PURE__ */
|
|
15046
|
-
/* @__PURE__ */
|
|
15047
|
-
] }) : /* @__PURE__ */
|
|
15048
|
-
/* @__PURE__ */
|
|
15070
|
+
/* @__PURE__ */ jsx88("circle", { cx: "12", cy: "12", r: "5" }),
|
|
15071
|
+
/* @__PURE__ */ jsx88("path", { d: "M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42" })
|
|
15072
|
+
] }) : /* @__PURE__ */ jsx88("svg", { className: "w-5 h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ jsx88("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" }) }),
|
|
15073
|
+
/* @__PURE__ */ jsx88("span", { className: "text-sm", children: isDark ? "Light" : "Dark" })
|
|
15049
15074
|
]
|
|
15050
15075
|
}
|
|
15051
15076
|
)
|
|
@@ -15053,7 +15078,7 @@ function ThemeSwitcher({ className = "", showBaseThemesOnly = true }) {
|
|
|
15053
15078
|
}
|
|
15054
15079
|
|
|
15055
15080
|
// src/design-system/DesignSystemPage.tsx
|
|
15056
|
-
import { jsx as
|
|
15081
|
+
import { jsx as jsx89, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
15057
15082
|
function DesignSystemPage({
|
|
15058
15083
|
showThemeSwitcher = true,
|
|
15059
15084
|
showColors = true,
|
|
@@ -15064,28 +15089,28 @@ function DesignSystemPage({
|
|
|
15064
15089
|
className = ""
|
|
15065
15090
|
}) {
|
|
15066
15091
|
return /* @__PURE__ */ jsxs61("div", { className: `max-w-4xl mx-auto px-4 py-8 ${className}`, children: [
|
|
15067
|
-
/* @__PURE__ */
|
|
15092
|
+
/* @__PURE__ */ jsx89("header", { className: "mb-12", children: /* @__PURE__ */ jsxs61("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-4", children: [
|
|
15068
15093
|
/* @__PURE__ */ jsxs61("div", { children: [
|
|
15069
|
-
/* @__PURE__ */
|
|
15070
|
-
/* @__PURE__ */
|
|
15094
|
+
/* @__PURE__ */ jsx89("h1", { className: "text-4xl font-bold text-foreground mb-2", children: "Design System" }),
|
|
15095
|
+
/* @__PURE__ */ jsx89("p", { className: "text-lg text-muted-foreground", children: "Visual reference for theme tokens and styles" })
|
|
15071
15096
|
] }),
|
|
15072
|
-
showThemeSwitcher && /* @__PURE__ */
|
|
15097
|
+
showThemeSwitcher && /* @__PURE__ */ jsx89(ThemeSwitcher, {})
|
|
15073
15098
|
] }) }),
|
|
15074
15099
|
showColors && /* @__PURE__ */ jsxs61("section", { className: "mb-16", children: [
|
|
15075
|
-
/* @__PURE__ */
|
|
15076
|
-
/* @__PURE__ */
|
|
15100
|
+
/* @__PURE__ */ jsx89("h2", { className: "text-2xl font-semibold text-foreground mb-6 pb-2 border-b border-border", children: "Color Palette" }),
|
|
15101
|
+
/* @__PURE__ */ jsx89(ColorPalette, { layout: colorLayout })
|
|
15077
15102
|
] }),
|
|
15078
15103
|
showTypography && /* @__PURE__ */ jsxs61("section", { className: "mb-16", children: [
|
|
15079
|
-
/* @__PURE__ */
|
|
15080
|
-
/* @__PURE__ */
|
|
15104
|
+
/* @__PURE__ */ jsx89("h2", { className: "text-2xl font-semibold text-foreground mb-6 pb-2 border-b border-border", children: "Typography" }),
|
|
15105
|
+
/* @__PURE__ */ jsx89(TypographyScale, {})
|
|
15081
15106
|
] }),
|
|
15082
15107
|
showRadius && /* @__PURE__ */ jsxs61("section", { className: "mb-16", children: [
|
|
15083
|
-
/* @__PURE__ */
|
|
15084
|
-
/* @__PURE__ */
|
|
15108
|
+
/* @__PURE__ */ jsx89("h2", { className: "text-2xl font-semibold text-foreground mb-6 pb-2 border-b border-border", children: "Border Radius" }),
|
|
15109
|
+
/* @__PURE__ */ jsx89(RadiusScale, {})
|
|
15085
15110
|
] }),
|
|
15086
15111
|
showSpacing && /* @__PURE__ */ jsxs61("section", { className: "mb-16", children: [
|
|
15087
|
-
/* @__PURE__ */
|
|
15088
|
-
/* @__PURE__ */
|
|
15112
|
+
/* @__PURE__ */ jsx89("h2", { className: "text-2xl font-semibold text-foreground mb-6 pb-2 border-b border-border", children: "Spacing Scale" }),
|
|
15113
|
+
/* @__PURE__ */ jsx89(SpacingScale, {})
|
|
15089
15114
|
] })
|
|
15090
15115
|
] });
|
|
15091
15116
|
}
|
|
@@ -15100,21 +15125,21 @@ function SpacingScale() {
|
|
|
15100
15125
|
{ name: "12", value: "3rem" },
|
|
15101
15126
|
{ name: "16", value: "4rem" }
|
|
15102
15127
|
];
|
|
15103
|
-
return /* @__PURE__ */
|
|
15104
|
-
/* @__PURE__ */
|
|
15105
|
-
/* @__PURE__ */
|
|
15128
|
+
return /* @__PURE__ */ jsx89("div", { className: "space-y-2", children: spaces.map((space) => /* @__PURE__ */ jsxs61("div", { className: "flex items-center gap-4", children: [
|
|
15129
|
+
/* @__PURE__ */ jsx89("code", { className: "text-xs text-muted-foreground font-mono w-8", children: space.name }),
|
|
15130
|
+
/* @__PURE__ */ jsx89(
|
|
15106
15131
|
"div",
|
|
15107
15132
|
{
|
|
15108
15133
|
className: "h-4 bg-primary rounded",
|
|
15109
15134
|
style: { width: space.value }
|
|
15110
15135
|
}
|
|
15111
15136
|
),
|
|
15112
|
-
/* @__PURE__ */
|
|
15137
|
+
/* @__PURE__ */ jsx89("span", { className: "text-sm text-muted-foreground", children: space.value })
|
|
15113
15138
|
] }, space.name)) });
|
|
15114
15139
|
}
|
|
15115
15140
|
|
|
15116
15141
|
// src/personalization/PersonalizationProvider.tsx
|
|
15117
|
-
import
|
|
15142
|
+
import React57, {
|
|
15118
15143
|
useState as useState46,
|
|
15119
15144
|
useCallback as useCallback26,
|
|
15120
15145
|
useRef as useRef30,
|
|
@@ -15122,25 +15147,25 @@ import React56, {
|
|
|
15122
15147
|
} from "react";
|
|
15123
15148
|
|
|
15124
15149
|
// src/personalization/PersonalizationContext.ts
|
|
15125
|
-
import { createContext as
|
|
15126
|
-
var PersonalizationContext =
|
|
15150
|
+
import { createContext as createContext11, useContext as useContext9 } from "react";
|
|
15151
|
+
var PersonalizationContext = createContext11(null);
|
|
15127
15152
|
function usePersonalizationContext() {
|
|
15128
|
-
return
|
|
15153
|
+
return useContext9(PersonalizationContext);
|
|
15129
15154
|
}
|
|
15130
15155
|
|
|
15131
15156
|
// src/personalization/PersonalizationProvider.tsx
|
|
15132
|
-
import { Fragment as Fragment21, jsx as
|
|
15157
|
+
import { Fragment as Fragment21, jsx as jsx90, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
15133
15158
|
function createBridgeFromCanvas(canvasModule) {
|
|
15134
15159
|
const { useEditor, useCommands, useImageBinding } = canvasModule;
|
|
15135
15160
|
function TextBinder({ name, value }) {
|
|
15136
15161
|
const { elements } = useEditor();
|
|
15137
15162
|
const { executeElementUpdate } = useCommands();
|
|
15138
|
-
const elementsRef =
|
|
15163
|
+
const elementsRef = React57.useRef(elements);
|
|
15139
15164
|
elementsRef.current = elements;
|
|
15140
|
-
const executeRef =
|
|
15165
|
+
const executeRef = React57.useRef(executeElementUpdate);
|
|
15141
15166
|
executeRef.current = executeElementUpdate;
|
|
15142
|
-
const hasUserInput =
|
|
15143
|
-
|
|
15167
|
+
const hasUserInput = React57.useRef(false);
|
|
15168
|
+
React57.useEffect(() => {
|
|
15144
15169
|
if (value == null) return;
|
|
15145
15170
|
if (value === "" && !hasUserInput.current) return;
|
|
15146
15171
|
hasUserInput.current = true;
|
|
@@ -15158,12 +15183,12 @@ function createBridgeFromCanvas(canvasModule) {
|
|
|
15158
15183
|
function ColorBinder({ originalColor, newColor }) {
|
|
15159
15184
|
const { elements } = useEditor();
|
|
15160
15185
|
const { executeElementUpdate } = useCommands();
|
|
15161
|
-
const elementsRef =
|
|
15186
|
+
const elementsRef = React57.useRef(elements);
|
|
15162
15187
|
elementsRef.current = elements;
|
|
15163
|
-
const executeRef =
|
|
15188
|
+
const executeRef = React57.useRef(executeElementUpdate);
|
|
15164
15189
|
executeRef.current = executeElementUpdate;
|
|
15165
|
-
const appliedColorRef =
|
|
15166
|
-
|
|
15190
|
+
const appliedColorRef = React57.useRef(normalizeHex(originalColor));
|
|
15191
|
+
React57.useEffect(() => {
|
|
15167
15192
|
const normalizedNew = normalizeHex(newColor);
|
|
15168
15193
|
if (normalizedNew === appliedColorRef.current) return;
|
|
15169
15194
|
const matchColor = appliedColorRef.current;
|
|
@@ -15203,11 +15228,11 @@ function createBridgeFromCanvas(canvasModule) {
|
|
|
15203
15228
|
}
|
|
15204
15229
|
function ImageBinder({ name, value, fit = "cover" }) {
|
|
15205
15230
|
const { setImageUrl } = useImageBinding(name, { fit });
|
|
15206
|
-
const hasUserInput =
|
|
15231
|
+
const hasUserInput = React57.useRef(false);
|
|
15207
15232
|
const debouncedValue = useDebouncedValue(value, 500);
|
|
15208
|
-
const setImageUrlRef =
|
|
15233
|
+
const setImageUrlRef = React57.useRef(setImageUrl);
|
|
15209
15234
|
setImageUrlRef.current = setImageUrl;
|
|
15210
|
-
|
|
15235
|
+
React57.useEffect(() => {
|
|
15211
15236
|
if (debouncedValue == null) return;
|
|
15212
15237
|
if (debouncedValue === "" && !hasUserInput.current) return;
|
|
15213
15238
|
hasUserInput.current = true;
|
|
@@ -15217,15 +15242,15 @@ function createBridgeFromCanvas(canvasModule) {
|
|
|
15217
15242
|
return null;
|
|
15218
15243
|
}
|
|
15219
15244
|
return function PersonalizationBridge({ fields = [], values = {} } = {}) {
|
|
15220
|
-
return /* @__PURE__ */
|
|
15245
|
+
return /* @__PURE__ */ jsx90(Fragment21, { children: fields.map((field) => {
|
|
15221
15246
|
if (field.type === "text") {
|
|
15222
|
-
return /* @__PURE__ */
|
|
15247
|
+
return /* @__PURE__ */ jsx90(TextBinder, { name: field.name, value: values[field.name] ?? "" }, `text-${field.name}`);
|
|
15223
15248
|
}
|
|
15224
15249
|
if (field.type === "color") {
|
|
15225
|
-
return /* @__PURE__ */
|
|
15250
|
+
return /* @__PURE__ */ jsx90(ColorBinder, { originalColor: field.color, newColor: values[field.color] ?? field.color }, `color-${field.color}`);
|
|
15226
15251
|
}
|
|
15227
15252
|
if (field.type === "image") {
|
|
15228
|
-
return /* @__PURE__ */
|
|
15253
|
+
return /* @__PURE__ */ jsx90(ImageBinder, { name: field.name, value: values[field.name] ?? "", fit: field.fit ?? "cover" }, `image-${field.name}`);
|
|
15229
15254
|
}
|
|
15230
15255
|
return null;
|
|
15231
15256
|
}) });
|
|
@@ -15336,7 +15361,7 @@ function PersonalizationProvider({
|
|
|
15336
15361
|
setIsExporting(true);
|
|
15337
15362
|
}, []);
|
|
15338
15363
|
const shouldMountCanvas = CanvasComponent && BridgeComponent && canvasState?.elements && canvasState.elements.length > 0 && (!lazy || isActive);
|
|
15339
|
-
const contextValue =
|
|
15364
|
+
const contextValue = React57.useMemo(
|
|
15340
15365
|
() => ({
|
|
15341
15366
|
fields,
|
|
15342
15367
|
personValues,
|
|
@@ -15350,7 +15375,7 @@ function PersonalizationProvider({
|
|
|
15350
15375
|
[fields, personValues, updateField, isActive, isExporting, exportedBlobUrls, exportCount, reset]
|
|
15351
15376
|
);
|
|
15352
15377
|
return /* @__PURE__ */ jsxs62(PersonalizationContext.Provider, { value: contextValue, children: [
|
|
15353
|
-
shouldMountCanvas && CanvasComponent && BridgeComponent && /* @__PURE__ */
|
|
15378
|
+
shouldMountCanvas && CanvasComponent && BridgeComponent && /* @__PURE__ */ jsx90(
|
|
15354
15379
|
"div",
|
|
15355
15380
|
{
|
|
15356
15381
|
style: {
|
|
@@ -15363,7 +15388,7 @@ function PersonalizationProvider({
|
|
|
15363
15388
|
pointerEvents: "none"
|
|
15364
15389
|
},
|
|
15365
15390
|
"aria-hidden": true,
|
|
15366
|
-
children: /* @__PURE__ */
|
|
15391
|
+
children: /* @__PURE__ */ jsx90(
|
|
15367
15392
|
CanvasComponent,
|
|
15368
15393
|
{
|
|
15369
15394
|
initialElements: canvasState?.elements,
|
|
@@ -15383,7 +15408,7 @@ function PersonalizationProvider({
|
|
|
15383
15408
|
exportImageQuality: exportConfig?.imageQuality ?? 0.85,
|
|
15384
15409
|
onExport: handleExport,
|
|
15385
15410
|
onExportScheduled: handleExportScheduled,
|
|
15386
|
-
overlay: /* @__PURE__ */
|
|
15411
|
+
overlay: /* @__PURE__ */ jsx90(BridgeComponent, { fields, values: personValues })
|
|
15387
15412
|
}
|
|
15388
15413
|
)
|
|
15389
15414
|
},
|
|
@@ -15408,7 +15433,7 @@ function usePersonalizationOptional() {
|
|
|
15408
15433
|
}
|
|
15409
15434
|
|
|
15410
15435
|
// src/personalization/PersonalizationInputs.tsx
|
|
15411
|
-
import { jsx as
|
|
15436
|
+
import { jsx as jsx91, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
15412
15437
|
function PersonalizationInputs({
|
|
15413
15438
|
className,
|
|
15414
15439
|
inputClassName = "w-full px-4 py-3 rounded-lg border text-base text-foreground placeholder:text-muted-foreground bg-white/50 outline-none focus:ring-2 focus:ring-foreground/20",
|
|
@@ -15433,7 +15458,7 @@ function PersonalizationInputs({
|
|
|
15433
15458
|
}
|
|
15434
15459
|
};
|
|
15435
15460
|
return /* @__PURE__ */ jsxs63("div", { className: className || "flex flex-col gap-3", children: [
|
|
15436
|
-
textFields.map((field) => /* @__PURE__ */
|
|
15461
|
+
textFields.map((field) => /* @__PURE__ */ jsx91(
|
|
15437
15462
|
"input",
|
|
15438
15463
|
{
|
|
15439
15464
|
type: "text",
|
|
@@ -15448,7 +15473,7 @@ function PersonalizationInputs({
|
|
|
15448
15473
|
`text-${field.name}`
|
|
15449
15474
|
)),
|
|
15450
15475
|
colorFields.map((field) => /* @__PURE__ */ jsxs63("div", { className: "flex items-center gap-3", children: [
|
|
15451
|
-
/* @__PURE__ */
|
|
15476
|
+
/* @__PURE__ */ jsx91(
|
|
15452
15477
|
"input",
|
|
15453
15478
|
{
|
|
15454
15479
|
type: "color",
|
|
@@ -15457,9 +15482,9 @@ function PersonalizationInputs({
|
|
|
15457
15482
|
onChange: (e) => updateField(field.color, e.target.value)
|
|
15458
15483
|
}
|
|
15459
15484
|
),
|
|
15460
|
-
/* @__PURE__ */
|
|
15485
|
+
/* @__PURE__ */ jsx91("span", { className: "text-base text-muted-foreground", children: field.label })
|
|
15461
15486
|
] }, `color-${field.color}`)),
|
|
15462
|
-
imageFields.map((field) => /* @__PURE__ */
|
|
15487
|
+
imageFields.map((field) => /* @__PURE__ */ jsx91(
|
|
15463
15488
|
"input",
|
|
15464
15489
|
{
|
|
15465
15490
|
type: "text",
|
|
@@ -15672,6 +15697,7 @@ export {
|
|
|
15672
15697
|
PDPLayout,
|
|
15673
15698
|
PersonalizationInputs,
|
|
15674
15699
|
PersonalizationProvider,
|
|
15700
|
+
PlacementArt,
|
|
15675
15701
|
PlacementClipShapeSelector,
|
|
15676
15702
|
PlacementTabs,
|
|
15677
15703
|
Popover,
|
|
@@ -15776,6 +15802,7 @@ export {
|
|
|
15776
15802
|
normalizeHex,
|
|
15777
15803
|
observe,
|
|
15778
15804
|
pictureRenderState,
|
|
15805
|
+
placementArtFor,
|
|
15779
15806
|
runConfigChecks,
|
|
15780
15807
|
scrollInputAboveKeyboard,
|
|
15781
15808
|
searchClient,
|
|
@@ -15802,6 +15829,7 @@ export {
|
|
|
15802
15829
|
usePersonalization,
|
|
15803
15830
|
usePersonalizationOptional,
|
|
15804
15831
|
usePersonalizationShimmer,
|
|
15832
|
+
usePlacementArtOptional,
|
|
15805
15833
|
usePlacementClipShape,
|
|
15806
15834
|
usePlacementsProcessor,
|
|
15807
15835
|
useProduct,
|