@orion-ds/react 5.1.13 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/AI_COMPONENTS.md +9 -2
  2. package/README.md +1 -5
  3. package/dist/blocks/index.cjs +1 -1
  4. package/dist/blocks/index.mjs +50 -54
  5. package/dist/blocks/sections/index.d.ts +0 -2
  6. package/dist/blocks/sections/index.d.ts.map +1 -1
  7. package/dist/blocks/templates/index.cjs +1 -1
  8. package/dist/blocks/templates/index.d.ts +0 -5
  9. package/dist/blocks/templates/index.d.ts.map +1 -1
  10. package/dist/blocks/templates/index.mjs +12 -14
  11. package/dist/blocks.css +0 -4
  12. package/dist/client.d.ts +1 -2
  13. package/dist/client.d.ts.map +1 -1
  14. package/dist/components/ThemeController/ThemeController.cjs +1 -1
  15. package/dist/components/ThemeController/ThemeController.d.ts.map +1 -1
  16. package/dist/components/ThemeController/ThemeController.mjs +7 -7
  17. package/dist/components/index.d.ts +0 -3
  18. package/dist/components/index.d.ts.map +1 -1
  19. package/dist/hooks/useTheme.cjs +1 -1
  20. package/dist/hooks/useTheme.d.ts +1 -1
  21. package/dist/hooks/useTheme.d.ts.map +1 -1
  22. package/dist/hooks/useTheme.mjs +1 -1
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/styles.css +0 -2
  25. package/dist/tokens/types.d.ts +64 -37
  26. package/dist/tokens/types.d.ts.map +1 -1
  27. package/dist/utils/fonts.cjs +1 -1
  28. package/dist/utils/fonts.d.ts.map +1 -1
  29. package/dist/utils/fonts.mjs +1 -0
  30. package/package.json +1 -6
  31. package/dist/blocks/sections/Chat/Chat.cjs +0 -1
  32. package/dist/blocks/sections/Chat/Chat.d.ts +0 -5
  33. package/dist/blocks/sections/Chat/Chat.d.ts.map +0 -1
  34. package/dist/blocks/sections/Chat/Chat.mjs +0 -93
  35. package/dist/blocks/sections/Chat/Chat.module.css +0 -1
  36. package/dist/blocks/sections/Chat/Chat.module.css.cjs +0 -1
  37. package/dist/blocks/sections/Chat/Chat.module.css.mjs +0 -47
  38. package/dist/blocks/sections/Chat/Chat.types.d.ts +0 -33
  39. package/dist/blocks/sections/Chat/Chat.types.d.ts.map +0 -1
  40. package/dist/blocks/sections/Chat/index.d.ts +0 -3
  41. package/dist/blocks/sections/Chat/index.d.ts.map +0 -1
  42. package/dist/blocks/templates/app/ChatPageTemplate/ChatPageTemplate.cjs +0 -1
  43. package/dist/blocks/templates/app/ChatPageTemplate/ChatPageTemplate.d.ts +0 -5
  44. package/dist/blocks/templates/app/ChatPageTemplate/ChatPageTemplate.d.ts.map +0 -1
  45. package/dist/blocks/templates/app/ChatPageTemplate/ChatPageTemplate.mjs +0 -192
  46. package/dist/blocks/templates/app/ChatPageTemplate/ChatPageTemplate.module.css +0 -1
  47. package/dist/blocks/templates/app/ChatPageTemplate/ChatPageTemplate.module.css.cjs +0 -1
  48. package/dist/blocks/templates/app/ChatPageTemplate/ChatPageTemplate.module.css.mjs +0 -81
  49. package/dist/blocks/templates/app/ChatPageTemplate/ChatPageTemplate.types.d.ts +0 -42
  50. package/dist/blocks/templates/app/ChatPageTemplate/ChatPageTemplate.types.d.ts.map +0 -1
  51. package/dist/blocks/templates/app/ChatPageTemplate/index.d.ts +0 -3
  52. package/dist/blocks/templates/app/ChatPageTemplate/index.d.ts.map +0 -1
  53. package/dist/components/Chat/Chat.cjs +0 -1
  54. package/dist/components/Chat/Chat.d.ts +0 -22
  55. package/dist/components/Chat/Chat.d.ts.map +0 -1
  56. package/dist/components/Chat/Chat.mjs +0 -56
  57. package/dist/components/Chat/Chat.module.css +0 -1
  58. package/dist/components/Chat/Chat.module.css.cjs +0 -1
  59. package/dist/components/Chat/Chat.module.css.mjs +0 -237
  60. package/dist/components/Chat/Chat.types.d.ts +0 -387
  61. package/dist/components/Chat/Chat.types.d.ts.map +0 -1
  62. package/dist/components/Chat/components/ChatAttachment.cjs +0 -1
  63. package/dist/components/Chat/components/ChatAttachment.d.ts +0 -5
  64. package/dist/components/Chat/components/ChatAttachment.d.ts.map +0 -1
  65. package/dist/components/Chat/components/ChatAttachment.mjs +0 -125
  66. package/dist/components/Chat/components/ChatAudioPlayer.cjs +0 -1
  67. package/dist/components/Chat/components/ChatAudioPlayer.d.ts +0 -5
  68. package/dist/components/Chat/components/ChatAudioPlayer.d.ts.map +0 -1
  69. package/dist/components/Chat/components/ChatAudioPlayer.mjs +0 -127
  70. package/dist/components/Chat/components/ChatCodeBlock.cjs +0 -1
  71. package/dist/components/Chat/components/ChatCodeBlock.d.ts +0 -5
  72. package/dist/components/Chat/components/ChatCodeBlock.d.ts.map +0 -1
  73. package/dist/components/Chat/components/ChatCodeBlock.mjs +0 -93
  74. package/dist/components/Chat/components/ChatFileUpload.cjs +0 -1
  75. package/dist/components/Chat/components/ChatFileUpload.d.ts +0 -5
  76. package/dist/components/Chat/components/ChatFileUpload.d.ts.map +0 -1
  77. package/dist/components/Chat/components/ChatFileUpload.mjs +0 -114
  78. package/dist/components/Chat/components/ChatHeader.cjs +0 -1
  79. package/dist/components/Chat/components/ChatHeader.d.ts +0 -5
  80. package/dist/components/Chat/components/ChatHeader.d.ts.map +0 -1
  81. package/dist/components/Chat/components/ChatHeader.mjs +0 -36
  82. package/dist/components/Chat/components/ChatImagePreview.cjs +0 -1
  83. package/dist/components/Chat/components/ChatImagePreview.d.ts +0 -5
  84. package/dist/components/Chat/components/ChatImagePreview.d.ts.map +0 -1
  85. package/dist/components/Chat/components/ChatImagePreview.mjs +0 -69
  86. package/dist/components/Chat/components/ChatInput.cjs +0 -1
  87. package/dist/components/Chat/components/ChatInput.d.ts +0 -5
  88. package/dist/components/Chat/components/ChatInput.d.ts.map +0 -1
  89. package/dist/components/Chat/components/ChatInput.mjs +0 -188
  90. package/dist/components/Chat/components/ChatLightbox.cjs +0 -1
  91. package/dist/components/Chat/components/ChatLightbox.d.ts +0 -5
  92. package/dist/components/Chat/components/ChatLightbox.d.ts.map +0 -1
  93. package/dist/components/Chat/components/ChatLightbox.mjs +0 -57
  94. package/dist/components/Chat/components/ChatMarkdown.cjs +0 -1
  95. package/dist/components/Chat/components/ChatMarkdown.d.ts +0 -5
  96. package/dist/components/Chat/components/ChatMarkdown.d.ts.map +0 -1
  97. package/dist/components/Chat/components/ChatMarkdown.mjs +0 -70
  98. package/dist/components/Chat/components/ChatMessage.cjs +0 -1
  99. package/dist/components/Chat/components/ChatMessage.d.ts +0 -5
  100. package/dist/components/Chat/components/ChatMessage.d.ts.map +0 -1
  101. package/dist/components/Chat/components/ChatMessage.mjs +0 -173
  102. package/dist/components/Chat/components/ChatMessages.cjs +0 -1
  103. package/dist/components/Chat/components/ChatMessages.d.ts +0 -5
  104. package/dist/components/Chat/components/ChatMessages.d.ts.map +0 -1
  105. package/dist/components/Chat/components/ChatMessages.mjs +0 -46
  106. package/dist/components/Chat/components/ChatSidebar.cjs +0 -1
  107. package/dist/components/Chat/components/ChatSidebar.d.ts +0 -5
  108. package/dist/components/Chat/components/ChatSidebar.d.ts.map +0 -1
  109. package/dist/components/Chat/components/ChatSidebar.mjs +0 -217
  110. package/dist/components/Chat/components/ChatTypingIndicator.cjs +0 -1
  111. package/dist/components/Chat/components/ChatTypingIndicator.d.ts +0 -5
  112. package/dist/components/Chat/components/ChatTypingIndicator.d.ts.map +0 -1
  113. package/dist/components/Chat/components/ChatTypingIndicator.mjs +0 -31
  114. package/dist/components/Chat/components/ChatVoiceRecorder.cjs +0 -1
  115. package/dist/components/Chat/components/ChatVoiceRecorder.d.ts +0 -5
  116. package/dist/components/Chat/components/ChatVoiceRecorder.d.ts.map +0 -1
  117. package/dist/components/Chat/components/ChatVoiceRecorder.mjs +0 -111
  118. package/dist/components/Chat/components/index.d.ts +0 -18
  119. package/dist/components/Chat/components/index.d.ts.map +0 -1
  120. package/dist/components/Chat/hooks/index.d.ts +0 -12
  121. package/dist/components/Chat/hooks/index.d.ts.map +0 -1
  122. package/dist/components/Chat/hooks/useAutoScroll.cjs +0 -1
  123. package/dist/components/Chat/hooks/useAutoScroll.d.ts +0 -24
  124. package/dist/components/Chat/hooks/useAutoScroll.d.ts.map +0 -1
  125. package/dist/components/Chat/hooks/useAutoScroll.mjs +0 -50
  126. package/dist/components/Chat/hooks/useChatInput.cjs +0 -1
  127. package/dist/components/Chat/hooks/useChatInput.d.ts +0 -43
  128. package/dist/components/Chat/hooks/useChatInput.d.ts.map +0 -1
  129. package/dist/components/Chat/hooks/useChatInput.mjs +0 -44
  130. package/dist/components/Chat/hooks/useStreamingText.d.ts +0 -22
  131. package/dist/components/Chat/hooks/useStreamingText.d.ts.map +0 -1
  132. package/dist/components/Chat/hooks/useVoiceRecorder.cjs +0 -1
  133. package/dist/components/Chat/hooks/useVoiceRecorder.d.ts +0 -26
  134. package/dist/components/Chat/hooks/useVoiceRecorder.d.ts.map +0 -1
  135. package/dist/components/Chat/hooks/useVoiceRecorder.mjs +0 -74
  136. package/dist/components/Chat/index.d.ts +0 -28
  137. package/dist/components/Chat/index.d.ts.map +0 -1
  138. package/dist/components/Chat/utils.cjs +0 -1
  139. package/dist/components/Chat/utils.d.ts +0 -16
  140. package/dist/components/Chat/utils.d.ts.map +0 -1
  141. package/dist/components/Chat/utils.mjs +0 -12
  142. package/dist/rich.cjs +0 -1
  143. package/dist/rich.d.ts +0 -16
  144. package/dist/rich.d.ts.map +0 -1
  145. package/dist/rich.mjs +0 -4
