@dashx/react 0.1.4 → 0.1.6
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/cjs/components/avatar.d.ts +5 -0
- package/dist/cjs/components/avatar.js +2 -0
- package/dist/cjs/components/avatar.js.map +7 -0
- package/dist/cjs/components/flex.d.ts +70 -0
- package/dist/cjs/components/flex.js +1 -1
- package/dist/cjs/components/flex.js.map +3 -3
- package/dist/cjs/components/index.d.ts +1 -0
- package/dist/cjs/components/index.js +1 -1
- package/dist/cjs/components/index.js.map +2 -2
- package/dist/cjs/components/markdown-renderer.d.ts +8 -0
- package/dist/cjs/components/markdown-renderer.js +2 -0
- package/dist/cjs/components/markdown-renderer.js.map +7 -0
- package/dist/cjs/components/popover copy.d.ts +47 -0
- package/dist/cjs/components/text-area.d.ts +1 -0
- package/dist/cjs/components/text-area.js +1 -1
- package/dist/cjs/components/text-area.js.map +3 -3
- package/dist/cjs/hooks/index.d.ts +2 -0
- package/dist/cjs/hooks/index.js +1 -1
- package/dist/cjs/hooks/index.js.map +3 -3
- package/dist/cjs/hooks/use-agent.d.ts +15 -0
- package/dist/cjs/hooks/use-agent.js +2 -0
- package/dist/cjs/hooks/use-agent.js.map +7 -0
- package/dist/cjs/hooks/use-animated-text.d.ts +11 -0
- package/dist/cjs/hooks/use-animated-text.js +2 -0
- package/dist/cjs/hooks/use-animated-text.js.map +7 -0
- package/dist/cjs/hooks/use-auto-scroll.d.ts +13 -0
- package/dist/cjs/hooks/use-auto-scroll.js +2 -0
- package/dist/cjs/hooks/use-auto-scroll.js.map +7 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/legacy.d.ts +2 -0
- package/dist/cjs/legacy.js +2 -0
- package/dist/cjs/legacy.js.map +7 -0
- package/dist/cjs/providers/DashXProvider.d.ts +3 -2
- package/dist/cjs/providers/DashXProvider.js +1 -1
- package/dist/cjs/providers/DashXProvider.js.map +3 -3
- package/dist/cjs/tsconfig.tsbuildinfo +1 -0
- package/dist/cjs/variants/avatar.d.ts +212 -0
- package/dist/cjs/variants/avatar.js +2 -0
- package/dist/cjs/variants/avatar.js.map +7 -0
- package/dist/cjs/variants/base-input.d.ts +1 -1
- package/dist/cjs/variants/base-input.js +1 -1
- package/dist/cjs/variants/base-input.js.map +2 -2
- package/dist/cjs/variants/button copy.d.ts +254 -0
- package/dist/cjs/variants/checkbox.d.ts +1 -1
- package/dist/cjs/widgets/Chat.d.ts +15 -0
- package/dist/cjs/widgets/Chat.js +2 -0
- package/dist/cjs/widgets/Chat.js.map +7 -0
- package/dist/cjs/widgets/ChatBody.d.ts +14 -0
- package/dist/cjs/widgets/ChatBody.js +2 -0
- package/dist/cjs/widgets/ChatBody.js.map +7 -0
- package/dist/cjs/widgets/ChatFooter.d.ts +7 -0
- package/dist/cjs/widgets/ChatFooter.js +2 -0
- package/dist/cjs/widgets/ChatFooter.js.map +7 -0
- package/dist/cjs/widgets/ChatHeader.d.ts +9 -0
- package/dist/cjs/widgets/ChatHeader.js +2 -0
- package/dist/cjs/widgets/ChatHeader.js.map +7 -0
- package/dist/cjs/widgets/ChatPopover.d.ts +3 -0
- package/dist/cjs/widgets/ChatPopover.js +2 -0
- package/dist/cjs/widgets/ChatPopover.js.map +7 -0
- package/dist/cjs/widgets/NotificationBell.js +1 -1
- package/dist/cjs/widgets/NotificationBell.js.map +2 -2
- package/dist/cjs/widgets/index.d.ts +2 -0
- package/dist/cjs/widgets/index.js +1 -1
- package/dist/cjs/widgets/index.js.map +3 -3
- package/dist/esm/components/avatar.d.ts +5 -0
- package/dist/esm/components/avatar.js +2 -0
- package/dist/esm/components/avatar.js.map +7 -0
- package/dist/esm/components/flex.d.ts +70 -0
- package/dist/esm/components/flex.js +1 -1
- package/dist/esm/components/flex.js.map +3 -3
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/index.js.map +2 -2
- package/dist/esm/components/markdown-renderer.d.ts +8 -0
- package/dist/esm/components/markdown-renderer.js +2 -0
- package/dist/esm/components/markdown-renderer.js.map +7 -0
- package/dist/esm/components/popover copy.d.ts +47 -0
- package/dist/esm/components/text-area.d.ts +1 -0
- package/dist/esm/components/text-area.js +1 -1
- package/dist/esm/components/text-area.js.map +3 -3
- package/dist/esm/hooks/index.d.ts +2 -0
- package/dist/esm/hooks/index.js +1 -1
- package/dist/esm/hooks/index.js.map +3 -3
- package/dist/esm/hooks/use-agent.d.ts +15 -0
- package/dist/esm/hooks/use-agent.js +2 -0
- package/dist/esm/hooks/use-agent.js.map +7 -0
- package/dist/esm/hooks/use-animated-text.d.ts +11 -0
- package/dist/esm/hooks/use-animated-text.js +2 -0
- package/dist/esm/hooks/use-animated-text.js.map +7 -0
- package/dist/esm/hooks/use-auto-scroll.d.ts +13 -0
- package/dist/esm/hooks/use-auto-scroll.js +2 -0
- package/dist/esm/hooks/use-auto-scroll.js.map +7 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/legacy.d.ts +2 -0
- package/dist/esm/legacy.js +2 -0
- package/dist/esm/legacy.js.map +7 -0
- package/dist/esm/providers/DashXProvider.d.ts +3 -2
- package/dist/esm/providers/DashXProvider.js +1 -1
- package/dist/esm/providers/DashXProvider.js.map +3 -3
- package/dist/esm/tsconfig.tsbuildinfo +1 -0
- package/dist/esm/variants/avatar.d.ts +212 -0
- package/dist/esm/variants/avatar.js +2 -0
- package/dist/esm/variants/avatar.js.map +7 -0
- package/dist/esm/variants/base-input.d.ts +1 -1
- package/dist/esm/variants/base-input.js +1 -1
- package/dist/esm/variants/base-input.js.map +2 -2
- package/dist/esm/variants/button copy.d.ts +254 -0
- package/dist/esm/variants/checkbox.d.ts +1 -1
- package/dist/esm/widgets/Chat.d.ts +15 -0
- package/dist/esm/widgets/Chat.js +2 -0
- package/dist/esm/widgets/Chat.js.map +7 -0
- package/dist/esm/widgets/ChatBody.d.ts +14 -0
- package/dist/esm/widgets/ChatBody.js +2 -0
- package/dist/esm/widgets/ChatBody.js.map +7 -0
- package/dist/esm/widgets/ChatFooter.d.ts +7 -0
- package/dist/esm/widgets/ChatFooter.js +2 -0
- package/dist/esm/widgets/ChatFooter.js.map +7 -0
- package/dist/esm/widgets/ChatHeader.d.ts +9 -0
- package/dist/esm/widgets/ChatHeader.js +2 -0
- package/dist/esm/widgets/ChatHeader.js.map +7 -0
- package/dist/esm/widgets/ChatPopover.d.ts +3 -0
- package/dist/esm/widgets/ChatPopover.js +2 -0
- package/dist/esm/widgets/ChatPopover.js.map +7 -0
- package/dist/esm/widgets/NotificationBell.js +1 -1
- package/dist/esm/widgets/NotificationBell.js.map +2 -2
- package/dist/esm/widgets/index.d.ts +2 -0
- package/dist/esm/widgets/index.js +1 -1
- package/dist/esm/widgets/index.js.map +2 -2
- package/package.json +5 -3
- package/src/components/avatar.tsx +32 -0
- package/src/components/flex.tsx +7 -2
- package/src/components/index.ts +1 -0
- package/src/components/markdown-renderer.tsx +57 -0
- package/src/components/text-area.tsx +23 -11
- package/src/hooks/index.ts +2 -0
- package/src/hooks/use-agent.ts +89 -0
- package/src/hooks/use-animated-text.ts +67 -0
- package/src/hooks/use-auto-scroll.ts +65 -0
- package/src/index.ts +2 -1
- package/src/legacy.ts +2 -0
- package/src/providers/DashXProvider.tsx +9 -6
- package/src/variants/avatar.ts +31 -0
- package/src/variants/base-input.ts +1 -1
- package/src/widgets/Chat.tsx +96 -0
- package/src/widgets/ChatBody.tsx +171 -0
- package/src/widgets/ChatFooter.tsx +62 -0
- package/src/widgets/ChatHeader.tsx +26 -0
- package/src/widgets/ChatPopover.tsx +42 -0
- package/src/widgets/NotificationBell.tsx +1 -1
- package/src/widgets/index.ts +2 -0
- package/styles.css +122 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import type { VariantProps } from 'tailwind-variants';
|
|
2
|
+
declare const avatar: import("tailwind-variants").TVReturnType<{
|
|
3
|
+
size: {
|
|
4
|
+
extrasmall: string;
|
|
5
|
+
small: string;
|
|
6
|
+
medium: string;
|
|
7
|
+
large: string;
|
|
8
|
+
extralarge: string;
|
|
9
|
+
};
|
|
10
|
+
roundness: {};
|
|
11
|
+
}, undefined, "inline-flex items-center justify-center outline-none select-none", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
12
|
+
size: {
|
|
13
|
+
extrasmall: string;
|
|
14
|
+
small: string;
|
|
15
|
+
medium: string;
|
|
16
|
+
large: string;
|
|
17
|
+
extralarge: string;
|
|
18
|
+
};
|
|
19
|
+
roundness: {};
|
|
20
|
+
}, {
|
|
21
|
+
size: {
|
|
22
|
+
extrasmall: string;
|
|
23
|
+
small: string;
|
|
24
|
+
medium: string;
|
|
25
|
+
large: string;
|
|
26
|
+
extralarge: string;
|
|
27
|
+
};
|
|
28
|
+
roundness: {
|
|
29
|
+
none: string;
|
|
30
|
+
small: string;
|
|
31
|
+
medium: string;
|
|
32
|
+
large: string;
|
|
33
|
+
full: string;
|
|
34
|
+
};
|
|
35
|
+
elevation: {
|
|
36
|
+
none: string;
|
|
37
|
+
small: string;
|
|
38
|
+
medium: string;
|
|
39
|
+
large: string;
|
|
40
|
+
};
|
|
41
|
+
}>, {
|
|
42
|
+
size: {
|
|
43
|
+
extrasmall: string;
|
|
44
|
+
small: string;
|
|
45
|
+
medium: string;
|
|
46
|
+
large: string;
|
|
47
|
+
extralarge: string;
|
|
48
|
+
};
|
|
49
|
+
roundness: {
|
|
50
|
+
none: string;
|
|
51
|
+
small: string;
|
|
52
|
+
medium: string;
|
|
53
|
+
large: string;
|
|
54
|
+
full: string;
|
|
55
|
+
};
|
|
56
|
+
elevation: {
|
|
57
|
+
none: string;
|
|
58
|
+
small: string;
|
|
59
|
+
medium: string;
|
|
60
|
+
large: string;
|
|
61
|
+
};
|
|
62
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
63
|
+
size: {
|
|
64
|
+
extrasmall: string;
|
|
65
|
+
small: string;
|
|
66
|
+
medium: string;
|
|
67
|
+
large: string;
|
|
68
|
+
extralarge: string;
|
|
69
|
+
};
|
|
70
|
+
roundness: {
|
|
71
|
+
none: string;
|
|
72
|
+
small: string;
|
|
73
|
+
medium: string;
|
|
74
|
+
large: string;
|
|
75
|
+
full: string;
|
|
76
|
+
};
|
|
77
|
+
elevation: {
|
|
78
|
+
none: string;
|
|
79
|
+
small: string;
|
|
80
|
+
medium: string;
|
|
81
|
+
large: string;
|
|
82
|
+
};
|
|
83
|
+
}, undefined, undefined, import("tailwind-variants/dist/config.js").TVConfig<{
|
|
84
|
+
size: {
|
|
85
|
+
extrasmall: string;
|
|
86
|
+
small: string;
|
|
87
|
+
medium: string;
|
|
88
|
+
large: string;
|
|
89
|
+
extralarge: string;
|
|
90
|
+
};
|
|
91
|
+
roundness: {
|
|
92
|
+
none: string;
|
|
93
|
+
small: string;
|
|
94
|
+
medium: string;
|
|
95
|
+
large: string;
|
|
96
|
+
full: string;
|
|
97
|
+
};
|
|
98
|
+
elevation: {
|
|
99
|
+
none: string;
|
|
100
|
+
small: string;
|
|
101
|
+
medium: string;
|
|
102
|
+
large: string;
|
|
103
|
+
};
|
|
104
|
+
}, {
|
|
105
|
+
size: {
|
|
106
|
+
extrasmall: string;
|
|
107
|
+
small: string;
|
|
108
|
+
medium: string;
|
|
109
|
+
large: string;
|
|
110
|
+
extralarge: string;
|
|
111
|
+
};
|
|
112
|
+
roundness: {
|
|
113
|
+
none: string;
|
|
114
|
+
small: string;
|
|
115
|
+
medium: string;
|
|
116
|
+
large: string;
|
|
117
|
+
full: string;
|
|
118
|
+
};
|
|
119
|
+
elevation: {
|
|
120
|
+
none: string;
|
|
121
|
+
small: string;
|
|
122
|
+
medium: string;
|
|
123
|
+
large: string;
|
|
124
|
+
};
|
|
125
|
+
}>, {
|
|
126
|
+
size: {
|
|
127
|
+
extrasmall: string;
|
|
128
|
+
small: string;
|
|
129
|
+
medium: string;
|
|
130
|
+
large: string;
|
|
131
|
+
extralarge: string;
|
|
132
|
+
};
|
|
133
|
+
roundness: {
|
|
134
|
+
none: string;
|
|
135
|
+
small: string;
|
|
136
|
+
medium: string;
|
|
137
|
+
large: string;
|
|
138
|
+
full: string;
|
|
139
|
+
};
|
|
140
|
+
elevation: {
|
|
141
|
+
none: string;
|
|
142
|
+
small: string;
|
|
143
|
+
medium: string;
|
|
144
|
+
large: string;
|
|
145
|
+
};
|
|
146
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
147
|
+
size: {
|
|
148
|
+
extrasmall: string;
|
|
149
|
+
small: string;
|
|
150
|
+
medium: string;
|
|
151
|
+
large: string;
|
|
152
|
+
extralarge: string;
|
|
153
|
+
};
|
|
154
|
+
roundness: {
|
|
155
|
+
none: string;
|
|
156
|
+
small: string;
|
|
157
|
+
medium: string;
|
|
158
|
+
large: string;
|
|
159
|
+
full: string;
|
|
160
|
+
};
|
|
161
|
+
elevation: {
|
|
162
|
+
none: string;
|
|
163
|
+
small: string;
|
|
164
|
+
medium: string;
|
|
165
|
+
large: string;
|
|
166
|
+
};
|
|
167
|
+
}, undefined, undefined, import("tailwind-variants/dist/config.js").TVConfig<{
|
|
168
|
+
size: {
|
|
169
|
+
extrasmall: string;
|
|
170
|
+
small: string;
|
|
171
|
+
medium: string;
|
|
172
|
+
large: string;
|
|
173
|
+
extralarge: string;
|
|
174
|
+
};
|
|
175
|
+
roundness: {
|
|
176
|
+
none: string;
|
|
177
|
+
small: string;
|
|
178
|
+
medium: string;
|
|
179
|
+
large: string;
|
|
180
|
+
full: string;
|
|
181
|
+
};
|
|
182
|
+
elevation: {
|
|
183
|
+
none: string;
|
|
184
|
+
small: string;
|
|
185
|
+
medium: string;
|
|
186
|
+
large: string;
|
|
187
|
+
};
|
|
188
|
+
}, {
|
|
189
|
+
size: {
|
|
190
|
+
extrasmall: string;
|
|
191
|
+
small: string;
|
|
192
|
+
medium: string;
|
|
193
|
+
large: string;
|
|
194
|
+
extralarge: string;
|
|
195
|
+
};
|
|
196
|
+
roundness: {
|
|
197
|
+
none: string;
|
|
198
|
+
small: string;
|
|
199
|
+
medium: string;
|
|
200
|
+
large: string;
|
|
201
|
+
full: string;
|
|
202
|
+
};
|
|
203
|
+
elevation: {
|
|
204
|
+
none: string;
|
|
205
|
+
small: string;
|
|
206
|
+
medium: string;
|
|
207
|
+
large: string;
|
|
208
|
+
};
|
|
209
|
+
}>, unknown, unknown, undefined>>>;
|
|
210
|
+
type AvatarVariantProps = VariantProps<typeof avatar>;
|
|
211
|
+
export type { AvatarVariantProps };
|
|
212
|
+
export { avatar };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var m=Object.create;var l=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var v=(t,e)=>{for(var r in e)l(t,r,{get:e[r],enumerable:!0})},o=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of f(e))!x.call(t,a)&&a!==r&&l(t,a,{get:()=>e[a],enumerable:!(n=u(e,a))||n.enumerable});return t};var c=(t,e,r)=>(r=t!=null?m(p(t)):{},o(e||!t||!t.__esModule?l(r,"default",{value:t,enumerable:!0}):r,t)),g=t=>o(l({},"__esModule",{value:!0}),t);var y={};v(y,{avatar:()=>d});module.exports=g(y);var i=require("tailwind-variants"),s=c(require("./base-element.js"));const d=(0,i.tv)({extend:s.default,base:"inline-flex items-center justify-center outline-none select-none",variants:{size:{extrasmall:"rounded-sm-or-full text-xs",small:"rounded-sm-or-full text-sm",medium:"rounded-md-or-full text-base",large:"rounded-lg-or-full text-lg",extralarge:"rounded-lg-or-full text-xl"},roundness:{}},defaultVariants:{size:"medium",mode:"distinct",variant:"fill"}});
|
|
2
|
+
//# sourceMappingURL=avatar.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/variants/avatar.ts"],
|
|
4
|
+
"sourcesContent": ["import { tv } from 'tailwind-variants';\n\nimport baseElement from './base-element.js';\n\nimport type { VariantProps } from 'tailwind-variants';\n\nconst avatar = tv({\n extend: baseElement,\n base: 'inline-flex items-center justify-center outline-none select-none',\n variants: {\n size: {\n extrasmall: 'rounded-sm-or-full text-xs',\n small: 'rounded-sm-or-full text-sm',\n medium: 'rounded-md-or-full text-base',\n large: 'rounded-lg-or-full text-lg',\n extralarge: 'rounded-lg-or-full text-xl',\n },\n roundness: {},\n },\n defaultVariants: {\n size: 'medium',\n mode: 'distinct',\n variant: 'fill',\n }\n});\n\ntype AvatarVariantProps = VariantProps<typeof avatar>;\n\nexport type { AvatarVariantProps };\n\nexport { avatar };\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,YAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmB,6BAEnBC,EAAwB,gCAIxB,MAAMH,KAAS,MAAG,CAChB,OAAQ,EAAAI,QACR,KAAM,mEACN,SAAU,CACR,KAAM,CACJ,WAAY,6BACZ,MAAO,6BACP,OAAQ,+BACR,MAAO,6BACP,WAAY,4BACd,EACA,UAAW,CAAC,CACd,EACA,gBAAiB,CACf,KAAM,SACN,KAAM,WACN,QAAS,MACX,CACF,CAAC",
|
|
6
|
+
"names": ["avatar_exports", "__export", "avatar", "__toCommonJS", "import_tailwind_variants", "import_base_element", "baseElement"]
|
|
7
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { VariantProps } from 'tailwind-variants';
|
|
2
|
-
declare const baseInput: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, "data-[invalid=\"true\"]:border-negative-300 data-[invalid=\"true\"]:hover:border-negative-400 data-[invalid=\"true\"]:focus:border-negative-500 data-[invalid=\"true\"]:text-negative-500 data-[invalid=\"true\"]:bg-negative-50 ease-fluid data-[invalid=\"true\"]:focus:outline-negative-500 focus:outline-accent-500 autofill:bg-accent-300 !hover:border-gray-400 border border-gray-300 py-3 px-4 text-sm text-gray-900 outline-none transition-[box-shadow,background-color,color,border-color] duration-300", import("tailwind-variants/dist/config.js").TVConfig<unknown, {} | {}>, {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, "data-[invalid=\"true\"]:border-negative-300 data-[invalid=\"true\"]:hover:border-negative-400 data-[invalid=\"true\"]:focus:border-negative-500 data-[invalid=\"true\"]:text-negative-500 data-[invalid=\"true\"]:bg-negative-50 ease-fluid data-[invalid=\"true\"]:focus:outline-negative-500 focus:outline-accent-500 autofill:bg-accent-300 !hover:border-gray-400 border border-gray-300 py-3 px-4 text-sm text-gray-900 outline-none transition-[box-shadow,background-color,color,border-color] duration-300", import("tailwind-variants/dist/config.js").TVConfig<unknown, {} | {}>, unknown, unknown, undefined>>;
|
|
2
|
+
declare const baseInput: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, "bg-white data-[invalid=\"true\"]:border-negative-300 data-[invalid=\"true\"]:hover:border-negative-400 data-[invalid=\"true\"]:focus:border-negative-500 data-[invalid=\"true\"]:text-negative-500 data-[invalid=\"true\"]:bg-negative-50 ease-fluid data-[invalid=\"true\"]:focus:outline-negative-500 focus:outline-accent-500 autofill:bg-accent-300 !hover:border-gray-400 border border-gray-300 py-3 px-4 text-sm text-gray-900 outline-none transition-[box-shadow,background-color,color,border-color] duration-300", import("tailwind-variants/dist/config.js").TVConfig<unknown, {} | {}>, {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, "bg-white data-[invalid=\"true\"]:border-negative-300 data-[invalid=\"true\"]:hover:border-negative-400 data-[invalid=\"true\"]:focus:border-negative-500 data-[invalid=\"true\"]:text-negative-500 data-[invalid=\"true\"]:bg-negative-50 ease-fluid data-[invalid=\"true\"]:focus:outline-negative-500 focus:outline-accent-500 autofill:bg-accent-300 !hover:border-gray-400 border border-gray-300 py-3 px-4 text-sm text-gray-900 outline-none transition-[box-shadow,background-color,color,border-color] duration-300", import("tailwind-variants/dist/config.js").TVConfig<unknown, {} | {}>, unknown, unknown, undefined>>;
|
|
3
3
|
type BaseInputVariantProps = VariantProps<typeof baseInput>;
|
|
4
4
|
export type { BaseInputVariantProps };
|
|
5
5
|
export { baseInput };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var o=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var l=(a,t)=>{for(var r in t)o(a,r,{get:t[r],enumerable:!0})},v=(a,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of p(t))!s.call(a,e)&&e!==r&&o(a,e,{get:()=>t[e],enumerable:!(i=u(t,e))||i.enumerable});return a};var b=a=>v(o({},"__esModule",{value:!0}),a);var
|
|
1
|
+
"use strict";var o=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var l=(a,t)=>{for(var r in t)o(a,r,{get:t[r],enumerable:!0})},v=(a,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of p(t))!s.call(a,e)&&e!==r&&o(a,e,{get:()=>t[e],enumerable:!(i=u(t,e))||i.enumerable});return a};var b=a=>v(o({},"__esModule",{value:!0}),a);var g={};l(g,{baseInput:()=>d});module.exports=b(g);var n=require("tailwind-variants");const d=(0,n.tv)({base:'bg-white data-[invalid="true"]:border-negative-300 data-[invalid="true"]:hover:border-negative-400 data-[invalid="true"]:focus:border-negative-500 data-[invalid="true"]:text-negative-500 data-[invalid="true"]:bg-negative-50 ease-fluid data-[invalid="true"]:focus:outline-negative-500 focus:outline-accent-500 autofill:bg-accent-300 !hover:border-gray-400 border border-gray-300 py-3 px-4 text-sm text-gray-900 outline-none transition-[box-shadow,background-color,color,border-color] duration-300'});
|
|
2
2
|
//# sourceMappingURL=base-input.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/variants/base-input.ts"],
|
|
4
|
-
"sourcesContent": ["import { tv } from 'tailwind-variants';\n\nimport type { VariantProps } from 'tailwind-variants';\n\nconst baseInput = tv({\n base: 'data-[invalid=\"true\"]:border-negative-300 data-[invalid=\"true\"]:hover:border-negative-400 data-[invalid=\"true\"]:focus:border-negative-500 data-[invalid=\"true\"]:text-negative-500 data-[invalid=\"true\"]:bg-negative-50 ease-fluid data-[invalid=\"true\"]:focus:outline-negative-500 focus:outline-accent-500 autofill:bg-accent-300 !hover:border-gray-400 border border-gray-300 py-3 px-4 text-sm text-gray-900 outline-none transition-[box-shadow,background-color,color,border-color] duration-300',\n});\n\ntype BaseInputVariantProps = VariantProps<typeof baseInput>;\n\nexport type { BaseInputVariantProps };\n\nexport { baseInput };\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,eAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmB,6BAInB,MAAMF,KAAY,MAAG,CACnB,KAAM,
|
|
4
|
+
"sourcesContent": ["import { tv } from 'tailwind-variants';\n\nimport type { VariantProps } from 'tailwind-variants';\n\nconst baseInput = tv({\n base: 'bg-white data-[invalid=\"true\"]:border-negative-300 data-[invalid=\"true\"]:hover:border-negative-400 data-[invalid=\"true\"]:focus:border-negative-500 data-[invalid=\"true\"]:text-negative-500 data-[invalid=\"true\"]:bg-negative-50 ease-fluid data-[invalid=\"true\"]:focus:outline-negative-500 focus:outline-accent-500 autofill:bg-accent-300 !hover:border-gray-400 border border-gray-300 py-3 px-4 text-sm text-gray-900 outline-none transition-[box-shadow,background-color,color,border-color] duration-300',\n});\n\ntype BaseInputVariantProps = VariantProps<typeof baseInput>;\n\nexport type { BaseInputVariantProps };\n\nexport { baseInput };\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,eAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmB,6BAInB,MAAMF,KAAY,MAAG,CACnB,KAAM,ifACR,CAAC",
|
|
6
6
|
"names": ["base_input_exports", "__export", "baseInput", "__toCommonJS", "import_tailwind_variants"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import type { VariantProps } from 'tailwind-variants';
|
|
2
|
+
declare const button: import("tailwind-variants").TVReturnType<{
|
|
3
|
+
size: {
|
|
4
|
+
extrasmall: string;
|
|
5
|
+
small: string;
|
|
6
|
+
medium: string;
|
|
7
|
+
large: string;
|
|
8
|
+
extralarge: string;
|
|
9
|
+
};
|
|
10
|
+
variant: {
|
|
11
|
+
fill: string;
|
|
12
|
+
outline: string;
|
|
13
|
+
simple: string;
|
|
14
|
+
ghost: string;
|
|
15
|
+
};
|
|
16
|
+
mode: {
|
|
17
|
+
distinct: string;
|
|
18
|
+
subtle: string;
|
|
19
|
+
negative: string;
|
|
20
|
+
};
|
|
21
|
+
roundness: {};
|
|
22
|
+
elevation: {};
|
|
23
|
+
shape: {
|
|
24
|
+
square: string;
|
|
25
|
+
rect: string;
|
|
26
|
+
};
|
|
27
|
+
inset: {
|
|
28
|
+
left: string;
|
|
29
|
+
right: string;
|
|
30
|
+
both: string;
|
|
31
|
+
};
|
|
32
|
+
}, undefined, "ease-fluid inline-flex items-center justify-center gap-2 outline-none transition-[box-shadow,background-color,color] duration-300 select-none data-[focus-visible]:outline-2 data-[focus-visible]:outline-offset-2 data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[disabled]:shadow-none", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
33
|
+
size: {
|
|
34
|
+
extrasmall: string;
|
|
35
|
+
small: string;
|
|
36
|
+
medium: string;
|
|
37
|
+
large: string;
|
|
38
|
+
extralarge: string;
|
|
39
|
+
};
|
|
40
|
+
variant: {
|
|
41
|
+
fill: string;
|
|
42
|
+
outline: string;
|
|
43
|
+
simple: string;
|
|
44
|
+
ghost: string;
|
|
45
|
+
};
|
|
46
|
+
mode: {
|
|
47
|
+
distinct: string;
|
|
48
|
+
subtle: string;
|
|
49
|
+
negative: string;
|
|
50
|
+
};
|
|
51
|
+
roundness: {};
|
|
52
|
+
elevation: {};
|
|
53
|
+
shape: {
|
|
54
|
+
square: string;
|
|
55
|
+
rect: string;
|
|
56
|
+
};
|
|
57
|
+
inset: {
|
|
58
|
+
left: string;
|
|
59
|
+
right: string;
|
|
60
|
+
both: string;
|
|
61
|
+
};
|
|
62
|
+
}, {
|
|
63
|
+
size: {
|
|
64
|
+
extrasmall: string;
|
|
65
|
+
small: string;
|
|
66
|
+
medium: string;
|
|
67
|
+
large: string;
|
|
68
|
+
extralarge: string;
|
|
69
|
+
};
|
|
70
|
+
roundness: {
|
|
71
|
+
none: string;
|
|
72
|
+
small: string;
|
|
73
|
+
medium: string;
|
|
74
|
+
large: string;
|
|
75
|
+
full: string;
|
|
76
|
+
};
|
|
77
|
+
elevation: {
|
|
78
|
+
none: string;
|
|
79
|
+
small: string;
|
|
80
|
+
medium: string;
|
|
81
|
+
large: string;
|
|
82
|
+
};
|
|
83
|
+
}>, {
|
|
84
|
+
size: {
|
|
85
|
+
extrasmall: string;
|
|
86
|
+
small: string;
|
|
87
|
+
medium: string;
|
|
88
|
+
large: string;
|
|
89
|
+
extralarge: string;
|
|
90
|
+
};
|
|
91
|
+
roundness: {
|
|
92
|
+
none: string;
|
|
93
|
+
small: string;
|
|
94
|
+
medium: string;
|
|
95
|
+
large: string;
|
|
96
|
+
full: string;
|
|
97
|
+
};
|
|
98
|
+
elevation: {
|
|
99
|
+
none: string;
|
|
100
|
+
small: string;
|
|
101
|
+
medium: string;
|
|
102
|
+
large: string;
|
|
103
|
+
};
|
|
104
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
105
|
+
size: {
|
|
106
|
+
extrasmall: string;
|
|
107
|
+
small: string;
|
|
108
|
+
medium: string;
|
|
109
|
+
large: string;
|
|
110
|
+
extralarge: string;
|
|
111
|
+
};
|
|
112
|
+
roundness: {
|
|
113
|
+
none: string;
|
|
114
|
+
small: string;
|
|
115
|
+
medium: string;
|
|
116
|
+
large: string;
|
|
117
|
+
full: string;
|
|
118
|
+
};
|
|
119
|
+
elevation: {
|
|
120
|
+
none: string;
|
|
121
|
+
small: string;
|
|
122
|
+
medium: string;
|
|
123
|
+
large: string;
|
|
124
|
+
};
|
|
125
|
+
}, undefined, undefined, import("tailwind-variants/dist/config.js").TVConfig<{
|
|
126
|
+
size: {
|
|
127
|
+
extrasmall: string;
|
|
128
|
+
small: string;
|
|
129
|
+
medium: string;
|
|
130
|
+
large: string;
|
|
131
|
+
extralarge: string;
|
|
132
|
+
};
|
|
133
|
+
roundness: {
|
|
134
|
+
none: string;
|
|
135
|
+
small: string;
|
|
136
|
+
medium: string;
|
|
137
|
+
large: string;
|
|
138
|
+
full: string;
|
|
139
|
+
};
|
|
140
|
+
elevation: {
|
|
141
|
+
none: string;
|
|
142
|
+
small: string;
|
|
143
|
+
medium: string;
|
|
144
|
+
large: string;
|
|
145
|
+
};
|
|
146
|
+
}, {
|
|
147
|
+
size: {
|
|
148
|
+
extrasmall: string;
|
|
149
|
+
small: string;
|
|
150
|
+
medium: string;
|
|
151
|
+
large: string;
|
|
152
|
+
extralarge: string;
|
|
153
|
+
};
|
|
154
|
+
roundness: {
|
|
155
|
+
none: string;
|
|
156
|
+
small: string;
|
|
157
|
+
medium: string;
|
|
158
|
+
large: string;
|
|
159
|
+
full: string;
|
|
160
|
+
};
|
|
161
|
+
elevation: {
|
|
162
|
+
none: string;
|
|
163
|
+
small: string;
|
|
164
|
+
medium: string;
|
|
165
|
+
large: string;
|
|
166
|
+
};
|
|
167
|
+
}>, {
|
|
168
|
+
size: {
|
|
169
|
+
extrasmall: string;
|
|
170
|
+
small: string;
|
|
171
|
+
medium: string;
|
|
172
|
+
large: string;
|
|
173
|
+
extralarge: string;
|
|
174
|
+
};
|
|
175
|
+
roundness: {
|
|
176
|
+
none: string;
|
|
177
|
+
small: string;
|
|
178
|
+
medium: string;
|
|
179
|
+
large: string;
|
|
180
|
+
full: string;
|
|
181
|
+
};
|
|
182
|
+
elevation: {
|
|
183
|
+
none: string;
|
|
184
|
+
small: string;
|
|
185
|
+
medium: string;
|
|
186
|
+
large: string;
|
|
187
|
+
};
|
|
188
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
189
|
+
size: {
|
|
190
|
+
extrasmall: string;
|
|
191
|
+
small: string;
|
|
192
|
+
medium: string;
|
|
193
|
+
large: string;
|
|
194
|
+
extralarge: string;
|
|
195
|
+
};
|
|
196
|
+
roundness: {
|
|
197
|
+
none: string;
|
|
198
|
+
small: string;
|
|
199
|
+
medium: string;
|
|
200
|
+
large: string;
|
|
201
|
+
full: string;
|
|
202
|
+
};
|
|
203
|
+
elevation: {
|
|
204
|
+
none: string;
|
|
205
|
+
small: string;
|
|
206
|
+
medium: string;
|
|
207
|
+
large: string;
|
|
208
|
+
};
|
|
209
|
+
}, undefined, undefined, import("tailwind-variants/dist/config.js").TVConfig<{
|
|
210
|
+
size: {
|
|
211
|
+
extrasmall: string;
|
|
212
|
+
small: string;
|
|
213
|
+
medium: string;
|
|
214
|
+
large: string;
|
|
215
|
+
extralarge: string;
|
|
216
|
+
};
|
|
217
|
+
roundness: {
|
|
218
|
+
none: string;
|
|
219
|
+
small: string;
|
|
220
|
+
medium: string;
|
|
221
|
+
large: string;
|
|
222
|
+
full: string;
|
|
223
|
+
};
|
|
224
|
+
elevation: {
|
|
225
|
+
none: string;
|
|
226
|
+
small: string;
|
|
227
|
+
medium: string;
|
|
228
|
+
large: string;
|
|
229
|
+
};
|
|
230
|
+
}, {
|
|
231
|
+
size: {
|
|
232
|
+
extrasmall: string;
|
|
233
|
+
small: string;
|
|
234
|
+
medium: string;
|
|
235
|
+
large: string;
|
|
236
|
+
extralarge: string;
|
|
237
|
+
};
|
|
238
|
+
roundness: {
|
|
239
|
+
none: string;
|
|
240
|
+
small: string;
|
|
241
|
+
medium: string;
|
|
242
|
+
large: string;
|
|
243
|
+
full: string;
|
|
244
|
+
};
|
|
245
|
+
elevation: {
|
|
246
|
+
none: string;
|
|
247
|
+
small: string;
|
|
248
|
+
medium: string;
|
|
249
|
+
large: string;
|
|
250
|
+
};
|
|
251
|
+
}>, unknown, unknown, undefined>>>;
|
|
252
|
+
type ButtonVariantProps = VariantProps<typeof button>;
|
|
253
|
+
export type { ButtonVariantProps };
|
|
254
|
+
export { button };
|
|
@@ -35,7 +35,7 @@ declare const checkbox: import("tailwind-variants").TVReturnType<{
|
|
|
35
35
|
medium: string;
|
|
36
36
|
large: string;
|
|
37
37
|
};
|
|
38
|
-
}, {} | {} | {}>, {} | {} | {}, undefined, import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, "data-[invalid=\"true\"]:border-negative-300 data-[invalid=\"true\"]:hover:border-negative-400 data-[invalid=\"true\"]:focus:border-negative-500 data-[invalid=\"true\"]:text-negative-500 data-[invalid=\"true\"]:bg-negative-50 ease-fluid data-[invalid=\"true\"]:focus:outline-negative-500 focus:outline-accent-500 autofill:bg-accent-300 !hover:border-gray-400 border border-gray-300 py-3 px-4 text-sm text-gray-900 outline-none transition-[box-shadow,background-color,color,border-color] duration-300", import("tailwind-variants/dist/config.js").TVConfig<unknown, {} | {}>, {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, "data-[invalid=\"true\"]:border-negative-300 data-[invalid=\"true\"]:hover:border-negative-400 data-[invalid=\"true\"]:focus:border-negative-500 data-[invalid=\"true\"]:text-negative-500 data-[invalid=\"true\"]:bg-negative-50 ease-fluid data-[invalid=\"true\"]:focus:outline-negative-500 focus:outline-accent-500 autofill:bg-accent-300 !hover:border-gray-400 border border-gray-300 py-3 px-4 text-sm text-gray-900 outline-none transition-[box-shadow,background-color,color,border-color] duration-300", import("tailwind-variants/dist/config.js").TVConfig<unknown, {} | {}>, unknown, unknown, undefined>>>;
|
|
38
|
+
}, {} | {} | {}>, {} | {} | {}, undefined, import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, "bg-white data-[invalid=\"true\"]:border-negative-300 data-[invalid=\"true\"]:hover:border-negative-400 data-[invalid=\"true\"]:focus:border-negative-500 data-[invalid=\"true\"]:text-negative-500 data-[invalid=\"true\"]:bg-negative-50 ease-fluid data-[invalid=\"true\"]:focus:outline-negative-500 focus:outline-accent-500 autofill:bg-accent-300 !hover:border-gray-400 border border-gray-300 py-3 px-4 text-sm text-gray-900 outline-none transition-[box-shadow,background-color,color,border-color] duration-300", import("tailwind-variants/dist/config.js").TVConfig<unknown, {} | {}>, {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, "bg-white data-[invalid=\"true\"]:border-negative-300 data-[invalid=\"true\"]:hover:border-negative-400 data-[invalid=\"true\"]:focus:border-negative-500 data-[invalid=\"true\"]:text-negative-500 data-[invalid=\"true\"]:bg-negative-50 ease-fluid data-[invalid=\"true\"]:focus:outline-negative-500 focus:outline-accent-500 autofill:bg-accent-300 !hover:border-gray-400 border border-gray-300 py-3 px-4 text-sm text-gray-900 outline-none transition-[box-shadow,background-color,color,border-color] duration-300", import("tailwind-variants/dist/config.js").TVConfig<unknown, {} | {}>, unknown, unknown, undefined>>>;
|
|
39
39
|
type CheckboxVariantProps = VariantProps<typeof checkbox>;
|
|
40
40
|
export type { CheckboxVariantProps };
|
|
41
41
|
export { checkbox };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type UseAgentHookResponse } from '../hooks/use-agent.js';
|
|
2
|
+
type ChatProps = UseAgentHookResponse & {
|
|
3
|
+
withChatHeader?: boolean;
|
|
4
|
+
withPopoverClose?: boolean;
|
|
5
|
+
borderless?: boolean;
|
|
6
|
+
isPopoverOpen?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const Chat: ({ agent, messages, isThinking, error, sendMessage, withChatHeader, withPopoverClose, borderless, isPopoverOpen, }: ChatProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
type ChatWrapperProps = Omit<ChatProps, keyof UseAgentHookResponse> & {
|
|
10
|
+
publicEmbedKey: string;
|
|
11
|
+
};
|
|
12
|
+
declare const ChatWrapper: ({ publicEmbedKey, ...props }: ChatWrapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export type { ChatProps, ChatWrapperProps };
|
|
14
|
+
export { Chat };
|
|
15
|
+
export default ChatWrapper;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var x=Object.create;var i=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var R=(e,o)=>{for(var t in o)i(e,t,{get:o[t],enumerable:!0})},f=(e,o,t,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of T(o))!I.call(e,r)&&r!==t&&i(e,r,{get:()=>o[r],enumerable:!(n=H(o,r))||n.enumerable});return e};var p=(e,o,t)=>(t=e!=null?x(F(e)):{},f(o||!e||!e.__esModule?i(t,"default",{value:e,enumerable:!0}):t,e)),W=e=>f(i({},"__esModule",{value:!0}),e);var N={};R(N,{Chat:()=>d,default:()=>M});module.exports=W(N);var s=require("react/jsx-runtime"),C=require("react"),c=require("../utils/cn.js"),a=require("../components"),u=require("../icons"),P=p(require("./ChatHeader.js")),b=p(require("./ChatBody.js")),v=p(require("./ChatFooter.js")),y=p(require("../hooks/use-agent.js"));const d=({agent:e,messages:o,isThinking:t,error:n,sendMessage:r,withChatHeader:l=!1,withPopoverClose:m=!1,borderless:h=!1,isPopoverOpen:A=!1})=>{const[g,k]=(0,C.useState)(!1);return e?(0,s.jsx)(a.Theme,{asChild:!0,children:(0,s.jsxs)(a.Flex,{direction:"column",className:(0,c.cn)("h-full",!h&&"border border-gray-400/40"),children:[l&&(0,s.jsx)(P.default,{agent:e,children:m&&(0,s.jsx)(a.Popover.Close,{children:(0,s.jsx)(a.Button,{shape:"square",roundness:"full",variant:"ghost",mode:"subtle",inset:"right",children:(0,s.jsx)(u.X,{})})})}),(0,s.jsx)(b.default,{agent:e,messages:o,isThinking:t,error:n,sendMessage:r,isAnimating:g,setIsAnimating:k,isPopoverOpen:A}),(0,s.jsx)(v.default,{sendMessage:r,isDisabled:t||g})]})}):(0,s.jsx)(a.Theme,{asChild:!0,children:(0,s.jsx)(a.Flex,{direction:"column",className:"h-full",children:(0,s.jsx)("div",{className:"text-red-600 p-4",children:n?`Error loading chat agent: ${n}`:"Loading chat agent..."})})})},B=({publicEmbedKey:e,...o})=>{const{agent:t,messages:n,isThinking:r,error:l,sendMessage:m,conversationId:h}=(0,y.default)({publicEmbedKey:e});return(0,s.jsx)(d,{agent:t,conversationId:h,messages:n,isThinking:r,error:l,sendMessage:m,...o})};var M=B;
|
|
2
|
+
//# sourceMappingURL=Chat.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/widgets/Chat.tsx"],
|
|
4
|
+
"sourcesContent": ["import React, { useState } from 'react';\n\nimport { cn } from '../utils/cn.js';\nimport { Button, Flex, Theme, Popover } from '../components';\nimport { X } from '../icons';\nimport ChatHeader from './ChatHeader.js';\nimport ChatBody from './ChatBody.js';\nimport ChatFooter from './ChatFooter.js';\nimport useAgent, { type UseAgentHookResponse } from '../hooks/use-agent.js';\n\ntype ChatProps = UseAgentHookResponse & {\n withChatHeader?: boolean;\n withPopoverClose?: boolean;\n borderless?: boolean;\n isPopoverOpen?: boolean;\n}\n\nconst Chat = ({\n agent,\n messages,\n isThinking,\n error,\n sendMessage,\n withChatHeader = false,\n withPopoverClose = false,\n borderless = false,\n isPopoverOpen = false,\n}: ChatProps) => {\n const [isAnimating, setIsAnimating] = useState(false);\n\n if (!agent) {\n return (\n <Theme asChild>\n <Flex direction=\"column\" className=\"h-full\">\n <div className=\"text-red-600 p-4\">\n {error\n ? `Error loading chat agent: ${error}`\n : 'Loading chat agent...'}\n </div>\n </Flex>\n </Theme>\n );\n }\n\n return (\n <Theme asChild>\n <Flex direction=\"column\" className={cn(\"h-full\", !borderless && \"border border-gray-400/40\")}>\n {withChatHeader && (\n <ChatHeader agent={agent}>\n {withPopoverClose && (\n <Popover.Close>\n <Button shape=\"square\" roundness=\"full\" variant=\"ghost\" mode=\"subtle\" inset=\"right\">\n <X />\n </Button>\n </Popover.Close>\n )}\n </ChatHeader>\n )}\n <ChatBody\n agent={agent}\n messages={messages}\n isThinking={isThinking}\n error={error}\n sendMessage={sendMessage}\n isAnimating={isAnimating}\n setIsAnimating={setIsAnimating}\n isPopoverOpen={isPopoverOpen}\n />\n <ChatFooter sendMessage={sendMessage} isDisabled={isThinking || isAnimating} />\n </Flex>\n </Theme>\n );\n};\n\ntype ChatWrapperProps = Omit<ChatProps, keyof UseAgentHookResponse> & { publicEmbedKey: string };\n\nconst ChatWrapper = ({ publicEmbedKey, ...props }: ChatWrapperProps) => {\n const { agent, messages, isThinking, error, sendMessage, conversationId } = useAgent({ publicEmbedKey });\n return (\n <Chat\n agent={agent}\n conversationId={conversationId}\n messages={messages}\n isThinking={isThinking}\n error={error}\n sendMessage={sendMessage}\n {...props}\n />\n );\n};\n\nexport type { ChatProps, ChatWrapperProps };\n\nexport { Chat };\n\nexport default ChatWrapper;\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,UAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAkCU,IAAAK,EAAA,6BAlCVC,EAAgC,iBAEhCC,EAAmB,0BACnBC,EAA6C,yBAC7CC,EAAkB,oBAClBC,EAAuB,8BACvBC,EAAqB,4BACrBC,EAAuB,8BACvBC,EAAoD,oCASpD,MAAMX,EAAO,CAAC,CACZ,MAAAY,EACA,SAAAC,EACA,WAAAC,EACA,MAAAC,EACA,YAAAC,EACA,eAAAC,EAAiB,GACjB,iBAAAC,EAAmB,GACnB,WAAAC,EAAa,GACb,cAAAC,EAAgB,EAClB,IAAiB,CACf,KAAM,CAACC,EAAaC,CAAc,KAAI,YAAS,EAAK,EAEpD,OAAKV,KAeH,OAAC,SAAM,QAAO,GACZ,oBAAC,QAAK,UAAU,SAAS,aAAW,MAAG,SAAU,CAACO,GAAc,2BAA2B,EACxF,UAAAF,MACC,OAAC,EAAAM,QAAA,CAAW,MAAOX,EAChB,SAAAM,MACC,OAAC,UAAQ,MAAR,CACC,mBAAC,UAAO,MAAM,SAAS,UAAU,OAAO,QAAQ,QAAQ,KAAK,SAAS,MAAM,QAC1E,mBAAC,MAAE,EACL,EACF,EAEJ,KAEF,OAAC,EAAAM,QAAA,CACC,MAAOZ,EACP,SAAUC,EACV,WAAYC,EACZ,MAAOC,EACP,YAAaC,EACb,YAAaK,EACb,eAAgBC,EAChB,cAAeF,EACjB,KACA,OAAC,EAAAK,QAAA,CAAW,YAAaT,EAAa,WAAYF,GAAcO,EAAa,GAC/E,EACF,KAtCE,OAAC,SAAM,QAAO,GACZ,mBAAC,QAAK,UAAU,SAAS,UAAU,SACjC,mBAAC,OAAI,UAAU,mBACZ,SAAAN,EACG,6BAA6BA,CAAK,GAClC,wBACN,EACF,EACF,CAgCN,EAIMW,EAAc,CAAC,CAAE,eAAAC,EAAgB,GAAGC,CAAM,IAAwB,CACtE,KAAM,CAAE,MAAAhB,EAAO,SAAAC,EAAU,WAAAC,EAAY,MAAAC,EAAO,YAAAC,EAAa,eAAAa,CAAe,KAAI,EAAAC,SAAS,CAAE,eAAAH,CAAe,CAAC,EACvG,SACE,OAAC3B,EAAA,CACC,MAAOY,EACP,eAAgBiB,EAChB,SAAUhB,EACV,WAAYC,EACZ,MAAOC,EACP,YAAaC,EACZ,GAAGY,EACN,CAEJ,EAMA,IAAO3B,EAAQyB",
|
|
6
|
+
"names": ["Chat_exports", "__export", "Chat", "Chat_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_cn", "import_components", "import_icons", "import_ChatHeader", "import_ChatBody", "import_ChatFooter", "import_use_agent", "agent", "messages", "isThinking", "error", "sendMessage", "withChatHeader", "withPopoverClose", "borderless", "isPopoverOpen", "isAnimating", "setIsAnimating", "ChatHeader", "ChatBody", "ChatFooter", "ChatWrapper", "publicEmbedKey", "props", "conversationId", "useAgent"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AiAgent, AiMessage } from '@dashx/browser';
|
|
2
|
+
type ChatBodyProps = {
|
|
3
|
+
agent: AiAgent;
|
|
4
|
+
messages: AiMessage[];
|
|
5
|
+
isThinking: boolean;
|
|
6
|
+
error: string | null;
|
|
7
|
+
sendMessage: (message: string) => void;
|
|
8
|
+
isAnimating: boolean;
|
|
9
|
+
setIsAnimating: (animating: boolean) => void;
|
|
10
|
+
isPopoverOpen?: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare const ChatBody: ({ agent, messages, isThinking, error, sendMessage, setIsAnimating, isAnimating, isPopoverOpen, }: ChatBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export type { ChatBodyProps };
|
|
14
|
+
export default ChatBody;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var F=Object.create;var d=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty;var G=(t,e)=>{for(var a in e)d(t,a,{get:e[a],enumerable:!0})},y=(t,e,a,m)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of U(e))!z.call(t,c)&&c!==a&&d(t,c,{get:()=>e[c],enumerable:!(m=P(e,c))||m.enumerable});return t};var w=(t,e,a)=>(a=t!=null?F($(t)):{},y(e||!t||!t.__esModule?d(a,"default",{value:t,enumerable:!0}):a,t)),I=t=>y(d({},"__esModule",{value:!0}),t);var W={};G(W,{default:()=>V});module.exports=I(W);var r=require("react/jsx-runtime"),g=w(require("@radix-ui/react-scroll-area")),n=require("react"),l=require("../components"),f=require("../utils/cn.js"),A=require("../components/markdown-renderer.js"),C=w(require("../hooks/use-auto-scroll.js"));const v="max-w-[max(80%,350px)]",D="max-w-[80%]",H=({agent:t,messages:e,isThinking:a,error:m,sendMessage:c,setIsAnimating:p,isAnimating:h,isPopoverOpen:S=!1})=>{const x=(0,n.useRef)(e.length),N=(0,n.useRef)(e.length),{scrollAreaRef:R,scrollToBottom:i,checkIfUserAtBottom:M,isUserAtBottom:u}=(0,C.default)(),T=(0,n.useCallback)(()=>{p(!1)},[p]);(0,n.useEffect)(()=>{const o=e[e.length-1],s=e.length>x.current;s&&o?.role==="assistant"&&p(!0),s&&setTimeout(()=>i({smooth:!0}),0),x.current=e.length},[e,a,p,i,u]),(0,n.useEffect)(()=>{a&&setTimeout(()=>i({smooth:!0}),0)},[a,i,u]),(0,n.useEffect)(()=>{if(h&&u){const o=setInterval(()=>{M(),u&&i({smooth:!1})},100);return()=>clearInterval(o)}},[h,i,M,u]),(0,n.useEffect)(()=>{S&&setTimeout(()=>i({smooth:!0}),100)},[S,i]);const B=o=>{c(o.content)},k=(o,s)=>{const b=o.role==="user",E=s===e.length-1&&!b,_=s>=N.current,L=E&&_;return(0,r.jsx)("div",{className:(0,f.cn)([b?`bg-bg ml-auto items-end rounded-lg py-2 px-3 ${D}`:`mr-auto items-start ${v}`]),children:(0,r.jsx)(A.MarkdownRenderer,{animate:L,onAnimationComplete:T,children:o.content||""})},o.id||s)};return(0,r.jsx)(l.Flex,{direction:"column",className:"grow overflow-auto bg-gray-50",children:(0,r.jsxs)(g.Root,{ref:R,className:"h-full grow-1 p-6",children:[(0,r.jsx)(g.Viewport,{className:"h-full",children:(0,r.jsxs)(l.Flex,{direction:"column",gap:6,children:[t.starterMessages?.map((o,s)=>(0,r.jsx)("div",{className:(0,f.cn)("mr-auto items-start",v),children:(0,r.jsx)(A.MarkdownRenderer,{children:o.content||""})},`message-${s}`)),t.starterSuggestions&&e.length===0&&(0,r.jsx)(l.Flex,{gap:2,wrap:"wrap",children:t.starterSuggestions.map((o,s)=>(0,r.jsx)(l.Button,{variant:"fill",mode:"subtle",roundness:"full",size:"extrasmall",onPress:()=>B(o),children:o.label||o.content},`suggestion-${s}`))}),e.map((o,s)=>k(o,s)),a&&(0,r.jsx)(l.Text,{as:"p",size:2,className:"mr-auto items-start text-gray-500",children:"Thinking..."}),m&&(0,r.jsxs)(l.Text,{as:"p",size:2,className:"bg-negative-100 text-negative-900 mx-auto items-start rounded-lg py-2 px-3",children:["Error: ",m]})]})}),(0,r.jsx)(g.Scrollbar,{orientation:"vertical",className:"w-1 bg-gray-200 opacity-50",children:(0,r.jsx)(g.Thumb,{className:"flex-1 rounded-2xl bg-gray-400"})}),(0,r.jsx)(g.Corner,{})]})})};var V=H;
|
|
2
|
+
//# sourceMappingURL=ChatBody.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/widgets/ChatBody.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as ScrollArea from '@radix-ui/react-scroll-area';\nimport React, { useEffect, useRef, useCallback } from 'react';\nimport type { AiAgent, AiMessage, AiAgentStarterSuggestion } from '@dashx/browser';\n\nimport { Button, Flex, Text } from '../components';\nimport { cn } from '../utils/cn.js';\nimport { MarkdownRenderer } from '../components/markdown-renderer.js';\nimport useAutoScroll from '../hooks/use-auto-scroll.js';\n\nconst AGENT_MESSAGE_WIDTH_CLASS = 'max-w-[max(80%,350px)]';\nconst USER_MESSAGE_WIDTH_CLASS = 'max-w-[80%]';\n\ntype ChatBodyProps = {\n agent: AiAgent;\n messages: AiMessage[];\n isThinking: boolean;\n error: string | null;\n sendMessage: (message: string) => void;\n isAnimating: boolean;\n setIsAnimating: (animating: boolean) => void;\n isPopoverOpen?: boolean;\n};\n\nconst ChatBody = ({\n agent,\n messages,\n isThinking,\n error,\n sendMessage,\n setIsAnimating,\n isAnimating,\n isPopoverOpen = false,\n}: ChatBodyProps) => {\n const previousMessageCountRef = useRef(messages.length);\n const initialMessageCountRef = useRef(messages.length);\n const { scrollAreaRef, scrollToBottom, checkIfUserAtBottom, isUserAtBottom } = useAutoScroll();\n\n const handleAnimationComplete = useCallback(() => {\n setIsAnimating(false);\n }, [setIsAnimating]);\n\n useEffect(() => {\n const lastMessage = messages[messages.length - 1];\n const hasNewMessage = messages.length > previousMessageCountRef.current;\n\n if (hasNewMessage && lastMessage?.role === 'assistant') {\n setIsAnimating(true);\n }\n\n if (hasNewMessage) {\n setTimeout(() => scrollToBottom({ smooth: true }), 0);\n }\n\n previousMessageCountRef.current = messages.length;\n }, [messages, isThinking, setIsAnimating, scrollToBottom, isUserAtBottom]);\n\n useEffect(() => {\n if (isThinking) {\n setTimeout(() => scrollToBottom({ smooth: true }), 0);\n }\n }, [isThinking, scrollToBottom, isUserAtBottom]);\n\n useEffect(() => {\n if (isAnimating && isUserAtBottom) {\n const interval = setInterval(() => {\n checkIfUserAtBottom();\n if (isUserAtBottom) {\n scrollToBottom({ smooth: false });\n }\n }, 100);\n\n return () => clearInterval(interval);\n }\n }, [isAnimating, scrollToBottom, checkIfUserAtBottom, isUserAtBottom]);\n\n useEffect(() => {\n if (isPopoverOpen) {\n // Use a small delay to ensure the popover content is fully rendered\n setTimeout(() => scrollToBottom({ smooth: true }), 100);\n }\n }, [isPopoverOpen, scrollToBottom]);\n\n const handleSuggestionClick = (suggestion: AiAgentStarterSuggestion) => {\n sendMessage(suggestion.content);\n };\n\n const renderMessage = (message: AiMessage, index: number) => {\n const isUser = message.role === 'user';\n const isLastMessage = index === messages.length - 1;\n const isLastAgentMessage = isLastMessage && !isUser;\n const isNewMessage = index >= initialMessageCountRef.current;\n const shouldAnimate = isLastAgentMessage && isNewMessage;\n\n return (\n <div\n key={message.id || index}\n className={cn([\n isUser\n ? `bg-bg ml-auto items-end rounded-lg py-2 px-3 ${USER_MESSAGE_WIDTH_CLASS}`\n : `mr-auto items-start ${AGENT_MESSAGE_WIDTH_CLASS}`,\n ])}\n >\n <MarkdownRenderer animate={shouldAnimate} onAnimationComplete={handleAnimationComplete}>\n {message.content || ''}\n </MarkdownRenderer>\n </div>\n );\n };\n\n return (\n <Flex direction=\"column\" className=\"grow overflow-auto bg-gray-50\">\n <ScrollArea.Root ref={scrollAreaRef} className=\"h-full grow-1 p-6\">\n <ScrollArea.Viewport className=\"h-full\">\n <Flex direction=\"column\" gap={6}>\n {agent.starterMessages?.map((msg, index) => (\n <div\n key={`message-${index}`}\n className={cn('mr-auto items-start', AGENT_MESSAGE_WIDTH_CLASS)}\n >\n <MarkdownRenderer>{msg.content || ''}</MarkdownRenderer>\n </div>\n ))}\n\n {agent.starterSuggestions && messages.length === 0 && (\n <Flex gap={2} wrap=\"wrap\">\n {agent.starterSuggestions.map((suggestion, index) => (\n <Button\n key={`suggestion-${index}`}\n variant=\"fill\"\n mode=\"subtle\"\n roundness=\"full\"\n size=\"extrasmall\"\n onPress={() => handleSuggestionClick(suggestion)}\n >\n {suggestion.label || suggestion.content}\n </Button>\n ))}\n </Flex>\n )}\n\n {messages.map((message, index) => renderMessage(message, index))}\n\n {isThinking && (\n <Text as=\"p\" size={2} className=\"mr-auto items-start text-gray-500\">\n Thinking...\n </Text>\n )}\n\n {error && (\n <Text\n as=\"p\"\n size={2}\n className=\"bg-negative-100 text-negative-900 mx-auto items-start rounded-lg py-2 px-3\"\n >\n Error: {error}\n </Text>\n )}\n </Flex>\n </ScrollArea.Viewport>\n <ScrollArea.Scrollbar orientation=\"vertical\" className=\"w-1 bg-gray-200 opacity-50\">\n <ScrollArea.Thumb className=\"flex-1 rounded-2xl bg-gray-400\" />\n </ScrollArea.Scrollbar>\n <ScrollArea.Corner />\n </ScrollArea.Root>\n </Flex>\n );\n};\n\nexport type { ChatBodyProps };\n\nexport default ChatBody;\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["ChatBody_exports", "__export", "ChatBody_default", "__toCommonJS", "import_jsx_runtime", "ScrollArea", "import_react", "import_components", "import_cn", "import_markdown_renderer", "import_use_auto_scroll", "AGENT_MESSAGE_WIDTH_CLASS", "USER_MESSAGE_WIDTH_CLASS", "ChatBody", "agent", "messages", "isThinking", "error", "sendMessage", "setIsAnimating", "isAnimating", "isPopoverOpen", "previousMessageCountRef", "initialMessageCountRef", "scrollAreaRef", "scrollToBottom", "checkIfUserAtBottom", "isUserAtBottom", "useAutoScroll", "handleAnimationComplete", "lastMessage", "hasNewMessage", "interval", "handleSuggestionClick", "suggestion", "renderMessage", "message", "index", "isUser", "isLastAgentMessage", "isNewMessage", "shouldAnimate", "msg"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type ChatFooterProps = {
|
|
2
|
+
sendMessage: (message: string) => void;
|
|
3
|
+
isDisabled?: boolean;
|
|
4
|
+
};
|
|
5
|
+
declare const ChatFooter: ({ sendMessage, isDisabled }: ChatFooterProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export type { ChatFooterProps };
|
|
7
|
+
export default ChatFooter;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var i=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var h=(t,e)=>{for(var a in e)i(t,a,{get:e[a],enumerable:!0})},g=(t,e,a,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of p(e))!f.call(t,r)&&r!==a&&i(t,r,{get:()=>e[r],enumerable:!(s=u(e,r))||s.enumerable});return t};var v=t=>g(i({},"__esModule",{value:!0}),t);var c={};h(c,{default:()=>b});module.exports=v(c);var o=require("react/jsx-runtime"),d=require("react"),m=require("lucide-react"),n=require("../components");const y=({sendMessage:t,isDisabled:e=!1})=>{const[a,s]=(0,d.useState)(""),r=()=>{a.trim()&&(t(a),s(""))};return(0,o.jsx)("div",{className:"shrink-0 grow-0 border-t border-t-gray-400/40",children:(0,o.jsxs)(n.Flex,{gap:2,align:"end",className:"w-full",children:[(0,o.jsx)("div",{className:"w-full [&_textarea]:!border-none [&_textarea]:!outline-none",children:(0,o.jsx)(n.TextArea,{"aria-label":"message",size:"extralarge",placeholder:"Ask anything...",value:a,onKeyDown:l=>{l.key==="Enter"&&!l.shiftKey&&(l.preventDefault(),r())},onChange:l=>s(l),roundness:"none",autogrow:!0})}),(0,o.jsx)("div",{className:"mr-[7px] mb-[7px]",children:(0,o.jsx)(n.Button,{shape:"square",roundness:"full",variant:"fill",size:"medium",onPress:r,isDisabled:!a.trim()||e,children:(0,o.jsx)(m.Send,{size:20})})})]})})};var b=y;
|
|
2
|
+
//# sourceMappingURL=ChatFooter.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/widgets/ChatFooter.tsx"],
|
|
4
|
+
"sourcesContent": ["import React, { useState } from 'react';\nimport { Send } from 'lucide-react';\nimport type { KeyboardEvent } from 'react';\n\nimport { Button, Flex, TextArea } from '../components';\n\ntype ChatFooterProps = {\n sendMessage: (message: string) => void;\n isDisabled?: boolean;\n};\n\nconst ChatFooter = ({ sendMessage, isDisabled = false }: ChatFooterProps) => {\n const [inputValue, setInputValue] = useState('');\n\n const handleSubmit = () => {\n if (!inputValue.trim()) return;\n sendMessage(inputValue);\n setInputValue('');\n };\n\n const handleKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n handleSubmit();\n }\n };\n\n return (\n <div className=\"shrink-0 grow-0 border-t border-t-gray-400/40\">\n <Flex gap={2} align=\"end\" className=\"w-full\">\n <div className=\"w-full [&_textarea]:!border-none [&_textarea]:!outline-none\">\n <TextArea\n aria-label=\"message\"\n size=\"extralarge\"\n placeholder=\"Ask anything...\"\n value={inputValue}\n onKeyDown={handleKeyDown}\n onChange={(text) => setInputValue(text)}\n roundness=\"none\"\n autogrow\n />\n </div>\n <div className=\"mr-[7px] mb-[7px]\">\n <Button \n shape=\"square\"\n roundness=\"full\"\n variant=\"fill\"\n size=\"medium\"\n onPress={handleSubmit}\n isDisabled={!inputValue.trim() || isDisabled}\n >\n <Send size={20} />\n </Button>\n </div>\n </Flex>\n </div>\n )\n}\n\nexport type { ChatFooterProps }\n\nexport default ChatFooter;\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA6BM,IAAAI,EAAA,6BA7BNC,EAAgC,iBAChCC,EAAqB,wBAGrBC,EAAuC,yBAOvC,MAAMC,EAAa,CAAC,CAAE,YAAAC,EAAa,WAAAC,EAAa,EAAM,IAAuB,CAC3E,KAAM,CAACC,EAAYC,CAAa,KAAI,YAAS,EAAE,EAEzCC,EAAe,IAAM,CACpBF,EAAW,KAAK,IACrBF,EAAYE,CAAU,EACtBC,EAAc,EAAE,EAClB,EASA,SACE,OAAC,OAAI,UAAU,gDACb,oBAAC,QAAK,IAAK,EAAG,MAAM,MAAM,UAAU,SAClC,oBAAC,OAAI,UAAU,8DACb,mBAAC,YACC,aAAW,UACX,KAAK,aACL,YAAY,kBACZ,MAAOD,EACP,UAhBaG,GAA0C,CAC3DA,EAAE,MAAQ,SAAW,CAACA,EAAE,WAC1BA,EAAE,eAAe,EACjBD,EAAa,EAEjB,EAYU,SAAWE,GAASH,EAAcG,CAAI,EACtC,UAAU,OACV,SAAQ,GACV,EACF,KACA,OAAC,OAAI,UAAU,oBACb,mBAAC,UACC,MAAM,SACN,UAAU,OACV,QAAQ,OACR,KAAK,SACL,QAASF,EACT,WAAY,CAACF,EAAW,KAAK,GAAKD,EAElC,mBAAC,QAAK,KAAM,GAAI,EAClB,EACF,GACF,EACF,CAEJ,EAIA,IAAOR,EAAQM",
|
|
6
|
+
"names": ["ChatFooter_exports", "__export", "ChatFooter_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_lucide_react", "import_components", "ChatFooter", "sendMessage", "isDisabled", "inputValue", "setInputValue", "handleSubmit", "e", "text"]
|
|
7
|
+
}
|