@orion-ds/react 4.2.9 → 4.2.10

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 (309) hide show
  1. package/dist/index10.cjs +1 -1
  2. package/dist/index10.mjs +1 -1
  3. package/dist/index100.cjs +1 -1
  4. package/dist/index100.mjs +46 -62
  5. package/dist/index101.cjs +1 -1
  6. package/dist/index101.mjs +30 -16
  7. package/dist/index102.cjs +1 -1
  8. package/dist/index102.mjs +28 -30
  9. package/dist/index103.cjs +1 -1
  10. package/dist/index103.mjs +53 -29
  11. package/dist/index104.cjs +1 -1
  12. package/dist/index104.mjs +33 -40
  13. package/dist/index105.cjs +1 -1
  14. package/dist/index105.mjs +44 -36
  15. package/dist/index106.cjs +1 -1
  16. package/dist/index106.mjs +52 -54
  17. package/dist/index107.cjs +1 -1
  18. package/dist/index107.mjs +40 -46
  19. package/dist/index108.cjs +1 -1
  20. package/dist/index108.mjs +40 -14
  21. package/dist/index109.cjs +1 -1
  22. package/dist/index109.mjs +40 -28
  23. package/dist/index11.cjs +1 -1
  24. package/dist/index11.mjs +1 -1
  25. package/dist/index110.cjs +1 -1
  26. package/dist/index110.mjs +30 -65
  27. package/dist/index111.cjs +1 -1
  28. package/dist/index111.mjs +29 -23
  29. package/dist/index112.cjs +1 -1
  30. package/dist/index112.mjs +30 -35
  31. package/dist/index113.cjs +1 -1
  32. package/dist/index113.mjs +21 -29
  33. package/dist/index114.cjs +1 -1
  34. package/dist/index114.mjs +18 -32
  35. package/dist/index115.cjs +1 -1
  36. package/dist/index115.mjs +12 -57
  37. package/dist/index116.cjs +1 -1
  38. package/dist/index116.mjs +62 -18
  39. package/dist/index117.cjs +1 -1
  40. package/dist/index117.mjs +57 -12
  41. package/dist/index118.cjs +1 -1
  42. package/dist/index118.mjs +42 -64
  43. package/dist/index119.cjs +1 -1
  44. package/dist/index119.mjs +28 -28
  45. package/dist/index12.cjs +1 -1
  46. package/dist/index12.mjs +1 -1
  47. package/dist/index120.cjs +1 -1
  48. package/dist/index120.mjs +24 -32
  49. package/dist/index121.cjs +1 -1
  50. package/dist/index121.mjs +18 -76
  51. package/dist/index122.cjs +1 -1
  52. package/dist/index122.mjs +32 -33
  53. package/dist/index123.cjs +1 -1
  54. package/dist/index123.mjs +46 -40
  55. package/dist/index124.cjs +1 -1
  56. package/dist/index124.mjs +26 -51
  57. package/dist/index125.cjs +1 -1
  58. package/dist/index125.mjs +20 -42
  59. package/dist/index126.cjs +1 -1
  60. package/dist/index126.mjs +14 -18
  61. package/dist/index127.cjs +1 -1
  62. package/dist/index127.mjs +17 -37
  63. package/dist/index128.cjs +1 -1
  64. package/dist/index128.mjs +20 -28
  65. package/dist/index129.cjs +1 -1
  66. package/dist/index129.mjs +28 -36
  67. package/dist/index13.cjs +1 -1
  68. package/dist/index13.mjs +1 -1
  69. package/dist/index130.cjs +1 -1
  70. package/dist/index130.mjs +36 -18
  71. package/dist/index131.cjs +1 -1
  72. package/dist/index131.mjs +50 -18
  73. package/dist/index132.cjs +1 -1
  74. package/dist/index132.mjs +30 -234
  75. package/dist/index133.cjs +1 -1
  76. package/dist/index133.mjs +29 -34
  77. package/dist/index134.cjs +1 -1
  78. package/dist/index134.mjs +36 -43
  79. package/dist/index135.cjs +1 -1
  80. package/dist/index135.mjs +28 -170
  81. package/dist/index136.cjs +1 -1
  82. package/dist/index136.mjs +27 -186
  83. package/dist/index137.cjs +1 -1
  84. package/dist/index137.mjs +19 -29
  85. package/dist/index138.cjs +1 -1
  86. package/dist/index138.mjs +38 -90
  87. package/dist/index139.cjs +1 -1
  88. package/dist/index139.mjs +25 -53
  89. package/dist/index14.cjs +1 -1
  90. package/dist/index14.mjs +1 -1
  91. package/dist/index140.cjs +1 -1
  92. package/dist/index140.mjs +35 -66
  93. package/dist/index141.cjs +1 -1
  94. package/dist/index141.mjs +234 -124
  95. package/dist/index142.cjs +1 -1
  96. package/dist/index142.mjs +33 -108
  97. package/dist/index143.cjs +1 -1
  98. package/dist/index143.mjs +44 -112
  99. package/dist/index144.cjs +1 -1
  100. package/dist/index144.mjs +159 -111
  101. package/dist/index145.cjs +1 -1
  102. package/dist/index145.mjs +176 -205
  103. package/dist/index146.cjs +1 -1
  104. package/dist/index146.mjs +29 -43
  105. package/dist/index147.cjs +1 -1
  106. package/dist/index147.mjs +90 -27
  107. package/dist/index148.cjs +1 -1
  108. package/dist/index148.mjs +53 -57
  109. package/dist/index149.cjs +1 -1
  110. package/dist/index149.mjs +66 -46
  111. package/dist/index15.cjs +1 -1
  112. package/dist/index15.mjs +1 -1
  113. package/dist/index150.cjs +1 -1
  114. package/dist/index150.mjs +124 -24
  115. package/dist/index151.cjs +1 -1
  116. package/dist/index151.mjs +108 -24
  117. package/dist/index152.cjs +1 -1
  118. package/dist/index152.mjs +111 -20
  119. package/dist/index153.cjs +1 -1
  120. package/dist/index153.mjs +122 -26
  121. package/dist/index154.cjs +1 -1
  122. package/dist/index154.mjs +214 -28
  123. package/dist/index155.cjs +1 -1
  124. package/dist/index155.mjs +18 -40
  125. package/dist/index156.cjs +1 -1
  126. package/dist/index156.mjs +67 -22
  127. package/dist/index157.cjs +1 -1
  128. package/dist/index157.mjs +55 -64
  129. package/dist/index158.cjs +1 -1
  130. package/dist/index158.mjs +20 -12
  131. package/dist/index159.cjs +1 -1
  132. package/dist/index159.mjs +32 -33
  133. package/dist/index16.cjs +1 -1
  134. package/dist/index16.mjs +1 -1
  135. package/dist/index160.cjs +1 -1
  136. package/dist/index160.mjs +56 -20
  137. package/dist/index161.cjs +1 -1
  138. package/dist/index161.mjs +28 -42
  139. package/dist/index162.cjs +1 -1
  140. package/dist/index162.mjs +24 -20
  141. package/dist/index163.cjs +1 -1
  142. package/dist/index163.mjs +52 -28
  143. package/dist/index164.cjs +1 -1
  144. package/dist/index164.mjs +65 -44
  145. package/dist/index166.cjs +1 -1
  146. package/dist/index166.mjs +106 -28
  147. package/dist/index167.cjs +1 -1
  148. package/dist/index167.mjs +45 -20
  149. package/dist/index168.cjs +1 -1
  150. package/dist/index168.mjs +20 -67
  151. package/dist/index17.cjs +1 -1
  152. package/dist/index17.mjs +1 -1
  153. package/dist/index170.cjs +1 -1
  154. package/dist/index170.mjs +27 -24
  155. package/dist/index171.cjs +1 -1
  156. package/dist/index171.mjs +46 -44
  157. package/dist/index172.cjs +1 -1
  158. package/dist/index172.mjs +24 -46
  159. package/dist/index173.cjs +1 -1
  160. package/dist/index173.mjs +12 -28
  161. package/dist/index174.cjs +1 -1
  162. package/dist/index174.mjs +33 -106
  163. package/dist/index175.cjs +1 -1
  164. package/dist/index175.mjs +42 -52
  165. package/dist/index176.cjs +1 -1
  166. package/dist/index176.mjs +64 -45
  167. package/dist/index177.cjs +1 -1
  168. package/dist/index177.mjs +51 -36
  169. package/dist/index178.cjs +1 -1
  170. package/dist/index178.mjs +76 -55
  171. package/dist/index179.cjs +1 -1
  172. package/dist/index179.mjs +42 -50
  173. package/dist/index18.cjs +1 -1
  174. package/dist/index18.mjs +1 -1
  175. package/dist/index180.cjs +1 -1
  176. package/dist/index180.mjs +64 -30
  177. package/dist/index181.cjs +1 -1
  178. package/dist/index181.mjs +44 -52
  179. package/dist/index182.cjs +1 -1
  180. package/dist/index182.mjs +17 -17
  181. package/dist/index183.cjs +1 -1
  182. package/dist/index183.mjs +17 -17
  183. package/dist/index185.cjs +1 -1
  184. package/dist/index185.mjs +1 -1
  185. package/dist/index19.cjs +1 -1
  186. package/dist/index19.mjs +2 -2
  187. package/dist/index20.cjs +1 -1
  188. package/dist/index20.mjs +14 -14
  189. package/dist/index21.cjs +1 -1
  190. package/dist/index21.mjs +1 -1
  191. package/dist/index22.cjs +1 -1
  192. package/dist/index22.mjs +1 -1
  193. package/dist/index23.cjs +1 -1
  194. package/dist/index23.mjs +1 -1
  195. package/dist/index24.cjs +1 -1
  196. package/dist/index24.mjs +1 -1
  197. package/dist/index25.cjs +1 -1
  198. package/dist/index25.mjs +1 -1
  199. package/dist/index26.cjs +1 -1
  200. package/dist/index26.mjs +1 -1
  201. package/dist/index27.cjs +1 -1
  202. package/dist/index27.mjs +1 -1
  203. package/dist/index28.cjs +1 -1
  204. package/dist/index28.mjs +1 -1
  205. package/dist/index29.cjs +1 -1
  206. package/dist/index29.mjs +1 -1
  207. package/dist/index30.cjs +1 -1
  208. package/dist/index30.mjs +1 -1
  209. package/dist/index31.cjs +1 -1
  210. package/dist/index31.mjs +1 -1
  211. package/dist/index32.cjs +1 -1
  212. package/dist/index32.mjs +1 -1
  213. package/dist/index33.cjs +1 -1
  214. package/dist/index33.mjs +1 -1
  215. package/dist/index34.cjs +1 -1
  216. package/dist/index34.mjs +1 -1
  217. package/dist/index35.cjs +1 -1
  218. package/dist/index35.mjs +1 -1
  219. package/dist/index36.cjs +1 -1
  220. package/dist/index36.mjs +1 -1
  221. package/dist/index37.cjs +1 -1
  222. package/dist/index37.mjs +1 -1
  223. package/dist/index38.cjs +1 -1
  224. package/dist/index38.mjs +1 -1
  225. package/dist/index39.cjs +1 -1
  226. package/dist/index39.mjs +1 -1
  227. package/dist/index40.cjs +1 -1
  228. package/dist/index40.mjs +1 -1
  229. package/dist/index42.cjs +1 -1
  230. package/dist/index42.mjs +1 -1
  231. package/dist/index43.cjs +1 -1
  232. package/dist/index43.mjs +1 -1
  233. package/dist/index44.cjs +1 -1
  234. package/dist/index44.mjs +1 -1
  235. package/dist/index46.cjs +1 -1
  236. package/dist/index46.mjs +1 -1
  237. package/dist/index47.cjs +1 -1
  238. package/dist/index47.mjs +1 -1
  239. package/dist/index49.cjs +1 -1
  240. package/dist/index49.mjs +1 -1
  241. package/dist/index5.cjs +1 -1
  242. package/dist/index5.mjs +1 -1
  243. package/dist/index50.cjs +1 -1
  244. package/dist/index50.mjs +1 -1
  245. package/dist/index51.cjs +1 -1
  246. package/dist/index51.mjs +1 -1
  247. package/dist/index52.cjs +1 -1
  248. package/dist/index52.mjs +1 -1
  249. package/dist/index54.cjs +1 -1
  250. package/dist/index54.mjs +1 -1
  251. package/dist/index55.cjs +1 -1
  252. package/dist/index55.mjs +1 -1
  253. package/dist/index56.cjs +1 -1
  254. package/dist/index56.mjs +1 -1
  255. package/dist/index57.cjs +1 -1
  256. package/dist/index57.mjs +1 -1
  257. package/dist/index58.cjs +1 -1
  258. package/dist/index58.mjs +1 -1
  259. package/dist/index6.cjs +1 -1
  260. package/dist/index6.mjs +1 -1
  261. package/dist/index60.cjs +1 -1
  262. package/dist/index60.mjs +1 -1
  263. package/dist/index61.cjs +1 -1
  264. package/dist/index61.mjs +1 -1
  265. package/dist/index62.cjs +1 -1
  266. package/dist/index62.mjs +1 -1
  267. package/dist/index63.cjs +1 -1
  268. package/dist/index63.mjs +1 -1
  269. package/dist/index64.cjs +1 -1
  270. package/dist/index64.mjs +1 -1
  271. package/dist/index65.cjs +1 -1
  272. package/dist/index65.mjs +1 -1
  273. package/dist/index66.cjs +1 -1
  274. package/dist/index66.mjs +1 -1
  275. package/dist/index67.cjs +1 -1
  276. package/dist/index67.mjs +1 -1
  277. package/dist/index68.cjs +1 -1
  278. package/dist/index68.mjs +1 -1
  279. package/dist/index69.cjs +1 -1
  280. package/dist/index69.mjs +1 -1
  281. package/dist/index7.cjs +1 -1
  282. package/dist/index7.mjs +1 -1
  283. package/dist/index70.cjs +1 -1
  284. package/dist/index70.mjs +1 -1
  285. package/dist/index71.cjs +1 -1
  286. package/dist/index71.mjs +1 -1
  287. package/dist/index72.cjs +1 -1
  288. package/dist/index72.mjs +1 -1
  289. package/dist/index73.cjs +1 -1
  290. package/dist/index73.mjs +1 -1
  291. package/dist/index76.cjs +1 -1
  292. package/dist/index76.mjs +1 -1
  293. package/dist/index77.cjs +1 -1
  294. package/dist/index77.mjs +1 -1
  295. package/dist/index78.cjs +1 -1
  296. package/dist/index78.mjs +1 -1
  297. package/dist/index79.cjs +1 -1
  298. package/dist/index79.mjs +1 -1
  299. package/dist/index8.cjs +1 -1
  300. package/dist/index8.mjs +1 -1
  301. package/dist/index80.cjs +1 -1
  302. package/dist/index80.mjs +1 -1
  303. package/dist/index81.cjs +1 -1
  304. package/dist/index81.mjs +1 -1
  305. package/dist/index9.cjs +1 -1
  306. package/dist/index9.mjs +1 -1
  307. package/dist/index99.cjs +1 -1
  308. package/dist/index99.mjs +35 -29
  309. package/package.json +1 -1