@@ -1,188 +0,0 @@
1
- import { jsx as t, jsxs as c } from "react/jsx-runtime";
2
- import { forwardRef as E, useState as O, useRef as X, useCallback as r } from "react";
3
- import { X as _, Paperclip as q, Mic as G, Send as H, Image as J, File as Q } from "lucide-react";
4
- import { useChatInput as Y } from "../hooks/useChatInput.mjs";
5
- import { ChatVoiceRecorder as Z } from "./ChatVoiceRecorder.mjs";
6
- import { formatFileSize as L } from "../utils.mjs";
7
- import n from "../Chat.module.css.mjs";
8
- const ee = (p) => p.type.startsWith("image/") ? /* @__PURE__ */ t(J, { size: 14 }) : /* @__PURE__ */ t(Q, { size: 14 }), te = E(
9
- ({
10
- onSend: p,
11
- placeholder: S = "Type a message...",
12
- allowAttachments: R = !0,
13
- allowVoiceRecording: z = !0,
14
- allowAudioUpload: ne = !0,
15
- disabled: s = !1,
16
- maxLength: f,
17
- acceptedFileTypes: w = [
18
- "image/*",
19
- "audio/*",
20
- ".pdf",
21
- ".doc",
22
- ".docx",
23
- ".txt"
24
- ],
25
- isLoading: i = !1,
26
- pendingAttachments: x,
27
- onRemoveAttachment: B,
28
- className: j,
29
- ...k
30
- }, o) => {
31
- const [g, h] = O(!1), m = X(null), {
32
- value: v,
33
- setValue: D,
34
- attachments: F,
35
- addAttachments: l,
36
- removeAttachment: I,
37
- handleSubmit: A,
38
- handleKeyDown: V,
39
- textareaRef: b,
40
- isEmpty: P
41
- } = Y({
42
- maxLength: f,
43
- onSend: p,
44
- disabled: s || i
45
- }), u = x || F, M = B || I, W = r(
46
- (e) => {
47
- b.current = e, typeof o == "function" ? o(e) : o && (o.current = e);
48
- },
49
- [o, b]
50
- ), K = r(
51
- (e) => {
52
- const a = e.target.files;
53
- a && a.length > 0 && l(Array.from(a)), m.current && (m.current.value = "");
54
- },
55
- [l]
56
- ), T = r(
57
- (e) => {
58
- const a = e.clipboardData.items, d = [];
59
- for (const C of a)
60
- if (C.type.startsWith("image/")) {
61
- const N = C.getAsFile();
62
- N && d.push(N);
63
- }
64
- d.length > 0 && (e.preventDefault(), l(d));
65
- },
66
- [l]
67
- ), U = r(
68
- (e) => {
69
- const a = Object.assign(e, {
70
- name: `voice-${Date.now()}.webm`,
71
- lastModified: Date.now()
72
- });
73
- l([a]), h(!1);
74
- },
75
- [l]
76
- ), $ = r(() => {
77
- s || i || A();
78
- }, [s, i, A]), y = !P || u.length > 0;
79
- return /* @__PURE__ */ t(
80
- "div",
81
- {
82
- className: [n.inputContainer, j].filter(Boolean).join(" "),
83
- children: /* @__PURE__ */ c("div", { className: n.inputWrapper, children: [
84
- u.length > 0 && /* @__PURE__ */ t("div", { className: n.pendingAttachments, children: u.map((e, a) => /* @__PURE__ */ c("div", { className: n.pendingAttachment, children: [
85
- ee(e),
86
- /* @__PURE__ */ t("span", { children: e.name }),
87
- /* @__PURE__ */ c("span", { className: n.pendingAttachmentSize, children: [
88
- "(",
89
- L(e.size),
90
- ")"
91
- ] }),
92
- /* @__PURE__ */ t(
93
- "button",
94
- {
95
- className: n.pendingAttachmentRemove,
96
- onClick: () => M(a),
97
- "aria-label": `Remove ${e.name}`,
98
- children: /* @__PURE__ */ t(_, { size: 14 })
99
- }
100
- )
101
- ] }, a)) }),
102
- g && /* @__PURE__ */ t(
103
- Z,
104
- {
105
- onRecordingComplete: U,
106
- onCancel: () => h(!1)
107
- }
108
- ),
109
- !g && /* @__PURE__ */ c("div", { className: n.inputBox, children: [
110
- R && /* @__PURE__ */ c("div", { className: n.inputActions, children: [
111
- /* @__PURE__ */ t(
112
- "input",
113
- {
114
- ref: m,
115
- type: "file",
116
- accept: w.join(","),
117
- multiple: !0,
118
- onChange: K,
119
- style: { display: "none" },
120
- "aria-hidden": "true"
121
- }
122
- ),
123
- /* @__PURE__ */ t(
124
- "button",
125
- {
126
- className: n.inputButton,
127
- onClick: () => m.current?.click(),
128
- disabled: s || i,
129
- "aria-label": "Attach file",
130
- title: "Attach file",
131
- children: /* @__PURE__ */ t(q, { size: 20 })
132
- }
133
- )
134
- ] }),
135
- /* @__PURE__ */ t(
136
- "textarea",
137
- {
138
- ref: W,
139
- className: n.inputTextarea,
140
- value: v,
141
- onChange: (e) => D(e.target.value),
142
- onKeyDown: V,
143
- onPaste: T,
144
- placeholder: S,
145
- disabled: s || i,
146
- maxLength: f,
147
- rows: 1,
148
- "aria-label": "Message input",
149
- ...k
150
- }
151
- ),
152
- /* @__PURE__ */ c("div", { className: n.inputActions, children: [
153
- z && !v && u.length === 0 && /* @__PURE__ */ t(
154
- "button",
155
- {
156
- className: n.inputButton,
157
- onClick: () => h(!0),
158
- disabled: s || i,
159
- "aria-label": "Record voice message",
160
- title: "Record voice message",
161
- children: /* @__PURE__ */ t(G, { size: 20 })
162
- }
163
- ),
164
- /* @__PURE__ */ t(
165
- "button",
166
- {
167
- className: [
168
- n.inputButton,
169
- y && n.inputButtonPrimary
170
- ].filter(Boolean).join(" "),
171
- onClick: $,
172
- disabled: s || i || !y,
173
- "aria-label": "Send message",
174
- title: "Send message",
175
- children: i ? /* @__PURE__ */ t("span", { className: n.inputSpinner }) : /* @__PURE__ */ t(H, { size: 20 })
176
- }
177
- )
178
- ] })
179
- ] })
180
- ] })
181
- }
182
- );
183
- }
184
- );
185
- te.displayName = "ChatInput";
186
- export {
187
- te as ChatInput
188
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),n=require("react"),b=require("lucide-react"),i=require("../Chat.module.css.cjs"),l=({src:s,alt:d="Image",isOpen:a,onClose:t,className:f,...m})=>{const u=n.useRef(null),r=n.useRef(null),c=n.useCallback(e=>{if(e.key==="Escape"){t();return}e.key==="Tab"&&(e.preventDefault(),u.current?.focus())},[t]),g=e=>{e.target===e.currentTarget&&t()};return n.useEffect(()=>(a&&(r.current=document.activeElement,document.addEventListener("keydown",c),document.body.style.overflow="hidden",requestAnimationFrame(()=>{u.current?.focus()})),()=>{document.removeEventListener("keydown",c),document.body.style.overflow="",r.current&&typeof r.current.focus=="function"&&r.current.focus()}),[a,c]),a?o.jsxs("div",{className:[i.default.lightbox,f].filter(Boolean).join(" "),onClick:g,role:"dialog","aria-modal":"true","aria-label":"Image viewer",...m,children:[o.jsx("button",{ref:u,className:i.default.lightboxClose,onClick:t,"aria-label":"Close image viewer",children:o.jsx(b.X,{size:24})}),o.jsx("img",{src:s,alt:d,className:i.default.lightboxImage})]}):null};l.displayName="ChatLightbox";exports.ChatLightbox=l;
@@ -1,5 +0,0 @@
1
- import { default as React } from 'react';
2
- import { ChatLightboxProps } from '../Chat.types';
3
-
4
- export declare const ChatLightbox: React.FC<ChatLightboxProps>;
5
- //# sourceMappingURL=ChatLightbox.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChatLightbox.d.ts","sourceRoot":"","sources":["../../../../src/components/Chat/components/ChatLightbox.tsx"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,OAAO,KAAyC,MAAM,OAAO,CAAC;AAE9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGvD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAwFpD,CAAC"}
@@ -1,57 +0,0 @@
1
- import { jsxs as g, jsx as i } from "react/jsx-runtime";
2
- import { useRef as c, useCallback as b, useEffect as h } from "react";
3
- import { X as y } from "lucide-react";
4
- import l from "../Chat.module.css.mjs";
5
- const v = ({
6
- src: u,
7
- alt: s = "Image",
8
- isOpen: o,
9
- onClose: t,
10
- className: m,
11
- ...f
12
- }) => {
13
- const n = c(null), r = c(null), a = b(
14
- (e) => {
15
- if (e.key === "Escape") {
16
- t();
17
- return;
18
- }
19
- e.key === "Tab" && (e.preventDefault(), n.current?.focus());
20
- },
21
- [t]
22
- ), d = (e) => {
23
- e.target === e.currentTarget && t();
24
- };
25
- return h(() => (o && (r.current = document.activeElement, document.addEventListener("keydown", a), document.body.style.overflow = "hidden", requestAnimationFrame(() => {
26
- n.current?.focus();
27
- })), () => {
28
- document.removeEventListener("keydown", a), document.body.style.overflow = "", r.current && typeof r.current.focus == "function" && r.current.focus();
29
- }), [o, a]), o ? /* @__PURE__ */ g(
30
- "div",
31
- {
32
- className: [l.lightbox, m].filter(Boolean).join(" "),
33
- onClick: d,
34
- role: "dialog",
35
- "aria-modal": "true",
36
- "aria-label": "Image viewer",
37
- ...f,
38
- children: [
39
- /* @__PURE__ */ i(
40
- "button",
41
- {
42
- ref: n,
43
- className: l.lightboxClose,
44
- onClick: t,
45
- "aria-label": "Close image viewer",
46
- children: /* @__PURE__ */ i(y, { size: 24 })
47
- }
48
- ),
49
- /* @__PURE__ */ i("img", { src: u, alt: s, className: l.lightboxImage })
50
- ]
51
- }
52
- ) : null;
53
- };
54
- v.displayName = "ChatLightbox";
55
- export {
56
- v as ChatLightbox
57
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),k=require("./ChatCodeBlock.cjs"),p=require("../../MissingDependencyError.cjs"),g=require("../Chat.module.css.cjs");let s,c,i=null;try{s=require("react-markdown"),c=require("remark-gfm")}catch(a){i=a instanceof Error?a:new Error("react-markdown or remark-gfm not found")}const d=({content:a,className:m,...l})=>i?r.jsx(p.MissingDependencyError,{available:!1,componentName:"Chat",depName:["react-markdown","remark-gfm"],installCommand:"npm install react-markdown remark-gfm",pnpmCommand:"pnpm add react-markdown remark-gfm",docsUrl:"https://docs.orion-ds.dev/components/chat"}):r.jsx("div",{className:[g.default.markdown,m].filter(Boolean).join(" "),...l,children:r.jsx(s,{remarkPlugins:[c],components:{code({className:e,children:t,...o}){const n=/language-(\w+)/.exec(e||"");if(!n)return r.jsx("code",{className:e,...o,children:t});const u=String(t).replace(/\n$/,"");return r.jsx(k.ChatCodeBlock,{code:u,language:n[1]})},pre({children:e}){return r.jsx(r.Fragment,{children:e})},a({href:e,children:t,...o}){const n=e?.startsWith("http");return r.jsx("a",{href:e,target:n?"_blank":void 0,rel:n?"noopener noreferrer":void 0,...o,children:t})}},children:a})});d.displayName="ChatMarkdown";exports.ChatMarkdown=d;
@@ -1,5 +0,0 @@
1
- import { default as React } from 'react';
2
- import { ChatMarkdownProps } from '../Chat.types';
3
-
4
- export declare const ChatMarkdown: React.FC<ChatMarkdownProps>;
5
- //# sourceMappingURL=ChatMarkdown.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChatMarkdown.d.ts","sourceRoot":"","sources":["../../../../src/components/Chat/components/ChatMarkdown.tsx"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAoBvD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAuEpD,CAAC"}
@@ -1,70 +0,0 @@
1
- import { jsx as e, Fragment as p } from "react/jsx-runtime";
2
- import { ChatCodeBlock as k } from "./ChatCodeBlock.mjs";
3
- import { MissingDependencyError as f } from "../../MissingDependencyError.mjs";
4
- import g from "../Chat.module.css.mjs";
5
- let m, c, i = null;
6
- try {
7
- m = require("react-markdown"), c = require("remark-gfm");
8
- } catch (a) {
9
- i = a instanceof Error ? a : new Error("react-markdown or remark-gfm not found");
10
- }
11
- const u = ({
12
- content: a,
13
- className: s,
14
- ...l
15
- }) => i ? /* @__PURE__ */ e(
16
- f,
17
- {
18
- available: !1,
19
- componentName: "Chat",
20
- depName: ["react-markdown", "remark-gfm"],
21
- installCommand: "npm install react-markdown remark-gfm",
22
- pnpmCommand: "pnpm add react-markdown remark-gfm",
23
- docsUrl: "https://docs.orion-ds.dev/components/chat"
24
- }
25
- ) : /* @__PURE__ */ e(
26
- "div",
27
- {
28
- className: [g.markdown, s].filter(Boolean).join(" "),
29
- ...l,
30
- children: /* @__PURE__ */ e(
31
- m,
32
- {
33
- remarkPlugins: [c],
34
- components: {
35
- // Custom code block rendering
36
- code({ className: r, children: o, ...t }) {
37
- const n = /language-(\w+)/.exec(r || "");
38
- if (!n)
39
- return /* @__PURE__ */ e("code", { className: r, ...t, children: o });
40
- const d = String(o).replace(/\n$/, "");
41
- return /* @__PURE__ */ e(k, { code: d, language: n[1] });
42
- },
43
- // Custom pre rendering (remove wrapper for code blocks)
44
- pre({ children: r }) {
45
- return /* @__PURE__ */ e(p, { children: r });
46
- },
47
- // Custom link rendering (open in new tab)
48
- a({ href: r, children: o, ...t }) {
49
- const n = r?.startsWith("http");
50
- return /* @__PURE__ */ e(
51
- "a",
52
- {
53
- href: r,
54
- target: n ? "_blank" : void 0,
55
- rel: n ? "noopener noreferrer" : void 0,
56
- ...t,
57
- children: o
58
- }
59
- );
60
- }
61
- },
62
- children: a
63
- }
64
- )
65
- }
66
- );
67
- u.displayName = "ChatMarkdown";
68
- export {
69
- u as ChatMarkdown
70
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),t=require("lucide-react"),p=require("./ChatMarkdown.cjs"),y=require("./ChatAttachment.cjs"),e=require("../Chat.module.css.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;
@@ -1,5 +0,0 @@
1
- import { default as React } from 'react';
2
- import { ChatMessageProps } from '../Chat.types';
3
-
4
- export declare const ChatMessage: React.FC<ChatMessageProps>;
5
- //# sourceMappingURL=ChatMessage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChatMessage.d.ts","sourceRoot":"","sources":["../../../../src/components/Chat/components/ChatMessage.tsx"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AA6BtD,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAyLlD,CAAC"}
@@ -1,173 +0,0 @@
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 "./ChatMarkdown.mjs";
4
- import { ChatAttachment as D } from "./ChatAttachment.mjs";
5
- import e from "../Chat.module.css.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 });
18
- default:
19
- return null;
20
- }
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
38
- }) => {
39
- const t = a === "user", A = a === "system", N = a === "assistant", C = k ?? !1;
40
- return A ? /* @__PURE__ */ s(
41
- "div",
42
- {
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,
59
- children: [
60
- C && /* @__PURE__ */ s(
61
- "div",
62
- {
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 }))
69
- }
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
- ] })
166
- ]
167
- }
168
- );
169
- };
170
- E.displayName = "ChatMessage";
171
- export {
172
- E as ChatMessage
173
- };
@@ -1 +0,0 @@
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("../hooks/useAutoScroll.cjs"),t=require("../Chat.module.css.cjs"),j=require("../../Button/Button.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;
@@ -1,5 +0,0 @@
1
- import { default as React } from 'react';
2
- import { ChatMessagesProps } from '../Chat.types';
3
-
4
- export declare const ChatMessages: React.ForwardRefExoticComponent<ChatMessagesProps & React.RefAttributes<HTMLDivElement>>;
5
- //# sourceMappingURL=ChatMessages.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChatMessages.d.ts","sourceRoot":"","sources":["../../../../src/components/Chat/components/ChatMessages.tsx"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAKvD,eAAO,MAAM,YAAY,0FAiDxB,CAAC"}
@@ -1,46 +0,0 @@
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 "../hooks/useAutoScroll.mjs";
5
- import e from "../Chat.module.css.mjs";
6
- import { Button as h } from "../../Button/Button.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";
44
- export {
45
- B as ChatMessages
46
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),c=require("lucide-react"),t=require("../Chat.module.css.cjs"),O={today:"Today",yesterday:"Yesterday",previous7:"Previous 7 days",previous30:"Previous 30 days",older:"Older"},y=["today","yesterday","previous7","previous30","older"],C=a=>{const r=new Date,u=(new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime()-new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime())/(1e3*60*60*24);return u<1?"today":u<2?"yesterday":u<7?"previous7":u<30?"previous30":"older"},P=a=>{const r=C(a);return r==="today"?new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit"}).format(a):r==="yesterday"?"Yesterday":r==="previous7"?new Intl.DateTimeFormat("en-US",{weekday:"short"}).format(a):new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric"}).format(a)},z=a=>{const r=new Map;return y.forEach(n=>r.set(n,[])),a.forEach(n=>{const b=C(n.updatedAt);r.get(b)?.push(n)}),r},S=({conversations:a=[],activeConversationId:r,onSelectConversation:n,onNewConversation:b,onDeleteConversation:u,onSearch:x,header:w,footer:N,collapsed:m=!1,onCollapsedChange:f,className:I,...D})=>{const[h,T]=d.useState(""),[p,j]=d.useState(null),o=d.useRef(void 0);d.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]);const g=d.useMemo(()=>{if(!h.trim())return a;const s=h.toLowerCase();return a.filter(l=>l.title.toLowerCase().includes(s)||l.preview?.toLowerCase().includes(s))},[a,h]),v=d.useMemo(()=>z(g),[g]),B=d.useCallback(s=>{const l=s.target.value;T(l),x?.(l)},[x]),k=d.useCallback(s=>{n?.(s),m&&f&&f(!0)},[n,m,f]),F=d.useCallback((s,l)=>{s.stopPropagation(),p===l?(u?.(l),j(null),o.current&&clearTimeout(o.current)):(j(l),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{j(null)},3e3))},[p,u]),M=y.some(s=>(v.get(s)?.length??0)>0);return e.jsxs(e.Fragment,{children:[!m&&e.jsx("div",{className:t.default.sidebarOverlay,onClick:()=>f?.(!0),"aria-hidden":"true"}),e.jsxs("aside",{className:[t.default.sidebar,m&&t.default.sidebarCollapsed,!m&&t.default.sidebarOpen,I].filter(Boolean).join(" "),...D,children:[e.jsx("div",{className:t.default.sidebarHeader,children:w||e.jsxs(e.Fragment,{children:[e.jsx("button",{className:[t.default.inputButton,t.default.inputButtonPrimary,t.default.sidebarNewButton].filter(Boolean).join(" "),onClick:b,"aria-label":"New conversation",children:e.jsxs("span",{className:t.default.sidebarNewButtonInner,children:[e.jsx(c.Plus,{size:18}),e.jsx("span",{children:"New Chat"})]})}),e.jsx("button",{className:[t.default.inputButton,t.default.sidebarCloseButton].join(" "),onClick:()=>f?.(!0),"aria-label":"Close sidebar",children:e.jsx(c.X,{size:20})})]})}),e.jsx("div",{className:t.default.sidebarSearch,children:e.jsxs("div",{className:t.default.sidebarSearchWrapper,children:[e.jsx(c.Search,{size:16,className:t.default.sidebarSearchIcon}),e.jsx("input",{type:"search",className:[t.default.sidebarSearchInput,t.default.sidebarSearchInputWithIcon].join(" "),placeholder:"Search conversations...",value:h,onChange:B,"aria-label":"Search conversations"})]})}),e.jsx("div",{className:t.default.sidebarList,role:"list","aria-label":"Conversations",children:M?y.map(s=>{const l=v.get(s)??[];return l.length===0?null:e.jsxs("div",{children:[e.jsx("div",{className:t.default.sidebarGroupHeader,children:O[s]}),l.map(i=>e.jsxs("button",{className:[t.default.sidebarItem,i.id===r&&t.default.sidebarItemActive].filter(Boolean).join(" "),onClick:()=>k(i.id),role:"listitem","aria-selected":i.id===r,"aria-label":`Conversation: ${i.title}`,children:[e.jsx(c.MessageSquare,{size:18,className:t.default.sidebarItemIcon}),e.jsxs("div",{className:t.default.sidebarItemContent,children:[e.jsx("span",{className:t.default.sidebarItemTitle,children:i.title}),i.preview&&e.jsx("span",{className:t.default.sidebarItemPreview,children:i.preview})]}),e.jsx("span",{className:t.default.sidebarItemDate,children:P(i.updatedAt)}),u&&e.jsx("button",{className:t.default.sidebarItemDelete,onClick:q=>F(q,i.id),"aria-label":p===i.id?`Confirm delete ${i.title}`:`Delete ${i.title}`,children:p===i.id?e.jsx("span",{className:t.default.sidebarItemDeleteConfirm,children:"Delete?"}):e.jsx(c.Trash2,{size:16})})]},i.id))]},s)}):e.jsxs("div",{className:t.default.sidebarEmpty,children:[e.jsx(c.MessageSquare,{size:32,className:t.default.sidebarEmptyIcon}),e.jsx("p",{children:h?"No conversations found":"No conversations yet"})]})}),N&&e.jsx("div",{className:t.default.sidebarFooter,children:N})]})]})};S.displayName="ChatSidebar";exports.ChatSidebar=S;
@@ -1,5 +0,0 @@
1
- import { default as React } from 'react';
2
- import { ChatSidebarProps } from '../Chat.types';
3
-
4
- export declare const ChatSidebar: React.FC<ChatSidebarProps>;
5
- //# sourceMappingURL=ChatSidebar.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChatSidebar.d.ts","sourceRoot":"","sources":["../../../../src/components/Chat/components/ChatSidebar.tsx"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,KAMN,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,gBAAgB,EAAoB,MAAM,eAAe,CAAC;AAoFxE,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA2QlD,CAAC"}