@medialane/ui 0.102.0 → 0.104.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.
Files changed (56) hide show
  1. package/dist/components/creator-analytics.cjs +170 -0
  2. package/dist/components/creator-analytics.cjs.map +1 -0
  3. package/dist/components/creator-analytics.d.cts +10 -0
  4. package/dist/components/creator-analytics.d.ts +10 -0
  5. package/dist/components/creator-analytics.js +153 -0
  6. package/dist/components/creator-analytics.js.map +1 -0
  7. package/dist/components/dialog.cjs +128 -0
  8. package/dist/components/dialog.cjs.map +1 -0
  9. package/dist/components/dialog.d.cts +25 -0
  10. package/dist/components/dialog.d.ts +25 -0
  11. package/dist/components/dialog.js +85 -0
  12. package/dist/components/dialog.js.map +1 -0
  13. package/dist/components/drop-countdown.cjs +66 -0
  14. package/dist/components/drop-countdown.cjs.map +1 -0
  15. package/dist/components/drop-countdown.d.cts +8 -0
  16. package/dist/components/drop-countdown.d.ts +8 -0
  17. package/dist/components/drop-countdown.js +42 -0
  18. package/dist/components/drop-countdown.js.map +1 -0
  19. package/dist/components/owner-setup-panel.cjs +91 -0
  20. package/dist/components/owner-setup-panel.cjs.map +1 -0
  21. package/dist/components/owner-setup-panel.d.cts +10 -0
  22. package/dist/components/owner-setup-panel.d.ts +10 -0
  23. package/dist/components/owner-setup-panel.js +57 -0
  24. package/dist/components/owner-setup-panel.js.map +1 -0
  25. package/dist/components/portfolio-header.cjs +1 -1
  26. package/dist/components/portfolio-header.cjs.map +1 -1
  27. package/dist/components/portfolio-header.d.cts +4 -1
  28. package/dist/components/portfolio-header.d.ts +4 -1
  29. package/dist/components/portfolio-header.js +1 -1
  30. package/dist/components/portfolio-header.js.map +1 -1
  31. package/dist/index.cjs +49 -2
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.d.cts +10 -0
  34. package/dist/index.d.ts +10 -0
  35. package/dist/index.js +45 -1
  36. package/dist/index.js.map +1 -1
  37. package/dist/medialane.css +16 -0
  38. package/dist/utils/use-creators.cjs +53 -0
  39. package/dist/utils/use-creators.cjs.map +1 -0
  40. package/dist/utils/use-creators.d.cts +11 -0
  41. package/dist/utils/use-creators.d.ts +11 -0
  42. package/dist/utils/use-creators.js +19 -0
  43. package/dist/utils/use-creators.js.map +1 -0
  44. package/dist/utils/use-medialane-client.cjs +33 -0
  45. package/dist/utils/use-medialane-client.cjs.map +1 -0
  46. package/dist/utils/use-medialane-client.d.cts +5 -0
  47. package/dist/utils/use-medialane-client.d.ts +5 -0
  48. package/dist/utils/use-medialane-client.js +9 -0
  49. package/dist/utils/use-medialane-client.js.map +1 -0
  50. package/dist/utils/use-rewards.cjs +100 -0
  51. package/dist/utils/use-rewards.cjs.map +1 -0
  52. package/dist/utils/use-rewards.d.cts +61 -0
  53. package/dist/utils/use-rewards.d.ts +61 -0
  54. package/dist/utils/use-rewards.js +62 -0
  55. package/dist/utils/use-rewards.js.map +1 -0
  56. package/package.json +7 -1
