@meshagent/meshagent-tailwind 0.5.6 → 0.5.8

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 (95) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/Chat.js +28 -5
  3. package/dist/cjs/ChatInput.d.ts +4 -1
  4. package/dist/cjs/ChatInput.js +15 -3
  5. package/dist/cjs/ChatThread.js +1 -0
  6. package/dist/cjs/ChatTypingIndicator.js +2 -2
  7. package/dist/cjs/components/pane-example.d.ts +1 -0
  8. package/dist/cjs/components/pane-example.js +43 -0
  9. package/dist/cjs/components/ui/dialog.d.ts +15 -0
  10. package/dist/cjs/components/ui/dialog.js +166 -0
  11. package/dist/cjs/components/ui/form.d.ts +24 -0
  12. package/dist/cjs/components/ui/form.js +146 -0
  13. package/dist/cjs/components/ui/input.d.ts +3 -0
  14. package/dist/cjs/components/ui/input.js +41 -0
  15. package/dist/cjs/components/ui/label.d.ts +4 -0
  16. package/dist/cjs/components/ui/label.js +53 -0
  17. package/dist/cjs/components/ui/radio-group.d.ts +5 -0
  18. package/dist/cjs/components/ui/radio-group.js +76 -0
  19. package/dist/cjs/components/ui/select.d.ts +15 -0
  20. package/dist/cjs/components/ui/select.js +199 -0
  21. package/dist/cjs/components/ui/sheet.d.ts +13 -0
  22. package/dist/cjs/components/ui/sheet.js +110 -0
  23. package/dist/cjs/components/ui/sonner.d.ts +3 -0
  24. package/dist/cjs/components/ui/sonner.js +42 -0
  25. package/dist/cjs/lib/pane-service.d.ts +16 -0
  26. package/dist/cjs/lib/pane-service.js +35 -0
  27. package/dist/cjs/lib/utils.d.ts +4 -0
  28. package/dist/cjs/tools/ask-user-for-file.d.ts +10 -0
  29. package/dist/cjs/tools/ask-user-for-file.js +68 -0
  30. package/dist/cjs/tools/ask-user.d.ts +10 -0
  31. package/dist/cjs/tools/ask-user.js +161 -0
  32. package/dist/cjs/tools/build-schema.d.ts +3 -0
  33. package/dist/cjs/tools/build-schema.js +55 -0
  34. package/dist/cjs/tools/display-document.d.ts +10 -0
  35. package/dist/cjs/tools/display-document.js +49 -0
  36. package/dist/cjs/tools/file-dialog.d.ts +11 -0
  37. package/dist/cjs/tools/file-dialog.js +113 -0
  38. package/dist/cjs/tools/form-dialog.d.ts +12 -0
  39. package/dist/cjs/tools/form-dialog.js +92 -0
  40. package/dist/cjs/tools/form-schema.d.ts +41 -0
  41. package/dist/cjs/tools/form-schema.js +51 -0
  42. package/dist/cjs/tools/form.d.ts +16 -0
  43. package/dist/cjs/tools/form.js +81 -0
  44. package/dist/cjs/tools/toast.d.ts +10 -0
  45. package/dist/cjs/tools/toast.js +52 -0
  46. package/dist/cjs/tools/ui-toolkit.d.ts +6 -0
  47. package/dist/cjs/tools/ui-toolkit.js +44 -0
  48. package/dist/esm/Chat.js +29 -6
  49. package/dist/esm/ChatInput.d.ts +4 -1
  50. package/dist/esm/ChatInput.js +15 -3
  51. package/dist/esm/ChatThread.js +1 -0
  52. package/dist/esm/ChatTypingIndicator.js +2 -2
  53. package/dist/esm/components/pane-example.d.ts +1 -0
  54. package/dist/esm/components/pane-example.js +30 -0
  55. package/dist/esm/components/ui/dialog.d.ts +15 -0
  56. package/dist/esm/components/ui/dialog.js +136 -0
  57. package/dist/esm/components/ui/form.d.ts +24 -0
  58. package/dist/esm/components/ui/form.js +121 -0
  59. package/dist/esm/components/ui/input.d.ts +3 -0
  60. package/dist/esm/components/ui/input.js +21 -0
  61. package/dist/esm/components/ui/label.d.ts +4 -0
  62. package/dist/esm/components/ui/label.js +23 -0
  63. package/dist/esm/components/ui/radio-group.d.ts +5 -0
  64. package/dist/esm/components/ui/radio-group.js +46 -0
  65. package/dist/esm/components/ui/select.d.ts +15 -0
  66. package/dist/esm/components/ui/select.js +169 -0
  67. package/dist/esm/components/ui/sheet.d.ts +13 -0
  68. package/dist/esm/components/ui/sheet.js +80 -0
  69. package/dist/esm/components/ui/sonner.d.ts +3 -0
  70. package/dist/esm/components/ui/sonner.js +22 -0
  71. package/dist/esm/lib/pane-service.d.ts +16 -0
  72. package/dist/esm/lib/pane-service.js +15 -0
  73. package/dist/esm/lib/utils.d.ts +4 -0
  74. package/dist/esm/tools/ask-user-for-file.d.ts +10 -0
  75. package/dist/esm/tools/ask-user-for-file.js +48 -0
  76. package/dist/esm/tools/ask-user.d.ts +10 -0
  77. package/dist/esm/tools/ask-user.js +141 -0
  78. package/dist/esm/tools/build-schema.d.ts +3 -0
  79. package/dist/esm/tools/build-schema.js +25 -0
  80. package/dist/esm/tools/display-document.d.ts +10 -0
  81. package/dist/esm/tools/display-document.js +29 -0
  82. package/dist/esm/tools/file-dialog.d.ts +11 -0
  83. package/dist/esm/tools/file-dialog.js +101 -0
  84. package/dist/esm/tools/form-dialog.d.ts +12 -0
  85. package/dist/esm/tools/form-dialog.js +79 -0
  86. package/dist/esm/tools/form-schema.d.ts +41 -0
  87. package/dist/esm/tools/form-schema.js +31 -0
  88. package/dist/esm/tools/form.d.ts +16 -0
  89. package/dist/esm/tools/form.js +64 -0
  90. package/dist/esm/tools/toast.d.ts +10 -0
  91. package/dist/esm/tools/toast.js +32 -0
  92. package/dist/esm/tools/ui-toolkit.d.ts +6 -0
  93. package/dist/esm/tools/ui-toolkit.js +24 -0
  94. package/dist/index.css +1 -1
  95. package/package.json +7 -4
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [0.5.8]
2
+ - Stability
3
+
4
+ ## [0.5.7]
5
+ - Stability
6
+
1
7
  ## [0.5.6]
