@medialane/ui 0.360.0 → 0.362.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import * as input_otp from 'input-otp';
2
2
  import * as React from 'react';
3
3
 
4
- declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "value" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
4
+ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
5
5
  value?: string;
6
6
  onChange?: (newValue: string) => unknown;
7
7
  maxLength: number;
@@ -14,7 +14,7 @@ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHT
14
14
  } & {
15
15
  render: (props: input_otp.RenderProps) => React.ReactNode;
16
16
  children?: never;
17
- } & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "value" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
17
+ } & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
18
18
  value?: string;
19
19
  onChange?: (newValue: string) => unknown;
20
20
  maxLength: number;
@@ -1,7 +1,7 @@
1
1
  import * as input_otp from 'input-otp';
2
2
  import * as React from 'react';
3
3
 
4
- declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "value" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
4
+ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
5
5
  value?: string;
6
6
  onChange?: (newValue: string) => unknown;
7
7
  maxLength: number;
@@ -14,7 +14,7 @@ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHT
14
14
  } & {
15
15
  render: (props: input_otp.RenderProps) => React.ReactNode;
16
16
  children?: never;
17
- } & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "value" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
17
+ } & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
18
18
  value?: string;
19
19
  onChange?: (newValue: string) => unknown;
20
20
  maxLength: number;
@@ -3,8 +3,8 @@ import * as React from 'react';
3
3
  import { VariantProps } from 'class-variance-authority';
4
4
 
5
5
  declare const buttonVariants: (props?: ({
6
- variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | "premium" | "tonal" | "gradient-border" | "gradient-fill" | null | undefined;
7
- size?: "default" | "icon" | "sm" | "lg" | null | undefined;
6
+ variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | "premium" | "tonal" | "gradient-border" | "gradient-fill" | null | undefined;
7
+ size?: "icon" | "default" | "sm" | "lg" | null | undefined;
8
8
  } & class_variance_authority_types.ClassProp) | undefined) => string;
9
9
  interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
10
10
  asChild?: boolean;
@@ -3,8 +3,8 @@ import * as React from 'react';
3
3
  import { VariantProps } from 'class-variance-authority';
4
4
 
5
5
  declare const buttonVariants: (props?: ({
6
- variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | "premium" | "tonal" | "gradient-border" | "gradient-fill" | null | undefined;
7
- size?: "default" | "icon" | "sm" | "lg" | null | undefined;
6
+ variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | "premium" | "tonal" | "gradient-border" | "gradient-fill" | null | undefined;
7
+ size?: "icon" | "default" | "sm" | "lg" | null | undefined;
8
8
  } & class_variance_authority_types.ClassProp) | undefined) => string;
9
9
  interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
10
10
  asChild?: boolean;
@@ -75,8 +75,6 @@ function CollectionShowcase({ collections, isLoading, getHref }) {
75
75
  if (isLoading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShowcaseSkeleton, {});
76
76
  if (count === 0) return null;
77
77
  const active = collections[current % count];
78
- const activeImage = resolveImage(active.image, { width: 960 });
79
- const supply = active.totalSupply;
80
78
  const transition = reduceMotion ? { duration: 0 } : { type: "spring", stiffness: 220, damping: 26 };
81
79
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
82
80
  "section",
@@ -87,18 +85,22 @@ function CollectionShowcase({ collections, isLoading, getHref }) {
87
85
  onFocus: () => setPaused(true),
88
86
  onBlur: () => setPaused(false),
89
87
  children: [
90
- activeImage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
91
- import_framer_motion.motion.div,
92
- {
93
- "aria-hidden": true,
94
- className: "pointer-events-none absolute inset-0 scale-125 opacity-30 blur-3xl dark:opacity-40",
95
- initial: reduceMotion ? false : { opacity: 0 },
96
- animate: { opacity: 1 },
97
- transition: { duration: 0.6 },
98
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_image.default, { src: activeImage, alt: "", fill: true, className: "object-cover", unoptimized: true })
99
- },
100
- active.contractAddress
101
- ),
88
+ collections.map((collection, index) => {
89
+ const haloImage = resolveImage(collection.image, { width: 960 });
90
+ if (!haloImage) return null;
91
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
92
+ import_framer_motion.motion.div,
93
+ {
94
+ "aria-hidden": true,
95
+ className: "pointer-events-none absolute inset-0 scale-125 blur-3xl",
96
+ initial: false,
97
+ animate: { opacity: index === current ? 1 : 0 },
98
+ transition: { duration: reduceMotion ? 0 : 0.8 },
99
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_image.default, { src: haloImage, alt: "", fill: true, className: "object-cover", unoptimized: true })
100
+ },
101
+ collection.contractAddress
102
+ );
103
+ }),
102
104
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { "aria-hidden": true, className: "pointer-events-none absolute inset-x-0 bottom-0 h-1/2 bg-gradient-to-b from-transparent to-background" }),
103
105
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
104
106
  import_framer_motion.motion.div,
@@ -158,10 +160,18 @@ function CollectionShowcase({ collections, isLoading, getHref }) {
158
160
  onClick: (event) => {
159
161
  if (dragged.current) event.preventDefault();
160
162
  },
161
- className: "relative block h-full w-full overflow-hidden rounded-2xl bg-muted shadow-2xl shadow-black/20 ring-1 ring-border dark:shadow-black/50",
163
+ className: "relative block h-full w-full overflow-hidden rounded-2xl bg-muted shadow-2xl shadow-black/20 dark:shadow-black/50",
162
164
  children: [
163
165
  image ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_image.default, { src: image, alt: "", fill: true, sizes: "(min-width: 1024px) 340px, 58vw", className: "object-cover", priority: index === 0, unoptimized: true }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute inset-0 bg-gradient-to-br from-brand-purple/40 via-brand-blue/20 to-brand-navy/60" }),
164
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: (0, import_cn.cn)("absolute inset-0 bg-black/30 transition-opacity duration-500", offset === 0 ? "opacity-0" : "opacity-100") })
166
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: (0, import_cn.cn)("absolute inset-0 bg-black/30 transition-opacity duration-500", offset === 0 ? "opacity-0" : "opacity-100") }),
167
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "absolute inset-x-3 bottom-3 flex flex-col items-start gap-1.5", children: [
168
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "max-w-full truncate rounded-full bg-black/30 px-4 py-1.5 text-base font-semibold leading-tight text-white backdrop-blur-md sm:text-lg", children: name }),
169
+ collection.totalSupply != null && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "rounded-full bg-black/30 px-3 py-1 text-xs font-medium tabular-nums text-white backdrop-blur-md", children: [
170
+ collection.totalSupply.toLocaleString(),
171
+ " ",
172
+ collection.totalSupply === 1 ? "item" : "items"
173
+ ] })
174
+ ] })
165
175
  ]
166
176
  }
167
177
  )
@@ -171,26 +181,8 @@ function CollectionShowcase({ collections, isLoading, getHref }) {
171
181
  })
172
182
  }
173
183
  ),
