@meshagent/meshagent-tailwind 0.4.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/CHANGELOG.md +3 -0
- package/LICENSE +201 -0
- package/README.md +0 -0
- package/dist/cjs/Chat.d.ts +7 -0
- package/dist/cjs/Chat.js +45 -0
- package/dist/cjs/ChatInput.d.ts +7 -0
- package/dist/cjs/ChatInput.js +70 -0
- package/dist/cjs/ChatThread.d.ts +6 -0
- package/dist/cjs/ChatThread.js +109 -0
- package/dist/cjs/ChatTypingIndicator.d.ts +7 -0
- package/dist/cjs/ChatTypingIndicator.js +49 -0
- package/dist/cjs/FileUploader.d.ts +6 -0
- package/dist/cjs/FileUploader.js +64 -0
- package/dist/cjs/components/ui/avatar.d.ts +6 -0
- package/dist/cjs/components/ui/avatar.js +83 -0
- package/dist/cjs/components/ui/button.d.ts +10 -0
- package/dist/cjs/components/ui/button.js +70 -0
- package/dist/cjs/components/ui/card.d.ts +9 -0
- package/dist/cjs/components/ui/card.js +110 -0
- package/dist/cjs/components/ui/skeleton.d.ts +2 -0
- package/dist/cjs/components/ui/skeleton.js +35 -0
- package/dist/cjs/components/ui/spinner.d.ts +24 -0
- package/dist/cjs/components/ui/spinner.js +48 -0
- package/dist/cjs/components/ui/textarea.d.ts +3 -0
- package/dist/cjs/components/ui/textarea.js +38 -0
- package/dist/cjs/index.d.ts +5 -0
- package/dist/cjs/index.js +22 -0
- package/dist/cjs/lib/utils.d.ts +2 -0
- package/dist/cjs/lib/utils.js +28 -0
- package/dist/esm/Chat.d.ts +7 -0
- package/dist/esm/Chat.js +25 -0
- package/dist/esm/ChatInput.d.ts +7 -0
- package/dist/esm/ChatInput.js +40 -0
- package/dist/esm/ChatThread.d.ts +6 -0
- package/dist/esm/ChatThread.js +79 -0
- package/dist/esm/ChatTypingIndicator.d.ts +7 -0
- package/dist/esm/ChatTypingIndicator.js +29 -0
- package/dist/esm/FileUploader.d.ts +6 -0
- package/dist/esm/FileUploader.js +44 -0
- package/dist/esm/components/ui/avatar.d.ts +6 -0
- package/dist/esm/components/ui/avatar.js +53 -0
- package/dist/esm/components/ui/button.d.ts +10 -0
- package/dist/esm/components/ui/button.js +50 -0
- package/dist/esm/components/ui/card.d.ts +9 -0
- package/dist/esm/components/ui/card.js +90 -0
- package/dist/esm/components/ui/skeleton.d.ts +2 -0
- package/dist/esm/components/ui/skeleton.js +15 -0
- package/dist/esm/components/ui/spinner.d.ts +24 -0
- package/dist/esm/components/ui/spinner.js +28 -0
- package/dist/esm/components/ui/textarea.d.ts +3 -0
- package/dist/esm/components/ui/textarea.js +18 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/lib/utils.d.ts +2 -0
- package/dist/esm/lib/utils.js +8 -0
- package/dist/index.css +2 -0
- package/package.json +72 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var avatar_exports = {};
|
|
30
|
+
__export(avatar_exports, {
|
|
31
|
+
Avatar: () => Avatar,
|
|
32
|
+
AvatarFallback: () => AvatarFallback,
|
|
33
|
+
AvatarImage: () => AvatarImage
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(avatar_exports);
|
|
36
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
+
var AvatarPrimitive = __toESM(require("@radix-ui/react-avatar"));
|
|
38
|
+
var import_utils = require("../../lib/utils");
|
|
39
|
+
function Avatar({
|
|
40
|
+
className,
|
|
41
|
+
...props
|
|
42
|
+
}) {
|
|
43
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
44
|
+
AvatarPrimitive.Root,
|
|
45
|
+
{
|
|
46
|
+
"data-slot": "avatar",
|
|
47
|
+
className: (0, import_utils.cn)(
|
|
48
|
+
"relative flex size-8 shrink-0 overflow-hidden rounded-full",
|
|
49
|
+
className
|
|
50
|
+
),
|
|
51
|
+
...props
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
function AvatarImage({
|
|
56
|
+
className,
|
|
57
|
+
...props
|
|
58
|
+
}) {
|
|
59
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
|
+
AvatarPrimitive.Image,
|
|
61
|
+
{
|
|
62
|
+
"data-slot": "avatar-image",
|
|
63
|
+
className: (0, import_utils.cn)("aspect-square size-full", className),
|
|
64
|
+
...props
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
function AvatarFallback({
|
|
69
|
+
className,
|
|
70
|
+
...props
|
|
71
|
+
}) {
|
|
72
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
73
|
+
AvatarPrimitive.Fallback,
|
|
74
|
+
{
|
|
75
|
+
"data-slot": "avatar-fallback",
|
|
76
|
+
className: (0, import_utils.cn)(
|
|
77
|
+
"bg-muted flex size-full items-center justify-center rounded-full",
|
|
78
|
+
className
|
|
79
|
+
),
|
|
80
|
+
...props
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
5
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
7
|
+
declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var button_exports = {};
|
|
20
|
+
__export(button_exports, {
|
|
21
|
+
Button: () => Button,
|
|
22
|
+
buttonVariants: () => buttonVariants
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(button_exports);
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
27
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
28
|
+
var import_utils = require("../../lib/utils");
|
|
29
|
+
const buttonVariants = (0, import_class_variance_authority.cva)(
|
|
30
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
31
|
+
{
|
|
32
|
+
variants: {
|
|
33
|
+
variant: {
|
|
34
|
+
default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
|
|
35
|
+
destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
36
|
+
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
37
|
+
secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
|
38
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
39
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
40
|
+
},
|
|
41
|
+
size: {
|
|
42
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
43
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
44
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
45
|
+
icon: "size-9"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
defaultVariants: {
|
|
49
|
+
variant: "default",
|
|
50
|
+
size: "default"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
function Button({
|
|
55
|
+
className,
|
|
56
|
+
variant,
|
|
57
|
+
size,
|
|
58
|
+
asChild = false,
|
|
59
|
+
...props
|
|
60
|
+
}) {
|
|
61
|
+
const Comp = asChild ? import_react_slot.Slot : "button";
|
|
62
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
63
|
+
Comp,
|
|
64
|
+
{
|
|
65
|
+
"data-slot": "button",
|
|
66
|
+
className: (0, import_utils.cn)(buttonVariants({ variant, size, className })),
|
|
67
|
+
...props
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare function Card({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare function CardHeader({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function CardTitle({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function CardDescription({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function CardAction({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function CardContent({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function CardFooter({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var card_exports = {};
|
|
20
|
+
__export(card_exports, {
|
|
21
|
+
Card: () => Card,
|
|
22
|
+
CardAction: () => CardAction,
|
|
23
|
+
CardContent: () => CardContent,
|
|
24
|
+
CardDescription: () => CardDescription,
|
|
25
|
+
CardFooter: () => CardFooter,
|
|
26
|
+
CardHeader: () => CardHeader,
|
|
27
|
+
CardTitle: () => CardTitle
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(card_exports);
|
|
30
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
+
var import_utils = require("../../lib/utils");
|
|
32
|
+
function Card({ className, ...props }) {
|
|
33
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
"data-slot": "card",
|
|
37
|
+
className: (0, import_utils.cn)(
|
|
38
|
+
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
|
|
39
|
+
className
|
|
40
|
+
),
|
|
41
|
+
...props
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
function CardHeader({ className, ...props }) {
|
|
46
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
"data-slot": "card-header",
|
|
50
|
+
className: (0, import_utils.cn)(
|
|
51
|
+
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
|
52
|
+
className
|
|
53
|
+
),
|
|
54
|
+
...props
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
function CardTitle({ className, ...props }) {
|
|
59
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
"data-slot": "card-title",
|
|
63
|
+
className: (0, import_utils.cn)("leading-none font-semibold", className),
|
|
64
|
+
...props
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
function CardDescription({ className, ...props }) {
|
|
69
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
70
|
+
"div",
|
|
71
|
+
{
|
|
72
|
+
"data-slot": "card-description",
|
|
73
|
+
className: (0, import_utils.cn)("text-muted-foreground text-sm", className),
|
|
74
|
+
...props
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
function CardAction({ className, ...props }) {
|
|
79
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
"data-slot": "card-action",
|
|
83
|
+
className: (0, import_utils.cn)(
|
|
84
|
+
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
85
|
+
className
|
|
86
|
+
),
|
|
87
|
+
...props
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
function CardContent({ className, ...props }) {
|
|
92
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
93
|
+
"div",
|
|
94
|
+
{
|
|
95
|
+
"data-slot": "card-content",
|
|
96
|
+
className: (0, import_utils.cn)("px-6", className),
|
|
97
|
+
...props
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
function CardFooter({ className, ...props }) {
|
|
102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
103
|
+
"div",
|
|
104
|
+
{
|
|
105
|
+
"data-slot": "card-footer",
|
|
106
|
+
className: (0, import_utils.cn)("flex items-center px-6 [.border-t]:pt-6", className),
|
|
107
|
+
...props
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var skeleton_exports = {};
|
|
20
|
+
__export(skeleton_exports, {
|
|
21
|
+
Skeleton: () => Skeleton
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(skeleton_exports);
|
|
24
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
+
var import_utils = require("../../lib/utils");
|
|
26
|
+
function Skeleton({ className, ...props }) {
|
|
27
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
28
|
+
"div",
|
|
29
|
+
{
|
|
30
|
+
"data-slot": "skeleton",
|
|
31
|
+
className: (0, import_utils.cn)("bg-accent animate-pulse rounded-md", className),
|
|
32
|
+
...props
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface SpinnerProps extends React.SVGProps<SVGSVGElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Spinner sizes: 'sm' (small), 'md' (medium), 'lg' (large)
|
|
5
|
+
* @default 'md'
|
|
6
|
+
*/
|
|
7
|
+
size?: "sm" | "md" | "lg";
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A simple rotating spinner component using Lucide's Loader2 icon and Tailwind CSS
|
|
11
|
+
*/
|
|
12
|
+
export declare function Spinner({ size, className, ...props }: SpinnerProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export interface LoadingOverlayProps {
|
|
14
|
+
/**
|
|
15
|
+
* When true, shows the overlay spinner; otherwise renders children normally
|
|
16
|
+
*/
|
|
17
|
+
isLoading: boolean;
|
|
18
|
+
className?: string;
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Wraps content and displays a centered spinner overlay when loading
|
|
23
|
+
*/
|
|
24
|
+
export declare function LoadingOverlay({ isLoading, className, children }: LoadingOverlayProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var spinner_exports = {};
|
|
20
|
+
__export(spinner_exports, {
|
|
21
|
+
LoadingOverlay: () => LoadingOverlay,
|
|
22
|
+
Spinner: () => Spinner
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(spinner_exports);
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import_lucide_react = require("lucide-react");
|
|
27
|
+
var import_utils = require("../../lib/utils");
|
|
28
|
+
const sizeClasses = {
|
|
29
|
+
sm: "h-4 w-4",
|
|
30
|
+
md: "h-6 w-6",
|
|
31
|
+
lg: "h-8 w-8"
|
|
32
|
+
};
|
|
33
|
+
function Spinner({ size = "md", className, ...props }) {
|
|
34
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
35
|
+
import_lucide_react.Loader2,
|
|
36
|
+
{
|
|
37
|
+
className: (0, import_utils.cn)("animate-spin text-current", sizeClasses[size], className),
|
|
38
|
+
"aria-label": "Loading...",
|
|
39
|
+
...props
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
function LoadingOverlay({ isLoading, className, children }) {
|
|
44
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col min-h-0 relative flex-1", children: [
|
|
45
|
+
children,
|
|
46
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { size: "lg", className }) })
|
|
47
|
+
] });
|
|
48
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var textarea_exports = {};
|
|
20
|
+
__export(textarea_exports, {
|
|
21
|
+
Textarea: () => Textarea
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(textarea_exports);
|
|
24
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
+
var import_utils = require("../../lib/utils");
|
|
26
|
+
function Textarea({ className, ...props }) {
|
|
27
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
28
|
+
"textarea",
|
|
29
|
+
{
|
|
30
|
+
"data-slot": "textarea",
|
|
31
|
+
className: (0, import_utils.cn)(
|
|
32
|
+
"border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
33
|
+
className
|
|
34
|
+
),
|
|
35
|
+
...props
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var index_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(index_exports);
|
|
18
|
+
__reExport(index_exports, require("./Chat"), module.exports);
|
|
19
|
+
__reExport(index_exports, require("./ChatInput"), module.exports);
|
|
20
|
+
__reExport(index_exports, require("./ChatThread"), module.exports);
|
|
21
|
+
__reExport(index_exports, require("./ChatTypingIndicator"), module.exports);
|
|
22
|
+
__reExport(index_exports, require("./FileUploader"), module.exports);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var utils_exports = {};
|
|
20
|
+
__export(utils_exports, {
|
|
21
|
+
cn: () => cn
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(utils_exports);
|
|
24
|
+
var import_clsx = require("clsx");
|
|
25
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
26
|
+
function cn(...inputs) {
|
|
27
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
28
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RoomClient, Participant } from "@meshagent/meshagent";
|
|
2
|
+
export interface ChatProps {
|
|
3
|
+
room: RoomClient;
|
|
4
|
+
path: string;
|
|
5
|
+
participants?: Participant[];
|
|
6
|
+
}
|
|
7
|
+
export declare function Chat({ room, path, participants }: ChatProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/esm/Chat.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useChat } from "@meshagent/meshagent-react";
|
|
3
|
+
import { ChatThread } from "./ChatThread";
|
|
4
|
+
import { ChatInput } from "./ChatInput";
|
|
5
|
+
import { ChatTypingIndicator } from "./ChatTypingIndicator";
|
|
6
|
+
import { Card, CardContent, CardHeader, CardTitle } from "./components/ui/card";
|
|
7
|
+
function Chat({ room, path, participants }) {
|
|
8
|
+
const {
|
|
9
|
+
messages,
|
|
10
|
+
sendMessage,
|
|
11
|
+
selectAttachments
|
|
12
|
+
} = useChat({ room, path, participants });
|
|
13
|
+
const localParticipantName = room.localParticipant.getAttribute("name");
|
|
14
|
+
return /* @__PURE__ */ jsxs(Card, { className: "flex flex-col min-h-0", children: [
|
|
15
|
+
/* @__PURE__ */ jsx(CardHeader, { className: "border-b flex-0", children: /* @__PURE__ */ jsx(CardTitle, { children: "Chat" }) }),
|
|
16
|
+
/* @__PURE__ */ jsxs(CardContent, { className: "flex flex-col flex-1 min-h-0 gap-2 p-0", children: [
|
|
17
|
+
/* @__PURE__ */ jsx(ChatThread, { messages, localParticipantName }),
|
|
18
|
+
/* @__PURE__ */ jsx(ChatTypingIndicator, { room, path }),
|
|
19
|
+
/* @__PURE__ */ jsx(ChatInput, { onSubmit: sendMessage, onFilesSelected: selectAttachments })
|
|
20
|
+
] })
|
|
21
|
+
] });
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
Chat
|
|
25
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ChatMessage } from "@meshagent/meshagent-react";
|
|
2
|
+
interface ChatInputProps {
|
|
3
|
+
onSubmit: (message: ChatMessage) => void;
|
|
4
|
+
onFilesSelected: (files: File[]) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function ChatInput({ onSubmit }: ChatInputProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { v4 as uuidV4 } from "uuid";
|
|
4
|
+
import { ChatMessage } from "@meshagent/meshagent-react";
|
|
5
|
+
import { Button } from "./components/ui/button";
|
|
6
|
+
import { Textarea } from "./components/ui/textarea";
|
|
7
|
+
function ChatInput({ onSubmit }) {
|
|
8
|
+
const [value, setValue] = React.useState("");
|
|
9
|
+
const handleSend = () => {
|
|
10
|
+
const trimmed = value.trim();
|
|
11
|
+
if (!trimmed) return;
|
|
12
|
+
onSubmit(new ChatMessage({
|
|
13
|
+
id: uuidV4(),
|
|
14
|
+
text: trimmed
|
|
15
|
+
}));
|
|
16
|
+
setValue("");
|
|
17
|
+
};
|
|
18
|
+
const onKeyDown = (e) => {
|
|
19
|
+
if (e.key === "Enter" && e.ctrlKey) {
|
|
20
|
+
e.preventDefault();
|
|
21
|
+
handleSend();
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
return /* @__PURE__ */ jsxs("div", { className: "border-t p-3 flex gap-3", children: [
|
|
25
|
+
/* @__PURE__ */ jsx(
|
|
26
|
+
Textarea,
|
|
27
|
+
{
|
|
28
|
+
placeholder: "Type a message and press Ctrl+Enter\u2026",
|
|
29
|
+
className: "flex-1 resize-none h-20",
|
|
30
|
+
value,
|
|
31
|
+
onChange: (e) => setValue(e.currentTarget.value),
|
|
32
|
+
onKeyDown
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
/* @__PURE__ */ jsx(Button, { onClick: handleSend, disabled: !value.trim(), children: "Send" })
|
|
36
|
+
] });
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
ChatInput
|
|
40
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Element } from "@meshagent/meshagent";
|
|
2
|
+
export declare function timeAgo(iso: string): string;
|
|
3
|
+
export declare function ChatThread({ messages, localParticipantName }: {
|
|
4
|
+
messages: Element[];
|
|
5
|
+
localParticipantName: string;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|