package/dist/index142.mjs CHANGED
@@ -1,111 +1,36 @@
1
- import { jsx as r, jsxs as c } from "react/jsx-runtime";
2
- import { X as t, Square as b, Send as C, Mic as j } from "lucide-react";
3
- import { useVoiceRecorder as S } from "./index95.mjs";
4
- import { formatTime as k } from "./index184.mjs";
5
- import e from "./index132.mjs";
6
- const z = ({
7
- onRecordingComplete: d,
8
- onCancel: v,
9
- maxDuration: m = 300,
10
- className: a,
1
+ import { jsxs as i, jsx as a, Fragment as c } from "react/jsx-runtime";
2
+ import { Bot as m } from "lucide-react";
3
+ import e from "./index141.mjs";
4
+ const o = ({
5
+ title: d = "AI Assistant",
6
+ subtitle: r,
7
+ avatar: l,
8
+ actions: s,
9
+ children: t,
10
+ className: h,
11
11
  ...n
12
- }) => {
13
- const {
14
- isRecording: o,
15
- duration: R,
16
- audioBlob: i,
17
- error: s,
18
- startRecording: h,
19
- stopRecording: u,
20
- cancelRecording: N,
21
- reset: l,
22
- isSupported: f
23
- } = S({
24
- maxDuration: m,
25
- onRecordingComplete: d,
26
- onError: (g) => console.error("Recording error:", g)
27
- }), p = () => {
28
- o ? u() : i ? (d?.(i), l()) : h();
29
- }, B = () => {
30
- N(), v?.();
31
- };
32
- return f ? s ? /* @__PURE__ */ c(
33
- "div",
34
- {
35
- className: [e.voiceRecorder, a].filter(Boolean).join(" "),
36
- ...n,
37
- children: [
38
- /* @__PURE__ */ r("div", { className: e.voiceRecorderInfo, children: /* @__PURE__ */ r(
39
- "span",
40
- {
41
- className: [
42
- e.voiceRecorderLabel,
43
- e.voiceRecorderError
44
- ].join(" "),
45
- children: s
46
- }
47
- ) }),
48
- /* @__PURE__ */ r(
49
- "button",
50
- {
51
- className: e.inputButton,
52
- onClick: l,
53
- "aria-label": "Try again",
54
- children: /* @__PURE__ */ r(t, { size: 20 })
55
- }
56
- )
57
- ]
58
- }
59
- ) : /* @__PURE__ */ c(
60
- "div",
61
- {
62
- className: [e.voiceRecorder, a].filter(Boolean).join(" "),
63
- ...n,
64
- children: [
65
- /* @__PURE__ */ r(
66
- "button",
67
- {
68
- className: [
69
- e.voiceRecorderButton,
70
- !o && !i && e.voiceRecorderButtonIdle
71
- ].filter(Boolean).join(" "),
72
- onClick: p,
73
- "aria-label": o ? "Stop recording" : i ? "Send recording" : "Start recording",
74
- children: o ? /* @__PURE__ */ r(b, { size: 20 }) : i ? /* @__PURE__ */ r(C, { size: 20 }) : /* @__PURE__ */ r(j, { size: 20 })
75
- }
76
- ),
77
- /* @__PURE__ */ c("div", { className: e.voiceRecorderInfo, children: [
78
- /* @__PURE__ */ r("span", { className: e.voiceRecorderDuration, children: k(R) }),
79
- /* @__PURE__ */ r("span", { className: e.voiceRecorderLabel, children: o ? "Recording..." : i ? "Recording ready" : "Click to record" })
80
- ] }),
81
- o && /* @__PURE__ */ c("div", { className: e.voiceRecorderWaveform, children: [
82
- /* @__PURE__ */ r("div", { className: e.voiceRecorderBar }),
83
- /* @__PURE__ */ r("div", { className: e.voiceRecorderBar }),
84
- /* @__PURE__ */ r("div", { className: e.voiceRecorderBar }),
85
- /* @__PURE__ */ r("div", { className: e.voiceRecorderBar }),
86
- /* @__PURE__ */ r("div", { className: e.voiceRecorderBar })
87
- ] }),
88
- (o || i) && /* @__PURE__ */ r("div", { className: e.voiceRecorderActions, children: /* @__PURE__ */ r(
89
- "button",
90
- {
91
- className: e.inputButton,
92
- onClick: B,
93
- "aria-label": "Cancel recording",
94
- children: /* @__PURE__ */ r(t, { size: 20 })
95
- }
96
- ) })
97
- ]
98
- }
99
- ) : /* @__PURE__ */ r(
100
- "div",
101
- {
102
- className: [e.voiceRecorder, a].filter(Boolean).join(" "),
103
- ...n,
104
- children: /* @__PURE__ */ r("div", { className: e.voiceRecorderInfo, children: /* @__PURE__ */ r("span", { className: e.voiceRecorderLabel, children: "Voice recording is not supported in this browser" }) })
105
- }
106
- );
107
- };
108
- z.displayName = "ChatVoiceRecorder";
12
+ }) => /* @__PURE__ */ i(
13
+ "div",
14
+ {
15
+ className: [e.header, h].filter(Boolean).join(" "),
16
+ ...n,
17
+ children: [
18
+ /* @__PURE__ */ a("div", { className: e.headerAvatar, children: l || /* @__PURE__ */ a(
19
+ "div",
20
+ {
21
+ className: [e.messageAvatar, e.headerAvatarDefault].filter(Boolean).join(" "),
22
+ children: /* @__PURE__ */ a(m, { size: 20 })
23
+ }
24
+ ) }),
25
+ /* @__PURE__ */ a("div", { className: e.headerContent, children: t || /* @__PURE__ */ i(c, { children: [
26
+ /* @__PURE__ */ a("h2", { className: e.headerTitle, children: d }),
27
+ r && /* @__PURE__ */ a("p", { className: e.headerSubtitle, children: r })
28
+ ] }) }),
29
+ s && /* @__PURE__ */ a("div", { className: e.headerActions, children: s })
30
+ ]
31
+ }
32
+ );
33
+ o.displayName = "ChatHeader";
109
34
  export {
110
- z as ChatVoiceRecorder
35
+ o as ChatHeader
111
36
  };