@@ -0,0 +1,170 @@
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 creator_analytics_exports = {};
21
+ __export(creator_analytics_exports, {
22
+ CreatorAnalytics: () => CreatorAnalytics
23
+ });
24
+ module.exports = __toCommonJS(creator_analytics_exports);
25
+ var import_jsx_runtime = require("react/jsx-runtime");
26
+ var import_react = require("react");
27
+ var import_recharts = require("recharts");
28
+ var import_lucide_react = require("lucide-react");
29
+ function parsePrice(formatted) {
30
+ if (!formatted) return 0;
31
+ return parseFloat(formatted.replace(/[^0-9.]/g, "")) || 0;
32
+ }
33
+ function buildDailyVolume(sales) {
34
+ const buckets = /* @__PURE__ */ new Map();
35
+ const now = Date.now();
36
+ for (let i = 29; i >= 0; i--) {
37
+ const d = new Date(now - i * 864e5);
38
+ buckets.set(
39
+ d.toLocaleDateString("en-US", { month: "short", day: "numeric" }),
40
+ 0
41
+ );
42
+ }
43
+ for (const s of sales) {
44
+ const ts = typeof s.timestamp === "number" ? s.timestamp * 1e3 : new Date(s.timestamp).getTime();
45
+ if (now - ts > 30 * 864e5) continue;
46
+ const label = new Date(ts).toLocaleDateString("en-US", {
47
+ month: "short",
48
+ day: "numeric"
49
+ });
50
+ buckets.set(label, (buckets.get(label) ?? 0) + parsePrice(s.price?.formatted));
51
+ }
52
+ return Array.from(buckets.entries()).map(([label, volume]) => ({ label, volume }));
53
+ }
54
+ function CreatorAnalytics({ activities, isLoading }) {
55
+ const { sales, totalVolume, topCurrency, dailyVolume } = (0, import_react.useMemo)(() => {
56
+ const sales2 = activities.filter((a) => a.type === "sale");
57
+ const byCurrency = /* @__PURE__ */ new Map();
58
+ for (const s of sales2) {
59
+ const cur = s.price?.currency ?? "STRK";
60
+ byCurrency.set(cur, (byCurrency.get(cur) ?? 0) + parsePrice(s.price?.formatted));
61
+ }
62
+ const sorted = [...byCurrency.entries()].sort((a, b) => b[1] - a[1]);
63
+ const topCurrency2 = sorted[0]?.[0] ?? "STRK";
64
+ const totalVolume2 = sorted[0]?.[1] ?? 0;
65
+ const dailyVolume2 = buildDailyVolume(
66
+ sales2.filter((s) => (s.price?.currency ?? "STRK") === topCurrency2)
67
+ );
68
+ return { sales: sales2, totalVolume: totalVolume2, topCurrency: topCurrency2, dailyVolume: dailyVolume2 };
69
+ }, [activities]);
70
+ if (isLoading) {
71
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "space-y-4 animate-pulse", children: [1, 2, 3].map((i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-20 rounded-xl bg-muted" }, i)) });
72
+ }
73
+ if (sales.length === 0) {
74
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "py-12 text-center text-sm text-muted-foreground", children: "No sales recorded yet." });
75
+ }
76
+ const stats = [
77
+ {
78
+ label: "Total Sales",
79
+ value: sales.length.toString(),
80
+ icon: import_lucide_react.ShoppingBag
81
+ },
82
+ {
83
+ label: `Total Volume (${topCurrency})`,
84
+ value: totalVolume.toFixed(2),
85
+ icon: import_lucide_react.Coins
86
+ },
87
+ {
88
+ label: "Last 30 Days",
89
+ value: `${dailyVolume.filter((d) => d.volume > 0).length} active days`,
90
+ icon: import_lucide_react.TrendingUp
91
+ }
92
+ ];
93
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-6", children: [
94
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-3 gap-3", children: stats.map(({ label, value, icon: Icon }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
95
+ "div",
96
+ {
97
+ className: "rounded-xl border border-border bg-card/50 p-4 space-y-1",
98
+ children: [
99
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2 text-muted-foreground", children: [
100
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { className: "h-3.5 w-3.5" }),
101
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs font-medium uppercase tracking-wide", children: label })
102
+ ] }),
103
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-2xl font-bold tabular-nums", children: value })
104
+ ]
105
+ },
106
+ label
107
+ )) }),
108
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "rounded-xl border border-border bg-card/50 p-4 space-y-2", children: [
109
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide", children: [
110
+ "30-day volume \xB7 ",
111
+ topCurrency
112
+ ] }),
113
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_recharts.ResponsiveContainer, { width: "100%", height: 140, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
114
+ import_recharts.BarChart,
115
+ {
116
+ data: dailyVolume,
117
+ margin: { top: 4, right: 4, bottom: 0, left: 0 },
118
+ children: [
119
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
120
+ import_recharts.XAxis,
121
+ {
122
+ dataKey: "label",
123
+ tick: { fontSize: 10, fill: "hsl(var(--muted-foreground))" },
124
+ axisLine: false,
125
+ tickLine: false,
126
+ interval: 6
127
+ }
128
+ ),
129
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
130
+ import_recharts.YAxis,
131
+ {
132
+ tick: { fontSize: 10, fill: "hsl(var(--muted-foreground))" },
133
+ axisLine: false,
134
+ tickLine: false,
135
+ width: 40
136
+ }
137
+ ),
138
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
139
+ import_recharts.Tooltip,
140
+ {
141
+ contentStyle: {
142
+ background: "hsl(var(--background))",
143
+ border: "1px solid hsl(var(--border))",
144
+ borderRadius: "8px",
145
+ fontSize: "12px",
146
+ color: "hsl(var(--foreground))"
147
+ },
148
+ formatter: (value) => [`${value} ${topCurrency}`, "Volume"]
149
+ }
150
+ ),
151
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
152
+ import_recharts.Bar,
153
+ {
154
+ dataKey: "volume",
155
+ fill: "hsl(var(--primary))",
156
+ radius: [3, 3, 0, 0],
157
+ maxBarSize: 24
158
+ }
159
+ )
160
+ ]
161
+ }
162
+ ) })
163
+ ] })
164
+ ] });
165
+ }
166
+ // Annotate the CommonJS export names for ESM import in node:
167
+ 0 && (module.exports = {
168
+ CreatorAnalytics
169
+ });
170
+ //# sourceMappingURL=creator-analytics.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/creator-analytics.tsx"],"sourcesContent":["\"use client\";\n\nimport { useMemo } from \"react\";\nimport {\n BarChart,\n Bar,\n XAxis,\n YAxis,\n Tooltip,\n ResponsiveContainer,\n} from \"recharts\";\nimport type { ApiActivity } from \"@medialane/sdk\";\nimport { TrendingUp, ShoppingBag, Coins } from \"lucide-react\";\n\ninterface CreatorAnalyticsProps {\n activities: ApiActivity[];\n isLoading: boolean;\n}\n\ninterface DayStat {\n label: string;\n volume: number;\n}\n\nfunction parsePrice(formatted: string | null | undefined): number {\n if (!formatted) return 0;\n return parseFloat(formatted.replace(/[^0-9.]/g, \"\")) || 0;\n}\n\nfunction buildDailyVolume(sales: ApiActivity[]): DayStat[] {\n const buckets = new Map<string, number>();\n const now = Date.now();\n // Pre-fill last 30 days so chart always shows full range\n for (let i = 29; i >= 0; i--) {\n const d = new Date(now - i * 86_400_000);\n buckets.set(\n d.toLocaleDateString(\"en-US\", { month: \"short\", day: \"numeric\" }),\n 0\n );\n }\n for (const s of sales) {\n const ts =\n typeof s.timestamp === \"number\"\n ? s.timestamp * 1000\n : new Date(s.timestamp).getTime();\n if (now - ts > 30 * 86_400_000) continue;\n const label = new Date(ts).toLocaleDateString(\"en-US\", {\n month: \"short\",\n day: \"numeric\",\n });\n buckets.set(label, (buckets.get(label) ?? 0) + parsePrice(s.price?.formatted));\n }\n return Array.from(buckets.entries()).map(([label, volume]) => ({ label, volume }));\n}\n\nexport function CreatorAnalytics({ activities, isLoading }: CreatorAnalyticsProps) {\n const { sales, totalVolume, topCurrency, dailyVolume } = useMemo(() => {\n const sales = activities.filter((a) => a.type === \"sale\");\n\n // Volume per currency\n const byCurrency = new Map<string, number>();\n for (const s of sales) {\n const cur = s.price?.currency ?? \"STRK\";\n byCurrency.set(cur, (byCurrency.get(cur) ?? 0) + parsePrice(s.price?.formatted));\n }\n const sorted = [...byCurrency.entries()].sort((a, b) => b[1] - a[1]);\n const topCurrency = sorted[0]?.[0] ?? \"STRK\";\n const totalVolume = sorted[0]?.[1] ?? 0;\n\n const dailyVolume = buildDailyVolume(\n sales.filter((s) => (s.price?.currency ?? \"STRK\") === topCurrency)\n );\n\n return { sales, totalVolume, topCurrency, dailyVolume };\n }, [activities]);\n\n if (isLoading) {\n return (\n <div className=\"space-y-4 animate-pulse\">\n {[1, 2, 3].map((i) => (\n <div key={i} className=\"h-20 rounded-xl bg-muted\" />\n ))}\n </div>\n );\n }\n\n if (sales.length === 0) {\n return (\n <div className=\"py-12 text-center text-sm text-muted-foreground\">\n No sales recorded yet.\n </div>\n );\n }\n\n const stats = [\n {\n label: \"Total Sales\",\n value: sales.length.toString(),\n icon: ShoppingBag,\n },\n {\n label: `Total Volume (${topCurrency})`,\n value: totalVolume.toFixed(2),\n icon: Coins,\n },\n {\n label: \"Last 30 Days\",\n value: `${dailyVolume.filter((d) => d.volume > 0).length} active days`,\n icon: TrendingUp,\n },\n ];\n\n return (\n <div className=\"space-y-6\">\n {/* Stat cards */}\n <div className=\"grid grid-cols-1 sm:grid-cols-3 gap-3\">\n {stats.map(({ label, value, icon: Icon }) => (\n <div\n key={label}\n className=\"rounded-xl border border-border bg-card/50 p-4 space-y-1\"\n >\n <div className=\"flex items-center gap-2 text-muted-foreground\">\n <Icon className=\"h-3.5 w-3.5\" />\n <p className=\"text-xs font-medium uppercase tracking-wide\">{label}</p>\n </div>\n <p className=\"text-2xl font-bold tabular-nums\">{value}</p>\n </div>\n ))}\n </div>\n\n {/* 30-day volume chart */}\n <div className=\"rounded-xl border border-border bg-card/50 p-4 space-y-2\">\n <p className=\"text-xs font-medium text-muted-foreground uppercase tracking-wide\">\n 30-day volume · {topCurrency}\n </p>\n <ResponsiveContainer width=\"100%\" height={140}>\n <BarChart\n data={dailyVolume}\n margin={{ top: 4, right: 4, bottom: 0, left: 0 }}\n >\n <XAxis\n dataKey=\"label\"\n tick={{ fontSize: 10, fill: \"hsl(var(--muted-foreground))\" }}\n axisLine={false}\n tickLine={false}\n interval={6}\n />\n <YAxis\n tick={{ fontSize: 10, fill: \"hsl(var(--muted-foreground))\" }}\n axisLine={false}\n tickLine={false}\n width={40}\n />\n <Tooltip\n contentStyle={{\n background: \"hsl(var(--background))\",\n border: \"1px solid hsl(var(--border))\",\n borderRadius: \"8px\",\n fontSize: \"12px\",\n color: \"hsl(var(--foreground))\",\n }}\n formatter={(value) => [`${value} ${topCurrency}`, \"Volume\"]}\n />\n <Bar\n dataKey=\"volume\"\n fill=\"hsl(var(--primary))\"\n radius={[3, 3, 0, 0]}\n maxBarSize={24}\n />\n </BarChart>\n </ResponsiveContainer>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgFU;AA9EV,mBAAwB;AACxB,sBAOO;AAEP,0BAA+C;AAY/C,SAAS,WAAW,WAA8C;AAChE,MAAI,CAAC,UAAW,QAAO;AACvB,SAAO,WAAW,UAAU,QAAQ,YAAY,EAAE,CAAC,KAAK;AAC1D;AAEA,SAAS,iBAAiB,OAAiC;AACzD,QAAM,UAAU,oBAAI,IAAoB;AACxC,QAAM,MAAM,KAAK,IAAI;AAErB,WAAS,IAAI,IAAI,KAAK,GAAG,KAAK;AAC5B,UAAM,IAAI,IAAI,KAAK,MAAM,IAAI,KAAU;AACvC,YAAQ;AAAA,MACN,EAAE,mBAAmB,SAAS,EAAE,OAAO,SAAS,KAAK,UAAU,CAAC;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACA,aAAW,KAAK,OAAO;AACrB,UAAM,KACJ,OAAO,EAAE,cAAc,WACnB,EAAE,YAAY,MACd,IAAI,KAAK,EAAE,SAAS,EAAE,QAAQ;AACpC,QAAI,MAAM,KAAK,KAAK,MAAY;AAChC,UAAM,QAAQ,IAAI,KAAK,EAAE,EAAE,mBAAmB,SAAS;AAAA,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gBACV,UAAU;AAAA;AAAA,YACZ;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACC,MAAM,EAAE,UAAU,IAAI,MAAM,+BAA+B;AAAA,gBAC3D,UAAU;AAAA,gBACV,UAAU;AAAA,gBACV,OAAO;AAAA;AAAA,YACT;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACC,cAAc;AAAA,kBACZ,YAAY;AAAA,kBACZ,QAAQ;AAAA,kBACR,cAAc;AAAA,kBACd,UAAU;AAAA,kBACV,OAAO;AAAA,gBACT;AAAA,gBACA,WAAW,CAAC,UAAU,CAAC,GAAG,KAAK,IAAI,WAAW,IAAI,QAAQ;AAAA;AAAA,YAC5D;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACC,SAAQ;AAAA,gBACR,MAAK;AAAA,gBACL,QAAQ,CAAC,GAAG,GAAG,GAAG,CAAC;AAAA,gBACnB,YAAY;AAAA;AAAA,YACd;AAAA;AAAA;AAAA,MACF,GACF;AAAA,OACF;AAAA,KACF;AAEJ;","names":["sales","topCurrency","totalVolume","dailyVolume"]}
@@ -0,0 +1,10 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ApiActivity } from '@medialane/sdk';
3
+
4
+ interface CreatorAnalyticsProps {
5
+ activities: ApiActivity[];
6
+ isLoading: boolean;
7
+ }
8
+ declare function CreatorAnalytics({ activities, isLoading }: CreatorAnalyticsProps): react_jsx_runtime.JSX.Element;
9
+
10
+ export { CreatorAnalytics };
@@ -0,0 +1,10 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ApiActivity } from '@medialane/sdk';
3
+
4
+ interface CreatorAnalyticsProps {
5
+ activities: ApiActivity[];
6
+ isLoading: boolean;
7
+ }
8
+ declare function CreatorAnalytics({ activities, isLoading }: CreatorAnalyticsProps): react_jsx_runtime.JSX.Element;
9
+
10
+ export { CreatorAnalytics };
@@ -0,0 +1,153 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useMemo } from "react";
4
+ import {
5
+ BarChart,
6
+ Bar,
7
+ XAxis,
8
+ YAxis,
9
+ Tooltip,
10
+ ResponsiveContainer
11
+ } from "recharts";
12
+ import { TrendingUp, ShoppingBag, Coins } from "lucide-react";
13
+ function parsePrice(formatted) {
14
+ if (!formatted) return 0;
15
+ return parseFloat(formatted.replace(/[^0-9.]/g, "")) || 0;
16
+ }
17
+ function buildDailyVolume(sales) {
18
+ const buckets = /* @__PURE__ */ new Map();
19
+ const now = Date.now();
20
+ for (let i = 29; i >= 0; i--) {
21
+ const d = new Date(now - i * 864e5);
22
+ buckets.set(
23
+ d.toLocaleDateString("en-US", { month: "short", day: "numeric" }),
24
+ 0
25
+ );
26
+ }
27
+ for (const s of sales) {
28
+ const ts = typeof s.timestamp === "number" ? s.timestamp * 1e3 : new Date(s.timestamp).getTime();
29
+ if (now - ts > 30 * 864e5) continue;
30
+ const label = new Date(ts).toLocaleDateString("en-US", {
31
+ month: "short",
32
+ day: "numeric"
33
+ });
34
+ buckets.set(label, (buckets.get(label) ?? 0) + parsePrice(s.price?.formatted));
35
+ }
36
+ return Array.from(buckets.entries()).map(([label, volume]) => ({ label, volume }));
37
+ }
38
+ function CreatorAnalytics({ activities, isLoading }) {
39
+ const { sales, totalVolume, topCurrency, dailyVolume } = useMemo(() => {
40
+ const sales2 = activities.filter((a) => a.type === "sale");
41
+ const byCurrency = /* @__PURE__ */ new Map();
42
+ for (const s of sales2) {
43
+ const cur = s.price?.currency ?? "STRK";
44
+ byCurrency.set(cur, (byCurrency.get(cur) ?? 0) + parsePrice(s.price?.formatted));
45
+ }
46
+ const sorted = [...byCurrency.entries()].sort((a, b) => b[1] - a[1]);
47
+ const topCurrency2 = sorted[0]?.[0] ?? "STRK";
48
+ const totalVolume2 = sorted[0]?.[1] ?? 0;
49
+ const dailyVolume2 = buildDailyVolume(
50
+ sales2.filter((s) => (s.price?.currency ?? "STRK") === topCurrency2)
51
+ );
52
+ return { sales: sales2, totalVolume: totalVolume2, topCurrency: topCurrency2, dailyVolume: dailyVolume2 };
53
+ }, [activities]);
54
+ if (isLoading) {
55
+ return /* @__PURE__ */ jsx("div", { className: "space-y-4 animate-pulse", children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx("div", { className: "h-20 rounded-xl bg-muted" }, i)) });
56
+ }
57
+ if (sales.length === 0) {
58
+ return /* @__PURE__ */ jsx("div", { className: "py-12 text-center text-sm text-muted-foreground", children: "No sales recorded yet." });
59
+ }
60
+ const stats = [
61
+ {
62
+ label: "Total Sales",
63
+ value: sales.length.toString(),
64
+ icon: ShoppingBag
65
+ },
66
+ {
67
+ label: `Total Volume (${topCurrency})`,
68
+ value: totalVolume.toFixed(2),
69
+ icon: Coins
70
+ },
71
+ {
72
+ label: "Last 30 Days",
73
+ value: `${dailyVolume.filter((d) => d.volume > 0).length} active days`,
74
+ icon: TrendingUp
75
+ }
76
+ ];
77
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
78
+ /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 sm:grid-cols-3 gap-3", children: stats.map(({ label, value, icon: Icon }) => /* @__PURE__ */ jsxs(
79
+ "div",
80
+ {
81
+ className: "rounded-xl border border-border bg-card/50 p-4 space-y-1",
82
+ children: [
83
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-muted-foreground", children: [
84
+ /* @__PURE__ */ jsx(Icon, { className: "h-3.5 w-3.5" }),
85
+ /* @__PURE__ */ jsx("p", { className: "text-xs font-medium uppercase tracking-wide", children: label })
86
+ ] }),
87
+ /* @__PURE__ */ jsx("p", { className: "text-2xl font-bold tabular-nums", children: value })
88
+ ]
89
+ },
90
+ label
91
+ )) }),
92
+ /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-border bg-card/50 p-4 space-y-2", children: [
93
+ /* @__PURE__ */ jsxs("p", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide", children: [
94
+ "30-day volume \xB7 ",
95
+ topCurrency
96
+ ] }),
97
+ /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: 140, children: /* @__PURE__ */ jsxs(
98
+ BarChart,
99
+ {
100
+ data: dailyVolume,
101
+ margin: { top: 4, right: 4, bottom: 0, left: 0 },
102
+ children: [
103
+ /* @__PURE__ */ jsx(
104
+ XAxis,
105
+ {
106
+ dataKey: "label",
107
+ tick: { fontSize: 10, fill: "hsl(var(--muted-foreground))" },
108
+ axisLine: false,
109
+ tickLine: false,
110
+ interval: 6
111
+ }
112
+ ),
113
+ /* @__PURE__ */ jsx(
114
+ YAxis,
115
+ {
116
+ tick: { fontSize: 10, fill: "hsl(var(--muted-foreground))" },
117
+ axisLine: false,
118
+ tickLine: false,
119
+ width: 40
120
+ }
121
+ ),
122
+ /* @__PURE__ */ jsx(
123
+ Tooltip,
124
+ {
125
+ contentStyle: {
126
+ background: "hsl(var(--background))",
127
+ border: "1px solid hsl(var(--border))",
128
+ borderRadius: "8px",
129
+ fontSize: "12px",
130
+ color: "hsl(var(--foreground))"
131
+ },
132
+ formatter: (value) => [`${value} ${topCurrency}`, "Volume"]
133
+ }
134
+ ),
135
+ /* @__PURE__ */ jsx(
136
+ Bar,
137
+ {
138
+ dataKey: "volume",
139
+ fill: "hsl(var(--primary))",
140
+ radius: [3, 3, 0, 0],
141
+ maxBarSize: 24
142
+ }
143
+ )
144
+ ]
145
+ }
146
+ ) })
147
+ ] })
148
+ ] });
149
+ }
150
+ export {
151
+ CreatorAnalytics
152
+ };
153
+ //# sourceMappingURL=creator-analytics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/creator-analytics.tsx"],"sourcesContent":["\"use client\";\n\nimport { useMemo } from \"react\";\nimport {\n BarChart,\n Bar,\n XAxis,\n YAxis,\n Tooltip,\n ResponsiveContainer,\n} from \"recharts\";\nimport type { ApiActivity } from \"@medialane/sdk\";\nimport { TrendingUp, ShoppingBag, Coins } from \"lucide-react\";\n\ninterface CreatorAnalyticsProps {\n activities: ApiActivity[];\n isLoading: boolean;\n}\n\ninterface DayStat {\n label: string;\n volume: number;\n}\n\nfunction parsePrice(formatted: string | null | undefined): number {\n if (!formatted) return 0;\n return parseFloat(formatted.replace(/[^0-9.]/g, \"\")) || 0;\n}\n\nfunction buildDailyVolume(sales: ApiActivity[]): DayStat[] {\n const buckets = new Map<string, number>();\n const now = Date.now();\n // Pre-fill last 30 days so chart always shows full range\n for (let i = 29; i >= 0; i--) {\n const d = new Date(now - i * 86_400_000);\n buckets.set(\n d.toLocaleDateString(\"en-US\", { month: \"short\", day: \"numeric\" }),\n 0\n );\n }\n for (const s of sales) {\n const ts =\n typeof s.timestamp === \"number\"\n ? s.timestamp * 1000\n : new Date(s.timestamp).getTime();\n if (now - ts > 30 * 86_400_000) continue;\n const label = new Date(ts).toLocaleDateString(\"en-US\", {\n month: \"short\",\n day: \"numeric\",\n });\n buckets.set(label, (buckets.get(label) ?? 0) + parsePrice(s.price?.formatted));\n }\n return Array.from(buckets.entries()).map(([label, volume]) => ({ label, volume }));\n}\n\nexport function CreatorAnalytics({ activities, isLoading }: CreatorAnalyticsProps) {\n const { sales, totalVolume, topCurrency, dailyVolume } = useMemo(() => {\n const sales = activities.filter((a) => a.type === \"sale\");\n\n // Volume per currency\n const byCurrency = new Map<string, number>();\n for (const s of sales) {\n const cur = s.price?.currency ?? \"STRK\";\n byCurrency.set(cur, (byCurrency.get(cur) ?? 0) + parsePrice(s.price?.formatted));\n }\n const sorted = [...byCurrency.entries()].sort((a, b) => b[1] - a[1]);\n const topCurrency = sorted[0]?.[0] ?? \"STRK\";\n const totalVolume = sorted[0]?.[1] ?? 0;\n\n const dailyVolume = buildDailyVolume(\n sales.filter((s) => (s.price?.currency ?? \"STRK\") === topCurrency)\n );\n\n return { sales, totalVolume, topCurrency, dailyVolume };\n }, [activities]);\n\n if (isLoading) {\n return (\n <div className=\"space-y-4 animate-pulse\">\n {[1, 2, 3].map((i) => (\n <div key={i} className=\"h-20 rounded-xl bg-muted\" />\n ))}\n </div>\n );\n }\n\n if (sales.length === 0) {\n return (\n <div className=\"py-12 text-center text-sm text-muted-foreground\">\n No sales recorded yet.\n </div>\n );\n }\n\n const stats = [\n {\n label: \"Total Sales\",\n value: sales.length.toString(),\n icon: ShoppingBag,\n },\n {\n label: `Total Volume (${topCurrency})`,\n value: totalVolume.toFixed(2),\n icon: Coins,\n },\n {\n label: \"Last 30 Days\",\n value: `${dailyVolume.filter((d) => d.volume > 0).length} active days`,\n icon: TrendingUp,\n },\n ];\n\n return (\n <div className=\"space-y-6\">\n {/* Stat cards */}\n <div className=\"grid grid-cols-1 sm:grid-cols-3 gap-3\">\n {stats.map(({ label, value, icon: Icon }) => (\n <div\n key={label}\n className=\"rounded-xl border border-border bg-card/50 p-4 space-y-1\"\n >\n <div className=\"flex items-center gap-2 text-muted-foreground\">\n <Icon className=\"h-3.5 w-3.5\" />\n <p className=\"text-xs font-medium uppercase tracking-wide\">{label}</p>\n </div>\n <p className=\"text-2xl font-bold tabular-nums\">{value}</p>\n </div>\n ))}\n </div>\n\n {/* 30-day volume chart */}\n <div className=\"rounded-xl border border-border bg-card/50 p-4 space-y-2\">\n <p className=\"text-xs font-medium text-muted-foreground uppercase tracking-wide\">\n 30-day volume · {topCurrency}\n </p>\n <ResponsiveContainer width=\"100%\" height={140}>\n <BarChart\n data={dailyVolume}\n margin={{ top: 4, right: 4, bottom: 0, left: 0 }}\n >\n <XAxis\n dataKey=\"label\"\n tick={{ fontSize: 10, fill: \"hsl(var(--muted-foreground))\" }}\n axisLine={false}\n tickLine={false}\n interval={6}\n />\n <YAxis\n tick={{ fontSize: 10, fill: \"hsl(var(--muted-foreground))\" }}\n axisLine={false}\n tickLine={false}\n width={40}\n />\n <Tooltip\n contentStyle={{\n background: \"hsl(var(--background))\",\n border: \"1px solid hsl(var(--border))\",\n borderRadius: \"8px\",\n fontSize: \"12px\",\n color: \"hsl(var(--foreground))\",\n }}\n formatter={(value) => [`${value} ${topCurrency}`, \"Volume\"]}\n />\n <Bar\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ACV,OAAO;AAAA,gBACT;AAAA,gBACA,WAAW,CAAC,UAAU,CAAC,GAAG,KAAK,IAAI,WAAW,IAAI,QAAQ;AAAA;AAAA,YAC5D;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACC,SAAQ;AAAA,gBACR,MAAK;AAAA,gBACL,QAAQ,CAAC,GAAG,GAAG,GAAG,CAAC;AAAA,gBACnB,YAAY;AAAA;AAAA,YACd;AAAA;AAAA;AAAA,MACF,GACF;AAAA,OACF;AAAA,KACF;AAEJ;","names":["sales","topCurrency","totalVolume","dailyVolume"]}
@@ -0,0 +1,128 @@
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 dialog_exports = {};
31
+ __export(dialog_exports, {
32
+ Dialog: () => Dialog,
33
+ DialogClose: () => DialogClose,
34
+ DialogContent: () => DialogContent,
35
+ DialogDescription: () => DialogDescription,
36
+ DialogFooter: () => DialogFooter,
37
+ DialogHeader: () => DialogHeader,
38
+ DialogOverlay: () => DialogOverlay,
39
+ DialogPortal: () => DialogPortal,
40
+ DialogTitle: () => DialogTitle,
41
+ DialogTrigger: () => DialogTrigger
42
+ });
43
+ module.exports = __toCommonJS(dialog_exports);
44
+ var import_jsx_runtime = require("react/jsx-runtime");
45
+ var React = __toESM(require("react"), 1);
46
+ var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
47
+ var import_lucide_react = require("lucide-react");
48
+ var import_cn = require("../utils/cn.js");
49
+ const Dialog = DialogPrimitive.Root;
50
+ const DialogTrigger = DialogPrimitive.Trigger;
51
+ const DialogPortal = DialogPrimitive.Portal;
52
+ const DialogClose = DialogPrimitive.Close;
53
+ const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
54
+ DialogPrimitive.Overlay,
55
+ {
56
+ ref,
57
+ className: (0, import_cn.cn)(
58
+ "fixed inset-0 z-50 bg-transparent backdrop-blur-[48px] backdrop-saturate-150 backdrop-brightness-100 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
59
+ className
60
+ ),
61
+ ...props
62
+ }
63
+ ));
64
+ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
65
+ const DialogContent = React.forwardRef(({ className, children, hideClose, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogPortal, { children: [
66
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogOverlay, {}),
67
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
68
+ DialogPrimitive.Content,
69
+ {
70
+ ref,
71
+ className: (0, import_cn.cn)(
72
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-[calc(100%-6px)] sm:max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 bg-background p-6 shadow-lg duration-200 rounded-2xl focus:outline-none max-h-[92svh] overflow-y-auto data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",
73
+ className
74
+ ),
75
+ ...props,
76
+ children: [
77
+ children,
78
+ !hideClose && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
79
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.X, { className: "h-4 w-4" }),
80
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: "Close" })
81
+ ] })
82
+ ]
83
+ }
84
+ )
85
+ ] }));
86
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
87
+ const DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: (0, import_cn.cn)("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
88
+ DialogHeader.displayName = "DialogHeader";
89
+ const DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
90
+ "div",
91
+ {
92
+ className: (0, import_cn.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
93
+ ...props
94
+ }
95
+ );
96
+ DialogFooter.displayName = "DialogFooter";
97
+ const DialogTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
98
+ DialogPrimitive.Title,
99
+ {
100
+ ref,
101
+ className: (0, import_cn.cn)("text-lg font-semibold leading-none tracking-tight", className),
102
+ ...props
103
+ }
104
+ ));
105
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
106
+ const DialogDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
107
+ DialogPrimitive.Description,
108
+ {
109
+ ref,
110
+ className: (0, import_cn.cn)("text-sm text-muted-foreground", className),
111
+ ...props
112
+ }
113
+ ));
114
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
115
+ // Annotate the CommonJS export names for ESM import in node:
116
+ 0 && (module.exports = {
117
+ Dialog,
118
+ DialogClose,
119
+ DialogContent,
120
+ DialogDescription,
121
+ DialogFooter,
122
+ DialogHeader,
123
+ DialogOverlay,
124
+ DialogPortal,
125
+ DialogTitle,
126
+ DialogTrigger
127
+ });
128
+ //# sourceMappingURL=dialog.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"../utils/cn.js\";\n\nconst Dialog = DialogPrimitive.Root;\nconst DialogTrigger = DialogPrimitive.Trigger;\nconst DialogPortal = DialogPrimitive.Portal;\nconst DialogClose = DialogPrimitive.Close;\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n \"fixed inset-0 z-50 bg-transparent backdrop-blur-[48px] backdrop-saturate-150 backdrop-brightness-100 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n className\n )}\n {...props}\n />\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\ninterface DialogContentProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {\n hideClose?: boolean;\n}\n\nconst DialogContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n DialogContentProps\n>(({ className, children, hideClose, ...props }, ref) => (\n <DialogPortal>\n <DialogOverlay />\n <DialogPrimitive.Content\n ref={ref}\n className={cn(\n \"fixed left-[50%] top-[50%] z-50 grid w-full max-w-[calc(100%-6px)] sm:max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 bg-background p-6 shadow-lg duration-200 rounded-2xl focus:outline-none max-h-[92svh] overflow-y-auto data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]\",\n className\n )}\n {...props}\n >\n {children}\n {!hideClose && (\n <DialogPrimitive.Close className=\"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground\">\n <X className=\"h-4 w-4\" />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogPortal>\n));\nDialogContent.displayName = DialogPrimitive.Content.displayName;\n\nconst DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div className={cn(\"flex flex-col space-y-1.5 text-center sm:text-left\", className)} {...props} />\n);\nDialogHeader.displayName = \"DialogHeader\";\n\nconst DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\", className)}\n {...props}\n />\n);\nDialogFooter.displayName = \"DialogFooter\";\n\nconst DialogTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn(\"text-lg font-semibold leading-none tracking-tight\", className)}\n {...props}\n />\n));\nDialogTitle.displayName = DialogPrimitive.Title.displayName;\n\nconst DialogDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nDialogDescription.displayName = DialogPrimitive.Description.displayName;\n\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogClose,\n DialogTrigger,\n DialogContent,\n DialogHeader,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBE;AAdF,YAAuB;AACvB,sBAAiC;AACjC,0BAAkB;AAClB,gBAAmB;AAEnB,MAAM,SAAS,gBAAgB;AAC/B,MAAM,gBAAgB,gBAAgB;AACtC,MAAM,eAAe,gBAAgB;AACrC,MAAM,cAAc,gBAAgB;AAEpC,MAAM,gBAAgB,MAAM,WAG1B,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAC1B;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,eAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,IACC,GAAG;AAAA;AACN,CACD;AACD,cAAc,cAAc,gBAAgB,QAAQ;AAMpD,MAAM,gBAAgB,MAAM,WAG1B,CAAC,EAAE,WAAW,UAAU,WAAW,GAAG,MAAM,GAAG,QAC/C,6CAAC,gB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ive from '@radix-ui/react-dialog';
4
+
5
+ declare const Dialog: React.FC<DialogPrimitive.DialogProps>;
6
+ declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
7
+ declare const DialogPortal: React.FC<DialogPrimitive.DialogPortalProps>;
8
+ declare const DialogClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
9
+ declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
10
+ interface DialogContentProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {
11
+ hideClose?: boolean;
12
+ }
13
+ declare const DialogContent: React.ForwardRefExoticComponent<DialogContentProps & React.RefAttributes<HTMLDivElement>>;
14
+ declare const DialogHeader: {
15
+ ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
16
+ displayName: string;
17
+ };
18
+ declare const DialogFooter: {
19
+ ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
20
+ displayName: string;
21
+ };
22
+ declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
23
+ declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
24
+
25
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
@@ -0,0 +1,25 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
4
+
5
+ declare const Dialog: React.FC<DialogPrimitive.DialogProps>;
6
+ declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
7
+ declare const DialogPortal: React.FC<DialogPrimitive.DialogPortalProps>;
8
+ declare const DialogClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
9
+ declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
10
+ interface DialogContentProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {
11
+ hideClose?: boolean;
12
+ }
13
+ declare const DialogContent: React.ForwardRefExoticComponent<DialogContentProps & React.RefAttributes<HTMLDivElement>>;
14
+ declare const DialogHeader: {
15
+ ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
16
+ displayName: string;
17
+ };
18
+ declare const DialogFooter: {
19
+ ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
20
+ displayName: string;
21
+ };
22
+ declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
23
+ declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
24
+
25
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };