@medialane/ui 0.295.0 → 0.296.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/asset-form-parts.cjs +194 -0
- package/dist/components/fast-mint/asset-form-parts.cjs.map +1 -0
- package/dist/components/fast-mint/asset-form-parts.d.cts +33 -0
- package/dist/components/fast-mint/asset-form-parts.d.ts +33 -0
- package/dist/components/fast-mint/asset-form-parts.js +158 -0
- package/dist/components/fast-mint/asset-form-parts.js.map +1 -0
- package/dist/components/fast-mint/collection-section.cjs +211 -0
- package/dist/components/fast-mint/collection-section.cjs.map +1 -0
- package/dist/components/fast-mint/collection-section.d.cts +27 -0
- package/dist/components/fast-mint/collection-section.d.ts +27 -0
- package/dist/components/fast-mint/collection-section.js +176 -0
- package/dist/components/fast-mint/collection-section.js.map +1 -0
- package/dist/components/fast-mint/fast-mint.cjs +116 -653
- package/dist/components/fast-mint/fast-mint.cjs.map +1 -1
- 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/fast-mint/fast-mint.js +115 -661
- package/dist/components/fast-mint/fast-mint.js.map +1 -1
- package/dist/components/fast-mint/form.cjs +40 -0
- package/dist/components/fast-mint/form.cjs.map +1 -0
- package/dist/components/fast-mint/form.d.cts +15 -0
- package/dist/components/fast-mint/form.d.ts +15 -0
- package/dist/components/fast-mint/form.js +16 -0
- package/dist/components/fast-mint/form.js.map +1 -0
- package/dist/components/fast-mint/ip-type-section.cjs +76 -0
- package/dist/components/fast-mint/ip-type-section.cjs.map +1 -0
- package/dist/components/fast-mint/ip-type-section.d.cts +17 -0
- package/dist/components/fast-mint/ip-type-section.d.ts +17 -0
- package/dist/components/fast-mint/ip-type-section.js +52 -0
- package/dist/components/fast-mint/ip-type-section.js.map +1 -0
- package/dist/components/fast-mint/licensing-section.cjs +124 -0
- package/dist/components/fast-mint/licensing-section.cjs.map +1 -0
- package/dist/components/fast-mint/licensing-section.d.cts +14 -0
- package/dist/components/fast-mint/licensing-section.d.ts +14 -0
- package/dist/components/fast-mint/licensing-section.js +99 -0
- package/dist/components/fast-mint/licensing-section.js.map +1 -0
- package/dist/components/fast-mint/media-kind.cjs +48 -0
- package/dist/components/fast-mint/media-kind.cjs.map +1 -0
- package/dist/components/fast-mint/media-kind.d.cts +12 -0
- package/dist/components/fast-mint/media-kind.d.ts +12 -0
- package/dist/components/fast-mint/media-kind.js +22 -0
- package/dist/components/fast-mint/media-kind.js.map +1 -0
- package/dist/components/fast-mint/mint-asset.cjs +124 -0
- package/dist/components/fast-mint/mint-asset.cjs.map +1 -0
- package/dist/components/fast-mint/mint-asset.d.cts +41 -0
- package/dist/components/fast-mint/mint-asset.d.ts +41 -0
- package/dist/components/fast-mint/mint-asset.js +100 -0
- package/dist/components/fast-mint/mint-asset.js.map +1 -0
- package/dist/components/fast-mint/use-ipfs-upload.cjs +64 -0
- package/dist/components/fast-mint/use-ipfs-upload.cjs.map +1 -0
- package/dist/components/fast-mint/use-ipfs-upload.d.cts +9 -0
- package/dist/components/fast-mint/use-ipfs-upload.d.ts +9 -0
- package/dist/components/fast-mint/use-ipfs-upload.js +40 -0
- package/dist/components/fast-mint/use-ipfs-upload.js.map +1 -0
- package/dist/components/fast-mint/use-new-collection-draft.cjs +66 -0
- package/dist/components/fast-mint/use-new-collection-draft.cjs.map +1 -0
- package/dist/components/fast-mint/use-new-collection-draft.d.cts +13 -0
- package/dist/components/fast-mint/use-new-collection-draft.d.ts +13 -0
- package/dist/components/fast-mint/use-new-collection-draft.js +42 -0
- package/dist/components/fast-mint/use-new-collection-draft.js.map +1 -0
- package/dist/components/sheet.d.cts +1 -1
- package/dist/components/sheet.d.ts +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>, "onChange" | "value" | "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>, "onChange" | "value" | "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>, "onChange" | "value" | "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>, "onChange" | "value" | "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" | "secondary" | "outline" | "destructive" | 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" | "secondary" | "outline" | "destructive" | 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?: "link" | "default" | "secondary" | "outline" | "destructive" | "ghost" | "premium" | "tonal" | "gradient-border" | "gradient-fill" | null | undefined;
|
|
7
|
+
size?: "default" | "icon" | "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?: "link" | "default" | "secondary" | "outline" | "destructive" | "ghost" | "premium" | "tonal" | "gradient-border" | "gradient-fill" | null | undefined;
|
|
7
|
+
size?: "default" | "icon" | "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;
|
|
@@ -0,0 +1,194 @@
|
|
|
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 asset_form_parts_exports = {};
|
|
31
|
+
__export(asset_form_parts_exports, {
|
|
32
|
+
AssetTypePicker: () => AssetTypePicker,
|
|
33
|
+
CoverUpload: () => CoverUpload,
|
|
34
|
+
MediaRow: () => MediaRow
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(asset_form_parts_exports);
|
|
37
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
|
+
var import_image = __toESM(require("next/image"), 1);
|
|
39
|
+
var import_lucide_react = require("lucide-react");
|
|
40
|
+
var import_input = require("../input.js");
|
|
41
|
+
var import_ip_templates = require("../../data/ip-templates.js");
|
|
42
|
+
var import_upload_limits = require("../../utils/upload-limits.js");
|
|
43
|
+
var import_cn = require("../../utils/cn.js");
|
|
44
|
+
const MEDIA_KIND_ICON = {
|
|
45
|
+
image: import_lucide_react.ImagePlus,
|
|
46
|
+
audio: import_lucide_react.Music,
|
|
47
|
+
video: import_lucide_react.Video,
|
|
48
|
+
document: import_lucide_react.FileText
|
|
49
|
+
};
|
|
50
|
+
function MediaRow({
|
|
51
|
+
file,
|
|
52
|
+
kind,
|
|
53
|
+
preview,
|
|
54
|
+
uri,
|
|
55
|
+
uploading,
|
|
56
|
+
ipType,
|
|
57
|
+
inputRef,
|
|
58
|
+
onSelect
|
|
59
|
+
}) {
|
|
60
|
+
const KindIcon = MEDIA_KIND_ICON[kind];
|
|
61
|
+
const template = import_ip_templates.IP_TEMPLATES[ipType];
|
|
62
|
+
const TemplateIcon = template.icon;
|
|
63
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-4 rounded-xl border border-border p-3", children: [
|
|
64
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "relative h-14 w-14 rounded-lg bg-muted overflow-hidden shrink-0", children: [
|
|
65
|
+
kind === "image" && preview ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_image.default, { src: preview, alt: "", fill: true, className: "object-cover", unoptimized: true }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(KindIcon, { className: "h-6 w-6 text-muted-foreground" }) }),
|
|
66
|
+
uploading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute inset-0 flex items-center justify-center bg-background/70", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Loader2, { className: "h-4 w-4 animate-spin" }) })
|
|
67
|
+
] }),
|
|
68
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "min-w-0 flex-1 space-y-1", children: [
|
|
69
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm font-semibold truncate", children: file.name }),
|
|
70
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2 flex-wrap", children: [
|
|
71
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-muted-foreground", children: uploading ? "Uploading\u2026" : uri ? "Uploaded" : "Upload failed" }),
|
|
72
|
+
uri && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
73
|
+
"span",
|
|
74
|
+
{
|
|
75
|
+
className: (0, import_cn.cn)(
|
|
76
|
+
"inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 text-2xs font-medium",
|
|
77
|
+
template.color.bg,
|
|
78
|
+
template.color.text,
|
|
79
|
+
template.color.border
|
|
80
|
+
),
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TemplateIcon, { className: "h-3 w-3" }),
|
|
83
|
+
template.label
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
] })
|
|
88
|
+
] }),
|
|
89
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
90
|
+
"button",
|
|
91
|
+
{
|
|
92
|
+
type: "button",
|
|
93
|
+
onClick: () => inputRef.current?.click(),
|
|
94
|
+
className: "text-xs font-semibold text-brand-blue hover:underline shrink-0",
|
|
95
|
+
children: "Change"
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { ref: inputRef, type: "file", className: "hidden", onChange: (e) => {
|
|
99
|
+
const f = e.target.files?.[0];
|
|
100
|
+
if (f) onSelect(f);
|
|
101
|
+
} })
|
|
102
|
+
] });
|
|
103
|
+
}
|
|
104
|
+
function CoverUpload({
|
|
105
|
+
preview,
|
|
106
|
+
uploading,
|
|
107
|
+
inputRef,
|
|
108
|
+
onSelect
|
|
109
|
+
}) {
|
|
110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2", children: [
|
|
111
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: "text-sm font-medium", children: "Upload a cover image for your asset *" }),
|
|
112
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
113
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
114
|
+
"div",
|
|
115
|
+
{
|
|
116
|
+
role: "button",
|
|
117
|
+
tabIndex: 0,
|
|
118
|
+
onClick: () => !uploading && inputRef.current?.click(),
|
|
119
|
+
onKeyDown: (e) => {
|
|
120
|
+
if ((e.key === "Enter" || e.key === " ") && !uploading) {
|
|
121
|
+
e.preventDefault();
|
|
122
|
+
inputRef.current?.click();
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
className: "relative h-20 w-20 rounded-xl border-2 border-dashed border-border bg-muted flex items-center justify-center overflow-hidden shrink-0 cursor-pointer hover:border-primary/50 transition-colors",
|
|
126
|
+
children: [
|
|
127
|
+
preview ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_image.default, { src: preview, alt: "", fill: true, className: "object-cover", unoptimized: true }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ImagePlus, { className: "h-6 w-6 text-muted-foreground" }),
|
|
128
|
+
uploading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute inset-0 flex items-center justify-center bg-background/70", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Loader2, { className: "h-4 w-4 animate-spin" }) }),
|
|
129
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { ref: inputRef, type: "file", accept: (0, import_upload_limits.acceptFor)("image"), className: "hidden", onChange: (e) => {
|
|
130
|
+
const f = e.target.files?.[0];
|
|
131
|
+
if (f) onSelect(f);
|
|
132
|
+
} })
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
),
|
|
136
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-muted-foreground", children: "Cover art shown wherever the work is previewed. JPG, PNG, GIF, SVG or WebP." })
|
|
137
|
+
] })
|
|
138
|
+
] });
|
|
139
|
+
}
|
|
140
|
+
const ASSET_TYPES = [
|
|
141
|
+
{ value: "single", icon: import_lucide_react.ImagePlus, title: "Single Edition NFT", hint: "Minted once" },
|
|
142
|
+
{ value: "editions", icon: import_lucide_react.Layers, title: "Limited Editions NFT", hint: "Several numbered copies" }
|
|
143
|
+
];
|
|
144
|
+
function AssetTypePicker({
|
|
145
|
+
value,
|
|
146
|
+
onChange,
|
|
147
|
+
editionCount,
|
|
148
|
+
onEditionCount
|
|
149
|
+
}) {
|
|
150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
151
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2", children: [
|
|
152
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: "text-sm font-medium", children: "Asset Type" }),
|
|
153
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid grid-cols-2 gap-3", children: ASSET_TYPES.map(({ value: type, icon: Icon, title, hint }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
154
|
+
"button",
|
|
155
|
+
{
|
|
156
|
+
type: "button",
|
|
157
|
+
onClick: () => onChange(type),
|
|
158
|
+
className: (0, import_cn.cn)(
|
|
159
|
+
"flex items-start gap-3 rounded-xl border p-4 text-left transition-colors",
|
|
160
|
+
value === type ? "border-brand-blue bg-brand-blue/5" : "border-border hover:bg-muted/40"
|
|
161
|
+
),
|
|
162
|
+
children: [
|
|
163
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { className: (0, import_cn.cn)("h-5 w-5 shrink-0 mt-0.5", value === type ? "text-brand-blue" : "text-muted-foreground") }),
|
|
164
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
165
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "block text-sm font-semibold", children: title }),
|
|
166
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "block text-xs mt-0.5 text-muted-foreground", children: hint })
|
|
167
|
+
] })
|
|
168
|
+
]
|
|
169
|
+
},
|
|
170
|
+
type
|
|
171
|
+
)) })
|
|
172
|
+
] }),
|
|
173
|
+
value === "editions" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2", children: [
|
|
174
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: "text-sm font-medium", children: "Number of copies" }),
|
|
175
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
176
|
+
import_input.Input,
|
|
177
|
+
{
|
|
178
|
+
type: "number",
|
|
179
|
+
min: 1,
|
|
180
|
+
value: editionCount,
|
|
181
|
+
onChange: (e) => onEditionCount(e.target.value),
|
|
182
|
+
className: "max-w-[140px]"
|
|
183
|
+
}
|
|
184
|
+
)
|
|
185
|
+
] })
|
|
186
|
+
] });
|
|
187
|
+
}
|
|
188
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
189
|
+
0 && (module.exports = {
|
|
190
|
+
AssetTypePicker,
|
|
191
|
+
CoverUpload,
|
|
192
|
+
MediaRow
|
|
193
|
+
});
|
|
194
|
+
//# sourceMappingURL=asset-form-parts.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/fast-mint/asset-form-parts.tsx"],"sourcesContent":["\"use client\";\n\nimport type { RefObject } from \"react\";\nimport Image from \"next/image\";\nimport { FileText, ImagePlus, ImagePlus as SingleIcon, Layers, Loader2, Music, Video } from \"lucide-react\";\nimport { Input } from \"../input.js\";\nimport { IP_TEMPLATES } from \"../../data/ip-templates.js\";\nimport type { IPType } from \"../../data/ip.js\";\nimport { acceptFor } from \"../../utils/upload-limits.js\";\nimport { cn } from \"../../utils/cn.js\";\nimport type { MintAssetType } from \"./mintable-collections.js\";\nimport type { MediaKind } from \"./types.js\";\n\nconst MEDIA_KIND_ICON: Record<MediaKind, typeof ImagePlus> = {\n image: ImagePlus,\n audio: Music,\n video: Video,\n document: FileText,\n};\n\nexport function MediaRow({\n file, kind, preview, uri, uploading, ipType, inputRef, onSelect,\n}: {\n file: File;\n kind: MediaKind;\n preview: string | null;\n uri: string | null;\n uploading: boolean;\n ipType: IPType;\n inputRef: RefObject<HTMLInputElement | null>;\n onSelect: (file: File) => void;\n}) {\n const KindIcon = MEDIA_KIND_ICON[kind];\n const template = IP_TEMPLATES[ipType];\n const TemplateIcon = template.icon;\n return (\n <div className=\"flex items-center gap-4 rounded-xl border border-border p-3\">\n <div className=\"relative h-14 w-14 rounded-lg bg-muted overflow-hidden shrink-0\">\n {kind === \"image\" && preview ? (\n <Image src={preview} alt=\"\" fill className=\"object-cover\" unoptimized />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n <KindIcon className=\"h-6 w-6 text-muted-foreground\" />\n </div>\n )}\n {uploading && (\n <div className=\"absolute inset-0 flex items-center justify-center bg-background/70\">\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n </div>\n )}\n </div>\n <div className=\"min-w-0 flex-1 space-y-1\">\n <p className=\"text-sm font-semibold truncate\">{file.name}</p>\n <div className=\"flex items-center gap-2 flex-wrap\">\n <p className=\"text-xs text-muted-foreground\">\n {uploading ? \"Uploading…\" : uri ? \"Uploaded\" : \"Upload failed\"}\n </p>\n {uri && (\n <span\n className={cn(\n \"inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 text-2xs font-medium\",\n template.color.bg, template.color.text, template.color.border\n )}\n >\n <TemplateIcon className=\"h-3 w-3\" />\n {template.label}\n </span>\n )}\n </div>\n </div>\n <button\n type=\"button\"\n onClick={() => inputRef.current?.click()}\n className=\"text-xs font-semibold text-brand-blue hover:underline shrink-0\"\n >\n Change\n </button>\n <input ref={inputRef} type=\"file\" className=\"hidden\" onChange={(e) => { const f = e.target.files?.[0]; if (f) onSelect(f); }} />\n </div>\n );\n}\n\nexport function CoverUpload({\n preview, uploading, inputRef, onSelect,\n}: {\n preview: string | null;\n uploading: boolean;\n inputRef: RefObject<HTMLInputElement | null>;\n onSelect: (file: File) => void;\n}) {\n return (\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">Upload a cover image for your asset *</label>\n <div className=\"flex items-center gap-4\">\n <div\n role=\"button\"\n tabIndex={0}\n onClick={() => !uploading && inputRef.current?.click()}\n onKeyDown={(e) => { if ((e.key === \"Enter\" || e.key === \" \") && !uploading) { e.preventDefault(); inputRef.current?.click(); } }}\n className=\"relative h-20 w-20 rounded-xl border-2 border-dashed border-border bg-muted flex items-center justify-center overflow-hidden shrink-0 cursor-pointer hover:border-primary/50 transition-colors\"\n >\n {preview ? (\n <Image src={preview} alt=\"\" fill className=\"object-cover\" unoptimized />\n ) : (\n <ImagePlus className=\"h-6 w-6 text-muted-foreground\" />\n )}\n {uploading && (\n <div className=\"absolute inset-0 flex items-center justify-center bg-background/70\">\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n </div>\n )}\n <input ref={inputRef} type=\"file\" accept={acceptFor(\"image\")} className=\"hidden\" onChange={(e) => { const f = e.target.files?.[0]; if (f) onSelect(f); }} />\n </div>\n <p className=\"text-xs text-muted-foreground\">Cover art shown wherever the work is previewed. JPG, PNG, GIF, SVG or WebP.</p>\n </div>\n </div>\n );\n}\n\nconst ASSET_TYPES = [\n { value: \"single\", icon: SingleIcon, title: \"Single Edition NFT\", hint: \"Minted once\" },\n { value: \"editions\", icon: Layers, title: \"Limited Editions NFT\", hint: \"Several numbered copies\" },\n] as const;\n\nexport function AssetTypePicker({\n value, onChange, editionCount, onEditionCount,\n}: {\n value: MintAssetType;\n onChange: (type: MintAssetType) => void;\n editionCount: string;\n onEditionCount: (count: string) => void;\n}) {\n return (\n <>\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">Asset Type</label>\n <div className=\"grid grid-cols-2 gap-3\">\n {ASSET_TYPES.map(({ value: type, icon: Icon, title, hint }) => (\n <button\n key={type}\n type=\"button\"\n onClick={() => onChange(type)}\n className={cn(\"flex items-start gap-3 rounded-xl border p-4 text-left transition-colors\",\n value === type ? \"border-brand-blue bg-brand-blue/5\" : \"border-border hover:bg-muted/40\")}\n >\n <Icon className={cn(\"h-5 w-5 shrink-0 mt-0.5\", value === type ? \"text-brand-blue\" : \"text-muted-foreground\")} />\n <span>\n <span className=\"block text-sm font-semibold\">{title}</span>\n <span className=\"block text-xs mt-0.5 text-muted-foreground\">{hint}</span>\n </span>\n </button>\n ))}\n </div>\n </div>\n\n {value === \"editions\" && (\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">Number of copies</label>\n <Input\n type=\"number\"\n min={1}\n value={editionCount}\n onChange={(e) => onEditionCount(e.target.value)}\n className=\"max-w-[140px]\"\n />\n </div>\n )}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqCM;AAlCN,mBAAkB;AAClB,0BAA4F;AAC5F,mBAAsB;AACtB,0BAA6B;AAE7B,2BAA0B;AAC1B,gBAAmB;AAInB,MAAM,kBAAuD;AAAA,EAC3D,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,UAAU;AACZ;AAEO,SAAS,SAAS;AAAA,EACvB;AAAA,EAAM;AAAA,EAAM;AAAA,EAAS;AAAA,EAAK;AAAA,EAAW;AAAA,EAAQ;AAAA,EAAU;AACzD,GASG;AACD,QAAM,WAAW,gBAAgB,IAAI;AACrC,QAAM,WAAW,iCAAa,MAAM;AACpC,QAAM,eAAe,SAAS;AAC9B,SACE,6CAAC,SAAI,WAAU,+DACb;AAAA,iDAAC,SAAI,WAAU,mEACZ;AAAA,eAAS,WAAW,UACnB,4CAAC,aAAAA,SAAA,EAAM,KA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AA,UAEC,MAAK;AAAA,UACL,SAAS,MAAM,SAAS,IAAI;AAAA,UAC5B,eAAW;AAAA,YAAG;AAAA,YACZ,UAAU,OAAO,sCAAsC;AAAA,UAAiC;AAAA,UAE1F;AAAA,wDAAC,QAAK,eAAW,cAAG,2BAA2B,UAAU,OAAO,oBAAoB,uBAAuB,GAAG;AAAA,YAC9G,6CAAC,UACC;AAAA,0DAAC,UAAK,WAAU,+BAA+B,iBAAM;AAAA,cACrD,4CAAC,UAAK,WAAU,8CAA8C,gBAAK;AAAA,eACrE;AAAA;AAAA;AAAA,QAVK;AAAA,MAWP,CACD,GACH;AAAA,OACF;AAAA,IAEC,UAAU,cACT,6CAAC,SAAI,WAAU,aACb;AAAA,kDAAC,WAAM,WAAU,uBAAsB,8BAAgB;AAAA,MACvD;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,KAAK;AAAA,UACL,OAAO;AAAA,UACP,UAAU,CAAC,MAAM,eAAe,EAAE,OAAO,KAAK;AAAA,UAC9C,WAAU;AAAA;AAAA,MACZ;AAAA,OACF;AAAA,KAEJ;AAEJ;","names":["Image","SingleIcon"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { RefObject } from 'react';
|
|
3
|
+
import { IPType } from '../../data/ip.cjs';
|
|
4
|
+
import { MintAssetType } from './mintable-collections.cjs';
|
|
5
|
+
import { MediaKind } from './types.cjs';
|
|
6
|
+
import '@medialane/sdk';
|
|
7
|
+
import 'starknet';
|
|
8
|
+
import '@medialane/sdk/starknet';
|
|
9
|
+
|
|
10
|
+
declare function MediaRow({ file, kind, preview, uri, uploading, ipType, inputRef, onSelect, }: {
|
|
11
|
+
file: File;
|
|
12
|
+
kind: MediaKind;
|
|
13
|
+
preview: string | null;
|
|
14
|
+
uri: string | null;
|
|
15
|
+
uploading: boolean;
|
|
16
|
+
ipType: IPType;
|
|
17
|
+
inputRef: RefObject<HTMLInputElement | null>;
|
|
18
|
+
onSelect: (file: File) => void;
|
|
19
|
+
}): react_jsx_runtime.JSX.Element;
|
|
20
|
+
declare function CoverUpload({ preview, uploading, inputRef, onSelect, }: {
|
|
21
|
+
preview: string | null;
|
|
22
|
+
uploading: boolean;
|
|
23
|
+
inputRef: RefObject<HTMLInputElement | null>;
|
|
24
|
+
onSelect: (file: File) => void;
|
|
25
|
+
}): react_jsx_runtime.JSX.Element;
|
|
26
|
+
declare function AssetTypePicker({ value, onChange, editionCount, onEditionCount, }: {
|
|
27
|
+
value: MintAssetType;
|
|
28
|
+
onChange: (type: MintAssetType) => void;
|
|
29
|
+
editionCount: string;
|
|
30
|
+
onEditionCount: (count: string) => void;
|
|
31
|
+
}): react_jsx_runtime.JSX.Element;
|
|
32
|
+
|
|
33
|
+
export { AssetTypePicker, CoverUpload, MediaRow };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { RefObject } from 'react';
|
|
3
|
+
import { IPType } from '../../data/ip.js';
|
|
4
|
+
import { MintAssetType } from './mintable-collections.js';
|
|
5
|
+
import { MediaKind } from './types.js';
|
|
6
|
+
import '@medialane/sdk';
|
|
7
|
+
import 'starknet';
|
|
8
|
+
import '@medialane/sdk/starknet';
|
|
9
|
+
|
|
10
|
+
declare function MediaRow({ file, kind, preview, uri, uploading, ipType, inputRef, onSelect, }: {
|
|
11
|
+
file: File;
|
|
12
|
+
kind: MediaKind;
|
|
13
|
+
preview: string | null;
|
|
14
|
+
uri: string | null;
|
|
15
|
+
uploading: boolean;
|
|
16
|
+
ipType: IPType;
|
|
17
|
+
inputRef: RefObject<HTMLInputElement | null>;
|
|
18
|
+
onSelect: (file: File) => void;
|
|
19
|
+
}): react_jsx_runtime.JSX.Element;
|
|
20
|
+
declare function CoverUpload({ preview, uploading, inputRef, onSelect, }: {
|
|
21
|
+
preview: string | null;
|
|
22
|
+
uploading: boolean;
|
|
23
|
+
inputRef: RefObject<HTMLInputElement | null>;
|
|
24
|
+
onSelect: (file: File) => void;
|
|
25
|
+
}): react_jsx_runtime.JSX.Element;
|
|
26
|
+
declare function AssetTypePicker({ value, onChange, editionCount, onEditionCount, }: {
|
|
27
|
+
value: MintAssetType;
|
|
28
|
+
onChange: (type: MintAssetType) => void;
|
|
29
|
+
editionCount: string;
|
|
30
|
+
onEditionCount: (count: string) => void;
|
|
31
|
+
}): react_jsx_runtime.JSX.Element;
|
|
32
|
+
|
|
33
|
+
export { AssetTypePicker, CoverUpload, MediaRow };
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import Image from "next/image";
|
|
4
|
+
import { FileText, ImagePlus, ImagePlus as SingleIcon, Layers, Loader2, Music, Video } from "lucide-react";
|
|
5
|
+
import { Input } from "../input.js";
|
|
6
|
+
import { IP_TEMPLATES } from "../../data/ip-templates.js";
|
|
7
|
+
import { acceptFor } from "../../utils/upload-limits.js";
|
|
8
|
+
import { cn } from "../../utils/cn.js";
|
|
9
|
+
const MEDIA_KIND_ICON = {
|
|
10
|
+
image: ImagePlus,
|
|
11
|
+
audio: Music,
|
|
12
|
+
video: Video,
|
|
13
|
+
document: FileText
|
|
14
|
+
};
|
|
15
|
+
function MediaRow({
|
|
16
|
+
file,
|
|
17
|
+
kind,
|
|
18
|
+
preview,
|
|
19
|
+
uri,
|
|
20
|
+
uploading,
|
|
21
|
+
ipType,
|
|
22
|
+
inputRef,
|
|
23
|
+
onSelect
|
|
24
|
+
}) {
|
|
25
|
+
const KindIcon = MEDIA_KIND_ICON[kind];
|
|
26
|
+
const template = IP_TEMPLATES[ipType];
|
|
27
|
+
const TemplateIcon = template.icon;
|
|
28
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 rounded-xl border border-border p-3", children: [
|
|
29
|
+
/* @__PURE__ */ jsxs("div", { className: "relative h-14 w-14 rounded-lg bg-muted overflow-hidden shrink-0", children: [
|
|
30
|
+
kind === "image" && preview ? /* @__PURE__ */ jsx(Image, { src: preview, alt: "", fill: true, className: "object-cover", unoptimized: true }) : /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx(KindIcon, { className: "h-6 w-6 text-muted-foreground" }) }),
|
|
31
|
+
uploading && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-background/70", children: /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }) })
|
|
32
|
+
] }),
|
|
33
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 space-y-1", children: [
|
|
34
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-semibold truncate", children: file.name }),
|
|
35
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
|
|
36
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: uploading ? "Uploading\u2026" : uri ? "Uploaded" : "Upload failed" }),
|
|
37
|
+
uri && /* @__PURE__ */ jsxs(
|
|
38
|
+
"span",
|
|
39
|
+
{
|
|
40
|
+
className: cn(
|
|
41
|
+
"inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 text-2xs font-medium",
|
|
42
|
+
template.color.bg,
|
|
43
|
+
template.color.text,
|
|
44
|
+
template.color.border
|
|
45
|
+
),
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ jsx(TemplateIcon, { className: "h-3 w-3" }),
|
|
48
|
+
template.label
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
] })
|
|
53
|
+
] }),
|
|
54
|
+
/* @__PURE__ */ jsx(
|
|
55
|
+
"button",
|
|
56
|
+
{
|
|
57
|
+
type: "button",
|
|
58
|
+
onClick: () => inputRef.current?.click(),
|
|
59
|
+
className: "text-xs font-semibold text-brand-blue hover:underline shrink-0",
|
|
60
|
+
children: "Change"
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
/* @__PURE__ */ jsx("input", { ref: inputRef, type: "file", className: "hidden", onChange: (e) => {
|
|
64
|
+
const f = e.target.files?.[0];
|
|
65
|
+
if (f) onSelect(f);
|
|
66
|
+
} })
|
|
67
|
+
] });
|
|
68
|
+
}
|
|
69
|
+
function CoverUpload({
|
|
70
|
+
preview,
|
|
71
|
+
uploading,
|
|
72
|
+
inputRef,
|
|
73
|
+
onSelect
|
|
74
|
+
}) {
|
|
75
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
76
|
+
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Upload a cover image for your asset *" }),
|
|
77
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
78
|
+
/* @__PURE__ */ jsxs(
|
|
79
|
+
"div",
|
|
80
|
+
{
|
|
81
|
+
role: "button",
|
|
82
|
+
tabIndex: 0,
|
|
83
|
+
onClick: () => !uploading && inputRef.current?.click(),
|
|
84
|
+
onKeyDown: (e) => {
|
|
85
|
+
if ((e.key === "Enter" || e.key === " ") && !uploading) {
|
|
86
|
+
e.preventDefault();
|
|
87
|
+
inputRef.current?.click();
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
className: "relative h-20 w-20 rounded-xl border-2 border-dashed border-border bg-muted flex items-center justify-center overflow-hidden shrink-0 cursor-pointer hover:border-primary/50 transition-colors",
|
|
91
|
+
children: [
|
|
92
|
+
preview ? /* @__PURE__ */ jsx(Image, { src: preview, alt: "", fill: true, className: "object-cover", unoptimized: true }) : /* @__PURE__ */ jsx(ImagePlus, { className: "h-6 w-6 text-muted-foreground" }),
|
|
93
|
+
uploading && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-background/70", children: /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }) }),
|
|
94
|
+
/* @__PURE__ */ jsx("input", { ref: inputRef, type: "file", accept: acceptFor("image"), className: "hidden", onChange: (e) => {
|
|
95
|
+
const f = e.target.files?.[0];
|
|
96
|
+
if (f) onSelect(f);
|
|
97
|
+
} })
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Cover art shown wherever the work is previewed. JPG, PNG, GIF, SVG or WebP." })
|
|
102
|
+
] })
|
|
103
|
+
] });
|
|
104
|
+
}
|
|
105
|
+
const ASSET_TYPES = [
|
|
106
|
+
{ value: "single", icon: SingleIcon, title: "Single Edition NFT", hint: "Minted once" },
|
|
107
|
+
{ value: "editions", icon: Layers, title: "Limited Editions NFT", hint: "Several numbered copies" }
|
|
108
|
+
];
|
|
109
|
+
function AssetTypePicker({
|
|
110
|
+
value,
|
|
111
|
+
onChange,
|
|
112
|
+
editionCount,
|
|
113
|
+
onEditionCount
|
|
114
|
+
}) {
|
|
115
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
116
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
117
|
+
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Asset Type" }),
|
|
118
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-3", children: ASSET_TYPES.map(({ value: type, icon: Icon, title, hint }) => /* @__PURE__ */ jsxs(
|
|
119
|
+
"button",
|
|
120
|
+
{
|
|
121
|
+
type: "button",
|
|
122
|
+
onClick: () => onChange(type),
|
|
123
|
+
className: cn(
|
|
124
|
+
"flex items-start gap-3 rounded-xl border p-4 text-left transition-colors",
|
|
125
|
+
value === type ? "border-brand-blue bg-brand-blue/5" : "border-border hover:bg-muted/40"
|
|
126
|
+
),
|
|
127
|
+
children: [
|
|
128
|
+
/* @__PURE__ */ jsx(Icon, { className: cn("h-5 w-5 shrink-0 mt-0.5", value === type ? "text-brand-blue" : "text-muted-foreground") }),
|
|
129
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
130
|
+
/* @__PURE__ */ jsx("span", { className: "block text-sm font-semibold", children: title }),
|
|
131
|
+
/* @__PURE__ */ jsx("span", { className: "block text-xs mt-0.5 text-muted-foreground", children: hint })
|
|
132
|
+
] })
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
type
|
|
136
|
+
)) })
|
|
137
|
+
] }),
|
|
138
|
+
value === "editions" && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
139
|
+
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Number of copies" }),
|
|
140
|
+
/* @__PURE__ */ jsx(
|
|
141
|
+
Input,
|
|
142
|
+
{
|
|
143
|
+
type: "number",
|
|
144
|
+
min: 1,
|
|
145
|
+
value: editionCount,
|
|
146
|
+
onChange: (e) => onEditionCount(e.target.value),
|
|
147
|
+
className: "max-w-[140px]"
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
] })
|
|
151
|
+
] });
|
|
152
|
+
}
|
|
153
|
+
export {
|
|
154
|
+
AssetTypePicker,
|
|
155
|
+
CoverUpload,
|
|
156
|
+
MediaRow
|
|
157
|
+
};
|
|
158
|
+
//# sourceMappingURL=asset-form-parts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/fast-mint/asset-form-parts.tsx"],"sourcesContent":["\"use client\";\n\nimport type { RefObject } from \"react\";\nimport Image from \"next/image\";\nimport { FileText, ImagePlus, ImagePlus as SingleIcon, Layers, Loader2, Music, Video } from \"lucide-react\";\nimport { Input } from \"../input.js\";\nimport { IP_TEMPLATES } from \"../../data/ip-templates.js\";\nimport type { IPType } from \"../../data/ip.js\";\nimport { acceptFor } from \"../../utils/upload-limits.js\";\nimport { cn } from \"../../utils/cn.js\";\nimport type { MintAssetType } from \"./mintable-collections.js\";\nimport type { MediaKind } from \"./types.js\";\n\nconst MEDIA_KIND_ICON: Record<MediaKind, typeof ImagePlus> = {\n image: ImagePlus,\n audio: Music,\n video: Video,\n document: FileText,\n};\n\nexport function MediaRow({\n file, kind, preview, uri, uploading, ipType, inputRef, onSelect,\n}: {\n file: File;\n kind: MediaKind;\n preview: string | null;\n uri: string | null;\n uploading: boolean;\n ipType: IPType;\n inputRef: RefObject<HTMLInputElement | null>;\n onSelect: (file: File) => void;\n}) {\n const KindIcon = MEDIA_KIND_ICON[kind];\n const template = IP_TEMPLATES[ipType];\n const TemplateIcon = template.icon;\n return (\n <div className=\"flex items-center gap-4 rounded-xl border border-border p-3\">\n <div className=\"relative h-14 w-14 rounded-lg bg-muted overflow-hidden shrink-0\">\n {kind === \"image\" && preview ? (\n <Image src={preview} alt=\"\" fill className=\"object-cover\" unoptimized />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n <KindIcon className=\"h-6 w-6 text-muted-foreground\" />\n </div>\n )}\n {uploading && (\n <div className=\"absolute inset-0 flex items-center justify-center bg-background/70\">\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n </div>\n )}\n </div>\n <div className=\"min-w-0 flex-1 space-y-1\">\n <p className=\"text-sm font-semibold truncate\">{file.name}</p>\n <div className=\"flex items-center gap-2 flex-wrap\">\n <p className=\"text-xs text-muted-foreground\">\n {uploading ? \"Uploading…\" : uri ? \"Uploaded\" : \"Upload failed\"}\n </p>\n {uri && (\n <span\n className={cn(\n \"inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 text-2xs font-medium\",\n template.color.bg, template.color.text, template.color.border\n )}\n >\n <TemplateIcon className=\"h-3 w-3\" />\n {template.label}\n </span>\n )}\n </div>\n </div>\n <button\n type=\"button\"\n onClick={() => inputRef.current?.click()}\n className=\"text-xs font-semibold text-brand-blue hover:underline shrink-0\"\n >\n Change\n </button>\n <input ref={inputRef} type=\"file\" className=\"hidden\" onChange={(e) => { const f = e.target.files?.[0]; if (f) onSelect(f); }} />\n </div>\n );\n}\n\nexport function CoverUpload({\n preview, uploading, inputRef, onSelect,\n}: {\n preview: string | null;\n uploading: boolean;\n inputRef: RefObject<HTMLInputElement | null>;\n onSelect: (file: File) => void;\n}) {\n return (\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">Upload a cover image for your asset *</label>\n <div className=\"flex items-center gap-4\">\n <div\n role=\"button\"\n tabIndex={0}\n onClick={() => !uploading && inputRef.current?.click()}\n onKeyDown={(e) => { if ((e.key === \"Enter\" || e.key === \" \") && !uploading) { e.preventDefault(); inputRef.current?.click(); } }}\n className=\"relative h-20 w-20 rounded-xl border-2 border-dashed border-border bg-muted flex items-center justify-center overflow-hidden shrink-0 cursor-pointer hover:border-primary/50 transition-colors\"\n >\n {preview ? (\n <Image src={preview} alt=\"\" fill className=\"object-cover\" unoptimized />\n ) : (\n <ImagePlus className=\"h-6 w-6 text-muted-foreground\" />\n )}\n {uploading && (\n <div className=\"absolute inset-0 flex items-center justify-center bg-background/70\">\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n </div>\n )}\n <input ref={inputRef} type=\"file\" accept={acceptFor(\"image\")} className=\"hidden\" onChange={(e) => { const f = e.target.files?.[0]; if (f) onSelect(f); }} />\n </div>\n <p className=\"text-xs text-muted-foreground\">Cover art shown wherever the work is previewed. JPG, PNG, GIF, SVG or WebP.</p>\n </div>\n </div>\n );\n}\n\nconst ASSET_TYPES = [\n { value: \"single\", icon: SingleIcon, title: \"Single Edition NFT\", hint: \"Minted once\" },\n { value: \"editions\", icon: Layers, title: \"Limited Editions NFT\", hint: \"Several numbered copies\" },\n] as const;\n\nexport function AssetTypePicker({\n value, onChange, editionCount, onEditionCount,\n}: {\n value: MintAssetType;\n onChange: (type: MintAssetType) => void;\n editionCount: string;\n onEditionCount: (count: string) => void;\n}) {\n return (\n <>\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">Asset Type</label>\n <div className=\"grid grid-cols-2 gap-3\">\n {ASSET_TYPES.map(({ value: type, icon: Icon, title, hint }) => (\n <button\n key={type}\n type=\"button\"\n onClick={() => onChange(type)}\n className={cn(\"flex items-start gap-3 rounded-xl border p-4 text-left transition-colors\",\n value === type ? \"border-brand-blue bg-brand-blue/5\" : \"border-border hover:bg-muted/40\")}\n >\n <Icon className={cn(\"h-5 w-5 shrink-0 mt-0.5\", value === type ? \"text-brand-blue\" : \"text-muted-foreground\")} />\n <span>\n <span className=\"block text-sm font-semibold\">{title}</span>\n <span className=\"block text-xs mt-0.5 text-muted-foreground\">{hint}</span>\n </span>\n </button>\n ))}\n </div>\n </div>\n\n {value === \"editions\" && (\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">Number of copies</label>\n <Input\n type=\"number\"\n min={1}\n value={editionCount}\n onChange={(e) => onEditionCount(e.target.value)}\n className=\"max-w-[140px]\"\n />\n </div>\n )}\n </>\n );\n}\n"],"mappings":";AAqCM,SAgGF,UA9FM,KAFJ;AAlCN,OAAO,WAAW;AAClB,SAAS,UAAU,WAAW,aAAa,YAAY,QAAQ,SAAS,OAAO,aAAa;AAC5F,SAAS,aAAa;AACtB,SAAS,oBAAoB;AAE7B,SAAS,iBAAiB;AAC1B,SAAS,UAAU;AAInB,MAAM,kBAAuD;AAAA,EAC3D,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,UAAU;AACZ;AAEO,SAAS,SAAS;AAAA,EACvB;AAAA,EAAM;AAAA,EAAM;AAAA,EAAS;AAAA,EAAK;AAAA,EAAW;AAAA,EAAQ;AAAA,EAAU;AACzD,GASG;AACD,QAAM,WAAW,gBAAgB,IAAI;AACrC,QAAM,WAAW,aAAa,MAAM;AACpC,QAAM,eAAe,SAAS;AAC9B,SACE,qBAAC,SAAI,WAAU,+DACb;AAAA,yBAAC,SAAI,WAAU,mEACZ;AAAA,eAAS,WAAW,UACnB,oBAAC,SAAM,KAAK,SAAS,KAAI,IAAG,MAAI,MAAC,WAAU,gBAAe,aAAW,MAAC,IAEtE,oBAAC,SAAI,WAAU,qDACb,8BAAC,YAAS,WAAU,iCAAgC,GACtD;AAAA,MAED,aACC,oBAAC,SAAI,WAAU,sEACb,8BAAC,WAAQ,WAA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