package/dist/index143.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),t=require("react"),R=require("lucide-react"),h=require("./index184.cjs"),o=require("./index132.cjs"),g=({onFilesSelected:f,accept:i=["*/*"],multiple:C=!0,maxSize:s=10*1024*1024,children:v,className:D,...k})=>{const[m,u]=t.useState(!1),c=t.useRef(null),d=t.useCallback(e=>{if(!e||e.length===0)return;const r=[];Array.from(e).forEach(l=>{if(s&&l.size>s){console.warn(`File ${l.name} exceeds max size of ${h.formatFileSize(s)}`);return}const F=i.includes("*/*"),q=i.flatMap(n=>(n.endsWith("/*"),n));if(!(F||q.some(n=>{if(n.endsWith("/*")){const N=n.split("/")[0];return l.type.startsWith(`${N}/`)}return l.type===n||l.name.endsWith(n)}))){console.warn(`File ${l.name} type not accepted`);return}r.push(l)}),r.length>0&&f?.(r)},[i,s,f]),b=t.useCallback(e=>{e.preventDefault(),e.stopPropagation(),u(!0)},[]),j=t.useCallback(e=>{e.preventDefault(),e.stopPropagation(),u(!1)},[]),y=t.useCallback(e=>{e.preventDefault(),e.stopPropagation(),u(!1);const{files:r}=e.dataTransfer;d(r)},[d]),x=t.useCallback(e=>{d(e.target.files),c.current&&(c.current.value="")},[d]),p=t.useCallback(()=>{c.current?.click()},[]),U=t.useCallback(e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),p())},[p]);return a.jsxs("div",{className:[o.default.fileUpload,m&&o.default.fileUploadDragging,D].filter(Boolean).join(" "),onDragOver:b,onDragLeave:j,onDrop:y,onClick:p,onKeyDown:U,role:"button",tabIndex:0,"aria-label":"Upload files",...k,children:[a.jsx("input",{ref:c,type:"file",accept:i.join(","),multiple:C,onChange:x,style:{display:"none"},"aria-hidden":"true"}),v||a.jsxs(a.Fragment,{children:[a.jsx("div",{className:o.default.fileUploadIcon,children:a.jsx(R.Upload,{size:32})}),a.jsxs("div",{className:o.default.fileUploadText,children:[a.jsx("strong",{children:"Click to upload"})," or drag and drop"]}),a.jsxs("div",{className:o.default.fileUploadHint,children:["Max file size: ",h.formatFileSize(s)]})]})]})};g.displayName="ChatFileUpload";exports.ChatFileUpload=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),g=require("react"),f=require("lucide-react"),h=require("./index84.cjs"),t=require("./index141.cjs"),j=require("./index14.cjs"),a=g.forwardRef(({children:l,autoScroll:r=!0,className:i,...n},s)=>{const{scrollRef:c,isAtBottom:u,scrollToBottom:m}=h.useAutoScroll({enabled:r}),d=o=>{c.current=o,typeof s=="function"?s(o):s&&(s.current=o)};return e.jsxs("div",{ref:d,className:[t.default.messages,i].filter(Boolean).join(" "),role:"log","aria-live":"polite","aria-label":"Chat messages","aria-relevant":"additions",...n,children:[e.jsx("div",{className:t.default.messagesInner,children:l}),!u&&e.jsx("div",{className:t.default.scrollToBottomWrapper,children:e.jsx(j.Button,{variant:"secondary",size:"sm",iconOnly:!0,icon:e.jsx(f.ArrowDown,{size:18}),onClick:m,"aria-label":"Scroll to latest messages",className:t.default.scrollToBottomButton})})]})});a.displayName="ChatMessages";exports.ChatMessages=a;
package/dist/index143.mjs CHANGED
@@ -1,114 +1,46 @@
1
- import { jsxs as d, jsx as p, Fragment as A } from "react/jsx-runtime";
2
- import { useState as I, useRef as W, useCallback as a } from "react";
3
- import { Upload as $ } from "lucide-react";
4
- import { formatFileSize as g } from "./index184.mjs";
5
- import l from "./index132.mjs";
6
- const P = ({
7
- onFilesSelected: h,
8
- accept: s = ["*/*"],
9
- multiple: m = !0,
10
- maxSize: r = 10 * 1024 * 1024,
11
- // 10MB default
12
- children: D,
13
- className: v,
14
- ...y
15
- }) => {
16
- const [U, f] = I(!1), i = W(null), c = a(
17
- (e) => {
18
- if (!e || e.length === 0) return;
19
- const o = [];
20
- Array.from(e).forEach((t) => {
21
- if (r && t.size > r) {
22
- console.warn(
23
- `File ${t.name} exceeds max size of ${g(r)}`
24
- );
25
- return;
26
- }
27
- const j = s.includes("*/*"), w = s.flatMap((n) => (n.endsWith("/*"), n));
28
- if (!(j || w.some((n) => {
29
- if (n.endsWith("/*")) {
30
- const x = n.split("/")[0];
31
- return t.type.startsWith(`${x}/`);
32
- }
33
- return t.type === n || t.name.endsWith(n);
34
- }))) {
35
- console.warn(`File ${t.name} type not accepted`);
36
- return;
37
- }
38
- o.push(t);
39
- }), o.length > 0 && h?.(o);
40
- },
41
- [s, r, h]
42
- ), C = a((e) => {
43
- e.preventDefault(), e.stopPropagation(), f(!0);
44
- }, []), k = a((e) => {
45
- e.preventDefault(), e.stopPropagation(), f(!1);
46
- }, []), F = a(
47
- (e) => {
48
- e.preventDefault(), e.stopPropagation(), f(!1);
49
- const { files: o } = e.dataTransfer;
50
- c(o);
51
- },
52
- [c]
53
- ), N = a(
54
- (e) => {
55
- c(e.target.files), i.current && (i.current.value = "");
56
- },
57
- [c]
58
- ), u = a(() => {
59
- i.current?.click();
60
- }, []), b = a(
61
- (e) => {
62
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), u());
63
- },
64
- [u]
65
- );
66
- return /* @__PURE__ */ d(
67
- "div",
68
- {
69
- className: [
70
- l.fileUpload,
71
- U && l.fileUploadDragging,
72
- v
73
- ].filter(Boolean).join(" "),
74
- onDragOver: C,
75
- onDragLeave: k,
76
- onDrop: F,
77
- onClick: u,
78
- onKeyDown: b,
79
- role: "button",
80
- tabIndex: 0,
81
- "aria-label": "Upload files",
82
- ...y,
83
- children: [
84
- /* @__PURE__ */ p(
85
- "input",
86
- {
87
- ref: i,
88
- type: "file",
89
- accept: s.join(","),
90
- multiple: m,
91
- onChange: N,
92
- style: { display: "none" },
93
- "aria-hidden": "true"
94
- }
95
- ),
96
- D || /* @__PURE__ */ d(A, { children: [
97
- /* @__PURE__ */ p("div", { className: l.fileUploadIcon, children: /* @__PURE__ */ p($, { size: 32 }) }),
98
- /* @__PURE__ */ d("div", { className: l.fileUploadText, children: [
99
- /* @__PURE__ */ p("strong", { children: "Click to upload" }),
100
- " or drag and drop"
101
- ] }),
102
- /* @__PURE__ */ d("div", { className: l.fileUploadHint, children: [
103
- "Max file size: ",
104
- g(r)
105
- ] })
106
- ] })
107
- ]
108
- }
109
- );
110
- };
111
- P.displayName = "ChatFileUpload";
1
+ import { jsxs as p, jsx as s } from "react/jsx-runtime";
2
+ import { forwardRef as f } from "react";
3
+ import { ArrowDown as u } from "lucide-react";
4
+ import { useAutoScroll as g } from "./index84.mjs";
5
+ import e from "./index141.mjs";
6
+ import { Button as h } from "./index14.mjs";
7
+ const B = f(
8
+ ({ children: r, autoScroll: a = !0, className: l, ...i }, o) => {
9
+ const { scrollRef: m, isAtBottom: n, scrollToBottom: c } = g({
10
+ enabled: a
11
+ });
12
+ return /* @__PURE__ */ p(
13
+ "div",
14
+ {
15
+ ref: (t) => {
16
+ m.current = t, typeof o == "function" ? o(t) : o && (o.current = t);
17
+ },
18
+ className: [e.messages, l].filter(Boolean).join(" "),
19
+ role: "log",
20
+ "aria-live": "polite",
21
+ "aria-label": "Chat messages",
22
+ "aria-relevant": "additions",
23
+ ...i,
24
+ children: [
25
+ /* @__PURE__ */ s("div", { className: e.messagesInner, children: r }),
26
+ !n && /* @__PURE__ */ s("div", { className: e.scrollToBottomWrapper, children: /* @__PURE__ */ s(
27
+ h,
28
+ {
29
+ variant: "secondary",
30
+ size: "sm",
31
+ iconOnly: !0,
32
+ icon: /* @__PURE__ */ s(u, { size: 18 }),
33
+ onClick: c,
34
+ "aria-label": "Scroll to latest messages",
35
+ className: e.scrollToBottomButton
36
+ }
37
+ ) })
38
+ ]
39
+ }
40
+ );
41
+ }
42
+ );
43
+ B.displayName = "ChatMessages";
112
44
  export {
113
- P as ChatFileUpload
45
+ B as ChatMessages
114
46
  };