2
8
  - Stability
3
9
 
package/dist/cjs/Chat.js CHANGED
@@ -22,10 +22,13 @@ __export(Chat_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(Chat_exports);
24
24
  var import_jsx_runtime = require("react/jsx-runtime");
25
+ var import_react = require("react");
25
26
  var import_meshagent_react = require("@meshagent/meshagent-react");
26
27
  var import_ChatThread = require("./ChatThread");
27
28
  var import_ChatInput = require("./ChatInput");
28
29
  var import_ChatTypingIndicator = require("./ChatTypingIndicator");
30
+ var import_ui_toolkit = require("./tools/ui-toolkit");
31
+ var import_sonner = require("./components/ui/sonner");
29
32
  function Chat({ room, path, participants }) {
30
33
  const {
31
34
  messages,
@@ -33,11 +36,27 @@ function Chat({ room, path, participants }) {
33
36
  selectAttachments,
34
37
  attachments,
35
38
  setAttachments,
36
- schemaFileExists
39
+ schemaFileExists,
40
+ cancelRequest
37
41
  } = (0, import_meshagent_react.useChat)({ room, path, participants });
38
- const localParticipantName = room.localParticipant.getAttribute("name");
42
+ const { thinking } = (0, import_meshagent_react.useRoomIndicators)({ room, path });
43
+ const toolkits = (0, import_react.useMemo)(() => [
44
+ new import_ui_toolkit.UIToolkit({ room })
45
+ ], [room]);
46
+ (0, import_meshagent_react.useClientToolkits)({ toolkits, public: true });
47
+ const onTextChange = (0, import_react.useCallback)((_) => {
48
+ const removeParticipant = room.messaging.remoteParticipants;
49
+ for (const part of removeParticipant) {
50
+ room.messaging.sendMessage({
51
+ to: part,
52
+ type: "typing",
53
+ message: { path }
54
+ });
55
+ }
56
+ }, [room, path]);
57
+ const localParticipantName = room.localParticipant?.getAttribute("name");
39
58
  if (schemaFileExists === false) {
40
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex flex-col flex-1 min-h-0 gap-2 p-4", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-red-500", children: 'No AI agent found in this room. Run `meshagent chatbot join --room [room-name] --agent-name "Chat Agent" --name "Chat Friend" and try again.' }) });
59
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex flex-col flex-1 min-h-0 gap-2 p-4", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-red-500", children: 'No AI agent found in this room. Run `meshagent chatbot join --room [room-name] --agent-name "Chat Agent" --name "Chat Friend"` and try again.' }) });
41
60
  }
