@medialane/ui 0.101.2 → 0.103.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/alert.cjs +75 -0
- package/dist/components/alert.cjs.map +1 -0
- package/dist/components/alert.d.cts +11 -0
- package/dist/components/alert.d.ts +11 -0
- package/dist/components/alert.js +39 -0
- package/dist/components/alert.js.map +1 -0
- package/dist/components/badge.cjs +52 -0
- package/dist/components/badge.cjs.map +1 -0
- package/dist/components/badge.d.cts +13 -0
- package/dist/components/badge.d.ts +13 -0
- package/dist/components/badge.js +27 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/button.cjs +86 -0
- package/dist/components/button.cjs.map +1 -0
- package/dist/components/button.d.cts +14 -0
- package/dist/components/button.d.ts +14 -0
- package/dist/components/button.js +51 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/card.cjs +87 -0
- package/dist/components/card.cjs.map +1 -0
- package/dist/components/card.d.cts +10 -0
- package/dist/components/card.d.ts +10 -0
- package/dist/components/card.js +48 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/checkbox.cjs +63 -0
- package/dist/components/checkbox.cjs.map +1 -0
- package/dist/components/checkbox.d.cts +6 -0
- package/dist/components/checkbox.d.ts +6 -0
- package/dist/components/checkbox.js +29 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/collapsible.cjs +47 -0
- package/dist/components/collapsible.cjs.map +1 -0
- package/dist/components/collapsible.d.cts +8 -0
- package/dist/components/collapsible.d.ts +8 -0
- package/dist/components/collapsible.js +11 -0
- package/dist/components/collapsible.js.map +1 -0
- package/dist/components/creator-analytics.cjs +170 -0
- package/dist/components/creator-analytics.cjs.map +1 -0
- package/dist/components/creator-analytics.d.cts +10 -0
- package/dist/components/creator-analytics.d.ts +10 -0
- package/dist/components/creator-analytics.js +153 -0
- package/dist/components/creator-analytics.js.map +1 -0
- package/dist/components/drop-countdown.cjs +66 -0
- package/dist/components/drop-countdown.cjs.map +1 -0
- package/dist/components/drop-countdown.d.cts +8 -0
- package/dist/components/drop-countdown.d.ts +8 -0
- package/dist/components/drop-countdown.js +42 -0
- package/dist/components/drop-countdown.js.map +1 -0
- package/dist/components/empty-or-error.cjs +88 -0
- package/dist/components/empty-or-error.cjs.map +1 -0
- package/dist/components/empty-or-error.d.cts +23 -0
- package/dist/components/empty-or-error.d.ts +23 -0
- package/dist/components/empty-or-error.js +54 -0
- package/dist/components/empty-or-error.js.map +1 -0
- package/dist/components/form.cjs +150 -0
- package/dist/components/form.cjs.map +1 -0
- package/dist/components/form.d.cts +29 -0
- package/dist/components/form.d.ts +29 -0
- package/dist/components/form.js +113 -0
- package/dist/components/form.js.map +1 -0
- package/dist/components/help-icon.cjs +47 -0
- package/dist/components/help-icon.cjs.map +1 -0
- package/dist/components/help-icon.d.cts +14 -0
- package/dist/components/help-icon.d.ts +14 -0
- package/dist/components/help-icon.js +23 -0
- package/dist/components/help-icon.js.map +1 -0
- package/dist/components/input.cjs +58 -0
- package/dist/components/input.cjs.map +1 -0
- package/dist/components/input.d.cts +5 -0
- package/dist/components/input.d.ts +5 -0
- package/dist/components/input.js +24 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/label.cjs +49 -0
- package/dist/components/label.cjs.map +1 -0
- package/dist/components/label.d.cts +8 -0
- package/dist/components/label.d.ts +8 -0
- package/dist/components/label.js +15 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/owner-setup-panel.cjs +91 -0
- package/dist/components/owner-setup-panel.cjs.map +1 -0
- package/dist/components/owner-setup-panel.d.cts +10 -0
- package/dist/components/owner-setup-panel.d.ts +10 -0
- package/dist/components/owner-setup-panel.js +57 -0
- package/dist/components/owner-setup-panel.js.map +1 -0
- package/dist/components/popover.cjs +66 -0
- package/dist/components/popover.cjs.map +1 -0
- package/dist/components/popover.d.cts +9 -0
- package/dist/components/popover.d.ts +9 -0
- package/dist/components/popover.js +29 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/select.cjs +163 -0
- package/dist/components/select.cjs.map +1 -0
- package/dist/components/select.d.cts +15 -0
- package/dist/components/select.d.ts +15 -0
- package/dist/components/select.js +120 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/skeleton.cjs +42 -0
- package/dist/components/skeleton.cjs.map +1 -0
- package/dist/components/skeleton.d.cts +5 -0
- package/dist/components/skeleton.d.ts +5 -0
- package/dist/components/skeleton.js +18 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/switch.cjs +63 -0
- package/dist/components/switch.cjs.map +1 -0
- package/dist/components/switch.d.cts +6 -0
- package/dist/components/switch.d.ts +6 -0
- package/dist/components/switch.js +29 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/tabs.cjs +86 -0
- package/dist/components/tabs.cjs.map +1 -0
- package/dist/components/tabs.d.cts +9 -0
- package/dist/components/tabs.d.ts +9 -0
- package/dist/components/tabs.js +49 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/index.cjs +142 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +108 -1
- package/dist/index.js.map +1 -1
- package/dist/medialane.css +0 -16
- package/dist/utils/use-creators.cjs +53 -0
- package/dist/utils/use-creators.cjs.map +1 -0
- package/dist/utils/use-creators.d.cts +11 -0
- package/dist/utils/use-creators.d.ts +11 -0
- package/dist/utils/use-creators.js +19 -0
- package/dist/utils/use-creators.js.map +1 -0
- package/dist/utils/use-medialane-client.cjs +33 -0
- package/dist/utils/use-medialane-client.cjs.map +1 -0
- package/dist/utils/use-medialane-client.d.cts +5 -0
- package/dist/utils/use-medialane-client.d.ts +5 -0
- package/dist/utils/use-medialane-client.js +9 -0
- package/dist/utils/use-medialane-client.js.map +1 -0
- package/dist/utils/use-rewards.cjs +100 -0
- package/dist/utils/use-rewards.cjs.map +1 -0
- package/dist/utils/use-rewards.d.cts +61 -0
- package/dist/utils/use-rewards.d.ts +61 -0
- package/dist/utils/use-rewards.js +62 -0
- package/dist/utils/use-rewards.js.map +1 -0
- package/package.json +25 -1
|
@@ -0,0 +1,66 @@
|
|
|
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 drop_countdown_exports = {};
|
|
21
|
+
__export(drop_countdown_exports, {
|
|
22
|
+
DropCountdown: () => DropCountdown
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(drop_countdown_exports);
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
function parts(totalSeconds) {
|
|
28
|
+
const s = Math.max(0, totalSeconds);
|
|
29
|
+
return {
|
|
30
|
+
d: Math.floor(s / 86400),
|
|
31
|
+
h: Math.floor(s % 86400 / 3600),
|
|
32
|
+
m: Math.floor(s % 3600 / 60),
|
|
33
|
+
s: Math.floor(s % 60)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function DropCountdown({ targetTs, label }) {
|
|
37
|
+
const [now, setNow] = (0, import_react.useState)(() => Math.floor(Date.now() / 1e3));
|
|
38
|
+
(0, import_react.useEffect)(() => {
|
|
39
|
+
const id = setInterval(() => setNow(Math.floor(Date.now() / 1e3)), 1e3);
|
|
40
|
+
return () => clearInterval(id);
|
|
41
|
+
}, []);
|
|
42
|
+
const { d, h, m, s } = parts(targetTs - now);
|
|
43
|
+
const cell = (value, unit) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col items-center", children: [
|
|
44
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-2xl font-black tabular-nums leading-none", children: String(value).padStart(2, "0") }),
|
|
45
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-[10px] uppercase tracking-widest text-muted-foreground mt-1", children: unit })
|
|
46
|
+
] });
|
|
47
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2", children: [
|
|
48
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs font-semibold uppercase tracking-widest text-brand-orange", children: label }),
|
|
49
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
50
|
+
d > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
51
|
+
cell(d, "days"),
|
|
52
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-xl text-muted-foreground/40", children: ":" })
|
|
53
|
+
] }),
|
|
54
|
+
cell(h, "hrs"),
|
|
55
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-xl text-muted-foreground/40", children: ":" }),
|
|
56
|
+
cell(m, "min"),
|
|
57
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-xl text-muted-foreground/40", children: ":" }),
|
|
58
|
+
cell(s, "sec")
|
|
59
|
+
] })
|
|
60
|
+
] });
|
|
61
|
+
}
|
|
62
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
+
0 && (module.exports = {
|
|
64
|
+
DropCountdown
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=drop-countdown.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/drop-countdown.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\nfunction parts(totalSeconds: number) {\n const s = Math.max(0, totalSeconds);\n return {\n d: Math.floor(s / 86400),\n h: Math.floor((s % 86400) / 3600),\n m: Math.floor((s % 3600) / 60),\n s: Math.floor(s % 60),\n };\n}\n\n// Counts down to a unix-seconds target (phase start when upcoming, phase end when live).\nexport function DropCountdown({ targetTs, label }: { targetTs: number; label: string }) {\n const [now, setNow] = useState(() => Math.floor(Date.now() / 1000));\n\n useEffect(() => {\n const id = setInterval(() => setNow(Math.floor(Date.now() / 1000)), 1000);\n return () => clearInterval(id);\n }, []);\n\n const { d, h, m, s } = parts(targetTs - now);\n const cell = (value: number, unit: string) => (\n <div className=\"flex flex-col items-center\">\n <span className=\"text-2xl font-black tabular-nums leading-none\">{String(value).padStart(2, \"0\")}</span>\n <span className=\"text-[10px] uppercase tracking-widest text-muted-foreground mt-1\">{unit}</span>\n </div>\n );\n\n return (\n <div className=\"space-y-2\">\n <p className=\"text-xs font-semibold uppercase tracking-widest text-brand-orange\">{label}</p>\n <div className=\"flex items-center gap-3\">\n {d > 0 && (<>{cell(d, \"days\")}<span className=\"text-xl text-muted-foreground/40\">:</span></>)}\n {cell(h, \"hrs\")}\n <span className=\"text-xl text-muted-foreground/40\">:</span>\n {cell(m, \"min\")}\n <span className=\"text-xl text-muted-foreground/40\">:</span>\n {cell(s, \"sec\")}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAyBI;AAvBJ,mBAAoC;AAEpC,SAAS,MAAM,cAAsB;AACnC,QAAM,IAAI,KAAK,IAAI,G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|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
function parts(totalSeconds) {
|
|
5
|
+
const s = Math.max(0, totalSeconds);
|
|
6
|
+
return {
|
|
7
|
+
d: Math.floor(s / 86400),
|
|
8
|
+
h: Math.floor(s % 86400 / 3600),
|
|
9
|
+
m: Math.floor(s % 3600 / 60),
|
|
10
|
+
s: Math.floor(s % 60)
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function DropCountdown({ targetTs, label }) {
|
|
14
|
+
const [now, setNow] = useState(() => Math.floor(Date.now() / 1e3));
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const id = setInterval(() => setNow(Math.floor(Date.now() / 1e3)), 1e3);
|
|
17
|
+
return () => clearInterval(id);
|
|
18
|
+
}, []);
|
|
19
|
+
const { d, h, m, s } = parts(targetTs - now);
|
|
20
|
+
const cell = (value, unit) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
|
|
21
|
+
/* @__PURE__ */ jsx("span", { className: "text-2xl font-black tabular-nums leading-none", children: String(value).padStart(2, "0") }),
|
|
22
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] uppercase tracking-widest text-muted-foreground mt-1", children: unit })
|
|
23
|
+
] });
|
|
24
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
25
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs font-semibold uppercase tracking-widest text-brand-orange", children: label }),
|
|
26
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
27
|
+
d > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
28
|
+
cell(d, "days"),
|
|
29
|
+
/* @__PURE__ */ jsx("span", { className: "text-xl text-muted-foreground/40", children: ":" })
|
|
30
|
+
] }),
|
|
31
|
+
cell(h, "hrs"),
|
|
32
|
+
/* @__PURE__ */ jsx("span", { className: "text-xl text-muted-foreground/40", children: ":" }),
|
|
33
|
+
cell(m, "min"),
|
|
34
|
+
/* @__PURE__ */ jsx("span", { className: "text-xl text-muted-foreground/40", children: ":" }),
|
|
35
|
+
cell(s, "sec")
|
|
36
|
+
] })
|
|
37
|
+
] });
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
DropCountdown
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=drop-countdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/drop-countdown.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\nfunction parts(totalSeconds: number) {\n const s = Math.max(0, totalSeconds);\n return {\n d: Math.floor(s / 86400),\n h: Math.floor((s % 86400) / 3600),\n m: Math.floor((s % 3600) / 60),\n s: Math.floor(s % 60),\n };\n}\n\n// Counts down to a unix-seconds target (phase start when upcoming, phase end when live).\nexport function DropCountdown({ targetTs, label }: { targetTs: number; label: string }) {\n const [now, setNow] = useState(() => Math.floor(Date.now() / 1000));\n\n useEffect(() => {\n const id = setInterval(() => setNow(Math.floor(Date.now() / 1000)), 1000);\n return () => clearInterval(id);\n }, []);\n\n const { d, h, m, s } = parts(targetTs - now);\n const cell = (value: number, unit: string) => (\n <div className=\"flex flex-col items-center\">\n <span className=\"text-2xl font-black tabular-nums leading-none\">{String(value).padStart(2, \"0\")}</span>\n <span className=\"text-[10px] uppercase tracking-widest text-muted-foreground mt-1\">{unit}</span>\n </div>\n );\n\n return (\n <div className=\"space-y-2\">\n <p className=\"text-xs font-semibold uppercase tracking-widest text-brand-orange\">{label}</p>\n <div className=\"flex items-center gap-3\">\n {d > 0 && (<>{cell(d, \"days\")}<span className=\"text-xl text-muted-foreground/40\">:</span></>)}\n {cell(h, \"hrs\")}\n <span className=\"text-xl text-muted-foreground/40\">:</span>\n {cell(m, \"min\")}\n <span className=\"text-xl text-muted-foreground/40\">:</span>\n {cell(s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AAC;AAAA,MACnD,KAAK,GAAG,KAAK;AAAA,MACd,oBAAC,UAAK,WAAU,oCAAmC,eAAC;AAAA,MACnD,KAAK,GAAG,KAAK;AAAA,OAChB;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,88 @@
|
|
|
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 empty_or_error_exports = {};
|
|
31
|
+
__export(empty_or_error_exports, {
|
|
32
|
+
EmptyOrError: () => EmptyOrError
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(empty_or_error_exports);
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var import_skeleton = require("./skeleton.js");
|
|
37
|
+
var import_button = require("./button.js");
|
|
38
|
+
var import_link = __toESM(require("next/link"), 1);
|
|
39
|
+
var import_lucide_react = require("lucide-react");
|
|
40
|
+
function EmptyOrError({
|
|
41
|
+
isLoading,
|
|
42
|
+
error,
|
|
43
|
+
isEmpty,
|
|
44
|
+
onRetry,
|
|
45
|
+
emptyTitle,
|
|
46
|
+
emptyDescription,
|
|
47
|
+
emptyCta,
|
|
48
|
+
emptyIcon,
|
|
49
|
+
skeletonCount = 4,
|
|
50
|
+
skeletonNode,
|
|
51
|
+
children
|
|
52
|
+
}) {
|
|
53
|
+
if (isLoading) {
|
|
54
|
+
if (skeletonNode) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: skeletonNode });
|
|
55
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "space-y-3", children: Array.from({ length: skeletonCount }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: "h-20 w-full rounded-xl" }, i)) });
|
|
56
|
+
}
|
|
57
|
+
if (error) {
|
|
58
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "py-16 text-center space-y-4", children: [
|
|
59
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-14 w-14 rounded-xl bg-destructive/10 flex items-center justify-center mx-auto", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.AlertCircle, { className: "h-7 w-7 text-destructive" }) }),
|
|
60
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "font-semibold text-lg", children: "Something went wrong" }),
|
|
61
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground max-w-xs mx-auto", children: error instanceof Error ? error.message : "Failed to load data. Please try again." }),
|
|
62
|
+
onRetry && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_button.Button, { variant: "outline", size: "sm", onClick: onRetry, children: [
|
|
63
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.RefreshCw, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
64
|
+
"Try again"
|
|
65
|
+
] })
|
|
66
|
+
] });
|
|
67
|
+
}
|
|
68
|
+
if (isEmpty) {
|
|
69
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "py-16 text-center space-y-4", children: [
|
|
70
|
+
emptyIcon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-14 w-14 rounded-xl bg-muted flex items-center justify-center mx-auto", children: emptyIcon }),
|
|
71
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "font-semibold text-lg", children: emptyTitle }),
|
|
72
|
+
emptyDescription && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground max-w-xs mx-auto", children: emptyDescription }),
|
|
73
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center justify-center gap-3", children: [
|
|
74
|
+
onRetry && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_button.Button, { variant: "outline", size: "sm", onClick: onRetry, children: [
|
|
75
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.RefreshCw, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
76
|
+
"Refresh"
|
|
77
|
+
] }),
|
|
78
|
+
emptyCta && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { size: "sm", asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.default, { href: emptyCta.href, children: emptyCta.label }) })
|
|
79
|
+
] })
|
|
80
|
+
] });
|
|
81
|
+
}
|
|
82
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
83
|
+
}
|
|
84
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
85
|
+
0 && (module.exports = {
|
|
86
|
+
EmptyOrError
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=empty-or-error.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/empty-or-error.tsx"],"sourcesContent":["\"use client\";\n\nimport { Skeleton } from \"./skeleton.js\";\nimport { Button } from \"./button.js\";\nimport Link from \"next/link\";\nimport { RefreshCw, AlertCircle } from \"lucide-react\";\nimport { ReactNode } from \"react\";\n\ninterface EmptyOrErrorProps {\n isLoading: boolean;\n error?: unknown;\n isEmpty: boolean;\n onRetry?: () => void;\n emptyTitle: string;\n emptyDescription?: string;\n emptyCta?: { label: string; href: string };\n emptyIcon?: ReactNode;\n skeletonCount?: number;\n /** Optional custom skeleton renderer — replaces the default row skeletons */\n skeletonNode?: ReactNode;\n children?: ReactNode;\n}\n\nexport function EmptyOrError({\n isLoading,\n error,\n isEmpty,\n onRetry,\n emptyTitle,\n emptyDescription,\n emptyCta,\n emptyIcon,\n skeletonCount = 4,\n skeletonNode,\n children,\n}: EmptyOrErrorProps) {\n if (isLoading) {\n if (skeletonNode) return <>{skeletonNode}</>;\n return (\n <div className=\"space-y-3\">\n {Array.from({ length: skeletonCount }).map((_, i) => (\n <Skeleton key={i} className=\"h-20 w-full rounded-xl\" />\n ))}\n </div>\n );\n }\n\n if (error) {\n return (\n <div className=\"py-16 text-center space-y-4\">\n <div className=\"h-14 w-14 rounded-xl bg-destructive/10 flex items-center justify-center mx-auto\">\n <AlertCircle className=\"h-7 w-7 text-destructive\" />\n </div>\n <p className=\"font-semibold text-lg\">Something went wrong</p>\n <p className=\"text-sm text-muted-foreground max-w-xs mx-auto\">\n {error instanceof Error ? error.message : \"Failed to load data. Please try again.\"}\n </p>\n {onRetry && (\n <Button variant=\"outline\" size=\"sm\" onClick={onRetry}>\n <RefreshCw className=\"h-3.5 w-3.5 mr-1.5\" />\n Try again\n </Button>\n )}\n </div>\n );\n }\n\n if (isEmpty) {\n return (\n <div className=\"py-16 text-center space-y-4\">\n {emptyIcon && (\n <div className=\"h-14 w-14 rounded-xl bg-muted flex items-center justify-center mx-auto\">\n {emptyIcon}\n </div>\n )}\n <p className=\"font-semibold text-lg\">{emptyTitle}</p>\n {emptyDescription && (\n <p className=\"text-sm text-muted-foreground max-w-xs mx-auto\">{emptyDescription}</p>\n )}\n <div className=\"flex items-center justify-center gap-3\">\n {onRetry && (\n <Button variant=\"outline\" size=\"sm\" onClick={onRetry}>\n <RefreshCw className=\"h-3.5 w-3.5 mr-1.5\" />\n Refresh\n </Button>\n )}\n {emptyCta && (\n <Button size=\"sm\" asChild>\n <Link href={emptyCta.href}>{emptyCta.label}</Link>\n </Button>\n )}\n </div>\n </div>\n );\n }\n\n return <>{children}</>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAqC6B;AAnC7B,sBAAyB;AACzB,oBAAuB;AACvB,kBAAiB;AACjB,0BAAuC;AAkBhC,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB;AAAA,EAChB;AAAA,EACA;AACF,GAAsB;AACpB,MAAI,WAAW;AACb,QAAI,aAAc,QAAO,2EAAG,wBAAa;AACzC,WACE,4CAAC,SAAI,WAAU,aACZ,gBAAM,KAAK,EAAE,QAAQ,cAAc,CAAC,EAAE,IAAI,CAAC,GAAG,MAC7C,4CAAC,4BAAiB,WAAU,4BAAb,CAAsC,CACtD,GACH;AAAA,EAEJ;AAEA,MAAI,OAAO;AACT,WACE,6CAAC,SAAI,WAAU,+BACb;AAAA,kDAAC,SAAI,WAAU,mFACb,sDAAC,mCAAY,WAAU,4BAA2B,GACpD;AAAA,MACA,4CAAC,OAAE,WAAU,yBAAwB,kCAAoB;AAAA,MACzD,4CAAC,OAAE,WAAU,kDACV,2BAAiB,QAAQ,MAAM,UAAU,0CAC5C;AAAA,MACC,WACC,6CAAC,wBAAO,SAAQ,WAAU,MAAK,MAAK,SAAS,SAC3C;AAAA,oDAAC,iCAAU,WAAU,sBAAqB;AAAA,QAAE;AAAA,SAE9C;AAAA,OAEJ;AAAA,EAEJ;AAEA,MAAI,SAAS;AACX,WACE,6CAAC,SAAI,WAAU,+BACZ;AAAA,mBACC,4CAAC,SAAI,WAAU,0EACZ,qBACH;AAAA,MAEF,4CAAC,OAAE,WAAU,yBAAyB,sBAAW;AAAA,MAChD,oBACC,4CAAC,OAAE,WAAU,kDAAkD,4BAAiB;AAAA,MAElF,6CAAC,SAAI,WAAU,0CACZ;AAAA,mBACC,6CAAC,wBAAO,SAAQ,WAAU,MAAK,MAAK,SAAS,SAC3C;AAAA,sDAAC,iCAAU,WAAU,sBAAqB;AAAA,UAAE;AAAA,WAE9C;AAAA,QAED,YACC,4CAAC,wBAAO,MAAK,MAAK,SAAO,MACvB,sDAAC,YAAAA,SAAA,EAAK,MAAM,SAAS,MAAO,mBAAS,OAAM,GAC7C;AAAA,SAEJ;AAAA,OACF;AAAA,EAEJ;AAEA,SAAO,2EAAG,UAAS;AACrB;","names":["Link"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface EmptyOrErrorProps {
|
|
5
|
+
isLoading: boolean;
|
|
6
|
+
error?: unknown;
|
|
7
|
+
isEmpty: boolean;
|
|
8
|
+
onRetry?: () => void;
|
|
9
|
+
emptyTitle: string;
|
|
10
|
+
emptyDescription?: string;
|
|
11
|
+
emptyCta?: {
|
|
12
|
+
label: string;
|
|
13
|
+
href: string;
|
|
14
|
+
};
|
|
15
|
+
emptyIcon?: ReactNode;
|
|
16
|
+
skeletonCount?: number;
|
|
17
|
+
/** Optional custom skeleton renderer — replaces the default row skeletons */
|
|
18
|
+
skeletonNode?: ReactNode;
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
declare function EmptyOrError({ isLoading, error, isEmpty, onRetry, emptyTitle, emptyDescription, emptyCta, emptyIcon, skeletonCount, skeletonNode, children, }: EmptyOrErrorProps): react_jsx_runtime.JSX.Element;
|
|
22
|
+
|
|
23
|
+
export { EmptyOrError };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface EmptyOrErrorProps {
|
|
5
|
+
isLoading: boolean;
|
|
6
|
+
error?: unknown;
|
|
7
|
+
isEmpty: boolean;
|
|
8
|
+
onRetry?: () => void;
|
|
9
|
+
emptyTitle: string;
|
|
10
|
+
emptyDescription?: string;
|
|
11
|
+
emptyCta?: {
|
|
12
|
+
label: string;
|
|
13
|
+
href: string;
|
|
14
|
+
};
|
|
15
|
+
emptyIcon?: ReactNode;
|
|
16
|
+
skeletonCount?: number;
|
|
17
|
+
/** Optional custom skeleton renderer — replaces the default row skeletons */
|
|
18
|
+
skeletonNode?: ReactNode;
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
declare function EmptyOrError({ isLoading, error, isEmpty, onRetry, emptyTitle, emptyDescription, emptyCta, emptyIcon, skeletonCount, skeletonNode, children, }: EmptyOrErrorProps): react_jsx_runtime.JSX.Element;
|
|
22
|
+
|
|
23
|
+
export { EmptyOrError };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Skeleton } from "./skeleton.js";
|
|
4
|
+
import { Button } from "./button.js";
|
|
5
|
+
import Link from "next/link";
|
|
6
|
+
import { RefreshCw, AlertCircle } from "lucide-react";
|
|
7
|
+
function EmptyOrError({
|
|
8
|
+
isLoading,
|
|
9
|
+
error,
|
|
10
|
+
isEmpty,
|
|
11
|
+
onRetry,
|
|
12
|
+
emptyTitle,
|
|
13
|
+
emptyDescription,
|
|
14
|
+
emptyCta,
|
|
15
|
+
emptyIcon,
|
|
16
|
+
skeletonCount = 4,
|
|
17
|
+
skeletonNode,
|
|
18
|
+
children
|
|
19
|
+
}) {
|
|
20
|
+
if (isLoading) {
|
|
21
|
+
if (skeletonNode) return /* @__PURE__ */ jsx(Fragment, { children: skeletonNode });
|
|
22
|
+
return /* @__PURE__ */ jsx("div", { className: "space-y-3", children: Array.from({ length: skeletonCount }).map((_, i) => /* @__PURE__ */ jsx(Skeleton, { className: "h-20 w-full rounded-xl" }, i)) });
|
|
23
|
+
}
|
|
24
|
+
if (error) {
|
|
25
|
+
return /* @__PURE__ */ jsxs("div", { className: "py-16 text-center space-y-4", children: [
|
|
26
|
+
/* @__PURE__ */ jsx("div", { className: "h-14 w-14 rounded-xl bg-destructive/10 flex items-center justify-center mx-auto", children: /* @__PURE__ */ jsx(AlertCircle, { className: "h-7 w-7 text-destructive" }) }),
|
|
27
|
+
/* @__PURE__ */ jsx("p", { className: "font-semibold text-lg", children: "Something went wrong" }),
|
|
28
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground max-w-xs mx-auto", children: error instanceof Error ? error.message : "Failed to load data. Please try again." }),
|
|
29
|
+
onRetry && /* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", onClick: onRetry, children: [
|
|
30
|
+
/* @__PURE__ */ jsx(RefreshCw, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
31
|
+
"Try again"
|
|
32
|
+
] })
|
|
33
|
+
] });
|
|
34
|
+
}
|
|
35
|
+
if (isEmpty) {
|
|
36
|
+
return /* @__PURE__ */ jsxs("div", { className: "py-16 text-center space-y-4", children: [
|
|
37
|
+
emptyIcon && /* @__PURE__ */ jsx("div", { className: "h-14 w-14 rounded-xl bg-muted flex items-center justify-center mx-auto", children: emptyIcon }),
|
|
38
|
+
/* @__PURE__ */ jsx("p", { className: "font-semibold text-lg", children: emptyTitle }),
|
|
39
|
+
emptyDescription && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground max-w-xs mx-auto", children: emptyDescription }),
|
|
40
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-3", children: [
|
|
41
|
+
onRetry && /* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", onClick: onRetry, children: [
|
|
42
|
+
/* @__PURE__ */ jsx(RefreshCw, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
43
|
+
"Refresh"
|
|
44
|
+
] }),
|
|
45
|
+
emptyCta && /* @__PURE__ */ jsx(Button, { size: "sm", asChild: true, children: /* @__PURE__ */ jsx(Link, { href: emptyCta.href, children: emptyCta.label }) })
|
|
46
|
+
] })
|
|
47
|
+
] });
|
|
48
|
+
}
|
|
49
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
EmptyOrError
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=empty-or-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/empty-or-error.tsx"],"sourcesContent":["\"use client\";\n\nimport { Skeleton } from \"./skeleton.js\";\nimport { Button } from \"./button.js\";\nimport Link from \"next/link\";\nimport { RefreshCw, AlertCircle } from \"lucide-react\";\nimport { ReactNode } from \"react\";\n\ninterface EmptyOrErrorProps {\n isLoading: boolean;\n error?: unknown;\n isEmpty: boolean;\n onRetry?: () => void;\n emptyTitle: string;\n emptyDescription?: string;\n emptyCta?: { label: string; href: string };\n emptyIcon?: ReactNode;\n skeletonCount?: number;\n /** Optional custom skeleton renderer — replaces the default row skeletons */\n skeletonNode?: ReactNode;\n children?: ReactNode;\n}\n\nexport function EmptyOrError({\n isLoading,\n error,\n isEmpty,\n onRetry,\n emptyTitle,\n emptyDescription,\n emptyCta,\n emptyIcon,\n skeletonCount = 4,\n skeletonNode,\n children,\n}: EmptyOrErrorProps) {\n if (isLoading) {\n if (skeletonNode) return <>{skeletonNode}</>;\n return (\n <div className=\"space-y-3\">\n {Array.from({ length: skeletonCount }).map((_, i) => (\n <Skeleton key={i} className=\"h-20 w-full rounded-xl\" />\n ))}\n </div>\n );\n }\n\n if (error) {\n return (\n <div className=\"py-16 text-center space-y-4\">\n <div className=\"h-14 w-14 rounded-xl bg-destructive/10 flex items-center justify-center mx-auto\">\n <AlertCircle className=\"h-7 w-7 text-destructive\" />\n </div>\n <p className=\"font-semibold text-lg\">Something went wrong</p>\n <p className=\"text-sm text-muted-foreground max-w-xs mx-auto\">\n {error instanceof Error ? error.message : \"Failed to load data. Please try again.\"}\n </p>\n {onRetry && (\n <Button variant=\"outline\" size=\"sm\" onClick={onRetry}>\n <RefreshCw className=\"h-3.5 w-3.5 mr-1.5\" />\n Try again\n </Button>\n )}\n </div>\n );\n }\n\n if (isEmpty) {\n return (\n <div className=\"py-16 text-center space-y-4\">\n {emptyIcon && (\n <div className=\"h-14 w-14 rounded-xl bg-muted flex items-center justify-center mx-auto\">\n {emptyIcon}\n </div>\n )}\n <p className=\"font-semibold text-lg\">{emptyTitle}</p>\n {emptyDescription && (\n <p className=\"text-sm text-muted-foreground max-w-xs mx-auto\">{emptyDescription}</p>\n )}\n <div className=\"flex items-center justify-center gap-3\">\n {onRetry && (\n <Button variant=\"outline\" size=\"sm\" onClick={onRetry}>\n <RefreshCw className=\"h-3.5 w-3.5 mr-1.5\" />\n Refresh\n </Button>\n )}\n {emptyCta && (\n <Button size=\"sm\" asChild>\n <Link href={emptyCta.href}>{emptyCta.label}</Link>\n </Button>\n )}\n </div>\n </div>\n );\n }\n\n return <>{children}</>;\n}\n"],"mappings":";AAqC6B,wBAqBnB,YAr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QAED,YACC,oBAAC,UAAO,MAAK,MAAK,SAAO,MACvB,8BAAC,QAAK,MAAM,SAAS,MAAO,mBAAS,OAAM,GAC7C;AAAA,SAEJ;AAAA,OACF;AAAA,EAEJ;AAEA,SAAO,gCAAG,UAAS;AACrB;","names":[]}
|
|
@@ -0,0 +1,150 @@
|
|
|
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 form_exports = {};
|
|
31
|
+
__export(form_exports, {
|
|
32
|
+
Form: () => Form,
|
|
33
|
+
FormControl: () => FormControl,
|
|
34
|
+
FormDescription: () => FormDescription,
|
|
35
|
+
FormField: () => FormField,
|
|
36
|
+
FormItem: () => FormItem,
|
|
37
|
+
FormLabel: () => FormLabel,
|
|
38
|
+
FormMessage: () => FormMessage,
|
|
39
|
+
useFormField: () => useFormField
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(form_exports);
|
|
42
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
43
|
+
var React = __toESM(require("react"), 1);
|
|
44
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
45
|
+
var import_react_hook_form = require("react-hook-form");
|
|
46
|
+
var import_cn = require("../utils/cn.js");
|
|
47
|
+
var import_label = require("./label.js");
|
|
48
|
+
const Form = import_react_hook_form.FormProvider;
|
|
49
|
+
const FormFieldContext = React.createContext({});
|
|
50
|
+
const FormField = ({
|
|
51
|
+
...props
|
|
52
|
+
}) => {
|
|
53
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_hook_form.Controller, { ...props }) });
|
|
54
|
+
};
|
|
55
|
+
const useFormField = () => {
|
|
56
|
+
const fieldContext = React.useContext(FormFieldContext);
|
|
57
|
+
const itemContext = React.useContext(FormItemContext);
|
|
58
|
+
const { getFieldState, formState } = (0, import_react_hook_form.useFormContext)();
|
|
59
|
+
const fieldState = getFieldState(fieldContext.name, formState);
|
|
60
|
+
if (!fieldContext) {
|
|
61
|
+
throw new Error("useFormField should be used within <FormField>");
|
|
62
|
+
}
|
|
63
|
+
const { id } = itemContext;
|
|
64
|
+
return {
|
|
65
|
+
id,
|
|
66
|
+
name: fieldContext.name,
|
|
67
|
+
formItemId: `${id}-form-item`,
|
|
68
|
+
formDescriptionId: `${id}-form-item-description`,
|
|
69
|
+
formMessageId: `${id}-form-item-message`,
|
|
70
|
+
...fieldState
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
const FormItemContext = React.createContext({});
|
|
74
|
+
const FormItem = React.forwardRef(
|
|
75
|
+
({ className, ...props }, ref) => {
|
|
76
|
+
const id = React.useId();
|
|
77
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, className: (0, import_cn.cn)("space-y-2", className), ...props }) });
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
FormItem.displayName = "FormItem";
|
|
81
|
+
const FormLabel = React.forwardRef(({ className, ...props }, ref) => {
|
|
82
|
+
const { error, formItemId } = useFormField();
|
|
83
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
84
|
+
import_label.Label,
|
|
85
|
+
{
|
|
86
|
+
ref,
|
|
87
|
+
className: (0, import_cn.cn)(error && "text-destructive", className),
|
|
88
|
+
htmlFor: formItemId,
|
|
89
|
+
...props
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
});
|
|
93
|
+
FormLabel.displayName = "FormLabel";
|
|
94
|
+
const FormControl = React.forwardRef(({ ...props }, ref) => {
|
|
95
|
+
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
96
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
97
|
+
import_react_slot.Slot,
|
|
98
|
+
{
|
|
99
|
+
ref,
|
|
100
|
+
id: formItemId,
|
|
101
|
+
"aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
|
|
102
|
+
"aria-invalid": !!error,
|
|
103
|
+
...props
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
});
|
|
107
|
+
FormControl.displayName = "FormControl";
|
|
108
|
+
const FormDescription = React.forwardRef(({ className, ...props }, ref) => {
|
|
109
|
+
const { formDescriptionId } = useFormField();
|
|
110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
111
|
+
"p",
|
|
112
|
+
{
|
|
113
|
+
ref,
|
|
114
|
+
id: formDescriptionId,
|
|
115
|
+
className: (0, import_cn.cn)("text-sm text-muted-foreground", className),
|
|
116
|
+
...props
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
});
|
|
120
|
+
FormDescription.displayName = "FormDescription";
|
|
121
|
+
const FormMessage = React.forwardRef(({ className, children, ...props }, ref) => {
|
|
122
|
+
const { error, formMessageId } = useFormField();
|
|
123
|
+
const body = error ? String(error?.message) : children;
|
|
124
|
+
if (!body) {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
128
|
+
"p",
|
|
129
|
+
{
|
|
130
|
+
ref,
|
|
131
|
+
id: formMessageId,
|
|
132
|
+
className: (0, import_cn.cn)("text-sm font-medium text-destructive", className),
|
|
133
|
+
...props,
|
|
134
|
+
children: body
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
});
|
|
138
|
+
FormMessage.displayName = "FormMessage";
|
|
139
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
140
|
+
0 && (module.exports = {
|
|
141
|
+
Form,
|
|
142
|
+
FormControl,
|
|
143
|
+
FormDescription,
|
|
144
|
+
FormField,
|
|
145
|
+
FormItem,
|
|
146
|
+
FormLabel,
|
|
147
|
+
FormMessage,
|
|
148
|
+
useFormField
|
|
149
|
+
});
|
|
150
|
+
//# sourceMappingURL=form.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/form.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as LabelPrimitive from \"@radix-ui/react-label\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport {\n Controller,\n ControllerProps,\n FieldPath,\n FieldValues,\n FormProvider,\n useFormContext,\n} from \"react-hook-form\";\nimport { cn } from \"../utils/cn.js\";\nimport { Label } from \"./label.js\";\n\nconst Form = FormProvider;\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = {\n name: TName;\n};\n\nconst FormFieldContext = React.createContext<FormFieldContextValue>({} as FormFieldContextValue);\n\nconst FormField = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n};\n\nconst useFormField = () => {\n const fieldContext = React.useContext(FormFieldContext);\n const itemContext = React.useContext(FormItemContext);\n const { getFieldState, formState } = useFormContext();\n\n const fieldState = getFieldState(fieldContext.name, formState);\n\n if (!fieldContext) {\n throw new Error(\"useFormField should be used within <FormField>\");\n }\n\n const { id } = itemContext;\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n};\n\ntype FormItemContextValue = {\n id: string;\n};\n\nconst FormItemContext = React.createContext<FormItemContextValue>({} as FormItemContextValue);\n\nconst FormItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => {\n const id = React.useId();\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <div ref={ref} className={cn(\"space-y-2\", className)} {...props} />\n </FormItemContext.Provider>\n );\n }\n);\nFormItem.displayName = \"FormItem\";\n\nconst FormLabel = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>\n>(({ className, ...props }, ref) => {\n const { error, formItemId } = useFormField();\n\n return (\n <Label\n ref={ref}\n className={cn(error && \"text-destructive\", className)}\n htmlFor={formItemId}\n {...props}\n />\n );\n});\nFormLabel.displayName = \"FormLabel\";\n\nconst FormControl = React.forwardRef<\n React.ElementRef<typeof Slot>,\n React.ComponentPropsWithoutRef<typeof Slot>\n>(({ ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={!!error}\n {...props}\n />\n );\n});\nFormControl.displayName = \"FormControl\";\n\nconst FormDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => {\n const { formDescriptionId } = useFormField();\n\n return (\n <p\n ref={ref}\n id={formDescriptionId}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n );\n});\nFormDescription.displayName = \"FormDescription\";\n\nconst FormMessage = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, children, ...props }, ref) => {\n const { error, formMessageId } = useFormField();\n const body = error ? String(error?.message) : children;\n\n if (!body) {\n return null;\n }\n\n return (\n <p\n ref={ref}\n id={formMessageId}\n className={cn(\"text-sm font-medium text-destructive\", className)}\n {...props}\n >\n {body}\n </p>\n );\n});\nFormMessage.displayName = \"FormMessage\";\n\nexport {\n useFormField,\n Form,\n FormItem,\n FormLabel,\n FormControl,\n FormDescription,\n FormMessage,\n FormField,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmCM;AAjCN,YAAuB;AAEvB,wBAAqB;AACrB,6BAOO;AACP,gBAAmB;AACnB,mBAAsB;AAEtB,MAAM,OAAO;AASb,MAAM,mBAAmB,MAAM,cAAqC,CAAC,CAA0B;AAE/F,MAAM,YAAY,CAGhB;AAAA,EACA,GAAG;AACL,MAA4C;AAC1C,SACE,4CAAC,iBAA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vB,QAAM,EAAE,OAAO,YAAY,mBAAmB,cAAc,IAAI,aAAa;AAE7E,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,IAAI;AAAA,MACJ,oBAAkB,CAAC,QAAQ,GAAG,iBAAiB,KAAK,GAAG,iBAAiB,IAAI,aAAa;AAAA,MACzF,gBAAc,CAAC,CAAC;AAAA,MACf,GAAG;AAAA;AAAA,EACN;AAEJ,CAAC;AACD,YAAY,cAAc;AAE1B,MAAM,kBAAkB,MAAM,WAG5B,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAAQ;AAClC,QAAM,EAAE,kBAAkB,IAAI,aAAa;AAE3C,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,IAAI;AAAA,MACJ,eAAW,cAAG,iCAAiC,SAAS;AAAA,MACvD,GAAG;AAAA;AAAA,EACN;AAEJ,CAAC;AACD,gBAAgB,cAAc;AAE9B,MAAM,cAAc,MAAM,WAGxB,CAAC,EAAE,WAAW,UAAU,GAAG,MAAM,GAAG,QAAQ;AAC5C,QAAM,EAAE,OAAO,cAAc,IAAI,aAAa;AAC9C,QAAM,OAAO,QAAQ,OAAO,OAAO,OAAO,IAAI;AAE9C,MAAI,CAAC,MAAM;AACT,WAAO;AAAA,EACT;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,IAAI;AAAA,MACJ,eAAW,cAAG,wCAAwC,SAAS;AAAA,MAC9D,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEJ,CAAC;AACD,YAAY,cAAc;","names":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react_hook_form from 'react-hook-form';
|
|
3
|
+
import { FieldValues, FieldPath, ControllerProps } from 'react-hook-form';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
6
|
+
|
|
7
|
+
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>({ children, watch, getValues, getFieldState, setError, clearErrors, setValue, setValues, trigger, formState, resetField, reset, resetDefaultValues, handleSubmit, unregister, control, register, setFocus, subscribe, }: react_hook_form.FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
8
|
+
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => react_jsx_runtime.JSX.Element;
|
|
9
|
+
declare const useFormField: () => {
|
|
10
|
+
invalid: boolean;
|
|
11
|
+
isDirty: boolean;
|
|
12
|
+
isTouched: boolean;
|
|
13
|
+
isValidating: boolean;
|
|
14
|
+
error?: react_hook_form.FieldError | undefined;
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
formItemId: string;
|
|
18
|
+
formDescriptionId: string;
|
|
19
|
+
formMessageId: string;
|
|
20
|
+
};
|
|
21
|
+
declare const FormItem: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
+
declare const FormLabel: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>>;
|
|
23
|
+
declare const FormControl: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLElement> & {
|
|
24
|
+
children?: React.ReactNode;
|
|
25
|
+
} & React.RefAttributes<HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
26
|
+
declare const FormDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
27
|
+
declare const FormMessage: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
28
|
+
|
|
29
|
+
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react_hook_form from 'react-hook-form';
|
|
3
|
+
import { FieldValues, FieldPath, ControllerProps } from 'react-hook-form';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
6
|
+
|
|
7
|
+
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>({ children, watch, getValues, getFieldState, setError, clearErrors, setValue, setValues, trigger, formState, resetField, reset, resetDefaultValues, handleSubmit, unregister, control, register, setFocus, subscribe, }: react_hook_form.FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
8
|
+
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => react_jsx_runtime.JSX.Element;
|
|
9
|
+
declare const useFormField: () => {
|
|
10
|
+
invalid: boolean;
|
|
11
|
+
isDirty: boolean;
|
|
12
|
+
isTouched: boolean;
|
|
13
|
+
isValidating: boolean;
|
|
14
|
+
error?: react_hook_form.FieldError | undefined;
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
formItemId: string;
|
|
18
|
+
formDescriptionId: string;
|
|
19
|
+
formMessageId: string;
|
|
20
|
+
};
|
|
21
|
+
declare const FormItem: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
+
declare const FormLabel: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>>;
|
|
23
|
+
declare const FormControl: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLElement> & {
|
|
24
|
+
children?: React.ReactNode;
|
|
25
|
+
} & React.RefAttributes<HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
26
|
+
declare const FormDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
27
|
+
declare const FormMessage: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
28
|
+
|
|
29
|
+
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };
|