174
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
175
- import_framer_motion.motion.div,
176
- {
177
- "aria-live": paused ? "polite" : "off",
178
- className: "relative mt-8 flex flex-col items-center gap-1 text-center",
179
- initial: reduceMotion ? false : { opacity: 0, y: 8 },
180
- animate: { opacity: 1, y: 0 },
181
- transition: { duration: 0.4 },
182
- children: [
183
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.default, { href: getHref(active), className: "transition-opacity hover:opacity-80", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "text-3xl font-semibold leading-tight tracking-tight text-foreground sm:text-4xl lg:text-5xl", children: active.name ?? "Collection" }) }),
184
- supply != null && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "text-sm text-muted-foreground", children: [
185
- supply.toLocaleString(),
186
- " ",
187
- supply === 1 ? "item" : "items"
188
- ] })
189
- ]
190
- },
191
- active.contractAddress
192
- ),
193
- count > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "relative mt-3 flex justify-center", children: collections.map((collection, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
184
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { "aria-live": paused ? "polite" : "off", className: "sr-only", children: active.name ?? "Collection" }),
185
+ count > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "relative mt-4 flex justify-center", children: collections.map((collection, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
194
186
  "button",
195
187
  {
196
188
  type: "button",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/collection-showcase.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { motion, useReducedMotion } from \"framer-motion\";\nimport type { ApiCollection } from \"@medialane/sdk\";\nimport Link from \"./link.js\";\nimport Image from \"./image.js\";\nimport { Skeleton } from \"./skeleton.js\";\nimport { cn } from \"../utils/cn.js\";\nimport { useImageUrl } from \"../utils/use-image-url.js\";\n\nexport interface CollectionShowcaseProps {\n collections: ApiCollection[];\n isLoading: boolean;\n getHref: (collection: ApiCollection) => string;\n}\n\nconst AUTOPLAY_MS = 6000;\nconst SWIPE_PX = 50;\nconst CARD_SIZE = \"aspect-[4/5] w-[58vw] max-w-[260px] sm:max-w-[300px] lg:max-w-[min(440px,60vh)] xl:max-w-[min(500px,62vh)]\";\n\nfunction offsetFrom(index: number, current: number, count: number) {\n const distance = (index - current + count) % count;\n return distance > count / 2 ? distance - count : distance;\n}\n\nfunction ShowcaseSkeleton() {\n return (\n <section className=\"px-4 pb-8 pt-20 sm:pt-14\">\n <Skeleton className={cn(\"mx-auto rounded-2xl\", CARD_SIZE)} />\n <Skeleton className=\"mx-auto mt-6 h-9 w-56\" />\n </section>\n );\n}\n\nexport function CollectionShowcase({ collections, isLoading, getHref }: CollectionShowcaseProps) {\n const resolveImage = useImageUrl();\n const reduceMotion = useReducedMotion();\n const [current, setCurrent] = useState(0);\n const [paused, setPaused] = useState(false);\n const [hidden, setHidden] = useState(false);\n const dragged = useRef(false);\n const count = collections.length;\n\n const go = (step: number) => setCurrent((index) => (index + step + count) % count);\n\n useEffect(() => {\n const onVisibility = () => setHidden(document.hidden);\n document.addEventListener(\"visibilitychange\", onVisibility);\n return () => document.removeEventListener(\"visibilitychange\", onVisibility);\n }, []);\n\n useEffect(() => {\n if (count <= 1 || paused || hidden || reduceMotion) return;\n const id = setInterval(() => setCurrent((index) => (index + 1) % count), AUTOPLAY_MS);\n return () => clearInterval(id);\n }, [count, paused, hidden, reduceMotion]);\n\n if (isLoading) return <ShowcaseSkeleton />;\n if (count === 0) return null;\n\n const active = collections[current % count]!;\n const activeImage = resolveImage(active.image, { width: 960 });\n const supply = active.totalSupply;\n const transition = reduceMotion ? { duration: 0 } : { type: \"spring\" as const, stiffness: 220, damping: 26 };\n\n return (\n <section\n className=\"relative overflow-hidden px-4 pb-8 pt-20 sm:pt-14\"\n onPointerEnter={() => setPaused(true)}\n onPointerLeave={() => setPaused(false)}\n onFocus={() => setPaused(true)}\n onBlur={() => setPaused(false)}\n >\n {activeImage && (\n <motion.div\n key={active.contractAddress}\n aria-hidden\n className=\"pointer-events-none absolute inset-0 scale-125 opacity-30 blur-3xl dark:opacity-40\"\n initial={reduceMotion ? false : { opacity: 0 }}\n animate={{ opacity: 1 }}\n transition={{ duration: 0.6 }}\n >\n <Image src={activeImage} alt=\"\" fill className=\"object-cover\" unoptimized />\n </motion.div>\n )}\n <div aria-hidden className=\"pointer-events-none absolute inset-x-0 bottom-0 h-1/2 bg-gradient-to-b from-transparent to-background\" />\n\n <motion.div\n role=\"group\"\n aria-roledescription=\"carousel\"\n aria-label=\"Featured collections\"\n tabIndex={count > 1 ? 0 : -1}\n onKeyDown={(event) => {\n if (count <= 1) return;\n if (event.key === \"ArrowLeft\") { event.preventDefault(); go(-1); }\n else if (event.key === \"ArrowRight\") { event.preventDefault(); go(1); }\n }}\n className={cn(\"relative mx-auto touch-pan-y rounded-2xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-4 focus-visible:ring-offset-background\", CARD_SIZE)}\n drag={count > 1 ? \"x\" : false}\n dragConstraints={{ left: 0, right: 0 }}\n dragElastic={0.2}\n onDragStart={() => { dragged.current = true; }}\n onDragEnd={(_, info) => {\n if (info.offset.x < -SWIPE_PX) go(1);\n else if (info.offset.x > SWIPE_PX) go(-1);\n setTimeout(() => { dragged.current = false; }, 0);\n }}\n >\n {collections.map((collection, index) => {\n const offset = offsetFrom(index, current, count);\n const distance = Math.abs(offset);\n const image = resolveImage(collection.image, { width: 640 });\n const name = collection.name ?? \"Collection\";\n return (\n <motion.div\n key={collection.contractAddress}\n className={cn(\"absolute inset-0\", distance > 2 && \"pointer-events-none\")}\n initial={false}\n animate={{\n x: `${offset * 58}%`,\n rotate: offset * 9,\n scale: 1 - distance * 0.12,\n opacity: distance > 2 ? 0 : 1,\n zIndex: 10 - distance,\n }}\n transition={transition}\n >\n <Link\n href={getHref(collection)}\n aria-label={name}\n draggable={false}\n onClick={(event) => { if (dragged.current) event.preventDefault(); }}\n className=\"relative block h-full w-full overflow-hidden rounded-2xl bg-muted shadow-2xl shadow-black/20 ring-1 ring-border dark:shadow-black/50\"\n >\n {image ? (\n <Image src={image} alt=\"\" fill sizes=\"(min-width: 1024px) 340px, 58vw\" className=\"object-cover\" priority={index === 0} unoptimized />\n ) : (\n <div className=\"absolute inset-0 bg-gradient-to-br from-brand-purple/40 via-brand-blue/20 to-brand-navy/60\" />\n )}\n <span className={cn(\"absolute inset-0 bg-black/30 transition-opacity duration-500\", offset === 0 ? \"opacity-0\" : \"opacity-100\")} />\n </Link>\n </motion.div>\n );\n })}\n </motion.div>\n\n <motion.div\n key={active.contractAddress}\n aria-live={paused ? \"polite\" : \"off\"}\n className=\"relative mt-8 flex flex-col items-center gap-1 text-center\"\n initial={reduceMotion ? false : { opacity: 0, y: 8 }}\n animate={{ opacity: 1, y: 0 }}\n transition={{ duration: 0.4 }}\n >\n <Link href={getHref(active)} className=\"transition-opacity hover:opacity-80\">\n <h2 className=\"text-3xl font-semibold leading-tight tracking-tight text-foreground sm:text-4xl lg:text-5xl\">\n {active.name ?? \"Collection\"}\n </h2>\n </Link>\n {supply != null && (\n <p className=\"text-sm text-muted-foreground\">\n {supply.toLocaleString()} {supply === 1 ? \"item\" : \"items\"}\n </p>\n )}\n </motion.div>\n\n {count > 1 && (\n <div className=\"relative mt-3 flex justify-center\">\n {collections.map((collection, index) => (\n <button\n key={collection.contractAddress}\n type=\"button\"\n aria-label={`Show ${collection.name ?? \"collection\"}`}\n aria-current={index === current ? \"true\" : undefined}\n onClick={() => setCurrent(index)}\n className=\"flex h-8 items-center px-0.5\"\n >\n <span className={cn(\"h-1.5 rounded-full transition-all\", index === current ? \"w-6 bg-foreground\" : \"w-1.5 bg-foreground/30\")} />\n </button>\n ))}\n </div>\n )}\n </section>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4BI;AA1BJ,mBAA4C;AAC5C,2BAAyC;AAEzC,kBAAiB;AACjB,mBAAkB;AAClB,sBAAyB;AACzB,gBAAmB;AACnB,2BAA4B;AAQ5B,MAAM,cAAc;AACpB,MAAM,WAAW;AACjB,MAAM,YAAY;AAElB,SAAS,WAAW,OAAe,SAAiB,OAAe;AACjE,QAAM,YAAY,QAAQ,UAAU,SAAS;AAC7C,SAAO,WAAW,QAAQ,IAAI,WAAW,QAAQ;AACnD;AAEA,SAAS,mBAAmB;AAC1B,SACE,6CAAC,aAAQ,WAAU,4BACjB;AAAA,gDAAC,4BAAS,eAAW,cAAG,uBAAuB,SAAS,GAAG;AAAA,IAC3D,4CAAC,4BA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AA,YAC/B,WAAU;AAAA,YACV,SAAS,eAAe,QAAQ,EAAE,SAAS,GAAG,GAAG,EAAE;AAAA,YACnD,SAAS,EAAE,SAAS,GAAG,GAAG,EAAE;AAAA,YAC5B,YAAY,EAAE,UAAU,IAAI;AAAA,YAE5B;AAAA,0DAAC,YAAAC,SAAA,EAAK,MAAM,QAAQ,MAAM,GAAG,WAAU,uCACrC,sDAAC,QAAG,WAAU,+FACX,iBAAO,QAAQ,cAClB,GACF;AAAA,cACC,UAAU,QACT,6CAAC,OAAE,WAAU,iCACV;AAAA,uBAAO,eAAe;AAAA,gBAAE;AAAA,gBAAE,WAAW,IAAI,SAAS;AAAA,iBACrD;AAAA;AAAA;AAAA,UAfG,OAAO;AAAA,QAiBd;AAAA,QAEC,QAAQ,KACP,4CAAC,SAAI,WAAU,qCACZ,sBAAY,IAAI,CAAC,YAAY,UAC5B;AAAA,UAAC;AAAA;AAAA,YAEC,MAAK;AAAA,YACL,cAAY,QAAQ,WAAW,QAAQ,YAAY;AAAA,YACnD,gBAAc,UAAU,UAAU,SAAS;AAAA,YAC3C,SAAS,MAAM,WAAW,KAAK;AAAA,YAC/B,WAAU;AAAA,YAEV,sDAAC,UAAK,eAAW,cAAG,qCAAqC,UAAU,UAAU,sBAAsB,wBAAwB,GAAG;AAAA;AAAA,UAPzH,WAAW;AAAA,QAQlB,CACD,GACH;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":["Image","Link"]}
1
+ {"version":3,"sources":["../../src/components/collection-showcase.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { motion, useReducedMotion } from \"framer-motion\";\nimport type { ApiCollection } from \"@medialane/sdk\";\nimport Link from \"./link.js\";\nimport Image from \"./image.js\";\nimport { Skeleton } from \"./skeleton.js\";\nimport { cn } from \"../utils/cn.js\";\nimport { useImageUrl } from \"../utils/use-image-url.js\";\n\nexport interface CollectionShowcaseProps {\n collections: ApiCollection[];\n isLoading: boolean;\n getHref: (collection: ApiCollection) => string;\n}\n\nconst AUTOPLAY_MS = 6000;\nconst SWIPE_PX = 50;\nconst CARD_SIZE = \"aspect-[4/5] w-[58vw] max-w-[260px] sm:max-w-[300px] lg:max-w-[min(440px,60vh)] xl:max-w-[min(500px,62vh)]\";\n\nfunction offsetFrom(index: number, current: number, count: number) {\n const distance = (index - current + count) % count;\n return distance > count / 2 ? distance - count : distance;\n}\n\nfunction ShowcaseSkeleton() {\n return (\n <section className=\"px-4 pb-8 pt-20 sm:pt-14\">\n <Skeleton className={cn(\"mx-auto rounded-2xl\", CARD_SIZE)} />\n <Skeleton className=\"mx-auto mt-6 h-9 w-56\" />\n </section>\n );\n}\n\nexport function CollectionShowcase({ collections, isLoading, getHref }: CollectionShowcaseProps) {\n const resolveImage = useImageUrl();\n const reduceMotion = useReducedMotion();\n const [current, setCurrent] = useState(0);\n const [paused, setPaused] = useState(false);\n const [hidden, setHidden] = useState(false);\n const dragged = useRef(false);\n const count = collections.length;\n\n const go = (step: number) => setCurrent((index) => (index + step + count) % count);\n\n useEffect(() => {\n const onVisibility = () => setHidden(document.hidden);\n document.addEventListener(\"visibilitychange\", onVisibility);\n return () => document.removeEventListener(\"visibilitychange\", onVisibility);\n }, []);\n\n useEffect(() => {\n if (count <= 1 || paused || hidden || reduceMotion) return;\n const id = setInterval(() => setCurrent((index) => (index + 1) % count), AUTOPLAY_MS);\n return () => clearInterval(id);\n }, [count, paused, hidden, reduceMotion]);\n\n if (isLoading) return <ShowcaseSkeleton />;\n if (count === 0) return null;\n\n const active = collections[current % count]!;\n const transition = reduceMotion ? { duration: 0 } : { type: \"spring\" as const, stiffness: 220, damping: 26 };\n\n return (\n <section\n className=\"relative overflow-hidden px-4 pb-8 pt-20 sm:pt-14\"\n onPointerEnter={() => setPaused(true)}\n onPointerLeave={() => setPaused(false)}\n onFocus={() => setPaused(true)}\n onBlur={() => setPaused(false)}\n >\n {collections.map((collection, index) => {\n const haloImage = resolveImage(collection.image, { width: 960 });\n if (!haloImage) return null;\n return (\n <motion.div\n key={collection.contractAddress}\n aria-hidden\n className=\"pointer-events-none absolute inset-0 scale-125 blur-3xl\"\n initial={false}\n animate={{ opacity: index === current ? 1 : 0 }}\n transition={{ duration: reduceMotion ? 0 : 0.8 }}\n >\n <Image src={haloImage} alt=\"\" fill className=\"object-cover\" unoptimized />\n </motion.div>\n );\n })}\n <div aria-hidden className=\"pointer-events-none absolute inset-x-0 bottom-0 h-1/2 bg-gradient-to-b from-transparent to-background\" />\n\n <motion.div\n role=\"group\"\n aria-roledescription=\"carousel\"\n aria-label=\"Featured collections\"\n tabIndex={count > 1 ? 0 : -1}\n onKeyDown={(event) => {\n if (count <= 1) return;\n if (event.key === \"ArrowLeft\") { event.preventDefault(); go(-1); }\n else if (event.key === \"ArrowRight\") { event.preventDefault(); go(1); }\n }}\n className={cn(\"relative mx-auto touch-pan-y rounded-2xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-4 focus-visible:ring-offset-background\", CARD_SIZE)}\n drag={count > 1 ? \"x\" : false}\n dragConstraints={{ left: 0, right: 0 }}\n dragElastic={0.2}\n onDragStart={() => { dragged.current = true; }}\n onDragEnd={(_, info) => {\n if (info.offset.x < -SWIPE_PX) go(1);\n else if (info.offset.x > SWIPE_PX) go(-1);\n setTimeout(() => { dragged.current = false; }, 0);\n }}\n >\n {collections.map((collection, index) => {\n const offset = offsetFrom(index, current, count);\n const distance = Math.abs(offset);\n const image = resolveImage(collection.image, { width: 640 });\n const name = collection.name ?? \"Collection\";\n return (\n <motion.div\n key={collection.contractAddress}\n className={cn(\"absolute inset-0\", distance > 2 && \"pointer-events-none\")}\n initial={false}\n animate={{\n x: `${offset * 58}%`,\n rotate: offset * 9,\n scale: 1 - distance * 0.12,\n opacity: distance > 2 ? 0 : 1,\n zIndex: 10 - distance,\n }}\n transition={transition}\n >\n <Link\n href={getHref(collection)}\n aria-label={name}\n draggable={false}\n onClick={(event) => { if (dragged.current) event.preventDefault(); }}\n className=\"relative block h-full w-full overflow-hidden rounded-2xl bg-muted shadow-2xl shadow-black/20 dark:shadow-black/50\"\n >\n {image ? (\n <Image src={image} alt=\"\" fill sizes=\"(min-width: 1024px) 340px, 58vw\" className=\"object-cover\" priority={index === 0} unoptimized />\n ) : (\n <div className=\"absolute inset-0 bg-gradient-to-br from-brand-purple/40 via-brand-blue/20 to-brand-navy/60\" />\n )}\n <span className={cn(\"absolute inset-0 bg-black/30 transition-opacity duration-500\", offset === 0 ? \"opacity-0\" : \"opacity-100\")} />\n <span className=\"absolute inset-x-3 bottom-3 flex flex-col items-start gap-1.5\">\n <span className=\"max-w-full truncate rounded-full bg-black/30 px-4 py-1.5 text-base font-semibold leading-tight text-white backdrop-blur-md sm:text-lg\">\n {name}\n </span>\n {collection.totalSupply != null && (\n <span className=\"rounded-full bg-black/30 px-3 py-1 text-xs font-medium tabular-nums text-white backdrop-blur-md\">\n {collection.totalSupply.toLocaleString()} {collection.totalSupply === 1 ? \"item\" : \"items\"}\n </span>\n )}\n </span>\n </Link>\n </motion.div>\n );\n })}\n </motion.div>\n\n <h2 aria-live={paused ? \"polite\" : \"off\"} className=\"sr-only\">\n {active.name ?? \"Collection\"}\n </h2>\n\n {count > 1 && (\n <div className=\"relative mt-4 flex justify-center\">\n {collections.map((collection, index) => (\n <button\n key={collection.contractAddress}\n type=\"button\"\n aria-label={`Show ${collection.name ?? \"collection\"}`}\n aria-current={index === current ? \"true\" : undefined}\n onClick={() => setCurrent(index)}\n className=\"flex h-8 items-center px-0.5\"\n >\n <span className={cn(\"h-1.5 rounded-full transition-all\", index === current ? \"w-6 bg-foreground\" : \"w-1.5 bg-foreground/30\")} />\n </button>\n ))}\n </div>\n )}\n </section>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4BI;AA1BJ,mBAA4C;AAC5C,2BAAyC;AAEzC,kBAAiB;AACjB,mBAAkB;AAClB,sBAAyB;AACzB,gB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AAD,SAAA,EAAM,KAAK,OAAO,KAAI,IAAG,MAAI,MAAC,OAAM,mCAAkC,WAAU,gBAAe,UAAU,UAAU,GAAG,aAAW,MAAC,IAEnI,4CAAC,SAAI,WAAU,8FAA6F;AAAA,wBAE9G,4CAAC,UAAK,eAAW,cAAG,gEAAgE,WAAW,IAAI,cAAc,aAAa,GAAG;AAAA,wBACjI,6CAAC,UAAK,WAAU,iEACd;AAAA,sEAAC,UAAK,WAAU,yIACb,gBACH;AAAA,0BACC,WAAW,eAAe,QACzB,6CAAC,UAAK,WAAU,mGACb;AAAA,uCAAW,YAAY,eAAe;AAAA,4BAAE;AAAA,4BAAE,WAAW,gBAAgB,IAAI,SAAS;AAAA,6BACrF;AAAA,2BAEJ;AAAA;AAAA;AAAA,kBACF;AAAA;AAAA,gBAnCK,WAAW;AAAA,cAoClB;AAAA,YAEJ,CAAC;AAAA;AAAA,QACH;AAAA,QAEA,4CAAC,QAAG,aAAW,SAAS,WAAW,OAAO,WAAU,WACjD,iBAAO,QAAQ,cAClB;AAAA,QAEC,QAAQ,KACP,4CAAC,SAAI,WAAU,qCACZ,sBAAY,IAAI,CAAC,YAAY,UAC5B;AAAA,UAAC;AAAA;AAAA,YAEC,MAAK;AAAA,YACL,cAAY,QAAQ,WAAW,QAAQ,YAAY;AAAA,YACnD,gBAAc,UAAU,UAAU,SAAS;AAAA,YAC3C,SAAS,MAAM,WAAW,KAAK;AAAA,YAC/B,WAAU;AAAA,YAEV,sDAAC,UAAK,eAAW,cAAG,qCAAqC,UAAU,UAAU,sBAAsB,wBAAwB,GAAG;AAAA;AAAA,UAPzH,WAAW;AAAA,QAQlB,CACD,GACH;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":["Image","Link"]}
@@ -42,8 +42,6 @@ function CollectionShowcase({ collections, isLoading, getHref }) {
42
42
  if (isLoading) return /* @__PURE__ */ jsx(ShowcaseSkeleton, {});
43
43
  if (count === 0) return null;
44
44
  const active = collections[current % count];
45
- const activeImage = resolveImage(active.image, { width: 960 });
46
- const supply = active.totalSupply;
47
45
  const transition = reduceMotion ? { duration: 0 } : { type: "spring", stiffness: 220, damping: 26 };
48
46
  return /* @__PURE__ */ jsxs(
49
47
  "section",
@@ -54,18 +52,22 @@ function CollectionShowcase({ collections, isLoading, getHref }) {
54
52
  onFocus: () => setPaused(true),
55
53
  onBlur: () => setPaused(false),
56
54
  children: [
57
- activeImage && /* @__PURE__ */ jsx(
58
- motion.div,
59
- {
60
- "aria-hidden": true,
61
- className: "pointer-events-none absolute inset-0 scale-125 opacity-30 blur-3xl dark:opacity-40",
62
- initial: reduceMotion ? false : { opacity: 0 },
63
- animate: { opacity: 1 },
64
- transition: { duration: 0.6 },
65
- children: /* @__PURE__ */ jsx(Image, { src: activeImage, alt: "", fill: true, className: "object-cover", unoptimized: true })
66
- },
67
- active.contractAddress
68
- ),
55
+ collections.map((collection, index) => {
56
+ const haloImage = resolveImage(collection.image, { width: 960 });
57
+ if (!haloImage) return null;
58
+ return /* @__PURE__ */ jsx(
59
+ motion.div,
60
+ {
61
+ "aria-hidden": true,
62
+ className: "pointer-events-none absolute inset-0 scale-125 blur-3xl",
63
+ initial: false,
64
+ animate: { opacity: index === current ? 1 : 0 },
65
+ transition: { duration: reduceMotion ? 0 : 0.8 },
66
+ children: /* @__PURE__ */ jsx(Image, { src: haloImage, alt: "", fill: true, className: "object-cover", unoptimized: true })
67
+ },
68
+ collection.contractAddress
69
+ );
70
+ }),
69
71
  /* @__PURE__ */ jsx("div", { "aria-hidden": true, className: "pointer-events-none absolute inset-x-0 bottom-0 h-1/2 bg-gradient-to-b from-transparent to-background" }),
70
72
  /* @__PURE__ */ jsx(
71
73
  motion.div,
@@ -125,10 +127,18 @@ function CollectionShowcase({ collections, isLoading, getHref }) {
125
127
  onClick: (event) => {
126
128
  if (dragged.current) event.preventDefault();
127
129
  },
128
- className: "relative block h-full w-full overflow-hidden rounded-2xl bg-muted shadow-2xl shadow-black/20 ring-1 ring-border dark:shadow-black/50",
130
+ className: "relative block h-full w-full overflow-hidden rounded-2xl bg-muted shadow-2xl shadow-black/20 dark:shadow-black/50",
129
131
  children: [
130
132
  image ? /* @__PURE__ */ jsx(Image, { src: image, alt: "", fill: true, sizes: "(min-width: 1024px) 340px, 58vw", className: "object-cover", priority: index === 0, unoptimized: true }) : /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-gradient-to-br from-brand-purple/40 via-brand-blue/20 to-brand-navy/60" }),
131
- /* @__PURE__ */ jsx("span", { className: cn("absolute inset-0 bg-black/30 transition-opacity duration-500", offset === 0 ? "opacity-0" : "opacity-100") })
133
+ /* @__PURE__ */ jsx("span", { className: cn("absolute inset-0 bg-black/30 transition-opacity duration-500", offset === 0 ? "opacity-0" : "opacity-100") }),
134
+ /* @__PURE__ */ jsxs("span", { className: "absolute inset-x-3 bottom-3 flex flex-col items-start gap-1.5", children: [
135
+ /* @__PURE__ */ jsx("span", { className: "max-w-full truncate rounded-full bg-black/30 px-4 py-1.5 text-base font-semibold leading-tight text-white backdrop-blur-md sm:text-lg", children: name }),
136
+ collection.totalSupply != null && /* @__PURE__ */ jsxs("span", { className: "rounded-full bg-black/30 px-3 py-1 text-xs font-medium tabular-nums text-white backdrop-blur-md", children: [
137
+ collection.totalSupply.toLocaleString(),
138
+ " ",
139
+ collection.totalSupply === 1 ? "item" : "items"
140
+ ] })
141
+ ] })
132
142
  ]
133
143
  }
134
144
  )
@@ -138,26 +148,8 @@ function CollectionShowcase({ collections, isLoading, getHref }) {
138
148
  })
139
149
  }
140
150
  ),
141
- /* @__PURE__ */ jsxs(
142
- motion.div,
143
- {
144
- "aria-live": paused ? "polite" : "off",
145
- className: "relative mt-8 flex flex-col items-center gap-1 text-center",
146
- initial: reduceMotion ? false : { opacity: 0, y: 8 },
147
- animate: { opacity: 1, y: 0 },
148
- transition: { duration: 0.4 },
149
- children: [
150
- /* @__PURE__ */ jsx(Link, { href: getHref(active), className: "transition-opacity hover:opacity-80", children: /* @__PURE__ */ jsx("h2", { className: "text-3xl font-semibold leading-tight tracking-tight text-foreground sm:text-4xl lg:text-5xl", children: active.name ?? "Collection" }) }),
151
- supply != null && /* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground", children: [
152
- supply.toLocaleString(),
153
- " ",
154
- supply === 1 ? "item" : "items"
155
- ] })
156
- ]
157
- },
158
- active.contractAddress
159
- ),
160
- count > 1 && /* @__PURE__ */ jsx("div", { className: "relative mt-3 flex justify-center", children: collections.map((collection, index) => /* @__PURE__ */ jsx(
151
+ /* @__PURE__ */ jsx("h2", { "aria-live": paused ? "polite" : "off", className: "sr-only", children: active.name ?? "Collection" }),
152
+ count > 1 && /* @__PURE__ */ jsx("div", { className: "relative mt-4 flex justify-center", children: collections.map((collection, index) => /* @__PURE__ */ jsx(
161
153
  "button",
162
154
  {
163
155
  type: "button",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/collection-showcase.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { motion, useReducedMotion } from \"framer-motion\";\nimport type { ApiCollection } from \"@medialane/sdk\";\nimport Link from \"./link.js\";\nimport Image from \"./image.js\";\nimport { Skeleton } from \"./skeleton.js\";\nimport { cn } from \"../utils/cn.js\";\nimport { useImageUrl } from \"../utils/use-image-url.js\";\n\nexport interface CollectionShowcaseProps {\n collections: ApiCollection[];\n isLoading: boolean;\n getHref: (collection: ApiCollection) => string;\n}\n\nconst AUTOPLAY_MS = 6000;\nconst SWIPE_PX = 50;\nconst CARD_SIZE = \"aspect-[4/5] w-[58vw] max-w-[260px] sm:max-w-[300px] lg:max-w-[min(440px,60vh)] xl:max-w-[min(500px,62vh)]\";\n\nfunction offsetFrom(index: number, current: number, count: number) {\n const distance = (index - current + count) % count;\n return distance > count / 2 ? distance - count : distance;\n}\n\nfunction ShowcaseSkeleton() {\n return (\n <section className=\"px-4 pb-8 pt-20 sm:pt-14\">\n <Skeleton className={cn(\"mx-auto rounded-2xl\", CARD_SIZE)} />\n <Skeleton className=\"mx-auto mt-6 h-9 w-56\" />\n </section>\n );\n}\n\nexport function CollectionShowcase({ collections, isLoading, getHref }: CollectionShowcaseProps) {\n const resolveImage = useImageUrl();\n const reduceMotion = useReducedMotion();\n const [current, setCurrent] = useState(0);\n const [paused, setPaused] = useState(false);\n const [hidden, setHidden] = useState(false);\n const dragged = useRef(false);\n const count = collections.length;\n\n const go = (step: number) => setCurrent((index) => (index + step + count) % count);\n\n useEffect(() => {\n const onVisibility = () => setHidden(document.hidden);\n document.addEventListener(\"visibilitychange\", onVisibility);\n return () => document.removeEventListener(\"visibilitychange\", onVisibility);\n }, []);\n\n useEffect(() => {\n if (count <= 1 || paused || hidden || reduceMotion) return;\n const id = setInterval(() => setCurrent((index) => (index + 1) % count), AUTOPLAY_MS);\n return () => clearInterval(id);\n }, [count, paused, hidden, reduceMotion]);\n\n if (isLoading) return <ShowcaseSkeleton />;\n if (count === 0) return null;\n\n const active = collections[current % count]!;\n const activeImage = resolveImage(active.image, { width: 960 });\n const supply = active.totalSupply;\n const transition = reduceMotion ? { duration: 0 } : { type: \"spring\" as const, stiffness: 220, damping: 26 };\n\n return (\n <section\n className=\"relative overflow-hidden px-4 pb-8 pt-20 sm:pt-14\"\n onPointerEnter={() => setPaused(true)}\n onPointerLeave={() => setPaused(false)}\n onFocus={() => setPaused(true)}\n onBlur={() => setPaused(false)}\n >\n {activeImage && (\n <motion.div\n key={active.contractAddress}\n aria-hidden\n className=\"pointer-events-none absolute inset-0 scale-125 opacity-30 blur-3xl dark:opacity-40\"\n initial={reduceMotion ? false : { opacity: 0 }}\n animate={{ opacity: 1 }}\n transition={{ duration: 0.6 }}\n >\n <Image src={activeImage} alt=\"\" fill className=\"object-cover\" unoptimized />\n </motion.div>\n )}\n <div aria-hidden className=\"pointer-events-none absolute inset-x-0 bottom-0 h-1/2 bg-gradient-to-b from-transparent to-background\" />\n\n <motion.div\n role=\"group\"\n aria-roledescription=\"carousel\"\n aria-label=\"Featured collections\"\n tabIndex={count > 1 ? 0 : -1}\n onKeyDown={(event) => {\n if (count <= 1) return;\n if (event.key === \"ArrowLeft\") { event.preventDefault(); go(-1); }\n else if (event.key === \"ArrowRight\") { event.preventDefault(); go(1); }\n }}\n className={cn(\"relative mx-auto touch-pan-y rounded-2xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-4 focus-visible:ring-offset-background\", CARD_SIZE)}\n drag={count > 1 ? \"x\" : false}\n dragConstraints={{ left: 0, right: 0 }}\n dragElastic={0.2}\n onDragStart={() => { dragged.current = true; }}\n onDragEnd={(_, info) => {\n if (info.offset.x < -SWIPE_PX) go(1);\n else if (info.offset.x > SWIPE_PX) go(-1);\n setTimeout(() => { dragged.current = false; }, 0);\n }}\n >\n {collections.map((collection, index) => {\n const offset = offsetFrom(index, current, count);\n const distance = Math.abs(offset);\n const image = resolveImage(collection.image, { width: 640 });\n const name = collection.name ?? \"Collection\";\n return (\n <motion.div\n key={collection.contractAddress}\n className={cn(\"absolute inset-0\", distance > 2 && \"pointer-events-none\")}\n initial={false}\n animate={{\n x: `${offset * 58}%`,\n rotate: offset * 9,\n scale: 1 - distance * 0.12,\n opacity: distance > 2 ? 0 : 1,\n zIndex: 10 - distance,\n }}\n transition={transition}\n >\n <Link\n href={getHref(collection)}\n aria-label={name}\n draggable={false}\n onClick={(event) => { if (dragged.current) event.preventDefault(); }}\n className=\"relative block h-full w-full overflow-hidden rounded-2xl bg-muted shadow-2xl shadow-black/20 ring-1 ring-border dark:shadow-black/50\"\n >\n {image ? (\n <Image src={image} alt=\"\" fill sizes=\"(min-width: 1024px) 340px, 58vw\" className=\"object-cover\" priority={index === 0} unoptimized />\n ) : (\n <div className=\"absolute inset-0 bg-gradient-to-br from-brand-purple/40 via-brand-blue/20 to-brand-navy/60\" />\n )}\n <span className={cn(\"absolute inset-0 bg-black/30 transition-opacity duration-500\", offset === 0 ? \"opacity-0\" : \"opacity-100\")} />\n </Link>\n </motion.div>\n );\n })}\n </motion.div>\n\n <motion.div\n key={active.contractAddress}\n aria-live={paused ? \"polite\" : \"off\"}\n className=\"relative mt-8 flex flex-col items-center gap-1 text-center\"\n initial={reduceMotion ? false : { opacity: 0, y: 8 }}\n animate={{ opacity: 1, y: 0 }}\n transition={{ duration: 0.4 }}\n >\n <Link href={getHref(active)} className=\"transition-opacity hover:opacity-80\">\n <h2 className=\"text-3xl font-semibold leading-tight tracking-tight text-foreground sm:text-4xl lg:text-5xl\">\n {active.name ?? \"Collection\"}\n </h2>\n </Link>\n {supply != null && (\n <p className=\"text-sm text-muted-foreground\">\n {supply.toLocaleString()} {supply === 1 ? \"item\" : \"items\"}\n </p>\n )}\n </motion.div>\n\n {count > 1 && (\n <div className=\"relative mt-3 flex justify-center\">\n {collections.map((collection, index) => (\n <button\n key={collection.contractAddress}\n type=\"button\"\n aria-label={`Show ${collection.name ?? \"collection\"}`}\n aria-current={index === current ? \"true\" : undefined}\n onClick={() => setCurrent(index)}\n className=\"flex h-8 items-center px-0.5\"\n >\n <span className={cn(\"h-1.5 rounded-full transition-all\", index === current ? \"w-6 bg-foreground\" : \"w-1.5 bg-foreground/30\")} />\n </button>\n ))}\n </div>\n )}\n </section>\n );\n}\n"],"mappings":";AA4BI,SACE,KADF;AA1BJ,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,QAAQ,wBAAwB;AAEzC,OAAO,UAAU;AACjB,OAAO,WAAW;AAClB,SAAS,gBAAgB;AACzB,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAQ5B,MAAM,cAAc;AACpB,MAAM,WAAW;AACjB,MAAM,YAAY;AAElB,SAAS,WAAW,OAAe,SAAiB,OAAe;AACjE,QAAM,YAAY,QAAQ,UAAU,SAAS;AAC7C,SAAO,WAAW,QAAQ,IAAI,WAAW,QAAQ;AACnD;AAEA,SAAS,mBAAmB;AAC1B,SACE,qBAAC,aAAQ,WAAU,4BACjB;AAAA,wBAAC,YAAS,WAAW,GAAG,uBAAuB,SAAS,GAAG;AAAA,IAC3D,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EAAE,SAAS,GAAG,GAAG,EAAE;AAAA,YACnD,SAAS,EAAE,SAAS,GAAG,GAAG,EAAE;AAAA,YAC5B,YAAY,EAAE,UAAU,IAAI;AAAA,YAE5B;AAAA,kCAAC,QAAK,MAAM,QAAQ,MAAM,GAAG,WAAU,uCACrC,8BAAC,QAAG,WAAU,+FACX,iBAAO,QAAQ,cAClB,GACF;AAAA,cACC,UAAU,QACT,qBAAC,OAAE,WAAU,iCACV;AAAA,uBAAO,eAAe;AAAA,gBAAE;AAAA,gBAAE,WAAW,IAAI,SAAS;AAAA,iBACrD;AAAA;AAAA;AAAA,UAfG,OAAO;AAAA,QAiBd;AAAA,QAEC,QAAQ,KACP,oBAAC,SAAI,WAAU,qCACZ,sBAAY,IAAI,CAAC,YAAY,UAC5B;AAAA,UAAC;AAAA;AAAA,YAEC,MAAK;AAAA,YACL,cAAY,QAAQ,WAAW,QAAQ,YAAY;AAAA,YACnD,gBAAc,UAAU,UAAU,SAAS;AAAA,YAC3C,SAAS,MAAM,WAAW,KAAK;AAAA,YAC/B,WAAU;AAAA,YAEV,8BAAC,UAAK,WAAW,GAAG,qCAAqC,UAAU,UAAU,sBAAsB,wBAAwB,GAAG;AAAA;AAAA,UAPzH,WAAW;AAAA,QAQlB,CACD,GACH;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/collection-showcase.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { motion, useReducedMotion } from \"framer-motion\";\nimport type { ApiCollection } from \"@medialane/sdk\";\nimport Link from \"./link.js\";\nimport Image from \"./image.js\";\nimport { Skeleton } from \"./skeleton.js\";\nimport { cn } from \"../utils/cn.js\";\nimport { useImageUrl } from \"../utils/use-image-url.js\";\n\nexport interface CollectionShowcaseProps {\n collections: ApiCollection[];\n isLoading: boolean;\n getHref: (collection: ApiCollection) => string;\n}\n\nconst AUTOPLAY_MS = 6000;\nconst SWIPE_PX = 50;\nconst CARD_SIZE = \"aspect-[4/5] w-[58vw] max-w-[260px] sm:max-w-[300px] lg:max-w-[min(440px,60vh)] xl:max-w-[min(500px,62vh)]\";\n\nfunction offsetFrom(index: number, current: number, count: number) {\n const distance = (index - current + count) % count;\n return distance > count / 2 ? distance - count : distance;\n}\n\nfunction ShowcaseSkeleton() {\n return (\n <section className=\"px-4 pb-8 pt-20 sm:pt-14\">\n <Skeleton className={cn(\"mx-auto rounded-2xl\", CARD_SIZE)} />\n <Skeleton className=\"mx-auto mt-6 h-9 w-56\" />\n </section>\n );\n}\n\nexport function CollectionShowcase({ collections, isLoading, getHref }: CollectionShowcaseProps) {\n const resolveImage = useImageUrl();\n const reduceMotion = useReducedMotion();\n const [current, setCurrent] = useState(0);\n const [paused, setPaused] = useState(false);\n const [hidden, setHidden] = useState(false);\n const dragged = useRef(false);\n const count = collections.length;\n\n const go = (step: number) => setCurrent((index) => (index + step + count) % count);\n\n useEffect(() => {\n const onVisibility = () => setHidden(document.hidden);\n document.addEventListener(\"visibilitychange\", onVisibility);\n return () => document.removeEventListener(\"visibilitychange\", onVisibility);\n }, []);\n\n useEffect(() => {\n if (count <= 1 || paused || hidden || reduceMotion) return;\n const id = setInterval(() => setCurrent((index) => (index + 1) % count), AUTOPLAY_MS);\n return () => clearInterval(id);\n }, [count, paused, hidden, reduceMotion]);\n\n if (isLoading) return <ShowcaseSkeleton />;\n if (count === 0) return null;\n\n const active = collections[current % count]!;\n const transition = reduceMotion ? { duration: 0 } : { type: \"spring\" as const, stiffness: 220, damping: 26 };\n\n return (\n <section\n className=\"relative overflow-hidden px-4 pb-8 pt-20 sm:pt-14\"\n onPointerEnter={() => setPaused(true)}\n onPointerLeave={() => setPaused(false)}\n onFocus={() => setPaused(true)}\n onBlur={() => setPaused(false)}\n >\n {collections.map((collection, index) => {\n const haloImage = resolveImage(collection.image, { width: 960 });\n if (!haloImage) return null;\n return (\n <motion.div\n key={collection.contractAddress}\n aria-hidden\n className=\"pointer-events-none absolute inset-0 scale-125 blur-3xl\"\n initial={false}\n animate={{ opacity: index === current ? 1 : 0 }}\n transition={{ duration: reduceMotion ? 0 : 0.8 }}\n >\n <Image src={haloImage} alt=\"\" fill className=\"object-cover\" unoptimized />\n </motion.div>\n );\n })}\n <div aria-hidden className=\"pointer-events-none absolute inset-x-0 bottom-0 h-1/2 bg-gradient-to-b from-transparent to-background\" />\n\n <motion.div\n role=\"group\"\n aria-roledescription=\"carousel\"\n aria-label=\"Featured collections\"\n tabIndex={count > 1 ? 0 : -1}\n onKeyDown={(event) => {\n if (count <= 1) return;\n if (event.key === \"ArrowLeft\") { event.preventDefault(); go(-1); }\n else if (event.key === \"ArrowRight\") { event.preventDefault(); go(1); }\n }}\n className={cn(\"relative mx-auto touch-pan-y rounded-2xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-4 focus-visible:ring-offset-background\", CARD_SIZE)}\n drag={count > 1 ? \"x\" : false}\n dragConstraints={{ left: 0, right: 0 }}\n dragElastic={0.2}\n onDragStart={() => { dragged.current = true; }}\n onDragEnd={(_, info) => {\n if (info.offset.x < -SWIPE_PX) go(1);\n else if (info.offset.x > SWIPE_PX) go(-1);\n setTimeout(() => { dragged.current = false; }, 0);\n }}\n >\n {collections.map((collection, index) => {\n const offset = offsetFrom(index, current, count);\n const distance = Math.abs(offset);\n const image = resolveImage(collection.image, { width: 640 });\n const name = collection.name ?? \"Collection\";\n return (\n <motion.div\n key={collection.contractAddress}\n className={cn(\"absolute inset-0\", distance > 2 && \"pointer-events-none\")}\n initial={false}\n animate={{\n x: `${offset * 58}%`,\n rotate: offset * 9,\n scale: 1 - distance * 0.12,\n opacity: distance > 2 ? 0 : 1,\n zIndex: 10 - distance,\n }}\n transition={transition}\n >\n <Link\n href={getHref(collection)}\n aria-label={name}\n draggable={false}\n onClick={(event) => { if (dragged.current) event.preventDefault(); }}\n className=\"relative block h-full w-full overflow-hidden rounded-2xl bg-muted shadow-2xl shadow-black/20 dark:shadow-black/50\"\n >\n {image ? (\n <Image src={image} alt=\"\" fill sizes=\"(min-width: 1024px) 340px, 58vw\" className=\"object-cover\" priority={index === 0} unoptimized />\n ) : (\n <div className=\"absolute inset-0 bg-gradient-to-br from-brand-purple/40 via-brand-blue/20 to-brand-navy/60\" />\n )}\n <span className={cn(\"absolute inset-0 bg-black/30 transition-opacity duration-500\", offset === 0 ? \"opacity-0\" : \"opacity-100\")} />\n <span className=\"absolute inset-x-3 bottom-3 flex flex-col items-start gap-1.5\">\n <span className=\"max-w-full truncate rounded-full bg-black/30 px-4 py-1.5 text-base font-semibold leading-tight text-white backdrop-blur-md sm:text-lg\">\n {name}\n </span>\n {collection.totalSupply != null && (\n <span className=\"rounded-full bg-black/30 px-3 py-1 text-xs font-medium tabular-nums text-white backdrop-blur-md\">\n {collection.totalSupply.toLocaleString()} {collection.totalSupply === 1 ? \"item\" : \"items\"}\n </span>\n )}\n </span>\n </Link>\n </motion.div>\n );\n })}\n </motion.div>\n\n <h2 aria-live={paused ? \"polite\" : \"off\"} className=\"sr-only\">\n {active.name ?? \"Collection\"}\n </h2>\n\n {count > 1 && (\n <div className=\"relative mt-4 flex justify-center\">\n {collections.map((collection, index) => (\n <button\n key={collection.contractAddress}\n type=\"button\"\n aria-label={`Show ${collection.name ?? \"collection\"}`}\n aria-current={index === current ? \"true\" : undefined}\n onClick={() => setCurrent(index)}\n className=\"flex h-8 items-center px-0.5\"\n >\n <span className={cn(\"h-1.5 rounded-full transition-all\", index === current ? \"w-6 bg-foreground\" : \"w-1.5 bg-foreground/30\")} />\n </button>\n ))}\n </div>\n )}\n </section>\n );\n}\n"],"mappings":";AA4BI,SACE,KADF;AA1BJ,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,QAAQ,wBAAwB;AAEzC,OAAO,UAAU;AACjB,OAAO,WAAW;AAClB,SAAS,gBAAgB;AACzB,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAQ5B,MAAM,cAAc;AACpB,MAAM,WAAW;AACjB,M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,SAAI,WAAU,8FAA6F;AAAA,wBAE9G,oBAAC,UAAK,WAAW,GAAG,gEAAgE,WAAW,IAAI,cAAc,aAAa,GAAG;AAAA,wBACjI,qBAAC,UAAK,WAAU,iEACd;AAAA,8CAAC,UAAK,WAAU,yIACb,gBACH;AAAA,0BACC,WAAW,eAAe,QACzB,qBAAC,UAAK,WAAU,mGACb;AAAA,uCAAW,YAAY,eAAe;AAAA,4BAAE;AAAA,4BAAE,WAAW,gBAAgB,IAAI,SAAS;AAAA,6BACrF;AAAA,2BAEJ;AAAA;AAAA;AAAA,kBACF;AAAA;AAAA,gBAnCK,WAAW;AAAA,cAoClB;AAAA,YAEJ,CAAC;AAAA;AAAA,QACH;AAAA,QAEA,oBAAC,QAAG,aAAW,SAAS,WAAW,OAAO,WAAU,WACjD,iBAAO,QAAQ,cAClB;AAAA,QAEC,QAAQ,KACP,oBAAC,SAAI,WAAU,qCACZ,sBAAY,IAAI,CAAC,YAAY,UAC5B;AAAA,UAAC;AAAA;AAAA,YAEC,MAAK;AAAA,YACL,cAAY,QAAQ,WAAW,QAAQ,YAAY;AAAA,YACnD,gBAAc,UAAU,UAAU,SAAS;AAAA,YAC3C,SAAS,MAAM,WAAW,KAAK;AAAA,YAC/B,WAAU;AAAA,YAEV,8BAAC,UAAK,WAAW,GAAG,qCAAqC,UAAU,UAAU,sBAAsB,wBAAwB,GAAG;AAAA;AAAA,UAPzH,WAAW;AAAA,QAQlB,CACD,GACH;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
@@ -19,13 +19,13 @@ declare const editionMintSchema: z.ZodObject<{
19
19
  ipType: "Audio" | "Video" | "Art" | "Photography" | "NFT" | "RWA" | "Posts" | "Publications" | "Documents";
20
20
  licenseType: string;
21
21
  commercialUse: "Yes" | "No";
22
+ value: string;
23
+ recipient: string;
22
24
  derivatives: "Allowed" | "Not Allowed" | "Share-Alike";
23
25
  attribution: "Required" | "Not Required";
24
26
  geographicScope: string;
25
27
  aiPolicy: "Allowed" | "Not Allowed" | "Training Only";
26
28
  royalty: number;
27
- value: string;
28
- recipient: string;
29
29
  description?: string | undefined;
30
30
  external_url?: string | undefined;
31
31
  }, {
@@ -33,13 +33,13 @@ declare const editionMintSchema: z.ZodObject<{
33
33
  ipType: "Audio" | "Video" | "Art" | "Photography" | "NFT" | "RWA" | "Posts" | "Publications" | "Documents";
34
34
  licenseType: string;
35
35
  commercialUse: "Yes" | "No";
36
+ value: string;
37
+ recipient: string;
36
38
  derivatives: "Allowed" | "Not Allowed" | "Share-Alike";
37
39
  attribution: "Required" | "Not Required";
38
40
  geographicScope: string;
39
41
  aiPolicy: "Allowed" | "Not Allowed" | "Training Only";
40
42
  royalty: number;
41
- value: string;
42
- recipient: string;
43
43
  description?: string | undefined;
44
44
  external_url?: string | undefined;
45
45
  }>;
@@ -19,13 +19,13 @@ declare const editionMintSchema: z.ZodObject<{
19
19
  ipType: "Audio" | "Video" | "Art" | "Photography" | "NFT" | "RWA" | "Posts" | "Publications" | "Documents";
20
20
  licenseType: string;
21
21
  commercialUse: "Yes" | "No";
22
+ value: string;
23
+ recipient: string;
22
24
  derivatives: "Allowed" | "Not Allowed" | "Share-Alike";
23
25
  attribution: "Required" | "Not Required";
24
26
  geographicScope: string;
25
27
  aiPolicy: "Allowed" | "Not Allowed" | "Training Only";
26
28
  royalty: number;
27
- value: string;
28
- recipient: string;
29
29
  description?: string | undefined;
30
30
  external_url?: string | undefined;
31
31
  }, {
@@ -33,13 +33,13 @@ declare const editionMintSchema: z.ZodObject<{
33
33
  ipType: "Audio" | "Video" | "Art" | "Photography" | "NFT" | "RWA" | "Posts" | "Publications" | "Documents";
34
34
  licenseType: string;
35
35
  commercialUse: "Yes" | "No";
36
+ value: string;
37
+ recipient: string;
36
38
  derivatives: "Allowed" | "Not Allowed" | "Share-Alike";
37
39
  attribution: "Required" | "Not Required";
38
40
  geographicScope: string;
39
41
  aiPolicy: "Allowed" | "Not Allowed" | "Training Only";
40
42
  royalty: number;
41
- value: string;
42
- recipient: string;
43
43
  description?: string | undefined;
44
44
  external_url?: string | undefined;
45
45
  }>;
@@ -7,7 +7,7 @@ declare function useTokenBalance(symbol: string | null, holderAddress: string |
7
7
  rawBalance: bigint | null;
8
8
  isLoading: boolean;
9
9
  error: any;
10
- decimals: 8 | 6 | 18;
10
+ decimals: 6 | 8 | 18;
11
11
  };
12
12
  declare function hasSufficientBalance(rawBalance: bigint | null, requiredHuman: string, decimals: number): boolean | null;
13
13
 
@@ -7,7 +7,7 @@ declare function useTokenBalance(symbol: string | null, holderAddress: string |
7
7
  rawBalance: bigint | null;
8
8
  isLoading: boolean;
9
9
  error: any;
10
- decimals: 8 | 6 | 18;
10
+ decimals: 6 | 8 | 18;
11
11
  };
12
12
  declare function hasSufficientBalance(rawBalance: bigint | null, requiredHuman: string, decimals: number): boolean | null;
13
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medialane/ui",
3
- "version": "0.360.0",
3
+ "version": "0.362.0",
4
4
  "description": "Shared UI components for Medialane apps",
5
5
  "type": "module",
6
6
  "sideEffects": false,