42
61
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col flex-1 min-h-0 gap-2 p-0", children: [
43
62
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -55,8 +74,12 @@ function Chat({ room, path, participants }) {
55
74
  onSubmit: sendMessage,
56
75
  attachments,
57
76
  onFilesSelected: selectAttachments,
58
- setAttachments
77
+ setAttachments,
78
+ onTextChange,
79
+ onCancelRequest: cancelRequest,
80
+ showCancelButton: thinking
59
81
  }
60
- )
82
+ ),
83
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sonner.Toaster, {})
61
84
  ] });
62
85
  }
@@ -4,6 +4,9 @@ interface ChatInputProps {
4
4
  onFilesSelected: (files: File[]) => void;
5
5
  attachments: FileUpload[];
6
6
  setAttachments: (attachments: FileUpload[]) => void;
7
+ onTextChange?: (text: string) => void;
8
+ onCancelRequest?: () => void;
9
+ showCancelButton?: boolean;
7
10
  }
8
- export declare function ChatInput({ onSubmit, onFilesSelected, attachments, setAttachments }: ChatInputProps): import("react/jsx-runtime").JSX.Element;
11
+ export declare function ChatInput({ onSubmit, onFilesSelected, attachments, setAttachments, onTextChange, onCancelRequest, showCancelButton }: ChatInputProps): import("react/jsx-runtime").JSX.Element;
9
12
  export {};
@@ -39,7 +39,15 @@ var import_button = require("./components/ui/button");
39
39
  var import_textarea = require("./components/ui/textarea");
40
40
  var import_FileUploader = require("./FileUploader");
41
41
  var import_UploadPill = require("./UploadPill");