package/dist/index144.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("lucide-react"),p=require("./index140.cjs"),P=require("./index141.cjs"),b=require("./index138.cjs"),C=require("./index184.cjs"),t=require("./index132.cjs"),w=d=>{switch(d){case"image":return e.jsx(a.Image,{size:18});case"audio":return e.jsx(a.Music,{size:18});case"code":return e.jsx(a.Code,{size:18});default:return e.jsx(a.FileText,{size:18})}},v=({attachment:d,removable:h=!1,onRemove:i,onClick:n,className:c,...o})=>{const{type:m,name:s,url:l,content:j,language:f,size:x,duration:u,thumbnail:g}=d;switch(m){case"image":if(l)return e.jsxs("div",{className:c,style:{position:"relative"},...o,children:[e.jsx(p.ChatImagePreview,{src:l,alt:s,thumbnail:g,onClick:n}),h&&i&&e.jsx("button",{className:t.default.attachmentPreviewRemove,onClick:r=>{r.stopPropagation(),i()},"aria-label":`Remove ${s}`,style:{position:"absolute",top:4,right:4,background:"var(--surface-base)"},children:e.jsx(a.X,{size:14})})]});break;case"audio":if(l)return e.jsxs("div",{className:c,style:{position:"relative"},...o,children:[e.jsx(P.ChatAudioPlayer,{src:l,duration:u,title:s}),h&&i&&e.jsx("button",{className:t.default.attachmentPreviewRemove,onClick:r=>{r.stopPropagation(),i()},"aria-label":`Remove ${s}`,children:e.jsx(a.X,{size:14})})]});break;case"code":if(j)return e.jsx(b.ChatCodeBlock,{code:j,language:f,className:c,...o});break}return e.jsxs("div",{className:[t.default.attachmentPreview,c].filter(Boolean).join(" "),onClick:n,role:n?"button":void 0,tabIndex:n?0:void 0,...o,children:[e.jsx("div",{className:t.default.attachmentPreviewIcon,children:w(m)}),e.jsxs("div",{className:t.default.attachmentPreviewInfo,children:[e.jsx("span",{className:t.default.attachmentPreviewName,children:s}),x&&e.jsxs("span",{className:t.default.attachmentPreviewMeta,children:[C.formatFileSize(x),u&&` · ${Math.floor(u/60)}:${(u%60).toString().padStart(2,"0")}`]})]}),h&&i&&e.jsx("button",{className:t.default.attachmentPreviewRemove,onClick:r=>{r.stopPropagation(),i()},"aria-label":`Remove ${s}`,children:e.jsx(a.X,{size:14})})]})};v.displayName="ChatAttachment";exports.ChatAttachment=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),t=require("lucide-react"),p=require("./index148.cjs"),y=require("./index153.cjs"),e=require("./index141.cjs"),R=a=>a?new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}).format(a):"",S=a=>{switch(a){case"sending":return s.jsx(t.Clock,{size:12});case"sent":return s.jsx(t.Check,{size:12});case"error":return s.jsx(t.AlertCircle,{size:12});default:return null}},b=({role:a,content:u,timestamp:m,status:i,attachments:d,avatar:C,showAvatar:N,actions:c,isStreaming:k,onImageClick:f,onRetry:g,reaction:l,onReaction:o,children:j,className:h,...x})=>{const r=a==="user",A=a==="system",v=a==="assistant",B=N??!1;return A?s.jsx("div",{className:[e.default.message,h].filter(Boolean).join(" "),role:"listitem",...x,children:s.jsx("div",{className:e.default.messageContent,children:s.jsx("div",{className:e.default.messageBubbleSystem,children:j||u})})}):s.jsxs("div",{className:[e.default.message,r&&e.default.messageUser,v&&e.default.messageAssistant,h].filter(Boolean).join(" "),role:"listitem",...x,children:[B&&s.jsx("div",{className:[e.default.messageAvatar,r?e.default.messageAvatarUser:e.default.messageAvatarAssistant].filter(Boolean).join(" "),"aria-hidden":"true",children:C||(r?s.jsx(t.User,{size:18}):s.jsx(t.Bot,{size:18}))}),s.jsxs("div",{className:e.default.messageContent,children:[s.jsxs("div",{className:[e.default.messageBubble,r?e.default.messageBubbleUser:e.default.messageBubbleAssistant].filter(Boolean).join(" "),children:[j||s.jsx(p.ChatMarkdown,{content:u,className:r?e.default.markdownUser:void 0}),k&&s.jsx("span",{className:e.default.streamingCursor})]}),d&&d.length>0&&s.jsx("div",{className:e.default.messageAttachments,children:d.map(n=>s.jsx(y.ChatAttachment,{attachment:n,onClick:n.type==="image"&&f?()=>f(n):void 0},n.id))}),s.jsxs("div",{className:e.default.messageFooter,children:[m&&s.jsx("span",{className:e.default.messageTimestamp,children:R(m)}),i&&s.jsxs("span",{className:[e.default.messageStatus,i==="error"&&e.default.messageStatusError].filter(Boolean).join(" "),children:[S(i),i==="error"&&"Failed to send"]}),i==="error"&&g&&s.jsxs("button",{className:e.default.messageRetry,onClick:g,"aria-label":"Retry sending message",children:[s.jsx(t.RotateCcw,{size:12}),"Retry"]}),c&&s.jsx("div",{className:e.default.messageActions,children:c}),v&&o&&s.jsxs("div",{className:[e.default.messageReactions,l&&e.default.messageReactionsVisible].filter(Boolean).join(" "),children:[s.jsx("button",{className:[e.default.messageReactionButton,l==="like"&&e.default.messageReactionActive].filter(Boolean).join(" "),onClick:()=>o("like"),"aria-label":"Like this response","aria-pressed":l==="like",children:s.jsx(t.ThumbsUp,{size:14})}),s.jsx("button",{className:[e.default.messageReactionButton,l==="dislike"&&e.default.messageReactionActive].filter(Boolean).join(" "),onClick:()=>o("dislike"),"aria-label":"Dislike this response","aria-pressed":l==="dislike",children:s.jsx(t.ThumbsDown,{size:14})})]})]})]})]})};b.displayName="ChatMessage";exports.ChatMessage=b;
package/dist/index144.mjs CHANGED
@@ -1,125 +1,173 @@
1
- import { jsx as e, jsxs as o } from "react/jsx-runtime";
2
- import { X as u, FileText as P, Code as w, Music as z, Image as y } from "lucide-react";
3
- import { ChatImagePreview as C } from "./index140.mjs";
4
- import { ChatAudioPlayer as N } from "./index141.mjs";
5
- import { ChatCodeBlock as I } from "./index138.mjs";
6
- import { formatFileSize as k } from "./index184.mjs";
7
- import t from "./index132.mjs";
8
- const x = (d) => {
9
- switch (d) {
10
- case "image":
11
- return /* @__PURE__ */ e(y, { size: 18 });
12
- case "audio":
13
- return /* @__PURE__ */ e(z, { size: 18 });
14
- case "code":
15
- return /* @__PURE__ */ e(w, { size: 18 });
1
+ import { jsx as s, jsxs as i } from "react/jsx-runtime";
2
+ import { User as j, Bot as y, RotateCcw as z, ThumbsUp as U, ThumbsDown as w, AlertCircle as R, Check as S, Clock as T } from "lucide-react";
3
+ import { ChatMarkdown as x } from "./index148.mjs";
4
+ import { ChatAttachment as D } from "./index153.mjs";
5
+ import e from "./index141.mjs";
6
+ const F = (a) => a ? new Intl.DateTimeFormat("en-US", {
7
+ hour: "numeric",
8
+ minute: "2-digit",
9
+ hour12: !0
10
+ }).format(a) : "", M = (a) => {
11
+ switch (a) {
12
+ case "sending":
13
+ return /* @__PURE__ */ s(T, { size: 12 });
14
+ case "sent":
15
+ return /* @__PURE__ */ s(S, { size: 12 });
16
+ case "error":
17
+ return /* @__PURE__ */ s(R, { size: 12 });
16
18
  default:
17
- return /* @__PURE__ */ e(P, { size: 18 });
19
+ return null;
18
20
  }
19
- }, $ = ({
20
- attachment: d,
21
- removable: h = !1,
22
- onRemove: a,
23
- onClick: n,
24
- className: s,
25
- ...c
21
+ }, E = ({
22
+ role: a,
23
+ content: c,
24
+ timestamp: d,
25
+ status: r,
26
+ attachments: o,
27
+ avatar: b,
28
+ showAvatar: k,
29
+ actions: g,
30
+ isStreaming: B,
31
+ onImageClick: u,
32
+ onRetry: h,
33
+ reaction: l,
34
+ onReaction: m,
35
+ children: f,
36
+ className: v,
37
+ ...p
26
38
  }) => {
27
- const { type: p, name: i, url: l, content: v, language: b, size: f, duration: m, thumbnail: g } = d;
28
- switch (p) {
29
- case "image":
30
- if (l)
31
- return /* @__PURE__ */ o("div", { className: s, style: { position: "relative" }, ...c, children: [
32
- /* @__PURE__ */ e(
33
- C,
34
- {
35
- src: l,
36
- alt: i,
37
- thumbnail: g,
38
- onClick: n
39
- }
40
- ),
41
- h && a && /* @__PURE__ */ e(
42
- "button",
43
- {
44
- className: t.attachmentPreviewRemove,
45
- onClick: (r) => {
46
- r.stopPropagation(), a();
47
- },
48
- "aria-label": `Remove ${i}`,
49
- style: {
50
- position: "absolute",
51
- top: 4,
52
- right: 4,
53
- background: "var(--surface-base)"
54
- },
55
- children: /* @__PURE__ */ e(u, { size: 14 })
56
- }
57
- )
58
- ] });
59
- break;
60
- case "audio":
61
- if (l)
62
- return /* @__PURE__ */ o("div", { className: s, style: { position: "relative" }, ...c, children: [
63
- /* @__PURE__ */ e(N, { src: l, duration: m, title: i }),
64
- h && a && /* @__PURE__ */ e(
65
- "button",
66
- {
67
- className: t.attachmentPreviewRemove,
68
- onClick: (r) => {
69
- r.stopPropagation(), a();
70
- },
71
- "aria-label": `Remove ${i}`,
72
- children: /* @__PURE__ */ e(u, { size: 14 })
73
- }
74
- )
75
- ] });
76
- break;
77
- case "code":
78
- if (v)
79
- return /* @__PURE__ */ e(
80
- I,
81
- {
82
- code: v,
83
- language: b,
84
- className: s,
85
- ...c
86
- }
87
- );
88
- break;
89
- }
90
- return /* @__PURE__ */ o(
39
+ const t = a === "user", A = a === "system", N = a === "assistant", C = k ?? !1;
40
+ return A ? /* @__PURE__ */ s(
91
41
  "div",
92
42
  {
93
- className: [t.attachmentPreview, s].filter(Boolean).join(" "),
94
- onClick: n,
95
- role: n ? "button" : void 0,
96
- tabIndex: n ? 0 : void 0,
97
- ...c,
43
+ className: [e.message, v].filter(Boolean).join(" "),
44
+ role: "listitem",
45
+ ...p,
46
+ children: /* @__PURE__ */ s("div", { className: e.messageContent, children: /* @__PURE__ */ s("div", { className: e.messageBubbleSystem, children: f || c }) })
47
+ }
48
+ ) : /* @__PURE__ */ i(
49
+ "div",
50
+ {
51
+ className: [
52
+ e.message,
53
+ t && e.messageUser,
54
+ N && e.messageAssistant,
55
+ v
56
+ ].filter(Boolean).join(" "),
57
+ role: "listitem",
58
+ ...p,
98
59
  children: [
99
- /* @__PURE__ */ e("div", { className: t.attachmentPreviewIcon, children: x(p) }),
100
- /* @__PURE__ */ o("div", { className: t.attachmentPreviewInfo, children: [
101
- /* @__PURE__ */ e("span", { className: t.attachmentPreviewName, children: i }),
102
- f && /* @__PURE__ */ o("span", { className: t.attachmentPreviewMeta, children: [
103
- k(f),
104
- m && ` · ${Math.floor(m / 60)}:${(m % 60).toString().padStart(2, "0")}`
105
- ] })
106
- ] }),
107
- h && a && /* @__PURE__ */ e(
108
- "button",
60
+ C && /* @__PURE__ */ s(
61
+ "div",
109
62
  {
110
- className: t.attachmentPreviewRemove,
111
- onClick: (r) => {
112
- r.stopPropagation(), a();
113
- },
114
- "aria-label": `Remove ${i}`,
115
- children: /* @__PURE__ */ e(u, { size: 14 })
63
+ className: [
64
+ e.messageAvatar,
65
+ t ? e.messageAvatarUser : e.messageAvatarAssistant
66
+ ].filter(Boolean).join(" "),
67
+ "aria-hidden": "true",
68
+ children: b || (t ? /* @__PURE__ */ s(j, { size: 18 }) : /* @__PURE__ */ s(y, { size: 18 }))
116
69
  }
117
- )
70
+ ),
71
+ /* @__PURE__ */ i("div", { className: e.messageContent, children: [
72
+ /* @__PURE__ */ i(
73
+ "div",
74
+ {
75
+ className: [
76
+ e.messageBubble,
77
+ t ? e.messageBubbleUser : e.messageBubbleAssistant
78
+ ].filter(Boolean).join(" "),
79
+ children: [
80
+ f || /* @__PURE__ */ s(
81
+ x,
82
+ {
83
+ content: c,
84
+ className: t ? e.markdownUser : void 0
85
+ }
86
+ ),
87
+ B && /* @__PURE__ */ s("span", { className: e.streamingCursor })
88
+ ]
89
+ }
90
+ ),
91
+ o && o.length > 0 && /* @__PURE__ */ s("div", { className: e.messageAttachments, children: o.map((n) => /* @__PURE__ */ s(
92
+ D,
93
+ {
94
+ attachment: n,
95
+ onClick: n.type === "image" && u ? () => u(n) : void 0
96
+ },
97
+ n.id
98
+ )) }),
99
+ /* @__PURE__ */ i("div", { className: e.messageFooter, children: [
100
+ d && /* @__PURE__ */ s("span", { className: e.messageTimestamp, children: F(d) }),
101
+ r && /* @__PURE__ */ i(
102
+ "span",
103
+ {
104
+ className: [
105
+ e.messageStatus,
106
+ r === "error" && e.messageStatusError
107
+ ].filter(Boolean).join(" "),
108
+ children: [
109
+ M(r),
110
+ r === "error" && "Failed to send"
111
+ ]
112
+ }
113
+ ),
114
+ r === "error" && h && /* @__PURE__ */ i(
115
+ "button",
116
+ {
117
+ className: e.messageRetry,
118
+ onClick: h,
119
+ "aria-label": "Retry sending message",
120
+ children: [
121
+ /* @__PURE__ */ s(z, { size: 12 }),
122
+ "Retry"
123
+ ]
124
+ }
125
+ ),
126
+ g && /* @__PURE__ */ s("div", { className: e.messageActions, children: g }),
127
+ N && m && /* @__PURE__ */ i(
128
+ "div",
129
+ {
130
+ className: [
131
+ e.messageReactions,
132
+ l && e.messageReactionsVisible
133
+ ].filter(Boolean).join(" "),
134
+ children: [
135
+ /* @__PURE__ */ s(
136
+ "button",
137
+ {
138
+ className: [
139
+ e.messageReactionButton,
140
+ l === "like" && e.messageReactionActive
141
+ ].filter(Boolean).join(" "),
142
+ onClick: () => m("like"),
143
+ "aria-label": "Like this response",
144
+ "aria-pressed": l === "like",
145
+ children: /* @__PURE__ */ s(U, { size: 14 })
146
+ }
147
+ ),
148
+ /* @__PURE__ */ s(
149
+ "button",
150
+ {
151
+ className: [
152
+ e.messageReactionButton,
153
+ l === "dislike" && e.messageReactionActive
154
+ ].filter(Boolean).join(" "),
155
+ onClick: () => m("dislike"),
156
+ "aria-label": "Dislike this response",
157
+ "aria-pressed": l === "dislike",
158
+ children: /* @__PURE__ */ s(w, { size: 14 })
159
+ }
160
+ )
161
+ ]
162
+ }
163
+ )
164
+ ] })
165
+ ] })
118
166
  ]
119
167
  }
120
168
  );
121
169
  };
122
- $.displayName = "ChatAttachment";
170
+ E.displayName = "ChatMessage";
123
171
  export {
124
- $ as ChatAttachment
172
+ E as ChatMessage
125
173
  };