@medialane/ui 0.235.0 → 0.236.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/account/input-otp.d.cts +2 -2
- package/dist/components/account/input-otp.d.ts +2 -2
- package/dist/components/badge.d.cts +1 -1
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/button.d.cts +2 -2
- package/dist/components/button.d.ts +2 -2
- package/dist/components/fast-mint/fast-mint.d.cts +2 -2
- package/dist/components/fast-mint/fast-mint.d.ts +2 -2
- package/dist/components/launchpad/collection-picker.cjs +147 -0
- package/dist/components/launchpad/collection-picker.cjs.map +1 -0
- package/dist/components/launchpad/collection-picker.d.cts +13 -0
- package/dist/components/launchpad/collection-picker.d.ts +13 -0
- package/dist/components/launchpad/collection-picker.js +113 -0
- package/dist/components/launchpad/collection-picker.js.map +1 -0
- package/dist/components/launchpad/single-edition-mint.cjs +427 -0
- package/dist/components/launchpad/single-edition-mint.cjs.map +1 -0
- package/dist/components/launchpad/single-edition-mint.d.cts +8 -0
- package/dist/components/launchpad/single-edition-mint.d.ts +8 -0
- package/dist/components/launchpad/single-edition-mint.js +393 -0
- package/dist/components/launchpad/single-edition-mint.js.map +1 -0
- package/dist/components/sheet.d.cts +1 -1
- package/dist/components/sheet.d.ts +1 -1
- package/dist/index.cjs +6 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -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>, "
|
|
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>, "
|
|
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>, "
|
|
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>, "
|
|
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;
|
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
|
|
6
6
|
declare const badgeVariants: (props?: ({
|
|
7
|
-
variant?: "default" | "
|
|
7
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
10
10
|
}
|
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
|
|
6
6
|
declare const badgeVariants: (props?: ({
|
|
7
|
-
variant?: "default" | "
|
|
7
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
10
10
|
}
|
|
@@ -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?: "
|
|
7
|
-
size?: "
|
|
6
|
+
variant?: "ghost" | "link" | "default" | "destructive" | "outline" | "secondary" | "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?: "
|
|
7
|
-
size?: "
|
|
6
|
+
variant?: "ghost" | "link" | "default" | "destructive" | "outline" | "secondary" | "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;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import { FastMintProps } from './types.cjs';
|
|
4
4
|
import 'starknet';
|
|
5
5
|
import '@medialane/sdk';
|
|
6
6
|
import '@medialane/sdk/starknet';
|
|
7
7
|
|
|
8
|
-
declare function FastMint(props: FastMintProps): string | number | bigint | boolean |
|
|
8
|
+
declare function FastMint(props: FastMintProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
9
9
|
|
|
10
10
|
export { FastMint };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import { FastMintProps } from './types.js';
|
|
4
4
|
import 'starknet';
|
|
5
5
|
import '@medialane/sdk';
|
|
6
6
|
import '@medialane/sdk/starknet';
|
|
7
7
|
|
|
8
|
-
declare function FastMint(props: FastMintProps): string | number | bigint | boolean |
|
|
8
|
+
declare function FastMint(props: FastMintProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
9
9
|
|
|
10
10
|
export { FastMint };
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var collection_picker_exports = {};
|
|
31
|
+
__export(collection_picker_exports, {
|
|
32
|
+
CollectionPicker: () => CollectionPicker
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(collection_picker_exports);
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var import_react = require("react");
|
|
37
|
+
var import_lucide_react = require("lucide-react");
|
|
38
|
+
var import_image = __toESM(require("../image.js"), 1);
|
|
39
|
+
var import_link = __toESM(require("../link.js"), 1);
|
|
40
|
+
var import_input = require("../input.js");
|
|
41
|
+
var import_skeleton = require("../skeleton.js");
|
|
42
|
+
var import_popover = require("../popover.js");
|
|
43
|
+
var import_cn = require("../../utils/cn.js");
|
|
44
|
+
var import_use_image_url = require("../../utils/use-image-url.js");
|
|
45
|
+
function label(col) {
|
|
46
|
+
return col.name || col.symbol || `Collection #${col.collectionId}`;
|
|
47
|
+
}
|
|
48
|
+
function works(col) {
|
|
49
|
+
return col.totalSupply != null ? `${col.totalSupply.toLocaleString()} work${col.totalSupply !== 1 ? "s" : ""}` : "Empty";
|
|
50
|
+
}
|
|
51
|
+
function Thumb({ image, size }) {
|
|
52
|
+
const url = (0, import_use_image_url.useImageUrl)()(image);
|
|
53
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: (0, import_cn.cn)("relative rounded-lg overflow-hidden bg-muted shrink-0", size === "md" ? "h-10 w-10" : "h-8 w-8"), children: url ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_image.default, { src: url, alt: "", fill: true, unoptimized: true, className: "object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Boxes, { className: "h-4 w-4 text-muted-foreground/40" }) }) });
|
|
54
|
+
}
|
|
55
|
+
function CollectionPicker({ collections, loading, value, onChange, newCollectionHref }) {
|
|
56
|
+
const [open, setOpen] = (0, import_react.useState)(false);
|
|
57
|
+
const [query, setQuery] = (0, import_react.useState)("");
|
|
58
|
+
if (loading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: "h-[4.25rem] rounded-xl" });
|
|
59
|
+
if (collections.length === 0) {
|
|
60
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "rounded-xl border border-dashed border-border p-5 text-center space-y-3", children: [
|
|
61
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground", children: "You don't have a collection yet \u2014 every work needs one to live in." }),
|
|
62
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
63
|
+
import_link.default,
|
|
64
|
+
{
|
|
65
|
+
href: newCollectionHref,
|
|
66
|
+
className: "inline-flex items-center gap-1.5 h-9 px-4 rounded-xl text-sm font-semibold text-white bg-brand-blue hover:brightness-110 transition-all",
|
|
67
|
+
children: [
|
|
68
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Plus, { className: "h-3.5 w-3.5" }),
|
|
69
|
+
"Create your first collection"
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
] });
|
|
74
|
+
}
|
|
75
|
+
const selected = collections.find((c) => c.collectionId === value) ?? null;
|
|
76
|
+
const filtered = query.trim() ? collections.filter((c) => label(c).toLowerCase().includes(query.trim().toLowerCase())) : collections;
|
|
77
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
78
|
+
import_popover.Popover,
|
|
79
|
+
{
|
|
80
|
+
open,
|
|
81
|
+
onOpenChange: (next) => {
|
|
82
|
+
setOpen(next);
|
|
83
|
+
if (!next) setQuery("");
|
|
84
|
+
},
|
|
85
|
+
children: [
|
|
86
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_popover.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
87
|
+
"button",
|
|
88
|
+
{
|
|
89
|
+
type: "button",
|
|
90
|
+
"aria-expanded": open,
|
|
91
|
+
className: "flex w-full items-center gap-3 rounded-xl border border-border p-3 text-left transition-colors hover:bg-muted/40",
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Thumb, { image: selected?.image, size: "md" }),
|
|
94
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
95
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm font-semibold truncate", children: selected ? label(selected) : "Choose a collection" }),
|
|
96
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-muted-foreground", children: selected ? works(selected) : "Where this work will live" })
|
|
97
|
+
] }),
|
|
98
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "flex items-center gap-1 text-xs font-medium text-muted-foreground shrink-0", children: [
|
|
99
|
+
"Change",
|
|
100
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronDown, { className: "h-3.5 w-3.5" })
|
|
101
|
+
] })
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
) }),
|
|
105
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_popover.PopoverContent, { className: "w-[var(--radix-popover-trigger-width)] p-0", align: "start", children: [
|
|
106
|
+
collections.length > 5 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "border-b border-border p-2", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input.Input, { value: query, onChange: (e) => setQuery(e.target.value), placeholder: "Search collections\u2026", className: "h-8" }) }),
|
|
107
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "max-h-64 overflow-y-auto p-1", children: filtered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "px-3 py-4 text-center text-sm text-muted-foreground", children: "No collection found." }) : filtered.map((col) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
108
|
+
"button",
|
|
109
|
+
{
|
|
110
|
+
type: "button",
|
|
111
|
+
onClick: () => {
|
|
112
|
+
onChange(col.collectionId);
|
|
113
|
+
setOpen(false);
|
|
114
|
+
},
|
|
115
|
+
className: "flex w-full items-center gap-2.5 rounded-lg px-2 py-2 text-left transition-colors hover:bg-muted/60",
|
|
116
|
+
children: [
|
|
117
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Thumb, { image: col.image, size: "sm" }),
|
|
118
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
119
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm font-medium truncate", children: label(col) }),
|
|
120
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-muted-foreground", children: works(col) })
|
|
121
|
+
] }),
|
|
122
|
+
value === col.collectionId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Check, { className: "h-4 w-4 text-brand-blue shrink-0" })
|
|
123
|
+
]
|
|
124
|
+
},
|
|
125
|
+
col.collectionId
|
|
126
|
+
)) }),
|
|
127
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "border-t border-border p-1", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
128
|
+
import_link.default,
|
|
129
|
+
{
|
|
130
|
+
href: newCollectionHref,
|
|
131
|
+
className: "flex items-center gap-2 rounded-lg px-2 py-2 text-sm font-medium text-muted-foreground hover:bg-muted/60 hover:text-foreground transition-colors",
|
|
132
|
+
children: [
|
|
133
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Plus, { className: "h-4 w-4" }),
|
|
134
|
+
"New collection"
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
) })
|
|
138
|
+
] })
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
144
|
+
0 && (module.exports = {
|
|
145
|
+
CollectionPicker
|
|
146
|
+
});
|
|
147
|
+
//# sourceMappingURL=collection-picker.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/launchpad/collection-picker.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { Boxes, Check, ChevronDown, Plus } from \"lucide-react\";\nimport type { ApiCollection } from \"@medialane/sdk\";\nimport Image from \"../image.js\";\nimport Link from \"../link.js\";\nimport { Input } from \"../input.js\";\nimport { Skeleton } from \"../skeleton.js\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover.js\";\nimport { cn } from \"../../utils/cn.js\";\nimport { useImageUrl } from \"../../utils/use-image-url.js\";\n\nexport interface CollectionPickerProps {\n collections: ApiCollection[];\n loading: boolean;\n value: string;\n onChange: (id: string) => void;\n newCollectionHref: string;\n}\n\nfunction label(col: ApiCollection) {\n return col.name || col.symbol || `Collection #${col.collectionId}`;\n}\n\nfunction works(col: ApiCollection) {\n return col.totalSupply != null ? `${col.totalSupply.toLocaleString()} work${col.totalSupply !== 1 ? \"s\" : \"\"}` : \"Empty\";\n}\n\nfunction Thumb({ image, size }: { image: string | null | undefined; size: \"sm\" | \"md\" }) {\n const url = useImageUrl()(image);\n return (\n <div className={cn(\"relative rounded-lg overflow-hidden bg-muted shrink-0\", size === \"md\" ? \"h-10 w-10\" : \"h-8 w-8\")}>\n {url ? (\n <Image src={url} alt=\"\" fill unoptimized className=\"object-cover\" />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n <Boxes className=\"h-4 w-4 text-muted-foreground/40\" />\n </div>\n )}\n </div>\n );\n}\n\nexport function CollectionPicker({ collections, loading, value, onChange, newCollectionHref }: CollectionPickerProps) {\n const [open, setOpen] = useState(false);\n const [query, setQuery] = useState(\"\");\n\n if (loading) return <Skeleton className=\"h-[4.25rem] rounded-xl\" />;\n\n if (collections.length === 0) {\n return (\n <div className=\"rounded-xl border border-dashed border-border p-5 text-center space-y-3\">\n <p className=\"text-sm text-muted-foreground\">You don't have a collection yet — every work needs one to live in.</p>\n <Link\n href={newCollectionHref}\n className=\"inline-flex items-center gap-1.5 h-9 px-4 rounded-xl text-sm font-semibold text-white bg-brand-blue hover:brightness-110 transition-all\"\n >\n <Plus className=\"h-3.5 w-3.5\" />\n Create your first collection\n </Link>\n </div>\n );\n }\n\n const selected = collections.find((c) => c.collectionId === value) ?? null;\n const filtered = query.trim() ? collections.filter((c) => label(c).toLowerCase().includes(query.trim().toLowerCase())) : collections;\n\n return (\n <Popover\n open={open}\n onOpenChange={(next) => {\n setOpen(next);\n if (!next) setQuery(\"\");\n }}\n >\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n aria-expanded={open}\n className=\"flex w-full items-center gap-3 rounded-xl border border-border p-3 text-left transition-colors hover:bg-muted/40\"\n >\n <Thumb image={selected?.image} size=\"md\" />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-semibold truncate\">{selected ? label(selected) : \"Choose a collection\"}</p>\n <p className=\"text-xs text-muted-foreground\">{selected ? works(selected) : \"Where this work will live\"}</p>\n </div>\n <span className=\"flex items-center gap-1 text-xs font-medium text-muted-foreground shrink-0\">\n Change\n <ChevronDown className=\"h-3.5 w-3.5\" />\n </span>\n </button>\n </PopoverTrigger>\n <PopoverContent className=\"w-[var(--radix-popover-trigger-width)] p-0\" align=\"start\">\n {collections.length > 5 && (\n <div className=\"border-b border-border p-2\">\n <Input value={query} onChange={(e) => setQuery(e.target.value)} placeholder=\"Search collections…\" className=\"h-8\" />\n </div>\n )}\n <div className=\"max-h-64 overflow-y-auto p-1\">\n {filtered.length === 0 ? (\n <p className=\"px-3 py-4 text-center text-sm text-muted-foreground\">No collection found.</p>\n ) : (\n filtered.map((col) => (\n <button\n key={col.collectionId!}\n type=\"button\"\n onClick={() => {\n onChange(col.collectionId!);\n setOpen(false);\n }}\n className=\"flex w-full items-center gap-2.5 rounded-lg px-2 py-2 text-left transition-colors hover:bg-muted/60\"\n >\n <Thumb image={col.image} size=\"sm\" />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-medium truncate\">{label(col)}</p>\n <p className=\"text-xs text-muted-foreground\">{works(col)}</p>\n </div>\n {value === col.collectionId && <Check className=\"h-4 w-4 text-brand-blue shrink-0\" />}\n </button>\n ))\n )}\n </div>\n <div className=\"border-t border-border p-1\">\n <Link\n href={newCollectionHref}\n className=\"flex items-center gap-2 rounded-lg px-2 py-2 text-sm font-medium text-muted-foreground hover:bg-muted/60 hover:text-foreground transition-colors\"\n >\n <Plus className=\"h-4 w-4\" />\n New collection\n </Link>\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkCQ;AAhCR,mBAAyB;AACzB,0BAAgD;AAEhD,mBAAkB;AAClB,kBAAiB;AACjB,mBAAsB;AACtB,sBAAyB;AACzB,qBAAwD;AACxD,gBAAmB;AACnB,2BAA4B;AAU5B,SAAS,MAAM,KAAoB;AACjC,SAAO,IAAI,QAAQ,IAAI,UAAU,eAAe,IAAI,YAAY;AAClE;AAEA,SAAS,MAAM,KAAoB;AACjC,SAAO,IAAI,eAAe,OAAO,GAAG,IAAI,YAAY,eAAe,CAAC,QAAQ,IAAI,gBAAgB,IAAI,MAAM,EAAE,KAAK;AACnH;AAEA,SAAS,MAAM,EA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CACD,GAEL;AAAA,UACA,4CAAC,SAAI,WAAU,8BACb;AAAA,YAAC,YAAAA;AAAA,YAAA;AAAA,cACC,MAAM;AAAA,cACN,WAAU;AAAA,cAEV;AAAA,4DAAC,4BAAK,WAAU,WAAU;AAAA,gBAAE;AAAA;AAAA;AAAA,UAE9B,GACF;AAAA,WACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["Image","Link"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ApiCollection } from '@medialane/sdk';
|
|
3
|
+
|
|
4
|
+
interface CollectionPickerProps {
|
|
5
|
+
collections: ApiCollection[];
|
|
6
|
+
loading: boolean;
|
|
7
|
+
value: string;
|
|
8
|
+
onChange: (id: string) => void;
|
|
9
|
+
newCollectionHref: string;
|
|
10
|
+
}
|
|
11
|
+
declare function CollectionPicker({ collections, loading, value, onChange, newCollectionHref }: CollectionPickerProps): react_jsx_runtime.JSX.Element;
|
|
12
|
+
|
|
13
|
+
export { CollectionPicker, type CollectionPickerProps };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ApiCollection } from '@medialane/sdk';
|
|
3
|
+
|
|
4
|
+
interface CollectionPickerProps {
|
|
5
|
+
collections: ApiCollection[];
|
|
6
|
+
loading: boolean;
|
|
7
|
+
value: string;
|
|
8
|
+
onChange: (id: string) => void;
|
|
9
|
+
newCollectionHref: string;
|
|
10
|
+
}
|
|
11
|
+
declare function CollectionPicker({ collections, loading, value, onChange, newCollectionHref }: CollectionPickerProps): react_jsx_runtime.JSX.Element;
|
|
12
|
+
|
|
13
|
+
export { CollectionPicker, type CollectionPickerProps };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Boxes, Check, ChevronDown, Plus } from "lucide-react";
|
|
5
|
+
import Image from "../image.js";
|
|
6
|
+
import Link from "../link.js";
|
|
7
|
+
import { Input } from "../input.js";
|
|
8
|
+
import { Skeleton } from "../skeleton.js";
|
|
9
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../popover.js";
|
|
10
|
+
import { cn } from "../../utils/cn.js";
|
|
11
|
+
import { useImageUrl } from "../../utils/use-image-url.js";
|
|
12
|
+
function label(col) {
|
|
13
|
+
return col.name || col.symbol || `Collection #${col.collectionId}`;
|
|
14
|
+
}
|
|
15
|
+
function works(col) {
|
|
16
|
+
return col.totalSupply != null ? `${col.totalSupply.toLocaleString()} work${col.totalSupply !== 1 ? "s" : ""}` : "Empty";
|
|
17
|
+
}
|
|
18
|
+
function Thumb({ image, size }) {
|
|
19
|
+
const url = useImageUrl()(image);
|
|
20
|
+
return /* @__PURE__ */ jsx("div", { className: cn("relative rounded-lg overflow-hidden bg-muted shrink-0", size === "md" ? "h-10 w-10" : "h-8 w-8"), children: url ? /* @__PURE__ */ jsx(Image, { src: url, alt: "", fill: true, unoptimized: true, className: "object-cover" }) : /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx(Boxes, { className: "h-4 w-4 text-muted-foreground/40" }) }) });
|
|
21
|
+
}
|
|
22
|
+
function CollectionPicker({ collections, loading, value, onChange, newCollectionHref }) {
|
|
23
|
+
const [open, setOpen] = useState(false);
|
|
24
|
+
const [query, setQuery] = useState("");
|
|
25
|
+
if (loading) return /* @__PURE__ */ jsx(Skeleton, { className: "h-[4.25rem] rounded-xl" });
|
|
26
|
+
if (collections.length === 0) {
|
|
27
|
+
return /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-dashed border-border p-5 text-center space-y-3", children: [
|
|
28
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "You don't have a collection yet \u2014 every work needs one to live in." }),
|
|
29
|
+
/* @__PURE__ */ jsxs(
|
|
30
|
+
Link,
|
|
31
|
+
{
|
|
32
|
+
href: newCollectionHref,
|
|
33
|
+
className: "inline-flex items-center gap-1.5 h-9 px-4 rounded-xl text-sm font-semibold text-white bg-brand-blue hover:brightness-110 transition-all",
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ jsx(Plus, { className: "h-3.5 w-3.5" }),
|
|
36
|
+
"Create your first collection"
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
] });
|
|
41
|
+
}
|
|
42
|
+
const selected = collections.find((c) => c.collectionId === value) ?? null;
|
|
43
|
+
const filtered = query.trim() ? collections.filter((c) => label(c).toLowerCase().includes(query.trim().toLowerCase())) : collections;
|
|
44
|
+
return /* @__PURE__ */ jsxs(
|
|
45
|
+
Popover,
|
|
46
|
+
{
|
|
47
|
+
open,
|
|
48
|
+
onOpenChange: (next) => {
|
|
49
|
+
setOpen(next);
|
|
50
|
+
if (!next) setQuery("");
|
|
51
|
+
},
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
54
|
+
"button",
|
|
55
|
+
{
|
|
56
|
+
type: "button",
|
|
57
|
+
"aria-expanded": open,
|
|
58
|
+
className: "flex w-full items-center gap-3 rounded-xl border border-border p-3 text-left transition-colors hover:bg-muted/40",
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ jsx(Thumb, { image: selected?.image, size: "md" }),
|
|
61
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
62
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-semibold truncate", children: selected ? label(selected) : "Choose a collection" }),
|
|
63
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: selected ? works(selected) : "Where this work will live" })
|
|
64
|
+
] }),
|
|
65
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1 text-xs font-medium text-muted-foreground shrink-0", children: [
|
|
66
|
+
"Change",
|
|
67
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: "h-3.5 w-3.5" })
|
|
68
|
+
] })
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
) }),
|
|
72
|
+
/* @__PURE__ */ jsxs(PopoverContent, { className: "w-[var(--radix-popover-trigger-width)] p-0", align: "start", children: [
|
|
73
|
+
collections.length > 5 && /* @__PURE__ */ jsx("div", { className: "border-b border-border p-2", children: /* @__PURE__ */ jsx(Input, { value: query, onChange: (e) => setQuery(e.target.value), placeholder: "Search collections\u2026", className: "h-8" }) }),
|
|
74
|
+
/* @__PURE__ */ jsx("div", { className: "max-h-64 overflow-y-auto p-1", children: filtered.length === 0 ? /* @__PURE__ */ jsx("p", { className: "px-3 py-4 text-center text-sm text-muted-foreground", children: "No collection found." }) : filtered.map((col) => /* @__PURE__ */ jsxs(
|
|
75
|
+
"button",
|
|
76
|
+
{
|
|
77
|
+
type: "button",
|
|
78
|
+
onClick: () => {
|
|
79
|
+
onChange(col.collectionId);
|
|
80
|
+
setOpen(false);
|
|
81
|
+
},
|
|
82
|
+
className: "flex w-full items-center gap-2.5 rounded-lg px-2 py-2 text-left transition-colors hover:bg-muted/60",
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ jsx(Thumb, { image: col.image, size: "sm" }),
|
|
85
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
86
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium truncate", children: label(col) }),
|
|
87
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: works(col) })
|
|
88
|
+
] }),
|
|
89
|
+
value === col.collectionId && /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 text-brand-blue shrink-0" })
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
col.collectionId
|
|
93
|
+
)) }),
|
|
94
|
+
/* @__PURE__ */ jsx("div", { className: "border-t border-border p-1", children: /* @__PURE__ */ jsxs(
|
|
95
|
+
Link,
|
|
96
|
+
{
|
|
97
|
+
href: newCollectionHref,
|
|
98
|
+
className: "flex items-center gap-2 rounded-lg px-2 py-2 text-sm font-medium text-muted-foreground hover:bg-muted/60 hover:text-foreground transition-colors",
|
|
99
|
+
children: [
|
|
100
|
+
/* @__PURE__ */ jsx(Plus, { className: "h-4 w-4" }),
|
|
101
|
+
"New collection"
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
) })
|
|
105
|
+
] })
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
export {
|
|
111
|
+
CollectionPicker
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=collection-picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/launchpad/collection-picker.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { Boxes, Check, ChevronDown, Plus } from \"lucide-react\";\nimport type { ApiCollection } from \"@medialane/sdk\";\nimport Image from \"../image.js\";\nimport Link from \"../link.js\";\nimport { Input } from \"../input.js\";\nimport { Skeleton } from \"../skeleton.js\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover.js\";\nimport { cn } from \"../../utils/cn.js\";\nimport { useImageUrl } from \"../../utils/use-image-url.js\";\n\nexport interface CollectionPickerProps {\n collections: ApiCollection[];\n loading: boolean;\n value: string;\n onChange: (id: string) => void;\n newCollectionHref: string;\n}\n\nfunction label(col: ApiCollection) {\n return col.name || col.symbol || `Collection #${col.collectionId}`;\n}\n\nfunction works(col: ApiCollection) {\n return col.totalSupply != null ? `${col.totalSupply.toLocaleString()} work${col.totalSupply !== 1 ? \"s\" : \"\"}` : \"Empty\";\n}\n\nfunction Thumb({ image, size }: { image: string | null | undefined; size: \"sm\" | \"md\" }) {\n const url = useImageUrl()(image);\n return (\n <div className={cn(\"relative rounded-lg overflow-hidden bg-muted shrink-0\", size === \"md\" ? \"h-10 w-10\" : \"h-8 w-8\")}>\n {url ? (\n <Image src={url} alt=\"\" fill unoptimized className=\"object-cover\" />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n <Boxes className=\"h-4 w-4 text-muted-foreground/40\" />\n </div>\n )}\n </div>\n );\n}\n\nexport function CollectionPicker({ collections, loading, value, onChange, newCollectionHref }: CollectionPickerProps) {\n const [open, setOpen] = useState(false);\n const [query, setQuery] = useState(\"\");\n\n if (loading) return <Skeleton className=\"h-[4.25rem] rounded-xl\" />;\n\n if (collections.length === 0) {\n return (\n <div className=\"rounded-xl border border-dashed border-border p-5 text-center space-y-3\">\n <p className=\"text-sm text-muted-foreground\">You don't have a collection yet — every work needs one to live in.</p>\n <Link\n href={newCollectionHref}\n className=\"inline-flex items-center gap-1.5 h-9 px-4 rounded-xl text-sm font-semibold text-white bg-brand-blue hover:brightness-110 transition-all\"\n >\n <Plus className=\"h-3.5 w-3.5\" />\n Create your first collection\n </Link>\n </div>\n );\n }\n\n const selected = collections.find((c) => c.collectionId === value) ?? null;\n const filtered = query.trim() ? collections.filter((c) => label(c).toLowerCase().includes(query.trim().toLowerCase())) : collections;\n\n return (\n <Popover\n open={open}\n onOpenChange={(next) => {\n setOpen(next);\n if (!next) setQuery(\"\");\n }}\n >\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n aria-expanded={open}\n className=\"flex w-full items-center gap-3 rounded-xl border border-border p-3 text-left transition-colors hover:bg-muted/40\"\n >\n <Thumb image={selected?.image} size=\"md\" />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-semibold truncate\">{selected ? label(selected) : \"Choose a collection\"}</p>\n <p className=\"text-xs text-muted-foreground\">{selected ? works(selected) : \"Where this work will live\"}</p>\n </div>\n <span className=\"flex items-center gap-1 text-xs font-medium text-muted-foreground shrink-0\">\n Change\n <ChevronDown className=\"h-3.5 w-3.5\" />\n </span>\n </button>\n </PopoverTrigger>\n <PopoverContent className=\"w-[var(--radix-popover-trigger-width)] p-0\" align=\"start\">\n {collections.length > 5 && (\n <div className=\"border-b border-border p-2\">\n <Input value={query} onChange={(e) => setQuery(e.target.value)} placeholder=\"Search collections…\" className=\"h-8\" />\n </div>\n )}\n <div className=\"max-h-64 overflow-y-auto p-1\">\n {filtered.length === 0 ? (\n <p className=\"px-3 py-4 text-center text-sm text-muted-foreground\">No collection found.</p>\n ) : (\n filtered.map((col) => (\n <button\n key={col.collectionId!}\n type=\"button\"\n onClick={() => {\n onChange(col.collectionId!);\n setOpen(false);\n }}\n className=\"flex w-full items-center gap-2.5 rounded-lg px-2 py-2 text-left transition-colors hover:bg-muted/60\"\n >\n <Thumb image={col.image} size=\"sm\" />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-medium truncate\">{label(col)}</p>\n <p className=\"text-xs text-muted-foreground\">{works(col)}</p>\n </div>\n {value === col.collectionId && <Check className=\"h-4 w-4 text-brand-blue shrink-0\" />}\n </button>\n ))\n )}\n </div>\n <div className=\"border-t border-border p-1\">\n <Link\n href={newCollectionHref}\n className=\"flex items-center gap-2 rounded-lg px-2 py-2 text-sm font-medium text-muted-foreground hover:bg-muted/60 hover:text-foreground transition-colors\"\n >\n <Plus className=\"h-4 w-4\" />\n New collection\n </Link>\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n"],"mappings":";AAkCQ,cAoBA,YApBA;AAhCR,SAAS,gBAAgB;AACzB,SAAS,OAAO,OAAO,aAAa,YAAY;AAEhD,OAAO,WAAW;AAClB,OAAO,UAAU;AACjB,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,SAAS,gBAAgB,sBAAsB;AACxD,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAU5B,SAAS,MAAM,KAAoB;AACjC,SAAO,IAAI,QAAQ,IAAI,UAAU,eAAe,IAAI,YAAY;AAClE;AAEA,SAAS,MAAM,KAAoB;AACjC,SAAO,IAAI,eAAe,OAAO,GAAG,IAAI,YAAY,eAAe,CAAC,QAAQ,IAAI,gBAAgB,IAAI,MAAM,EAAE,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