42
- function ChatInput({ onSubmit, onFilesSelected, attachments, setAttachments }) {
42
+ function ChatInput({
43
+ onSubmit,
44
+ onFilesSelected,
45
+ attachments,
46
+ setAttachments,
47
+ onTextChange,
48
+ onCancelRequest,
49
+ showCancelButton
50
+ }) {
43
51
  const [value, setValue] = import_react.default.useState("");
44
52
  const handleSend = (0, import_react.useCallback)(() => {
45
53
  const trimmed2 = value.trim();
@@ -63,6 +71,10 @@ function ChatInput({ onSubmit, onFilesSelected, attachments, setAttachments }) {
63
71
  const cancelAttachment = (0, import_react.useCallback)((attachment) => {
64
72
  setAttachments(attachments.filter((f) => f.path !== attachment.path));
65
73
  }, [attachments, setAttachments]);
74
+ const _onChange = (0, import_react.useCallback)((e) => {
75
+ setValue(e.currentTarget.value);
76
+ onTextChange?.(e.currentTarget.value);
77
+ }, [onTextChange]);
66
78
  const trimmed = value.trim();
67
79
  const disabled = !trimmed && attachments.length === 0;
68
80
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "border-t py-3 gap-3 flex flex-col", children: [
@@ -82,11 +94,11 @@ function ChatInput({ onSubmit, onFilesSelected, attachments, setAttachments }) {
82
94
  placeholder: "Type a message and press Enter",
83
95
  className: "flex-1 resize-none h-20",
84
96
  value,
85
- onChange: (e) => setValue(e.currentTarget.value),
97
+ onChange: _onChange,
86
98
  onKeyDown
87
99
  }
88
100
  ),
89
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { onClick: handleSend, disabled, children: "Send" })
101
+ showCancelButton === true ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { onClick: onCancelRequest, children: "Cancel" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { onClick: handleSend, disabled, children: "Send" })
90
102
  ] })
91
103
  ] });
92
104
  }
