@medialane/ui 0.391.0 → 0.393.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/button.d.cts +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/components/create-form-primitives.cjs +6 -1
- package/dist/components/create-form-primitives.cjs.map +1 -1
- package/dist/components/create-form-primitives.js +6 -1
- package/dist/components/create-form-primitives.js.map +1 -1
- package/dist/components/drop/create/asset-editor.cjs +164 -0
- package/dist/components/drop/create/asset-editor.cjs.map +1 -0
- package/dist/components/drop/create/asset-editor.d.cts +17 -0
- package/dist/components/drop/create/asset-editor.d.ts +17 -0
- package/dist/components/drop/create/asset-editor.js +140 -0
- package/dist/components/drop/create/asset-editor.js.map +1 -0
- package/dist/components/drop/create/assets-panel.cjs +269 -0
- package/dist/components/drop/create/assets-panel.cjs.map +1 -0
- package/dist/components/drop/create/assets-panel.d.cts +11 -0
- package/dist/components/drop/create/assets-panel.d.ts +11 -0
- package/dist/components/drop/create/assets-panel.js +245 -0
- package/dist/components/drop/create/assets-panel.js.map +1 -0
- package/dist/components/drop/create/collection-panel.cjs +138 -0
- package/dist/components/drop/create/collection-panel.cjs.map +1 -0
- package/dist/components/drop/create/collection-panel.d.cts +12 -0
- package/dist/components/drop/create/collection-panel.d.ts +12 -0
- package/dist/components/drop/create/collection-panel.js +113 -0
- package/dist/components/drop/create/collection-panel.js.map +1 -0
- package/dist/components/drop/create/drop-create.cjs +57 -112
- package/dist/components/drop/create/drop-create.cjs.map +1 -1
- package/dist/components/drop/create/drop-create.d.cts +6 -12
- package/dist/components/drop/create/drop-create.d.ts +6 -12
- package/dist/components/drop/create/drop-create.js +60 -112
- package/dist/components/drop/create/drop-create.js.map +1 -1
- package/dist/components/drop/create/drop-fields.cjs +40 -144
- package/dist/components/drop/create/drop-fields.cjs.map +1 -1
- package/dist/components/drop/create/drop-fields.d.cts +5 -17
- package/dist/components/drop/create/drop-fields.d.ts +5 -17
- package/dist/components/drop/create/drop-fields.js +40 -131
- package/dist/components/drop/create/drop-fields.js.map +1 -1
- package/dist/components/drop/create/drop-panel.cjs +57 -0
- package/dist/components/drop/create/drop-panel.cjs.map +1 -0
- package/dist/components/drop/create/drop-panel.d.cts +25 -0
- package/dist/components/drop/create/drop-panel.d.ts +25 -0
- package/dist/components/drop/create/drop-panel.js +33 -0
- package/dist/components/drop/create/drop-panel.js.map +1 -0
- package/dist/components/drop/create/launch-dialog.cjs +40 -45
- package/dist/components/drop/create/launch-dialog.cjs.map +1 -1
- package/dist/components/drop/create/launch-dialog.d.cts +4 -5
- package/dist/components/drop/create/launch-dialog.d.ts +4 -5
- package/dist/components/drop/create/launch-dialog.js +44 -49
- package/dist/components/drop/create/launch-dialog.js.map +1 -1
- package/dist/components/drop/create/settings-panel.cjs +97 -0
- package/dist/components/drop/create/settings-panel.cjs.map +1 -0
- package/dist/components/drop/create/settings-panel.d.cts +11 -0
- package/dist/components/drop/create/settings-panel.d.ts +11 -0
- package/dist/components/drop/create/settings-panel.js +73 -0
- package/dist/components/drop/create/settings-panel.js.map +1 -0
- package/dist/components/drop/drop-features.cjs +3 -3
- package/dist/components/drop/drop-features.cjs.map +1 -1
- package/dist/components/drop/drop-features.js +3 -3
- package/dist/components/drop/drop-features.js.map +1 -1
- package/dist/components/drop/drop-status.d.cts +1 -0
- package/dist/components/drop/drop-status.d.ts +1 -0
- package/dist/components/drop/page/drop-action-box.cjs +4 -4
- package/dist/components/drop/page/drop-action-box.cjs.map +1 -1
- package/dist/components/drop/page/drop-action-box.d.cts +1 -0
- package/dist/components/drop/page/drop-action-box.d.ts +1 -0
- package/dist/components/drop/page/drop-action-box.js +4 -4
- package/dist/components/drop/page/drop-action-box.js.map +1 -1
- package/dist/components/drop/page/drop-mint-dialog.cjs +1 -1
- package/dist/components/drop/page/drop-mint-dialog.cjs.map +1 -1
- package/dist/components/drop/page/drop-mint-dialog.d.cts +2 -1
- package/dist/components/drop/page/drop-mint-dialog.d.ts +2 -1
- package/dist/components/drop/page/drop-mint-dialog.js +1 -1
- package/dist/components/drop/page/drop-mint-dialog.js.map +1 -1
- package/dist/components/drop/page/drop-page.cjs +4 -8
- package/dist/components/drop/page/drop-page.cjs.map +1 -1
- package/dist/components/drop/page/drop-page.js +5 -9
- package/dist/components/drop/page/drop-page.js.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/launchpad/edition-mint-schema.d.cts +4 -4
- package/dist/components/launchpad/edition-mint-schema.d.ts +4 -4
- package/dist/draft-B0fPlVZS.d.ts +86 -0
- package/dist/draft-Bw3JWkOZ.d.cts +86 -0
- package/dist/i18n/catalog/pt.cjs +78 -28
- package/dist/i18n/catalog/pt.cjs.map +1 -1
- package/dist/i18n/catalog/pt.js +78 -28
- package/dist/i18n/catalog/pt.js.map +1 -1
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +1 -1
- package/dist/i18n/index.d.ts +1 -1
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/translate.cjs.map +1 -1
- package/dist/i18n/translate.d.cts +5 -1
- package/dist/i18n/translate.d.ts +5 -1
- package/dist/i18n/translate.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js.map +1 -1
- package/dist/utils/drop/draft-store.cjs +133 -0
- package/dist/utils/drop/draft-store.cjs.map +1 -0
- package/dist/utils/drop/draft-store.d.cts +23 -0
- package/dist/utils/drop/draft-store.d.ts +23 -0
- package/dist/utils/drop/draft-store.js +107 -0
- package/dist/utils/drop/draft-store.js.map +1 -0
- package/dist/utils/drop/draft.cjs +62 -38
- package/dist/utils/drop/draft.cjs.map +1 -1
- package/dist/utils/drop/draft.d.cts +2 -38
- package/dist/utils/drop/draft.d.ts +2 -38
- package/dist/utils/drop/draft.js +58 -37
- package/dist/utils/drop/draft.js.map +1 -1
- package/dist/utils/drop/metadata.cjs +35 -16
- package/dist/utils/drop/metadata.cjs.map +1 -1
- package/dist/utils/drop/metadata.d.cts +4 -28
- package/dist/utils/drop/metadata.d.ts +4 -28
- package/dist/utils/drop/metadata.js +33 -15
- package/dist/utils/drop/metadata.js.map +1 -1
- package/dist/utils/drop/sale.cjs +10 -9
- package/dist/utils/drop/sale.cjs.map +1 -1
- package/dist/utils/drop/sale.d.cts +3 -2
- package/dist/utils/drop/sale.d.ts +3 -2
- package/dist/utils/drop/sale.js +10 -9
- package/dist/utils/drop/sale.js.map +1 -1
- package/dist/utils/drop/view.cjs +15 -13
- package/dist/utils/drop/view.cjs.map +1 -1
- package/dist/utils/drop/view.d.cts +6 -4
- package/dist/utils/drop/view.d.ts +6 -4
- package/dist/utils/drop/view.js +15 -13
- package/dist/utils/drop/view.js.map +1 -1
- package/dist/utils/media-wallet/use-erc20-balance.d.cts +1 -1
- package/dist/utils/media-wallet/use-erc20-balance.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var collection_panel_exports = {};
|
|
21
|
+
__export(collection_panel_exports, {
|
|
22
|
+
CollectionPanel: () => CollectionPanel,
|
|
23
|
+
coverFile: () => coverFile
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(collection_panel_exports);
|
|
26
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
27
|
+
var import_react = require("react");
|
|
28
|
+
var import_lucide_react = require("lucide-react");
|
|
29
|
+
var import_button = require("../../button.js");
|
|
30
|
+
var import_input = require("../../input.js");
|
|
31
|
+
var import_textarea = require("../../textarea.js");
|
|
32
|
+
var import_drop_panel = require("./drop-panel.js");
|
|
33
|
+
var import_drop_fields = require("./drop-fields.js");
|
|
34
|
+
var import_preview = require("../../../utils/drop/preview.js");
|
|
35
|
+
var import_upload_limits = require("../../../utils/upload-limits.js");
|
|
36
|
+
var import_field_limits = require("../../../utils/field-limits.js");
|
|
37
|
+
var import_provider = require("../../../i18n/provider.js");
|
|
38
|
+
function coverFile(draft) {
|
|
39
|
+
return draft.collection.cover ?? draft.assets[0]?.file ?? null;
|
|
40
|
+
}
|
|
41
|
+
function CollectionPanel({ draft, setDraft, errors, open, onToggle }) {
|
|
42
|
+
const t = (0, import_provider.useT)();
|
|
43
|
+
const [coverError, setCoverError] = (0, import_react.useState)(null);
|
|
44
|
+
const collection = draft.collection;
|
|
45
|
+
const set = (patch) => setDraft({ collection: { ...collection, ...patch } });
|
|
46
|
+
const cover = coverFile(draft);
|
|
47
|
+
const name = collection.name.trim();
|
|
48
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
49
|
+
import_drop_panel.DropPanel,
|
|
50
|
+
{
|
|
51
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Layers, {}),
|
|
52
|
+
title: t("Collection"),
|
|
53
|
+
open,
|
|
54
|
+
onToggle,
|
|
55
|
+
error: errors.collection.name ?? errors.collection.externalUrl,
|
|
56
|
+
summary: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "flex items-center gap-2.5", children: [
|
|
57
|
+
cover && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { src: (0, import_preview.previewUrl)(cover), alt: "", className: "h-6 w-6 rounded-md object-cover" }),
|
|
58
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "truncate", children: name || t("Name the collection") })
|
|
59
|
+
] }),
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
62
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid h-24 w-24 shrink-0 place-items-center overflow-hidden rounded-xl bg-muted", children: cover ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { src: (0, import_preview.previewUrl)(cover), alt: t("Cover"), className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ImageIcon, { className: "h-6 w-6 text-muted-foreground" }) }),
|
|
63
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2", children: [
|
|
64
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm font-medium", children: t("Cover") }),
|
|
65
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-wrap gap-2", children: [
|
|
66
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { asChild: true, variant: "soft", size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "cursor-pointer", children: [
|
|
67
|
+
t("Choose cover"),
|
|
68
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
69
|
+
"input",
|
|
70
|
+
{
|
|
71
|
+
type: "file",
|
|
72
|
+
"data-testid": "cover-input",
|
|
73
|
+
accept: (0, import_upload_limits.acceptFor)("image"),
|
|
74
|
+
className: "hidden",
|
|
75
|
+
onChange: (e) => {
|
|
76
|
+
const file = e.target.files?.[0];
|
|
77
|
+
e.target.value = "";
|
|
78
|
+
if (!file) return;
|
|
79
|
+
const problem = (0, import_upload_limits.uploadError)(file);
|
|
80
|
+
setCoverError(problem);
|
|
81
|
+
if (!problem) set({ cover: file });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
] }) }),
|
|
86
|
+
collection.cover && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { type: "button", variant: "ghost", size: "sm", onClick: () => set({ cover: null }), children: t("Use first asset") })
|
|
87
|
+
] }),
|
|
88
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_drop_fields.FieldError, { message: coverError ? { text: coverError } : null })
|
|
89
|
+
] })
|
|
90
|
+
] }),
|
|
91
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_drop_fields.Field, { label: t("Name *"), htmlFor: "drop-name", children: [
|
|
92
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
93
|
+
import_input.Input,
|
|
94
|
+
{
|
|
95
|
+
id: "drop-name",
|
|
96
|
+
value: collection.name,
|
|
97
|
+
maxLength: import_field_limits.FIELD_LIMITS.name,
|
|
98
|
+
placeholder: t("Collection name"),
|
|
99
|
+
onChange: (e) => set({ name: e.target.value })
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_drop_fields.FieldError, { message: errors.collection.name })
|
|
103
|
+
] }),
|
|
104
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_drop_fields.Field, { label: t("Description"), htmlFor: "drop-description", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
105
|
+
import_textarea.Textarea,
|
|
106
|
+
{
|
|
107
|
+
id: "drop-description",
|
|
108
|
+
value: collection.description,
|
|
109
|
+
maxLength: import_field_limits.FIELD_LIMITS.description,
|
|
110
|
+
rows: 4,
|
|
111
|
+
placeholder: t("The story behind the collection\u2026"),
|
|
112
|
+
onChange: (e) => set({ description: e.target.value })
|
|
113
|
+
}
|
|
114
|
+
) }),
|
|
115
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_drop_fields.Field, { label: t("External link"), htmlFor: "drop-link", children: [
|
|
116
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
117
|
+
import_input.Input,
|
|
118
|
+
{
|
|
119
|
+
id: "drop-link",
|
|
120
|
+
type: "url",
|
|
121
|
+
inputMode: "url",
|
|
122
|
+
value: collection.externalUrl,
|
|
123
|
+
placeholder: "https://",
|
|
124
|
+
onChange: (e) => set({ externalUrl: e.target.value.trim() })
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_drop_fields.FieldError, { message: errors.collection.externalUrl })
|
|
128
|
+
] })
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
134
|
+
0 && (module.exports = {
|
|
135
|
+
CollectionPanel,
|
|
136
|
+
coverFile
|
|
137
|
+
});
|
|
138
|
+
//# sourceMappingURL=collection-panel.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/drop/create/collection-panel.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { ImageIcon, Layers } from \"lucide-react\";\nimport { Button } from \"../../button.js\";\nimport { Input } from \"../../input.js\";\nimport { Textarea } from \"../../textarea.js\";\nimport { DropPanel, type PanelProps } from \"./drop-panel.js\";\nimport { Field, FieldError } from \"./drop-fields.js\";\nimport type { DropDraft } from \"../../../utils/drop/draft.js\";\nimport { previewUrl } from \"../../../utils/drop/preview.js\";\nimport { acceptFor, uploadError } from \"../../../utils/upload-limits.js\";\nimport { FIELD_LIMITS } from \"../../../utils/field-limits.js\";\nimport { useT } from \"../../../i18n/provider.js\";\n\nexport function coverFile(draft: DropDraft): File | null {\n return draft.collection.cover ?? draft.assets[0]?.file ?? null;\n}\n\nexport function CollectionPanel({ draft, setDraft, errors, open, onToggle }: PanelProps) {\n const t = useT();\n const [coverError, setCoverError] = useState<string | null>(null);\n const collection = draft.collection;\n const set = (patch: Partial<DropDraft[\"collection\"]>) => setDraft({ collection: { ...collection, ...patch } });\n const cover = coverFile(draft);\n const name = collection.name.trim();\n\n return (\n <DropPanel\n icon={<Layers />}\n title={t(\"Collection\")}\n open={open}\n onToggle={onToggle}\n error={errors.collection.name ?? errors.collection.externalUrl}\n summary={\n <span className=\"flex items-center gap-2.5\">\n {cover && <img src={previewUrl(cover)} alt=\"\" className=\"h-6 w-6 rounded-md object-cover\" />}\n <span className=\"truncate\">{name || t(\"Name the collection\")}</span>\n </span>\n }\n >\n <div className=\"flex items-center gap-4\">\n <div className=\"grid h-24 w-24 shrink-0 place-items-center overflow-hidden rounded-xl bg-muted\">\n {cover\n ? <img src={previewUrl(cover)} alt={t(\"Cover\")} className=\"h-full w-full object-cover\" />\n : <ImageIcon className=\"h-6 w-6 text-muted-foreground\" />}\n </div>\n <div className=\"space-y-2\">\n <p className=\"text-sm font-medium\">{t(\"Cover\")}</p>\n <div className=\"flex flex-wrap gap-2\">\n <Button asChild variant=\"soft\" size=\"sm\">\n <label className=\"cursor-pointer\">\n {t(\"Choose cover\")}\n <input type=\"file\" data-testid=\"cover-input\" accept={acceptFor(\"image\")} className=\"hidden\"\n onChange={(e) => {\n const file = e.target.files?.[0];\n e.target.value = \"\";\n if (!file) return;\n const problem = uploadError(file);\n setCoverError(problem);\n if (!problem) set({ cover: file });\n }} />\n </label>\n </Button>\n {collection.cover && (\n <Button type=\"button\" variant=\"ghost\" size=\"sm\" onClick={() => set({ cover: null })}>{t(\"Use first asset\")}</Button>\n )}\n </div>\n <FieldError message={coverError ? { text: coverError } : null} />\n </div>\n </div>\n <Field label={t(\"Name *\")} htmlFor=\"drop-name\">\n <Input id=\"drop-name\" value={collection.name} maxLength={FIELD_LIMITS.name} placeholder={t(\"Collection name\")}\n onChange={(e) => set({ name: e.target.value })} />\n <FieldError message={errors.collection.name} />\n </Field>\n <Field label={t(\"Description\")} htmlFor=\"drop-description\">\n <Textarea id=\"drop-description\" value={collection.description} maxLength={FIELD_LIMITS.description} rows={4}\n placeholder={t(\"The story behind the collection…\")}\n onChange={(e) => set({ description: e.target.value })} />\n </Field>\n <Field label={t(\"External link\")} htmlFor=\"drop-link\">\n <Input id=\"drop-link\" type=\"url\" inputMode=\"url\" value={collection.externalUrl} placeholder=\"https://\"\n onChange={(e) => set({ externalUrl: e.target.value.trim() })} />\n <FieldError message={errors.collection.externalUrl} />\n </Field>\n </DropPanel>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6BY;AA3BZ,mBAAyB;AACzB,0BAAkC;AAClC,oBAAuB;AACvB,mBAAsB;AACtB,sBAAyB;AACzB,wBAA2C;AAC3C,yBAAkC;AAElC,qBAA2B;AAC3B,2BAAuC;AACvC,0BAA6B;AAC7B,sBAAqB;AAEd,SAAS,UAAU,OAA+B;AACvD,SAAO,MAAM,WAAW,SAAS,MAAM,OAAO,CAAC,GAAG,QAAQ;AAC5D;AAEO,SAAS,gBAAgB,EAAE,OAAO,UAAU,QAAQ,MAAM,SAAS,GAAe;AACvF,QAAM,QAAI,sBAAK;AACf,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAwB,IAAI;AAChE,QAAM,aAAa,MAAM;AACzB,QAAM,MAAM,CAAC,UAA4C,SAAS,EAAE,YAAY,EAAE,GAAG,YAAY,GAAG,MAAM,EAAE,CAAC;AAC7G,QAAM,QAAQ,UAAU,KAAK;AAC7B,QAAM,OAAO,WAAW,KAAK,KAAK;AAElC,SACE;AAA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 -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { PanelProps } from './drop-panel.cjs';
|
|
3
|
+
import { a as DropDraft } from '../../../draft-Bw3JWkOZ.cjs';
|
|
4
|
+
import 'react';
|
|
5
|
+
import '../../../i18n/translate.cjs';
|
|
6
|
+
import '@medialane/sdk';
|
|
7
|
+
import '../../../utils/drop/sale.cjs';
|
|
8
|
+
|
|
9
|
+
declare function coverFile(draft: DropDraft): File | null;
|
|
10
|
+
declare function CollectionPanel({ draft, setDraft, errors, open, onToggle }: PanelProps): react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { CollectionPanel, coverFile };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { PanelProps } from './drop-panel.js';
|
|
3
|
+
import { a as DropDraft } from '../../../draft-B0fPlVZS.js';
|
|
4
|
+
import 'react';
|
|
5
|
+
import '../../../i18n/translate.js';
|
|
6
|
+
import '@medialane/sdk';
|
|
7
|
+
import '../../../utils/drop/sale.js';
|
|
8
|
+
|
|
9
|
+
declare function coverFile(draft: DropDraft): File | null;
|
|
10
|
+
declare function CollectionPanel({ draft, setDraft, errors, open, onToggle }: PanelProps): react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { CollectionPanel, coverFile };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { ImageIcon, Layers } from "lucide-react";
|
|
5
|
+
import { Button } from "../../button.js";
|
|
6
|
+
import { Input } from "../../input.js";
|
|
7
|
+
import { Textarea } from "../../textarea.js";
|
|
8
|
+
import { DropPanel } from "./drop-panel.js";
|
|
9
|
+
import { Field, FieldError } from "./drop-fields.js";
|
|
10
|
+
import { previewUrl } from "../../../utils/drop/preview.js";
|
|
11
|
+
import { acceptFor, uploadError } from "../../../utils/upload-limits.js";
|
|
12
|
+
import { FIELD_LIMITS } from "../../../utils/field-limits.js";
|
|
13
|
+
import { useT } from "../../../i18n/provider.js";
|
|
14
|
+
function coverFile(draft) {
|
|
15
|
+
return draft.collection.cover ?? draft.assets[0]?.file ?? null;
|
|
16
|
+
}
|
|
17
|
+
function CollectionPanel({ draft, setDraft, errors, open, onToggle }) {
|
|
18
|
+
const t = useT();
|
|
19
|
+
const [coverError, setCoverError] = useState(null);
|
|
20
|
+
const collection = draft.collection;
|
|
21
|
+
const set = (patch) => setDraft({ collection: { ...collection, ...patch } });
|
|
22
|
+
const cover = coverFile(draft);
|
|
23
|
+
const name = collection.name.trim();
|
|
24
|
+
return /* @__PURE__ */ jsxs(
|
|
25
|
+
DropPanel,
|
|
26
|
+
{
|
|
27
|
+
icon: /* @__PURE__ */ jsx(Layers, {}),
|
|
28
|
+
title: t("Collection"),
|
|
29
|
+
open,
|
|
30
|
+
onToggle,
|
|
31
|
+
error: errors.collection.name ?? errors.collection.externalUrl,
|
|
32
|
+
summary: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2.5", children: [
|
|
33
|
+
cover && /* @__PURE__ */ jsx("img", { src: previewUrl(cover), alt: "", className: "h-6 w-6 rounded-md object-cover" }),
|
|
34
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: name || t("Name the collection") })
|
|
35
|
+
] }),
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
38
|
+
/* @__PURE__ */ jsx("div", { className: "grid h-24 w-24 shrink-0 place-items-center overflow-hidden rounded-xl bg-muted", children: cover ? /* @__PURE__ */ jsx("img", { src: previewUrl(cover), alt: t("Cover"), className: "h-full w-full object-cover" }) : /* @__PURE__ */ jsx(ImageIcon, { className: "h-6 w-6 text-muted-foreground" }) }),
|
|
39
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
40
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: t("Cover") }),
|
|
41
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
42
|
+
/* @__PURE__ */ jsx(Button, { asChild: true, variant: "soft", size: "sm", children: /* @__PURE__ */ jsxs("label", { className: "cursor-pointer", children: [
|
|
43
|
+
t("Choose cover"),
|
|
44
|
+
/* @__PURE__ */ jsx(
|
|
45
|
+
"input",
|
|
46
|
+
{
|
|
47
|
+
type: "file",
|
|
48
|
+
"data-testid": "cover-input",
|
|
49
|
+
accept: acceptFor("image"),
|
|
50
|
+
className: "hidden",
|
|
51
|
+
onChange: (e) => {
|
|
52
|
+
const file = e.target.files?.[0];
|
|
53
|
+
e.target.value = "";
|
|
54
|
+
if (!file) return;
|
|
55
|
+
const problem = uploadError(file);
|
|
56
|
+
setCoverError(problem);
|
|
57
|
+
if (!problem) set({ cover: file });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
] }) }),
|
|
62
|
+
collection.cover && /* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: () => set({ cover: null }), children: t("Use first asset") })
|
|
63
|
+
] }),
|
|
64
|
+
/* @__PURE__ */ jsx(FieldError, { message: coverError ? { text: coverError } : null })
|
|
65
|
+
] })
|
|
66
|
+
] }),
|
|
67
|
+
/* @__PURE__ */ jsxs(Field, { label: t("Name *"), htmlFor: "drop-name", children: [
|
|
68
|
+
/* @__PURE__ */ jsx(
|
|
69
|
+
Input,
|
|
70
|
+
{
|
|
71
|
+
id: "drop-name",
|
|
72
|
+
value: collection.name,
|
|
73
|
+
maxLength: FIELD_LIMITS.name,
|
|
74
|
+
placeholder: t("Collection name"),
|
|
75
|
+
onChange: (e) => set({ name: e.target.value })
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
/* @__PURE__ */ jsx(FieldError, { message: errors.collection.name })
|
|
79
|
+
] }),
|
|
80
|
+
/* @__PURE__ */ jsx(Field, { label: t("Description"), htmlFor: "drop-description", children: /* @__PURE__ */ jsx(
|
|
81
|
+
Textarea,
|
|
82
|
+
{
|
|
83
|
+
id: "drop-description",
|
|
84
|
+
value: collection.description,
|
|
85
|
+
maxLength: FIELD_LIMITS.description,
|
|
86
|
+
rows: 4,
|
|
87
|
+
placeholder: t("The story behind the collection\u2026"),
|
|
88
|
+
onChange: (e) => set({ description: e.target.value })
|
|
89
|
+
}
|
|
90
|
+
) }),
|
|
91
|
+
/* @__PURE__ */ jsxs(Field, { label: t("External link"), htmlFor: "drop-link", children: [
|
|
92
|
+
/* @__PURE__ */ jsx(
|
|
93
|
+
Input,
|
|
94
|
+
{
|
|
95
|
+
id: "drop-link",
|
|
96
|
+
type: "url",
|
|
97
|
+
inputMode: "url",
|
|
98
|
+
value: collection.externalUrl,
|
|
99
|
+
placeholder: "https://",
|
|
100
|
+
onChange: (e) => set({ externalUrl: e.target.value.trim() })
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
/* @__PURE__ */ jsx(FieldError, { message: errors.collection.externalUrl })
|
|
104
|
+
] })
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
export {
|
|
110
|
+
CollectionPanel,
|
|
111
|
+
coverFile
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=collection-panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/drop/create/collection-panel.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { ImageIcon, Layers } from \"lucide-react\";\nimport { Button } from \"../../button.js\";\nimport { Input } from \"../../input.js\";\nimport { Textarea } from \"../../textarea.js\";\nimport { DropPanel, type PanelProps } from \"./drop-panel.js\";\nimport { Field, FieldError } from \"./drop-fields.js\";\nimport type { DropDraft } from \"../../../utils/drop/draft.js\";\nimport { previewUrl } from \"../../../utils/drop/preview.js\";\nimport { acceptFor, uploadError } from \"../../../utils/upload-limits.js\";\nimport { FIELD_LIMITS } from \"../../../utils/field-limits.js\";\nimport { useT } from \"../../../i18n/provider.js\";\n\nexport function coverFile(draft: DropDraft): File | null {\n return draft.collection.cover ?? draft.assets[0]?.file ?? null;\n}\n\nexport function CollectionPanel({ draft, setDraft, errors, open, onToggle }: PanelProps) {\n const t = useT();\n const [coverError, setCoverError] = useState<string | null>(null);\n const collection = draft.collection;\n const set = (patch: Partial<DropDraft[\"collection\"]>) => setDraft({ collection: { ...collection, ...patch } });\n const cover = coverFile(draft);\n const name = collection.name.trim();\n\n return (\n <DropPanel\n icon={<Layers />}\n title={t(\"Collection\")}\n open={open}\n onToggle={onToggle}\n error={errors.collection.name ?? errors.collection.externalUrl}\n summary={\n <span className=\"flex items-center gap-2.5\">\n {cover && <img src={previewUrl(cover)} alt=\"\" className=\"h-6 w-6 rounded-md object-cover\" />}\n <span className=\"truncate\">{name || t(\"Name the collection\")}</span>\n </span>\n }\n >\n <div className=\"flex items-center gap-4\">\n <div className=\"grid h-24 w-24 shrink-0 place-items-center overflow-hidden rounded-xl bg-muted\">\n {cover\n ? <img src={previewUrl(cover)} alt={t(\"Cover\")} className=\"h-full w-full object-cover\" />\n : <ImageIcon className=\"h-6 w-6 text-muted-foreground\" />}\n </div>\n <div className=\"space-y-2\">\n <p className=\"text-sm font-medium\">{t(\"Cover\")}</p>\n <div className=\"flex flex-wrap gap-2\">\n <Button asChild variant=\"soft\" size=\"sm\">\n <label className=\"cursor-pointer\">\n {t(\"Choose cover\")}\n <input type=\"file\" data-testid=\"cover-input\" accept={acceptFor(\"image\")} className=\"hidden\"\n onChange={(e) => {\n const file = e.target.files?.[0];\n e.target.value = \"\";\n if (!file) return;\n const problem = uploadError(file);\n setCoverError(problem);\n if (!problem) set({ cover: file });\n }} />\n </label>\n </Button>\n {collection.cover && (\n <Button type=\"button\" variant=\"ghost\" size=\"sm\" onClick={() => set({ cover: null })}>{t(\"Use first asset\")}</Button>\n )}\n </div>\n <FieldError message={coverError ? { text: coverError } : null} />\n </div>\n </div>\n <Field label={t(\"Name *\")} htmlFor=\"drop-name\">\n <Input id=\"drop-name\" value={collection.name} maxLength={FIELD_LIMITS.name} placeholder={t(\"Collection name\")}\n onChange={(e) => set({ name: e.target.value })} />\n <FieldError message={errors.collection.name} />\n </Field>\n <Field label={t(\"Description\")} htmlFor=\"drop-description\">\n <Textarea id=\"drop-description\" value={collection.description} maxLength={FIELD_LIMITS.description} rows={4}\n placeholder={t(\"The story behind the collection…\")}\n onChange={(e) => set({ description: e.target.value })} />\n </Field>\n <Field label={t(\"External link\")} htmlFor=\"drop-link\">\n <Input id=\"drop-link\" type=\"url\" inputMode=\"url\" value={collection.externalUrl} placeholder=\"https://\"\n onChange={(e) => set({ externalUrl: e.target.value.trim() })} />\n <FieldError message={errors.collection.externalUrl} />\n </Field>\n </DropPanel>\n );\n}\n"],"mappings":";AA6BY,cAMJ,YANI;AA3BZ,SAAS,gBAAgB;AACzB,SAAS,WAAW,cAAc;AAClC,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,iBAAkC;AAC3C,SAAS,OAAO,kBAAkB;AAElC,SAAS,kBAAkB;AAC3B,SAAS,WAAW,mBAAmB;AACvC,SAAS,oBAAoB;AAC7B,SAAS,YAAY;AAEd,SAAS,UAAU,OAA+B;AACvD,SAAO,MAAM,WAAW,SAAS,MAAM,OAAO,CAAC,GAAG,QAAQ;AAC5D;AAEO,SAAS,gBAAgB,EAAE,OAAO,UAAU,QAAQ,MAAM,SAAS,GAAe;AACvF,QAAM,IAAI,KAAK;AACf,QAAM,CAAC,YAAY,aAAa,IAAI,SAAwB,IAAI;AAChE,QAAM,aAAa,MAAM;AACzB,QAAM,MAAM,CAAC,UAA4C,SAAS,EAAE,YAAY,EAAE,GAAG,YAAY,GAAG,MAAM,EAAE,CAAC;AAC7G,QAAM,QAAQ,UAAU,KAAK;AAC7B,QAAM,OAAO,WAAW,KAAK,KAAK;AAElC,SACE;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 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
var drop_create_exports = {};
|
|
21
21
|
__export(drop_create_exports, {
|
|
22
22
|
DropCreate: () => DropCreate,
|
|
23
|
-
|
|
24
|
-
dropSymbol: () => dropSymbol,
|
|
25
|
-
withArtwork: () => withArtwork,
|
|
26
|
-
withoutArtwork: () => withoutArtwork
|
|
23
|
+
dropSymbol: () => import_draft2.dropSymbol
|
|
27
24
|
});
|
|
28
25
|
module.exports = __toCommonJS(drop_create_exports);
|
|
29
26
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
27
|
var import_react = require("react");
|
|
31
28
|
var import_lucide_react = require("lucide-react");
|
|
32
|
-
var import_sdk = require("@medialane/sdk");
|
|
33
29
|
var import_action_button = require("../../action-button.js");
|
|
34
|
-
var
|
|
30
|
+
var import_button = require("../../button.js");
|
|
35
31
|
var import_claim_route_shell = require("../../claim-route-shell.js");
|
|
36
|
-
var
|
|
37
|
-
var
|
|
38
|
-
var
|
|
32
|
+
var import_collection_panel = require("./collection-panel.js");
|
|
33
|
+
var import_assets_panel = require("./assets-panel.js");
|
|
34
|
+
var import_settings_panel = require("./settings-panel.js");
|
|
39
35
|
var import_launch_dialog = require("./launch-dialog.js");
|
|
40
36
|
var import_draft = require("../../../utils/drop/draft.js");
|
|
41
|
-
var
|
|
42
|
-
var import_launchpad_defaults = require("../../../utils/launchpad-defaults.js");
|
|
37
|
+
var import_draft_store = require("../../../utils/drop/draft-store.js");
|
|
43
38
|
var import_medialane_app = require("../../medialane-app.js");
|
|
44
|
-
var import_use_drops = require("../../../utils/use-drops.js");
|
|
45
39
|
var import_translate = require("../../../i18n/translate.js");
|
|
46
40
|
var import_provider = require("../../../i18n/provider.js");
|
|
47
|
-
var
|
|
48
|
-
const
|
|
49
|
-
function
|
|
50
|
-
return draft.kind === "edition" ? draft.edition ? [draft.edition] : [] : draft.items.map((it) => it.file);
|
|
51
|
-
}
|
|
52
|
-
function withArtwork(draft, files) {
|
|
53
|
-
const current = draft.kind === "edition" ? draft.edition ? [toItem(draft.edition)] : [] : draft.items;
|
|
54
|
-
const items = [...current, ...files.map(toItem)];
|
|
55
|
-
if (items.length === 1) return { kind: "edition", edition: items[0].file, items: [] };
|
|
56
|
-
return { kind: "collection", edition: null, items };
|
|
57
|
-
}
|
|
58
|
-
function withoutArtwork(draft, file) {
|
|
59
|
-
if (draft.kind === "edition") return { edition: null };
|
|
60
|
-
const items = draft.items.filter((it) => it.file !== file);
|
|
61
|
-
if (items.length === 1) return { kind: "edition", edition: items[0].file, items: [] };
|
|
62
|
-
return { items };
|
|
63
|
-
}
|
|
64
|
-
function dropSymbol(name) {
|
|
65
|
-
return (0, import_launchpad_defaults.suggestLaunchpadSymbol)(name) || "DROP";
|
|
66
|
-
}
|
|
67
|
-
function DropCreate({ aside }) {
|
|
41
|
+
var import_draft2 = require("../../../utils/drop/draft.js");
|
|
42
|
+
const CLEAN = { collection: {}, assets: { byId: {} }, settings: {} };
|
|
43
|
+
function DropCreate({ store }) {
|
|
68
44
|
const t = (0, import_provider.useT)();
|
|
69
|
-
const intl = (0, import_use_format.useFormat)();
|
|
70
45
|
const app = (0, import_medialane_app.useMedialaneApp)();
|
|
71
|
-
const
|
|
72
|
-
const
|
|
46
|
+
const draftStore = (0, import_react.useMemo)(() => store ?? (0, import_draft_store.indexedDbDraftStore)(), [store]);
|
|
47
|
+
const { draft, setDraft, ready, restored, startOver, clearSaved } = (0, import_draft_store.useSavedDraft)(draftStore);
|
|
48
|
+
const [open, setOpen] = (0, import_react.useState)("collection");
|
|
73
49
|
const [tried, setTried] = (0, import_react.useState)(false);
|
|
74
50
|
const [launching, setLaunching] = (0, import_react.useState)(false);
|
|
75
|
-
const [
|
|
76
|
-
const setDraft = (patch) => setDraftState((d) => ({ ...d, ...patch }));
|
|
77
|
-
const errors = tried ? (0, import_draft.validateDropDraft)(draft, Math.floor(Date.now() / 1e3)) : {};
|
|
78
|
-
const files = draftFiles(draft);
|
|
79
|
-
const supply = (0, import_draft.draftSupply)(draft);
|
|
51
|
+
const [launched, setLaunched] = (0, import_react.useState)(false);
|
|
80
52
|
const wallet = app.walletAddress;
|
|
53
|
+
const live = (0, import_draft.validateDropDraft)(draft, Math.floor(Date.now() / 1e3));
|
|
54
|
+
const errors = tried ? live : CLEAN;
|
|
55
|
+
const missing = (0, import_draft.firstMissing)(live);
|
|
56
|
+
const toggle = (panel2) => () => setOpen(open === panel2 ? null : panel2);
|
|
57
|
+
const panel = { draft, setDraft, errors };
|
|
81
58
|
const launch = () => {
|
|
82
59
|
if (!wallet) return app.onRequireWallet();
|
|
83
60
|
setTried(true);
|
|
84
|
-
if (
|
|
61
|
+
if (missing) return setOpen(missing.panel);
|
|
62
|
+
setLaunching(true);
|
|
85
63
|
};
|
|
86
64
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
87
65
|
import_claim_route_shell.ClaimRouteShell,
|
|
88
66
|
{
|
|
89
67
|
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Package, { className: "h-4 w-4 text-white" }),
|
|
90
68
|
title: (0, import_translate.msg)("Collection drop"),
|
|
91
|
-
subtitle: (0, import_translate.msg)("
|
|
92
|
-
aside: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
93
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
94
|
-
import_medialane_collection_card.MedialaneCollectionCard,
|
|
95
|
-
{
|
|
96
|
-
image: files[0] ? (0, import_preview.previewUrl)(files[0]) : null,
|
|
97
|
-
name: draft.name,
|
|
98
|
-
collection: files.length > 0 && Number.isFinite(supply) && supply > 0 ? (0, import_draft.supplyLabel)(t, draft.kind, supply, intl.number(supply)) : void 0,
|
|
99
|
-
creator: wallet ? `${wallet.slice(0, 6)}\u2026${wallet.slice(-4)}` : void 0,
|
|
100
|
-
creatorHref: wallet ? (0, import_sdk.profileHref)({ address: wallet }) : void 0
|
|
101
|
-
}
|
|
102
|
-
),
|
|
103
|
-
aside
|
|
104
|
-
] }),
|
|
69
|
+
subtitle: (0, import_translate.msg)("A new collection released for collectors to mint."),
|
|
105
70
|
children: [
|
|
106
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-
|
|
107
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
108
|
-
|
|
109
|
-
{
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
),
|
|
116
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
onNameChange: (name) => setDraft({ name, symbol: dropSymbol(name) })
|
|
123
|
-
}
|
|
124
|
-
),
|
|
125
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_drop_fields.PriceFields, { draft, setDraft, errors, feeBps }),
|
|
126
|
-
draft.kind === "edition" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_drop_fields.CopiesField, { draft, setDraft, errors }),
|
|
127
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_drop_fields.AccessFields, { draft, setDraft, errors }),
|
|
128
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_drop_fields.TimingFields, { draft, setDraft, errors }),
|
|
129
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
130
|
-
import_collapsible_section.CollapsibleSection,
|
|
131
|
-
{
|
|
132
|
-
open: licenseOpen,
|
|
133
|
-
onOpenChange: setLicenseOpen,
|
|
134
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ShieldCheck, { className: "h-4 w-4 text-primary" }),
|
|
135
|
-
label: t("License terms"),
|
|
136
|
-
hint: t("Optional \xB7 Berne Convention"),
|
|
137
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_drop_fields.LicenseFields, { draft, setDraft })
|
|
138
|
-
}
|
|
139
|
-
),
|
|
140
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
141
|
-
import_collapsible_section.CollapsibleSection,
|
|
142
|
-
{
|
|
143
|
-
open: draft.gated.enabled,
|
|
144
|
-
onOpenChange: (enabled) => setDraft({ gated: { ...draft.gated, enabled } }),
|
|
145
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Lock, { className: "h-4 w-4 text-primary" }),
|
|
146
|
-
label: t("Exclusive content"),
|
|
147
|
-
hint: t("Optional \xB7 a private link only holders can open"),
|
|
148
|
-
children: [
|
|
149
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_exclusive_fields.ExclusiveFields, { value: draft.gated, onChange: (v) => setDraft({ gated: { ...draft.gated, ...v } }) }),
|
|
150
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_drop_fields.FieldError, { message: errors.gated })
|
|
151
|
-
]
|
|
152
|
-
}
|
|
153
|
-
),
|
|
154
|
-
tried && Object.keys(errors).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm font-medium text-destructive", children: t("Check the highlighted fields.") }),
|
|
155
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_action_button.ActionButton, { solid: true, big: true, onClick: launch, className: "w-full", children: wallet ? t("Launch drop") : app.connectLabel ?? t("Sign in to launch") }),
|
|
156
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-center text-xs text-muted-foreground", children: t("The drop is final at launch.") })
|
|
71
|
+
ready && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-3", children: [
|
|
72
|
+
restored && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center justify-between gap-3 rounded-2xl bg-muted/40 px-4 py-3 text-sm", children: [
|
|
73
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: t("Draft restored") }),
|
|
74
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { type: "button", variant: "ghost", size: "sm", onClick: () => {
|
|
75
|
+
startOver();
|
|
76
|
+
setTried(false);
|
|
77
|
+
setOpen("collection");
|
|
78
|
+
}, children: t("Start over") })
|
|
79
|
+
] }),
|
|
80
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_collection_panel.CollectionPanel, { ...panel, open: open === "collection", onToggle: toggle("collection") }),
|
|
81
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_assets_panel.AssetsPanel, { ...panel, open: open === "assets", onToggle: toggle("assets") }),
|
|
82
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_settings_panel.SettingsPanel, { ...panel, open: open === "settings", onToggle: toggle("settings") }),
|
|
83
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-3 pt-3", children: [
|
|
84
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-center text-xs text-muted-foreground", children: t("Fixed at launch: assets, price, dates, supply and the wallet limit.") }),
|
|
85
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_action_button.ActionButton, { solid: true, big: true, onClick: launch, className: "w-full", children: !wallet ? app.connectLabel ?? t("Sign in to launch") : missing ? t(missing.message.text, missing.message.vars) : t("Launch drop") })
|
|
86
|
+
] })
|
|
157
87
|
] }),
|
|
158
|
-
launching && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
88
|
+
launching && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
89
|
+
import_launch_dialog.LaunchDialog,
|
|
90
|
+
{
|
|
91
|
+
open: true,
|
|
92
|
+
draft,
|
|
93
|
+
onClose: () => {
|
|
94
|
+
setLaunching(false);
|
|
95
|
+
if (!launched) return;
|
|
96
|
+
setLaunched(false);
|
|
97
|
+
setTried(false);
|
|
98
|
+
setOpen("collection");
|
|
99
|
+
startOver();
|
|
100
|
+
},
|
|
101
|
+
onLaunched: () => {
|
|
102
|
+
setLaunched(true);
|
|
103
|
+
void clearSaved();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
)
|
|
159
107
|
]
|
|
160
108
|
}
|
|
161
109
|
);
|
|
@@ -163,9 +111,6 @@ function DropCreate({ aside }) {
|
|
|
163
111
|
// Annotate the CommonJS export names for ESM import in node:
|
|
164
112
|
0 && (module.exports = {
|
|
165
113
|
DropCreate,
|
|
166
|
-
|
|
167
|
-
dropSymbol,
|
|
168
|
-
withArtwork,
|
|
169
|
-
withoutArtwork
|
|
114
|
+
dropSymbol
|
|
170
115
|
});
|
|
171
116
|
//# sourceMappingURL=drop-create.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/drop/create/drop-create.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState, type ReactNode } from \"react\";\nimport { Lock, Package, ShieldCheck } from \"lucide-react\";\nimport { profileHref } from \"@medialane/sdk\";\nimport { ActionButton } from \"../../action-button.js\";\nimport { CollapsibleSection } from \"../../collapsible-section.js\";\nimport { ClaimRouteShell } from \"../../claim-route-shell.js\";\nimport { MedialaneCollectionCard } from \"../../medialane-collection-card.js\";\nimport { AccessFields, ArtworkUpload, CopiesField, FieldError, LicenseFields, NameFields, PriceFields, TimingFields } from \"./drop-fields.js\";\nimport { ExclusiveFields } from \"./exclusive-fields.js\";\nimport { LaunchDialog } from \"./launch-dialog.js\";\nimport { EMPTY_DRAFT, draftSupply, validateDropDraft, type DraftItem, type DropDraft, supplyLabel } from \"../../../utils/drop/draft.js\";\nimport { previewUrl } from \"../../../utils/drop/preview.js\";\nimport { suggestLaunchpadSymbol } from \"../../../utils/launchpad-defaults.js\";\nimport { useMedialaneApp } from \"../../medialane-app.js\";\nimport { useDropFee } from \"../../../utils/use-drops.js\";\nimport { msg } from \"../../../i18n/translate.js\";\nimport { useT } from \"../../../i18n/provider.js\";\nimport { useFormat } from \"../../../i18n/use-format.js\";\n\nconst toItem = (file: File): DraftItem => ({ id: crypto.randomUUID(), file, previewUrl: URL.createObjectURL(file), name: \"\", description: \"\" });\n\nexport function draftFiles(draft: DropDraft): File[] {\n return draft.kind === \"edition\" ? (draft.edition ? [draft.edition] : []) : draft.items.map((it) => it.file);\n}\n\nexport function withArtwork(draft: DropDraft, files: File[]): Partial<DropDraft> {\n const current: DraftItem[] = draft.kind === \"edition\" ? (draft.edition ? [toItem(draft.edition)] : []) : draft.items;\n const items = [...current, ...files.map(toItem)];\n if (items.length === 1) return { kind: \"edition\", edition: items[0]!.file, items: [] };\n return { kind: \"collection\", edition: null, items };\n}\n\nexport function withoutArtwork(draft: DropDraft, file: File): Partial<DropDraft> {\n if (draft.kind === \"edition\") return { edition: null };\n const items = draft.items.filter((it) => it.file !== file);\n if (items.length === 1) return { kind: \"edition\", edition: items[0]!.file, items: [] };\n return { items };\n}\n\nexport function dropSymbol(name: string): string {\n return suggestLaunchpadSymbol(name) || \"DROP\";\n}\n\nexport function DropCreate({ aside }: { aside?: ReactNode }) {\n const t = useT();\n const intl = useFormat();\n const app = useMedialaneApp();\n const feeBps = useDropFee();\n const [draft, setDraftState] = useState<DropDraft>(EMPTY_DRAFT);\n const [tried, setTried] = useState(false);\n const [launching, setLaunching] = useState(false);\n const [licenseOpen, setLicenseOpen] = useState(false);\n const setDraft = (patch: Partial<DropDraft>) => setDraftState((d) => ({ ...d, ...patch }));\n const errors = tried ? validateDropDraft(draft, Math.floor(Date.now() / 1000)) : {};\n const files = draftFiles(draft);\n const supply = draftSupply(draft);\n const wallet = app.walletAddress;\n\n const launch = () => {\n if (!wallet) return app.onRequireWallet();\n setTried(true);\n if (Object.keys(validateDropDraft(draft, Math.floor(Date.now() / 1000))).length === 0) setLaunching(true);\n };\n\n return (\n <ClaimRouteShell\n icon={<Package className=\"h-4 w-4 text-white\" />}\n title={msg(\"Collection drop\")}\n subtitle={msg(\"Release work at a set price and time.\")}\n aside={\n <>\n <MedialaneCollectionCard\n image={files[0] ? previewUrl(files[0]) : null}\n name={draft.name}\n collection={files.length > 0 && Number.isFinite(supply) && supply > 0 ? supplyLabel(t, draft.kind, supply, intl.number(supply)) : undefined}\n creator={wallet ? `${wallet.slice(0, 6)}…${wallet.slice(-4)}` : undefined}\n creatorHref={wallet ? profileHref({ address: wallet }) : undefined}\n />\n {aside}\n </>\n }\n >\n <div className=\"space-y-6\">\n <ArtworkUpload\n files={files}\n error={errors.artwork}\n onAdd={(picked) => setDraftState((d) => ({ ...d, ...withArtwork(d, picked) }))}\n onRemove={(file) => setDraftState((d) => ({ ...d, ...withoutArtwork(d, file) }))}\n />\n <NameFields draft={draft} setDraft={setDraft} errors={errors}\n onNameChange={(name) => setDraft({ name, symbol: dropSymbol(name) })} />\n <PriceFields draft={draft} setDraft={setDraft} errors={errors} feeBps={feeBps} />\n {draft.kind === \"edition\" && <CopiesField draft={draft} setDraft={setDraft} errors={errors} />}\n <AccessFields draft={draft} setDraft={setDraft} errors={errors} />\n <TimingFields draft={draft} setDraft={setDraft} errors={errors} />\n\n <CollapsibleSection open={licenseOpen} onOpenChange={setLicenseOpen}\n icon={<ShieldCheck className=\"h-4 w-4 text-primary\" />}\n label={t(\"License terms\")} hint={t(\"Optional · Berne Convention\")}>\n <LicenseFields draft={draft} setDraft={setDraft} />\n </CollapsibleSection>\n <CollapsibleSection open={draft.gated.enabled}\n onOpenChange={(enabled) => setDraft({ gated: { ...draft.gated, enabled } })}\n icon={<Lock className=\"h-4 w-4 text-primary\" />}\n label={t(\"Exclusive content\")} hint={t(\"Optional · a private link only holders can open\")}>\n <ExclusiveFields value={draft.gated} onChange={(v) => setDraft({ gated: { ...draft.gated, ...v } })} />\n <FieldError message={errors.gated} />\n </CollapsibleSection>\n\n {tried && Object.keys(errors).length > 0 && <p className=\"text-sm font-medium text-destructive\">{t(\"Check the highlighted fields.\")}</p>}\n <ActionButton solid big onClick={launch} className=\"w-full\">\n {wallet ? t(\"Launch drop\") : app.connectLabel ?? t(\"Sign in to launch\")}\n </ActionButton>\n <p className=\"text-center text-xs text-muted-foreground\">{t(\"The drop is final at launch.\")}</p>\n </div>\n {launching && <LaunchDialog open onClose={() => setLaunching(false)} draft={draft} />}\n </ClaimRouteShell>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoEY;AAlEZ,mBAAyC;AACzC,0BAA2C;AAC3C,iBAA4B;AAC5B,2BAA6B;AAC7B,iCAAmC;AACnC,+BAAgC;AAChC,uCAAwC;AACxC,yBAA2H;AAC3H,8BAAgC;AAChC,2BAA6B;AAC7B,mBAAyG;AACzG,qBAA2B;AAC3B,gCAAuC;AACvC,2BAAgC;AAChC,uBAA2B;AAC3B,uBAAoB;AACpB,sBAAqB;AACrB,wBAA0B;AAE1B,MAAM,SAAS,CAAC,UAA2B,EAAE,IAAI,OAAO,WAAW,GAAG,MAAM,YAAY,IAAI,gBAAgB,IAAI,GAAG,MAAM,IAAI,aAAa,GAAG;AAEtI,SAAS,WAAW,OAA0B;AACnD,SAAO,MAAM,SAAS,YAAa,MAAM,UAAU,CAAC,MAAM,OAAO,IAAI,CAAC,IAAK,MAAM,MAAM,IAAI,CAAC,OAAO,GAAG,IAAI;AAC5G;AAEO,SAAS,YAAY,OAAkB,OAAmC;AAC/E,QAAM,UAAuB,MAAM,SAAS,YAAa,MAAM,UAAU,CAAC,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,IAAK,MAAM;AAC/G,QAAM,QAAQ,CAAC,GAAG,SAAS,GAAG,MAAM,IAAI,MAAM,CAAC;AAC/C,MAAI,MAAM,WAAW,EAAG,QAAO,EAAE,MAAM,WAAW,SAAS,MAAM,CAAC,EAAG,MAAM,OAAO,CAAC,EAAE;AACrF,SAAO,EAAE,MAAM,cAAc,SAAS,MAAM,MAAM;AACpD;AAEO,SAAS,eAAe,OAAkB,MAAgC;AAC/E,MAAI,MAAM,SAAS,UAAW,QAAO,EAA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cAAmB,MAAM;AAAA,cAAa,cAAc;AAAA,cACnD,MAAM,4CAAC,mCAAY,WAAU,wBAAuB;AAAA,cACpD,OAAO,EAAE,eAAe;AAAA,cAAG,MAAM,EAAE,gCAA6B;AAAA,cAChE,sDAAC,oCAAc,OAAc,UAAoB;AAAA;AAAA,UACnD;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cAAmB,MAAM,MAAM,MAAM;AAAA,cACpC,cAAc,CAAC,YAAY,SAAS,EAAE,OAAO,EAAE,GAAG,MAAM,OAAO,QAAQ,EAAE,CAAC;AAAA,cAC1E,MAAM,4CAAC,4BAAK,WAAU,wBAAuB;AAAA,cAC7C,OAAO,EAAE,mBAAmB;AAAA,cAAG,MAAM,EAAE,oDAAiD;AAAA,cACxF;AAAA,4DAAC,2CAAgB,OAAO,MAAM,OAAO,UAAU,CAAC,MAAM,SAAS,EAAE,OAAO,EAAE,GAAG,MAAM,OAAO,GAAG,EAAE,EAAE,CAAC,GAAG;AAAA,gBACrG,4CAAC,iCAAW,SAAS,OAAO,OAAO;AAAA;AAAA;AAAA,UACrC;AAAA,UAEC,SAAS,OAAO,KAAK,MAAM,EAAE,SAAS,KAAK,4CAAC,OAAE,WAAU,wCAAwC,YAAE,+BAA+B,GAAE;AAAA,UACpI,4CAAC,qCAAa,OAAK,MAAC,KAAG,MAAC,SAAS,QAAQ,WAAU,UAChD,mBAAS,EAAE,aAAa,IAAI,IAAI,gBAAgB,EAAE,mBAAmB,GACxE;AAAA,UACA,4CAAC,OAAE,WAAU,6CAA6C,YAAE,8BAA8B,GAAE;AAAA,WAC9F;AAAA,QACC,aAAa,4CAAC,qCAAa,MAAI,MAAC,SAAS,MAAM,aAAa,KAAK,GAAG,OAAc;AAAA;AAAA;AAAA,EACrF;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/drop/create/drop-create.tsx"],"sourcesContent":["\"use client\";\n\nimport { useMemo, useState } from \"react\";\nimport { Package } from \"lucide-react\";\nimport { ActionButton } from \"../../action-button.js\";\nimport { Button } from \"../../button.js\";\nimport { ClaimRouteShell } from \"../../claim-route-shell.js\";\nimport { CollectionPanel } from \"./collection-panel.js\";\nimport { AssetsPanel } from \"./assets-panel.js\";\nimport { SettingsPanel } from \"./settings-panel.js\";\nimport { LaunchDialog } from \"./launch-dialog.js\";\nimport { firstMissing, validateDropDraft, type DropDraftErrors, type DropPanel } from \"../../../utils/drop/draft.js\";\nimport { indexedDbDraftStore, useSavedDraft, type DraftStore } from \"../../../utils/drop/draft-store.js\";\nimport { useMedialaneApp } from \"../../medialane-app.js\";\nimport { msg } from \"../../../i18n/translate.js\";\nimport { useT } from \"../../../i18n/provider.js\";\n\nexport { dropSymbol } from \"../../../utils/drop/draft.js\";\n\nconst CLEAN: DropDraftErrors = { collection: {}, assets: { byId: {} }, settings: {} };\n\nexport function DropCreate({ store }: { store?: DraftStore }) {\n const t = useT();\n const app = useMedialaneApp();\n const draftStore = useMemo(() => store ?? indexedDbDraftStore(), [store]);\n const { draft, setDraft, ready, restored, startOver, clearSaved } = useSavedDraft(draftStore);\n const [open, setOpen] = useState<DropPanel | null>(\"collection\");\n const [tried, setTried] = useState(false);\n const [launching, setLaunching] = useState(false);\n const [launched, setLaunched] = useState(false);\n const wallet = app.walletAddress;\n const live = validateDropDraft(draft, Math.floor(Date.now() / 1000));\n const errors = tried ? live : CLEAN;\n const missing = firstMissing(live);\n const toggle = (panel: DropPanel) => () => setOpen(open === panel ? null : panel);\n const panel = { draft, setDraft, errors };\n\n const launch = () => {\n if (!wallet) return app.onRequireWallet();\n setTried(true);\n if (missing) return setOpen(missing.panel);\n setLaunching(true);\n };\n\n return (\n <ClaimRouteShell\n icon={<Package className=\"h-4 w-4 text-white\" />}\n title={msg(\"Collection drop\")}\n subtitle={msg(\"A new collection released for collectors to mint.\")}\n >\n {ready && (\n <div className=\"space-y-3\">\n {restored && (\n <div className=\"flex items-center justify-between gap-3 rounded-2xl bg-muted/40 px-4 py-3 text-sm\">\n <span>{t(\"Draft restored\")}</span>\n <Button type=\"button\" variant=\"ghost\" size=\"sm\" onClick={() => { startOver(); setTried(false); setOpen(\"collection\"); }}>\n {t(\"Start over\")}\n </Button>\n </div>\n )}\n <CollectionPanel {...panel} open={open === \"collection\"} onToggle={toggle(\"collection\")} />\n <AssetsPanel {...panel} open={open === \"assets\"} onToggle={toggle(\"assets\")} />\n <SettingsPanel {...panel} open={open === \"settings\"} onToggle={toggle(\"settings\")} />\n <div className=\"space-y-3 pt-3\">\n <p className=\"text-center text-xs text-muted-foreground\">{t(\"Fixed at launch: assets, price, dates, supply and the wallet limit.\")}</p>\n <ActionButton solid big onClick={launch} className=\"w-full\">\n {!wallet ? app.connectLabel ?? t(\"Sign in to launch\") : missing ? t(missing.message.text, missing.message.vars) : t(\"Launch drop\")}\n </ActionButton>\n </div>\n </div>\n )}\n {launching && (\n <LaunchDialog\n open\n draft={draft}\n onClose={() => {\n setLaunching(false);\n if (!launched) return;\n setLaunched(false);\n setTried(false);\n setOpen(\"collection\");\n startOver();\n }}\n onLaunched={() => { setLaunched(true); void clearSaved(); }}\n />\n )}\n </ClaimRouteShell>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8CY;AA5CZ,mBAAkC;AAClC,0BAAwB;AACxB,2BAA6B;AAC7B,oBAAuB;AACvB,+BAAgC;AAChC,8BAAgC;AAChC,0BAA4B;AAC5B,4BAA8B;AAC9B,2BAA6B;AAC7B,mBAAsF;AACtF,yBAAoE;AACpE,2BAAgC;AAChC,uBAAoB;AACpB,sBAAqB;AAErB,IAAAA,gBAA2B;AAE3B,MAAM,QAAyB,EAAE,YAAY,CAAC,GAAG,QAAQ,EAAE,MAAM,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE;AAE7E,SAAS,WAAW,EAAE,MAAM,GAA2B;AAC5D,QAAM,QAAI,sBAAK;AACf,QAAM,UAAM,sCAAgB;AAC5B,QAAM,iBAAa,sBAAQ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2CAAiB,GAAG,OAAO,MAAM,SAAS,cAAc,UAAU,OAAO,YAAY,GAAG;AAAA,UACzF,4CAAC,mCAAa,GAAG,OAAO,MAAM,SAAS,UAAU,UAAU,OAAO,QAAQ,GAAG;AAAA,UAC7E,4CAAC,uCAAe,GAAG,OAAO,MAAM,SAAS,YAAY,UAAU,OAAO,UAAU,GAAG;AAAA,UACnF,6CAAC,SAAI,WAAU,kBACb;AAAA,wDAAC,OAAE,WAAU,6CAA6C,YAAE,qEAAqE,GAAE;AAAA,YACnI,4CAAC,qCAAa,OAAK,MAAC,KAAG,MAAC,SAAS,QAAQ,WAAU,UAChD,WAAC,SAAS,IAAI,gBAAgB,EAAE,mBAAmB,IAAI,UAAU,EAAE,QAAQ,QAAQ,MAAM,QAAQ,QAAQ,IAAI,IAAI,EAAE,aAAa,GACnI;AAAA,aACF;AAAA,WACF;AAAA,QAED,aACC;AAAA,UAAC;AAAA;AAAA,YACC,MAAI;AAAA,YACJ;AAAA,YACA,SAAS,MAAM;AACb,2BAAa,KAAK;AAClB,kBAAI,CAAC,SAAU;AACf,0BAAY,KAAK;AACjB,uBAAS,KAAK;AACd,sBAAQ,YAAY;AACpB,wBAAU;AAAA,YACZ;AAAA,YACA,YAAY,MAAM;AAAE,0BAAY,IAAI;AAAG,mBAAK,WAAW;AAAA,YAAG;AAAA;AAAA,QAC5D;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":["import_draft","panel"]}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import '../../../i18n/make-t.cjs';
|
|
5
|
-
import '../../../i18n/translate.cjs';
|
|
6
|
-
import '../../../utils/drop/metadata.cjs';
|
|
2
|
+
import { DraftStore } from '../../../utils/drop/draft-store.cjs';
|
|
3
|
+
export { d as dropSymbol } from '../../../draft-Bw3JWkOZ.cjs';
|
|
7
4
|
import '@medialane/sdk';
|
|
8
5
|
import '../../../utils/drop/sale.cjs';
|
|
6
|
+
import '../../../i18n/translate.cjs';
|
|
9
7
|
|
|
10
|
-
declare function
|
|
11
|
-
|
|
12
|
-
declare function withoutArtwork(draft: DropDraft, file: File): Partial<DropDraft>;
|
|
13
|
-
declare function dropSymbol(name: string): string;
|
|
14
|
-
declare function DropCreate({ aside }: {
|
|
15
|
-
aside?: ReactNode;
|
|
8
|
+
declare function DropCreate({ store }: {
|
|
9
|
+
store?: DraftStore;
|
|
16
10
|
}): react_jsx_runtime.JSX.Element;
|
|
17
11
|
|
|
18
|
-
export { DropCreate
|
|
12
|
+
export { DropCreate };
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import '../../../i18n/make-t.js';
|
|
5
|
-
import '../../../i18n/translate.js';
|
|
6
|
-
import '../../../utils/drop/metadata.js';
|
|
2
|
+
import { DraftStore } from '../../../utils/drop/draft-store.js';
|
|
3
|
+
export { d as dropSymbol } from '../../../draft-B0fPlVZS.js';
|
|
7
4
|
import '@medialane/sdk';
|
|
8
5
|
import '../../../utils/drop/sale.js';
|
|
6
|
+
import '../../../i18n/translate.js';
|
|
9
7
|
|
|
10
|
-
declare function
|
|
11
|
-
|
|
12
|
-
declare function withoutArtwork(draft: DropDraft, file: File): Partial<DropDraft>;
|
|
13
|
-
declare function dropSymbol(name: string): string;
|
|
14
|
-
declare function DropCreate({ aside }: {
|
|
15
|
-
aside?: ReactNode;
|
|
8
|
+
declare function DropCreate({ store }: {
|
|
9
|
+
store?: DraftStore;
|
|
16
10
|
}): react_jsx_runtime.JSX.Element;
|
|
17
11
|
|
|
18
|
-
export { DropCreate
|
|
12
|
+
export { DropCreate };
|