@kopexa/assistant 0.0.1

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.
@@ -0,0 +1,97 @@
1
+ import * as react from 'react';
2
+ import { HTMLAttributes, ComponentProps } from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import { IconButton } from '@kopexa/button';
5
+
6
+ /**
7
+ * Role of the message sender
8
+ */
9
+ type MessageRole = "user" | "assistant" | "system";
10
+ type MessageProps = HTMLAttributes<HTMLDivElement> & {
11
+ /** Role of the message sender */
12
+ from: MessageRole;
13
+ };
14
+ declare function Message({ className, from, ...props }: MessageProps): react_jsx_runtime.JSX.Element;
15
+ declare namespace Message {
16
+ var displayName: string;
17
+ }
18
+ type MessageContentProps = HTMLAttributes<HTMLDivElement>;
19
+ declare function MessageContent({ children, className, ...props }: MessageContentProps): react_jsx_runtime.JSX.Element;
20
+ declare namespace MessageContent {
21
+ var displayName: string;
22
+ }
23
+ type MessageActionsProps = ComponentProps<"div">;
24
+ declare function MessageActions({ className, children, ...props }: MessageActionsProps): react_jsx_runtime.JSX.Element;
25
+ declare namespace MessageActions {
26
+ var displayName: string;
27
+ }
28
+ type MessageActionBaseProps = Omit<ComponentProps<typeof IconButton>, "aria-label" | "tooltip">;
29
+ type MessageActionProps = MessageActionBaseProps & ({
30
+ /** Tooltip text (also used as accessible label if label not provided) */
31
+ tooltip: string;
32
+ /** Accessible label (falls back to tooltip) */
33
+ label?: string;
34
+ } | {
35
+ /** Tooltip text */
36
+ tooltip?: undefined;
37
+ /** Accessible label (required if tooltip not provided) */
38
+ label: string;
39
+ });
40
+ declare function MessageAction({ tooltip, children, label, variant, size, ...props }: MessageActionProps): react_jsx_runtime.JSX.Element;
41
+ declare namespace MessageAction {
42
+ var displayName: string;
43
+ }
44
+ type MessageToolbarProps = ComponentProps<"div">;
45
+ declare function MessageToolbar({ className, children, ...props }: MessageToolbarProps): react_jsx_runtime.JSX.Element;
46
+ declare namespace MessageToolbar {
47
+ var displayName: string;
48
+ }
49
+ type MessageBranchProps = HTMLAttributes<HTMLDivElement> & {
50
+ /** Default branch index */
51
+ defaultBranch?: number;
52
+ /** Callback when branch changes */
53
+ onBranchChange?: (branchIndex: number) => void;
54
+ };
55
+ declare function MessageBranch({ defaultBranch, onBranchChange, className, children, ...props }: MessageBranchProps): react_jsx_runtime.JSX.Element;
56
+ declare namespace MessageBranch {
57
+ var displayName: string;
58
+ }
59
+ type MessageBranchContentProps = HTMLAttributes<HTMLDivElement>;
60
+ declare function MessageBranchContent({ children, ...props }: MessageBranchContentProps): react_jsx_runtime.JSX.Element;
61
+ declare namespace MessageBranchContent {
62
+ var displayName: string;
63
+ }
64
+ type MessageBranchSelectorProps = HTMLAttributes<HTMLDivElement>;
65
+ declare function MessageBranchSelector({ className, children, ...props }: MessageBranchSelectorProps): react_jsx_runtime.JSX.Element | null;
66
+ declare namespace MessageBranchSelector {
67
+ var displayName: string;
68
+ }
69
+ type MessageBranchPreviousProps = Omit<ComponentProps<typeof IconButton>, "aria-label">;
70
+ declare function MessageBranchPrevious({ children, ...props }: MessageBranchPreviousProps): react_jsx_runtime.JSX.Element;
71
+ declare namespace MessageBranchPrevious {
72
+ var displayName: string;
73
+ }
74
+ type MessageBranchNextProps = Omit<ComponentProps<typeof IconButton>, "aria-label">;
75
+ declare function MessageBranchNext({ children, ...props }: MessageBranchNextProps): react_jsx_runtime.JSX.Element;
76
+ declare namespace MessageBranchNext {
77
+ var displayName: string;
78
+ }
79
+ type MessageBranchPageProps = HTMLAttributes<HTMLSpanElement>;
80
+ declare function MessageBranchPage({ className, ...props }: MessageBranchPageProps): react_jsx_runtime.JSX.Element;
81
+ declare namespace MessageBranchPage {
82
+ var displayName: string;
83
+ }
84
+ type MessageResponseProps = HTMLAttributes<HTMLDivElement> & {
85
+ /** Markdown content to render */
86
+ children?: string;
87
+ };
88
+ /**
89
+ * MessageResponse renders markdown content.
90
+ *
91
+ * Note: This is a basic implementation. For full markdown support with
92
+ * code highlighting, math, and mermaid diagrams, integrate with a
93
+ * markdown renderer like Streamdown or react-markdown.
94
+ */
95
+ declare const MessageResponse: react.MemoExoticComponent<({ className, children, ...props }: MessageResponseProps) => react_jsx_runtime.JSX.Element>;
96
+
97
+ export { Message, MessageAction, type MessageActionProps, MessageActions, type MessageActionsProps, MessageBranch, MessageBranchContent, type MessageBranchContentProps, MessageBranchNext, type MessageBranchNextProps, MessageBranchPage, type MessageBranchPageProps, MessageBranchPrevious, type MessageBranchPreviousProps, type MessageBranchProps, MessageBranchSelector, type MessageBranchSelectorProps, MessageContent, type MessageContentProps, type MessageProps, MessageResponse, type MessageResponseProps, type MessageRole, MessageToolbar, type MessageToolbarProps };
@@ -0,0 +1,328 @@
1
+ "use client";
2
+ "use strict";
3
+ "use client";
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/message.tsx
23
+ var message_exports = {};
24
+ __export(message_exports, {
25
+ Message: () => Message,
26
+ MessageAction: () => MessageAction,
27
+ MessageActions: () => MessageActions,
28
+ MessageBranch: () => MessageBranch,
29
+ MessageBranchContent: () => MessageBranchContent,
30
+ MessageBranchNext: () => MessageBranchNext,
31
+ MessageBranchPage: () => MessageBranchPage,
32
+ MessageBranchPrevious: () => MessageBranchPrevious,
33
+ MessageBranchSelector: () => MessageBranchSelector,
34
+ MessageContent: () => MessageContent,
35
+ MessageResponse: () => MessageResponse,
36
+ MessageToolbar: () => MessageToolbar
37
+ });
38
+ module.exports = __toCommonJS(message_exports);
39
+ var import_button = require("@kopexa/button");
40
+ var import_icons = require("@kopexa/icons");
41
+ var import_shared_utils = require("@kopexa/shared-utils");
42
+ var import_theme = require("@kopexa/theme");
43
+ var import_tooltip = require("@kopexa/tooltip");
44
+ var import_react = require("react");
45
+ var import_jsx_runtime = require("react/jsx-runtime");
46
+ var styles = (0, import_theme.message)();
47
+ function Message({ className, from, ...props }) {
48
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
49
+ "div",
50
+ {
51
+ className: (0, import_shared_utils.cn)(styles.root({ from }), className),
52
+ "data-slot": "message",
53
+ "data-from": from,
54
+ ...props
55
+ }
56
+ );
57
+ }
58
+ Message.displayName = "Message";
59
+ function MessageContent({
60
+ children,
61
+ className,
62
+ ...props
63
+ }) {
64
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
65
+ "div",
66
+ {
67
+ className: (0, import_shared_utils.cn)(styles.content(), className),
68
+ "data-slot": "message-content",
69
+ ...props,
70
+ children
71
+ }
72
+ );
73
+ }
74
+ MessageContent.displayName = "MessageContent";
75
+ function MessageActions({
76
+ className,
77
+ children,
78
+ ...props
79
+ }) {
80
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
81
+ "div",
82
+ {
83
+ className: (0, import_shared_utils.cn)(styles.actions(), className),
84
+ "data-slot": "message-actions",
85
+ ...props,
86
+ children
87
+ }
88
+ );
89
+ }
90
+ MessageActions.displayName = "MessageActions";
91
+ function MessageAction({
92
+ tooltip,
93
+ children,
94
+ label,
95
+ variant = "ghost",
96
+ size = "sm",
97
+ ...props
98
+ }) {
99
+ var _a;
100
+ const ariaLabel = (_a = label != null ? label : tooltip) != null ? _a : "";
101
+ const button = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
102
+ import_button.IconButton,
103
+ {
104
+ size,
105
+ type: "button",
106
+ variant,
107
+ "aria-label": ariaLabel,
108
+ ...props,
109
+ children
110
+ }
111
+ );
112
+ if (tooltip) {
113
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tooltip.Tooltip, { content: tooltip, children: button });
114
+ }
115
+ return button;
116
+ }
117
+ MessageAction.displayName = "MessageAction";
118
+ function MessageToolbar({
119
+ className,
120
+ children,
121
+ ...props
122
+ }) {
123
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
124
+ "div",
125
+ {
126
+ className: (0, import_shared_utils.cn)(styles.toolbar(), className),
127
+ "data-slot": "message-toolbar",
128
+ ...props,
129
+ children
130
+ }
131
+ );
132
+ }
133
+ MessageToolbar.displayName = "MessageToolbar";
134
+ var MessageBranchContext = (0, import_react.createContext)(
135
+ null
136
+ );
137
+ function useMessageBranch() {
138
+ const context = (0, import_react.useContext)(MessageBranchContext);
139
+ if (!context) {
140
+ throw new Error(
141
+ "MessageBranch components must be used within MessageBranch"
142
+ );
143
+ }
144
+ return context;
145
+ }
146
+ function MessageBranch({
147
+ defaultBranch = 0,
148
+ onBranchChange,
149
+ className,
150
+ children,
151
+ ...props
152
+ }) {
153
+ const [currentBranch, setCurrentBranch] = (0, import_react.useState)(defaultBranch);
154
+ const [branches, setBranches] = (0, import_react.useState)([]);
155
+ const handleBranchChange = (0, import_react.useCallback)(
156
+ (newBranch) => {
157
+ setCurrentBranch(newBranch);
158
+ onBranchChange == null ? void 0 : onBranchChange(newBranch);
159
+ },
160
+ [onBranchChange]
161
+ );
162
+ const goToPrevious = (0, import_react.useCallback)(() => {
163
+ const newBranch = currentBranch > 0 ? currentBranch - 1 : branches.length - 1;
164
+ handleBranchChange(newBranch);
165
+ }, [currentBranch, branches.length, handleBranchChange]);
166
+ const goToNext = (0, import_react.useCallback)(() => {
167
+ const newBranch = currentBranch < branches.length - 1 ? currentBranch + 1 : 0;
168
+ handleBranchChange(newBranch);
169
+ }, [currentBranch, branches.length, handleBranchChange]);
170
+ const contextValue = {
171
+ currentBranch,
172
+ totalBranches: branches.length,
173
+ goToPrevious,
174
+ goToNext,
175
+ branches,
176
+ setBranches
177
+ };
178
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessageBranchContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
179
+ "div",
180
+ {
181
+ className: (0, import_shared_utils.cn)(styles.branchRoot(), className),
182
+ "data-slot": "message-branch",
183
+ ...props,
184
+ children
185
+ }
186
+ ) });
187
+ }
188
+ MessageBranch.displayName = "MessageBranch";
189
+ function MessageBranchContent({
190
+ children,
191
+ ...props
192
+ }) {
193
+ const { currentBranch, setBranches, branches } = useMessageBranch();
194
+ const childrenArray = Array.isArray(children) ? children : [children];
195
+ (0, import_react.useEffect)(() => {
196
+ if (branches.length !== childrenArray.length) {
197
+ setBranches(childrenArray);
198
+ }
199
+ }, [childrenArray, branches, setBranches]);
200
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: childrenArray.map((branch, index) => {
201
+ var _a;
202
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
203
+ "div",
204
+ {
205
+ className: (0, import_shared_utils.cn)(
206
+ styles.branchContent(),
207
+ index === currentBranch ? "block" : "hidden"
208
+ ),
209
+ "data-slot": "message-branch-content",
210
+ ...props,
211
+ children: branch
212
+ },
213
+ (_a = branch.key) != null ? _a : index
214
+ );
215
+ }) });
216
+ }
217
+ MessageBranchContent.displayName = "MessageBranchContent";
218
+ function MessageBranchSelector({
219
+ className,
220
+ children,
221
+ ...props
222
+ }) {
223
+ const { totalBranches } = useMessageBranch();
224
+ if (totalBranches <= 1) {
225
+ return null;
226
+ }
227
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
228
+ "div",
229
+ {
230
+ className: (0, import_shared_utils.cn)(styles.branchSelector(), className),
231
+ "data-slot": "message-branch-selector",
232
+ ...props,
233
+ children
234
+ }
235
+ );
236
+ }
237
+ MessageBranchSelector.displayName = "MessageBranchSelector";
238
+ function MessageBranchPrevious({
239
+ children,
240
+ ...props
241
+ }) {
242
+ const { goToPrevious, totalBranches } = useMessageBranch();
243
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
244
+ import_button.IconButton,
245
+ {
246
+ "aria-label": "Previous branch",
247
+ disabled: totalBranches <= 1,
248
+ onClick: goToPrevious,
249
+ size: "sm",
250
+ type: "button",
251
+ variant: "ghost",
252
+ ...props,
253
+ children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.ChevronLeftIcon, { className: "size-4" })
254
+ }
255
+ );
256
+ }
257
+ MessageBranchPrevious.displayName = "MessageBranchPrevious";
258
+ function MessageBranchNext({
259
+ children,
260
+ ...props
261
+ }) {
262
+ const { goToNext, totalBranches } = useMessageBranch();
263
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
264
+ import_button.IconButton,
265
+ {
266
+ "aria-label": "Next branch",
267
+ disabled: totalBranches <= 1,
268
+ onClick: goToNext,
269
+ size: "sm",
270
+ type: "button",
271
+ variant: "ghost",
272
+ ...props,
273
+ children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.ChevronRightIcon, { className: "size-4" })
274
+ }
275
+ );
276
+ }
277
+ MessageBranchNext.displayName = "MessageBranchNext";
278
+ function MessageBranchPage({
279
+ className,
280
+ ...props
281
+ }) {
282
+ const { currentBranch, totalBranches } = useMessageBranch();
283
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
284
+ "span",
285
+ {
286
+ className: (0, import_shared_utils.cn)(styles.branchPage(), className),
287
+ "data-slot": "message-branch-page",
288
+ ...props,
289
+ children: [
290
+ currentBranch + 1,
291
+ " of ",
292
+ totalBranches
293
+ ]
294
+ }
295
+ );
296
+ }
297
+ MessageBranchPage.displayName = "MessageBranchPage";
298
+ var MessageResponse = (0, import_react.memo)(
299
+ ({ className, children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
300
+ "div",
301
+ {
302
+ className: (0, import_shared_utils.cn)(
303
+ "size-full prose prose-sm dark:prose-invert max-w-none",
304
+ "[&>*:first-child]:mt-0 [&>*:last-child]:mb-0",
305
+ className
306
+ ),
307
+ "data-slot": "message-response",
308
+ ...props,
309
+ children
310
+ }
311
+ )
312
+ );
313
+ MessageResponse.displayName = "MessageResponse";
314
+ // Annotate the CommonJS export names for ESM import in node:
315
+ 0 && (module.exports = {
316
+ Message,
317
+ MessageAction,
318
+ MessageActions,
319
+ MessageBranch,
320
+ MessageBranchContent,
321
+ MessageBranchNext,
322
+ MessageBranchPage,
323
+ MessageBranchPrevious,
324
+ MessageBranchSelector,
325
+ MessageContent,
326
+ MessageResponse,
327
+ MessageToolbar
328
+ });
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ "use client";
3
+ import {
4
+ Message,
5
+ MessageAction,
6
+ MessageActions,
7
+ MessageBranch,
8
+ MessageBranchContent,
9
+ MessageBranchNext,
10
+ MessageBranchPage,
11
+ MessageBranchPrevious,
12
+ MessageBranchSelector,
13
+ MessageContent,
14
+ MessageResponse,
15
+ MessageToolbar
16
+ } from "./chunk-OLZG7MMU.mjs";
17
+ export {
18
+ Message,
19
+ MessageAction,
20
+ MessageActions,
21
+ MessageBranch,
22
+ MessageBranchContent,
23
+ MessageBranchNext,
24
+ MessageBranchPage,
25
+ MessageBranchPrevious,
26
+ MessageBranchSelector,
27
+ MessageContent,
28
+ MessageResponse,
29
+ MessageToolbar
30
+ };
@@ -0,0 +1,22 @@
1
+ import * as react from 'react';
2
+ import { ComponentProps } from 'react';
3
+
4
+ interface PromptInputProps extends Omit<ComponentProps<"form">, "onSubmit"> {
5
+ /** Placeholder text for the textarea */
6
+ placeholder?: string;
7
+ /** Current value of the textarea */
8
+ value?: string;
9
+ /** Callback when value changes */
10
+ onValueChange?: (value: string) => void;
11
+ /** Callback when form is submitted */
12
+ onSubmit?: (value: string) => void;
13
+ /** Whether the input is disabled */
14
+ disabled?: boolean;
15
+ /** Whether submission is in progress */
16
+ isLoading?: boolean;
17
+ /** Label for the submit button (for accessibility) */
18
+ submitLabel?: string;
19
+ }
20
+ declare const PromptInput: react.ForwardRefExoticComponent<Omit<PromptInputProps, "ref"> & react.RefAttributes<HTMLFormElement>>;
21
+
22
+ export { PromptInput, type PromptInputProps };
@@ -0,0 +1,22 @@
1
+ import * as react from 'react';
2
+ import { ComponentProps } from 'react';
3
+
4
+ interface PromptInputProps extends Omit<ComponentProps<"form">, "onSubmit"> {
5
+ /** Placeholder text for the textarea */
6
+ placeholder?: string;
7
+ /** Current value of the textarea */
8
+ value?: string;
9
+ /** Callback when value changes */
10
+ onValueChange?: (value: string) => void;
11
+ /** Callback when form is submitted */
12
+ onSubmit?: (value: string) => void;
13
+ /** Whether the input is disabled */
14
+ disabled?: boolean;
15
+ /** Whether submission is in progress */
16
+ isLoading?: boolean;
17
+ /** Label for the submit button (for accessibility) */
18
+ submitLabel?: string;
19
+ }
20
+ declare const PromptInput: react.ForwardRefExoticComponent<Omit<PromptInputProps, "ref"> & react.RefAttributes<HTMLFormElement>>;
21
+
22
+ export { PromptInput, type PromptInputProps };
@@ -0,0 +1,123 @@
1
+ "use client";
2
+ "use strict";
3
+ "use client";
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/prompt-input.tsx
23
+ var prompt_input_exports = {};
24
+ __export(prompt_input_exports, {
25
+ PromptInput: () => PromptInput
26
+ });
27
+ module.exports = __toCommonJS(prompt_input_exports);
28
+ var import_button = require("@kopexa/button");
29
+ var import_icons = require("@kopexa/icons");
30
+ var import_shared_utils = require("@kopexa/shared-utils");
31
+ var import_theme = require("@kopexa/theme");
32
+ var import_react = require("react");
33
+ var import_jsx_runtime = require("react/jsx-runtime");
34
+ var styles = (0, import_theme.promptInput)();
35
+ var PromptInput = (0, import_react.forwardRef)(
36
+ ({
37
+ className,
38
+ placeholder = "Type a message...",
39
+ value,
40
+ onValueChange,
41
+ onSubmit,
42
+ disabled,
43
+ isLoading,
44
+ submitLabel = "Send message",
45
+ ...props
46
+ }, ref) => {
47
+ const textareaRef = (0, import_react.useRef)(null);
48
+ const handleSubmit = (0, import_react.useCallback)(
49
+ (e) => {
50
+ e.preventDefault();
51
+ const trimmedValue = value == null ? void 0 : value.trim();
52
+ if (trimmedValue && !disabled && !isLoading) {
53
+ onSubmit == null ? void 0 : onSubmit(trimmedValue);
54
+ }
55
+ },
56
+ [value, disabled, isLoading, onSubmit]
57
+ );
58
+ const handleKeyDown = (0, import_react.useCallback)(
59
+ (e) => {
60
+ if (e.key === "Enter" && !e.shiftKey) {
61
+ e.preventDefault();
62
+ const trimmedValue = value == null ? void 0 : value.trim();
63
+ if (trimmedValue && !disabled && !isLoading) {
64
+ onSubmit == null ? void 0 : onSubmit(trimmedValue);
65
+ }
66
+ }
67
+ },
68
+ [value, disabled, isLoading, onSubmit]
69
+ );
70
+ const handleTextareaChange = (0, import_react.useCallback)(
71
+ (e) => {
72
+ onValueChange == null ? void 0 : onValueChange(e.target.value);
73
+ const textarea = e.target;
74
+ textarea.style.height = "auto";
75
+ textarea.style.height = `${Math.min(textarea.scrollHeight, 200)}px`;
76
+ },
77
+ [onValueChange]
78
+ );
79
+ const canSubmit = !!(value == null ? void 0 : value.trim()) && !disabled && !isLoading;
80
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: (0, import_shared_utils.cn)(styles.root(), className), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
81
+ "form",
82
+ {
83
+ ref,
84
+ className: styles.form(),
85
+ onSubmit: handleSubmit,
86
+ ...props,
87
+ children: [
88
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
89
+ "textarea",
90
+ {
91
+ ref: textareaRef,
92
+ className: styles.textarea(),
93
+ placeholder,
94
+ value,
95
+ onChange: handleTextareaChange,
96
+ onKeyDown: handleKeyDown,
97
+ disabled: disabled || isLoading,
98
+ rows: 1,
99
+ "aria-label": placeholder
100
+ }
101
+ ),
102
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles.actions(), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
103
+ import_button.Button,
104
+ {
105
+ type: "submit",
106
+ isIconOnly: true,
107
+ disabled: !canSubmit,
108
+ isLoading,
109
+ className: styles.submitButton(),
110
+ "aria-label": submitLabel,
111
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.ArrowUp, { className: "size-4" })
112
+ }
113
+ ) })
114
+ ]
115
+ }
116
+ ) });
117
+ }
118
+ );
119
+ PromptInput.displayName = "PromptInput";
120
+ // Annotate the CommonJS export names for ESM import in node:
121
+ 0 && (module.exports = {
122
+ PromptInput
123
+ });
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ "use client";
3
+ import {
4
+ PromptInput
5
+ } from "./chunk-UIXG4SXX.mjs";
6
+ export {
7
+ PromptInput
8
+ };
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@kopexa/assistant",
3
+ "version": "0.0.1",
4
+ "description": "AI assistant components for building conversational interfaces",
5
+ "keywords": [
6
+ "assistant",
7
+ "ai",
8
+ "chat",
9
+ "conversation"
10
+ ],
11
+ "author": "Kopexa <hello@kopexa.com>",
12
+ "homepage": "https://kopexa.com",
13
+ "license": "Apache-2.0",
14
+ "main": "dist/index.js",
15
+ "sideEffects": false,
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/kopexa-grc/sight.git",
25
+ "directory": "packages/components/assistant"
26
+ },
27
+ "bugs": {
28
+ "url": "https://github.com/kopexa-grc/sight/issues"
29
+ },
30
+ "peerDependencies": {
31
+ "react": ">=19.0.0-rc.0",
32
+ "react-dom": ">=19.0.0-rc.0",
33
+ "@kopexa/theme": "17.16.0"
34
+ },
35
+ "dependencies": {
36
+ "use-stick-to-bottom": "^1.1.2",
37
+ "@kopexa/button": "17.0.29",
38
+ "@kopexa/react-utils": "17.0.29",
39
+ "@kopexa/tooltip": "17.1.1",
40
+ "@kopexa/icons": "17.5.0",
41
+ "@kopexa/shared-utils": "17.0.29"
42
+ },
43
+ "clean-package": "../../../clean-package.config.json",
44
+ "module": "dist/index.mjs",
45
+ "types": "dist/index.d.ts",
46
+ "exports": {
47
+ ".": {
48
+ "types": "./dist/index.d.ts",
49
+ "import": "./dist/index.mjs",
50
+ "require": "./dist/index.js"
51
+ },
52
+ "./package.json": "./package.json"
53
+ },
54
+ "scripts": {
55
+ "build": "tsup src --dts",
56
+ "dev": "pnpm build:fast --watch",
57
+ "clean": "rimraf dist .turbo",
58
+ "typecheck": "tsc --noEmit",
59
+ "build:fast": "tsup src"
60
+ }
61
+ }