@@ -59,6 +59,7 @@ function timeAgo(iso) {
59
59
  const rtf = new Intl.RelativeTimeFormat(void 0, { numeric: "auto" });
60
60
  const date = new Date(iso);
61
61
  const now = /* @__PURE__ */ new Date();
62
+ if (isNaN(date.getTime())) return "";
62
63
  const seconds = Math.round((date.getTime() - now.getTime()) / 1e3);
63
64
  const minutes = Math.round(seconds / 60);
64
65
  const hours = Math.round(minutes / 60);
@@ -24,8 +24,8 @@ module.exports = __toCommonJS(ChatTypingIndicator_exports);
24
24
  var import_jsx_runtime = require("react/jsx-runtime");
25
25
  var import_meshagent_react = require("@meshagent/meshagent-react");
26
26
  function ChatTypingIndicator({ room, path }) {
27
- const { typing } = (0, import_meshagent_react.useRoomIndicators)({ room, path });
28
- return typing ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-end space-x-1 h-6 p-6", children: [
27
+ const { typing, thinking } = (0, import_meshagent_react.useRoomIndicators)({ room, path });
28
+ return typing || thinking ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-end space-x-1 h-6 p-6", children: [
29
29
  [0, 1, 2].map((index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
30
30
  "span",
31
31
  {
@@ -0,0 +1 @@
1
+ export default function PaneExample(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,43 @@
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 pane_example_exports = {};
21
+ __export(pane_example_exports, {
22
+ default: () => PaneExample
23
+ });
24
+ module.exports = __toCommonJS(pane_example_exports);
25
+ var import_jsx_runtime = require("react/jsx-runtime");
26
+ var import_react = require("react");
27
+ var import_button = require("@/components/ui/button");
28
+ var import_sheet = require("@/components/ui/sheet");
29
+ var import_pane_service = require("@/lib/pane-service");
30
+ function PaneExample() {
31
+ const [open, setOpen] = (0, import_react.useState)(false);
32
+ (0, import_react.useEffect)(() => {
33
+ (0, import_pane_service.registerPane)(setOpen);
34
+ }, []);
35
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sheet.Sheet, { open, onOpenChange: setOpen, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_sheet.SheetContent, { side: "right", className: "w-full sm:w-[700px] sm:max-w-1/2", children: [
36
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_sheet.SheetHeader, { children: [
37
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sheet.SheetTitle, { children: "My Side Pane" }),
38
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sheet.SheetDescription, { children: "Here's a panel you can open/close programmatically." })
39
+ ] }),
40
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "p-4 space-y-4 flex-1 overflow-auto p-4 space-y-4", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "This is the pane content area. Add any React nodes here." }) }),
41
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sheet.SheetFooter, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { variant: "outline", onClick: import_pane_service.closePane, children: "Close Pane" }) })
42
+ ] }) });
43
+ }
@@ -0,0 +1,15 @@
1
+ import * as React from "react";
2
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
3
+ declare function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
+ declare function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
5
+ declare function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
6
+ declare function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>): import("react/jsx-runtime").JSX.Element;
7
+ declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): import("react/jsx-runtime").JSX.Element;
8
+ declare function DialogContent({ className, children, showCloseButton, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
9
+ showCloseButton?: boolean;
10
+ }): import("react/jsx-runtime").JSX.Element;
11
+ declare function DialogHeader({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
12
+ declare function DialogFooter({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
13
+ declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): import("react/jsx-runtime").JSX.Element;
14
+ declare function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): import("react/jsx-runtime").JSX.Element;
15
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
@@ -0,0 +1,166 @@
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 dialog_exports = {};
30
+ __export(dialog_exports, {
31
+ Dialog: () => Dialog,
32
+ DialogClose: () => DialogClose,
33
+ DialogContent: () => DialogContent,
34
+ DialogDescription: () => DialogDescription,
35
+ DialogFooter: () => DialogFooter,
36
+ DialogHeader: () => DialogHeader,
37
+ DialogOverlay: () => DialogOverlay,
38
+ DialogPortal: () => DialogPortal,
39
+ DialogTitle: () => DialogTitle,
40
+ DialogTrigger: () => DialogTrigger
41
+ });
42
+ module.exports = __toCommonJS(dialog_exports);
43
+ var import_jsx_runtime = require("react/jsx-runtime");
44
+ var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"));
45
+ var import_lucide_react = require("lucide-react");
46
+ var import_utils = require("@/lib/utils");
47
+ function Dialog({
48
+ ...props
49
+ }) {
50
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
51
+ }
52
+ function DialogTrigger({
53
+ ...props
54
+ }) {
55
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
56
+ }
57
+ function DialogPortal({
58
+ ...props
59
+ }) {
60
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
61
+ }
62
+ function DialogClose({
63
+ ...props
64
+ }) {
65
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
66
+ }
67
+ function DialogOverlay({
68
+ className,
69
+ ...props
70
+ }) {
71
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
72
+ DialogPrimitive.Overlay,
73
+ {
74
+ "data-slot": "dialog-overlay",
75
+ className: (0, import_utils.cn)(
76
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
77
+ className
78
+ ),
79
+ ...props
80
+ }
81
+ );
82
+ }
83
+ function DialogContent({
84
+ className,
85
+ children,
86
+ showCloseButton = true,
87
+ ...props
88
+ }) {
89
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogPortal, { "data-slot": "dialog-portal", children: [
90
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogOverlay, {}),
91
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
92
+ DialogPrimitive.Content,
93
+ {
94
+ "data-slot": "dialog-content",
95
+ className: (0, import_utils.cn)(
96
+ "bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
97
+ className
98
+ ),
99
+ ...props,
100
+ children: [
101
+ children,
102
+ showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
103
+ DialogPrimitive.Close,
104
+ {
105
+ "data-slot": "dialog-close",
106
+ className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
107
+ children: [
108
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.XIcon, {}),
109
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: "Close" })
110
+ ]
111
+ }
112
+ )
113
+ ]
114
+ }
115
+ )
116
+ ] });
117
+ }
118
+ function DialogHeader({ className, ...props }) {
119
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
120
+ "div",
121
+ {
122
+ "data-slot": "dialog-header",
123
+ className: (0, import_utils.cn)("flex flex-col gap-2 text-center sm:text-left", className),
124
+ ...props
125
+ }
126
+ );
127
+ }
128
+ function DialogFooter({ className, ...props }) {
129
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
130
+ "div",
131
+ {
132
+ "data-slot": "dialog-footer",
133
+ className: (0, import_utils.cn)(
134
+ "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
135
+ className
136
+ ),
137
+ ...props
138
+ }
139
+ );
140
+ }
141
+ function DialogTitle({
142
+ className,
143
+ ...props
144
+ }) {
145
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
146
+ DialogPrimitive.Title,
147
+ {
148
+ "data-slot": "dialog-title",
149
+ className: (0, import_utils.cn)("text-lg leading-none font-semibold", className),
150
+ ...props
151
+ }
152
+ );
153
+ }
154
+ function DialogDescription({
155
+ className,
156
+ ...props
157
+ }) {
158
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
159
+ DialogPrimitive.Description,
160
+ {
161
+ "data-slot": "dialog-description",
162
+ className: (0, import_utils.cn)("text-muted-foreground text-sm", className),
163
+ ...props
164
+ }
165
+ );
166
+ }
@@ -0,0 +1,24 @@
1
+ import * as React from "react";
2
+ import * as LabelPrimitive from "@radix-ui/react-label";
3
+ import { Slot } from "@radix-ui/react-slot";
4
+ import { type ControllerProps, type FieldPath, type FieldValues } from "react-hook-form";
5
+ declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
6
+ declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => import("react/jsx-runtime").JSX.Element;
7
+ declare const useFormField: () => {
8
+ invalid: boolean;
9
+ isDirty: boolean;
10
+ isTouched: boolean;
11
+ isValidating: boolean;
12
+ error?: import("react-hook-form").FieldError;
13
+ id: string;
14
+ name: string;
15
+ formItemId: string;
16
+ formDescriptionId: string;
17
+ formMessageId: string;
18
+ };
19
+ declare function FormItem({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
20
+ declare function FormLabel({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
21
+ declare function FormControl({ ...props }: React.ComponentProps<typeof Slot>): import("react/jsx-runtime").JSX.Element;
22
+ declare function FormDescription({ className, ...props }: React.ComponentProps<"p">): import("react/jsx-runtime").JSX.Element;
23
+ declare function FormMessage({ className, ...props }: React.ComponentProps<"p">): import("react/jsx-runtime").JSX.Element | null;
24
+ export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField, };
@@ -0,0 +1,146 @@
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 form_exports = {};
30
+ __export(form_exports, {
31
+ Form: () => Form,
32
+ FormControl: () => FormControl,
33
+ FormDescription: () => FormDescription,
34
+ FormField: () => FormField,
35
+ FormItem: () => FormItem,
36
+ FormLabel: () => FormLabel,
37
+ FormMessage: () => FormMessage,
38
+ useFormField: () => useFormField
39
+ });
40
+ module.exports = __toCommonJS(form_exports);
41
+ var import_jsx_runtime = require("react/jsx-runtime");
42
+ var React = __toESM(require("react"));
43
+ var import_react_slot = require("@radix-ui/react-slot");
44
+ var import_react_hook_form = require("react-hook-form");
45
+ var import_utils = require("@/lib/utils");
46
+ var import_label = require("@/components/ui/label");
47
+ const Form = import_react_hook_form.FormProvider;
48
+ const FormFieldContext = React.createContext(
49
+ {}
50
+ );
51
+ const FormField = ({
52
+ ...props
53
+ }) => {
54
+ 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 }) });
55
+ };
56
+ const useFormField = () => {
57
+ const fieldContext = React.useContext(FormFieldContext);
58
+ const itemContext = React.useContext(FormItemContext);
59
+ const { getFieldState } = (0, import_react_hook_form.useFormContext)();
60
+ const formState = (0, import_react_hook_form.useFormState)({ name: fieldContext.name });
61
+ const fieldState = getFieldState(fieldContext.name, formState);
62
+ if (!fieldContext) {
63
+ throw new Error("useFormField should be used within <FormField>");
64
+ }
65
+ const { id } = itemContext;
66
+ return {
67
+ id,
68
+ name: fieldContext.name,
69
+ formItemId: `${id}-form-item`,
70
+ formDescriptionId: `${id}-form-item-description`,
71
+ formMessageId: `${id}-form-item-message`,
72
+ ...fieldState
73
+ };
74
+ };
75
+ const FormItemContext = React.createContext(
76
+ {}
77
+ );
78
+ function FormItem({ className, ...props }) {
79
+ const id = React.useId();
80
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
81
+ "div",
82
+ {
83
+ "data-slot": "form-item",
84
+ className: (0, import_utils.cn)("grid gap-2", className),
85
+ ...props
86
+ }
87
+ ) });
88
+ }
89
+ function FormLabel({
90
+ className,
91
+ ...props
92
+ }) {
93
+ const { error, formItemId } = useFormField();
94
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
95
+ import_label.Label,
96
+ {
97
+ "data-slot": "form-label",
98
+ "data-error": !!error,
99
+ className: (0, import_utils.cn)("data-[error=true]:text-destructive", className),
100
+ htmlFor: formItemId,
101
+ ...props
102
+ }
103
+ );
104
+ }
105
+ function FormControl({ ...props }) {
106
+ const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
107
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
108
+ import_react_slot.Slot,
109
+ {
110
+ "data-slot": "form-control",
111
+ id: formItemId,
112
+ "aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
113
+ "aria-invalid": !!error,
114
+ ...props
115
+ }
116
+ );
117
+ }
118
+ function FormDescription({ className, ...props }) {
119
+ const { formDescriptionId } = useFormField();
120
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
121
+ "p",
122
+ {
123
+ "data-slot": "form-description",
124
+ id: formDescriptionId,
125
+ className: (0, import_utils.cn)("text-muted-foreground text-sm", className),
126
+ ...props
127
+ }
128
+ );
129
+ }
130
+ function FormMessage({ className, ...props }) {
131
+ const { error, formMessageId } = useFormField();
132
+ const body = error ? String(error?.message ?? "") : props.children;
133
+ if (!body) {
134
+ return null;
135
+ }
136
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
137
+ "p",
138
+ {
139
+ "data-slot": "form-message",
140
+ id: formMessageId,
141
+ className: (0, import_utils.cn)("text-destructive text-sm", className),
142
+ ...props,
143
+ children: body
144
+ }
145
+ );
146
+ }
@@ -0,0 +1,3 @@
1
+ import * as React from "react";
2
+ declare function Input({ className, type, ...props }: React.ComponentProps<"input">): import("react/jsx-runtime").JSX.Element;
3
+ export { Input };
@@ -0,0 +1,41 @@
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 input_exports = {};
20
+ __export(input_exports, {
21
+ Input: () => Input
22
+ });
23
+ module.exports = __toCommonJS(input_exports);
24
+ var import_jsx_runtime = require("react/jsx-runtime");
25
+ var import_utils = require("@/lib/utils");
26
+ function Input({ className, type, ...props }) {
27
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
28
+ "input",
29
+ {
30
+ type,
31
+ "data-slot": "input",
32
+ className: (0, import_utils.cn)(
33
+ "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
34
+ "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
35
+ "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
36
+ className
37
+ ),
38
+ ...props
39
+ }
40
+ );
41
+ }
@@ -0,0 +1,4 @@
1
+ import * as React from "react";
2
+ import * as LabelPrimitive from "@radix-ui/react-label";
3
+ declare function Label({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
+ export { Label };
@@ -0,0 +1,53 @@
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 label_exports = {};
31
+ __export(label_exports, {
32
+ Label: () => Label
33
+ });
34
+ module.exports = __toCommonJS(label_exports);
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var LabelPrimitive = __toESM(require("@radix-ui/react-label"));
37
+ var import_utils = require("@/lib/utils");
38
+ function Label({
39
+ className,
40
+ ...props
41
+ }) {
42
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
43
+ LabelPrimitive.Root,
44
+ {
45
+ "data-slot": "label",
46
+ className: (0, import_utils.cn)(
47
+ "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
48
+ className
49
+ ),
50
+ ...props
51
+ }
52
+ );
53
+ }
@@ -0,0 +1,5 @@
1
+ import * as React from "react";
2
+ import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
3
+ declare function RadioGroup({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
+ declare function RadioGroupItem({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Item>): import("react/jsx-runtime").JSX.Element;
5
+ export { RadioGroup, RadioGroupItem };