@memori.ai/memori-react 8.2.0 → 8.4.0-rc.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 (146) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/components/Chat/Chat.js +8 -1
  3. package/dist/components/Chat/Chat.js.map +1 -1
  4. package/dist/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.css +160 -0
  5. package/dist/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.d.ts +4 -0
  6. package/dist/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.js +166 -0
  7. package/dist/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.js.map +1 -0
  8. package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +877 -0
  9. package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.d.ts +3 -0
  10. package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +115 -0
  11. package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -0
  12. package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.css +238 -0
  13. package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.d.ts +4 -0
  14. package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js +104 -0
  15. package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js.map +1 -0
  16. package/dist/components/MemoriArtifactSystem/components/ArtifactHistory/ArtifactHistory.css +319 -0
  17. package/dist/components/MemoriArtifactSystem/components/ArtifactHistory/ArtifactHistory.d.ts +4 -0
  18. package/dist/components/MemoriArtifactSystem/components/ArtifactHistory/ArtifactHistory.js +50 -0
  19. package/dist/components/MemoriArtifactSystem/components/ArtifactHistory/ArtifactHistory.js.map +1 -0
  20. package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +343 -0
  21. package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.d.ts +4 -0
  22. package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js +78 -0
  23. package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js.map +1 -0
  24. package/dist/components/MemoriArtifactSystem/context/ArtifactSystemContext.d.ts +12 -0
  25. package/dist/components/MemoriArtifactSystem/context/ArtifactSystemContext.js +22 -0
  26. package/dist/components/MemoriArtifactSystem/context/ArtifactSystemContext.js.map +1 -0
  27. package/dist/components/MemoriArtifactSystem/hooks/useArtifactSystem.d.ts +12 -0
  28. package/dist/components/MemoriArtifactSystem/hooks/useArtifactSystem.js +288 -0
  29. package/dist/components/MemoriArtifactSystem/hooks/useArtifactSystem.js.map +1 -0
  30. package/dist/components/MemoriArtifactSystem/index.d.ts +9 -0
  31. package/dist/components/MemoriArtifactSystem/index.js +28 -0
  32. package/dist/components/MemoriArtifactSystem/index.js.map +1 -0
  33. package/dist/components/MemoriArtifactSystem/types/artifact.types.d.ts +108 -0
  34. package/dist/components/MemoriArtifactSystem/types/artifact.types.js +31 -0
  35. package/dist/components/MemoriArtifactSystem/types/artifact.types.js.map +1 -0
  36. package/dist/components/icons/Print.d.ts +6 -0
  37. package/dist/components/icons/Print.js +6 -0
  38. package/dist/components/icons/Print.js.map +1 -0
  39. package/dist/components/layouts/Chat.js +29 -1
  40. package/dist/components/layouts/Chat.js.map +1 -1
  41. package/dist/components/layouts/FullPage.js +33 -1
  42. package/dist/components/layouts/FullPage.js.map +1 -1
  43. package/dist/components/layouts/ZoomedFullBody.js +29 -2
  44. package/dist/components/layouts/ZoomedFullBody.js.map +1 -1
  45. package/dist/components/layouts/chat.css +335 -13
  46. package/dist/components/layouts/zoomed-full-body.css +1 -3
  47. package/dist/helpers/message.js +1 -0
  48. package/dist/helpers/message.js.map +1 -1
  49. package/dist/helpers/stt/useSTT.js +76 -9
  50. package/dist/helpers/stt/useSTT.js.map +1 -1
  51. package/dist/index.js +58 -15
  52. package/dist/index.js.map +1 -1
  53. package/dist/styles.css +5 -0
  54. package/esm/components/Chat/Chat.js +8 -1
  55. package/esm/components/Chat/Chat.js.map +1 -1
  56. package/esm/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.css +160 -0
  57. package/esm/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.d.ts +4 -0
  58. package/esm/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.js +163 -0
  59. package/esm/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.js.map +1 -0
  60. package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +877 -0
  61. package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.d.ts +3 -0
  62. package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +112 -0
  63. package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -0
  64. package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.css +238 -0
  65. package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.d.ts +4 -0
  66. package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js +101 -0
  67. package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js.map +1 -0
  68. package/esm/components/MemoriArtifactSystem/components/ArtifactHistory/ArtifactHistory.css +319 -0
  69. package/esm/components/MemoriArtifactSystem/components/ArtifactHistory/ArtifactHistory.d.ts +4 -0
  70. package/esm/components/MemoriArtifactSystem/components/ArtifactHistory/ArtifactHistory.js +47 -0
  71. package/esm/components/MemoriArtifactSystem/components/ArtifactHistory/ArtifactHistory.js.map +1 -0
  72. package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +343 -0
  73. package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.d.ts +4 -0
  74. package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js +75 -0
  75. package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js.map +1 -0
  76. package/esm/components/MemoriArtifactSystem/context/ArtifactSystemContext.d.ts +12 -0
  77. package/esm/components/MemoriArtifactSystem/context/ArtifactSystemContext.js +17 -0
  78. package/esm/components/MemoriArtifactSystem/context/ArtifactSystemContext.js.map +1 -0
  79. package/esm/components/MemoriArtifactSystem/hooks/useArtifactSystem.d.ts +12 -0
  80. package/esm/components/MemoriArtifactSystem/hooks/useArtifactSystem.js +281 -0
  81. package/esm/components/MemoriArtifactSystem/hooks/useArtifactSystem.js.map +1 -0
  82. package/esm/components/MemoriArtifactSystem/index.d.ts +9 -0
  83. package/esm/components/MemoriArtifactSystem/index.js +9 -0
  84. package/esm/components/MemoriArtifactSystem/index.js.map +1 -0
  85. package/esm/components/MemoriArtifactSystem/types/artifact.types.d.ts +108 -0
  86. package/esm/components/MemoriArtifactSystem/types/artifact.types.js +28 -0
  87. package/esm/components/MemoriArtifactSystem/types/artifact.types.js.map +1 -0
  88. package/esm/components/icons/Print.d.ts +6 -0
  89. package/esm/components/icons/Print.js +4 -0
  90. package/esm/components/icons/Print.js.map +1 -0
  91. package/esm/components/layouts/Chat.js +29 -1
  92. package/esm/components/layouts/Chat.js.map +1 -1
  93. package/esm/components/layouts/FullPage.js +33 -1
  94. package/esm/components/layouts/FullPage.js.map +1 -1
  95. package/esm/components/layouts/ZoomedFullBody.js +30 -3
  96. package/esm/components/layouts/ZoomedFullBody.js.map +1 -1
  97. package/esm/components/layouts/chat.css +335 -13
  98. package/esm/components/layouts/zoomed-full-body.css +1 -3
  99. package/esm/helpers/message.js +1 -0
  100. package/esm/helpers/message.js.map +1 -1
  101. package/esm/helpers/stt/useSTT.js +76 -9
  102. package/esm/helpers/stt/useSTT.js.map +1 -1
  103. package/esm/index.js +58 -15
  104. package/esm/index.js.map +1 -1
  105. package/esm/styles.css +5 -0
  106. package/package.json +1 -1
  107. package/src/components/Avatar/Avatar.test.tsx +13 -0
  108. package/src/components/Chat/Chat.stories.tsx +33 -2
  109. package/src/components/Chat/Chat.test.tsx +340 -213
  110. package/src/components/Chat/Chat.tsx +27 -4
  111. package/src/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.css +160 -0
  112. package/src/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.tsx +278 -0
  113. package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +877 -0
  114. package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.tsx +308 -0
  115. package/src/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.css +238 -0
  116. package/src/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.tsx +282 -0
  117. package/src/components/MemoriArtifactSystem/components/ArtifactHistory/ArtifactHistory.css +319 -0
  118. package/src/components/MemoriArtifactSystem/components/ArtifactHistory/ArtifactHistory.tsx +178 -0
  119. package/src/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +343 -0
  120. package/src/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.tsx +190 -0
  121. package/src/components/MemoriArtifactSystem/context/ArtifactSystemContext.tsx +57 -0
  122. package/src/components/MemoriArtifactSystem/hooks/useArtifactSystem.ts +419 -0
  123. package/src/components/MemoriArtifactSystem/index.ts +45 -0
  124. package/src/components/MemoriArtifactSystem/types/artifact.types.ts +180 -0
  125. package/src/components/icons/Print.tsx +34 -0
  126. package/src/components/layouts/Chat.test.tsx +13 -0
  127. package/src/components/layouts/Chat.tsx +80 -25
  128. package/src/components/layouts/FullPage.test.tsx +40 -11
  129. package/src/components/layouts/FullPage.tsx +92 -24
  130. package/src/components/layouts/HiddenChat.test.tsx +13 -0
  131. package/src/components/layouts/Totem.test.tsx +13 -0
  132. package/src/components/layouts/WebsiteAssistant.test.tsx +13 -0
  133. package/src/components/layouts/ZoomedFullBody.test.tsx +13 -0
  134. package/src/components/layouts/ZoomedFullBody.tsx +78 -14
  135. package/src/components/layouts/__snapshots__/Chat.test.tsx.snap +252 -248
  136. package/src/components/layouts/__snapshots__/FullPage.test.tsx.snap +504 -496
  137. package/src/components/layouts/__snapshots__/ZoomedFullBody.test.tsx.snap +252 -248
  138. package/src/components/layouts/chat.css +335 -13
  139. package/src/components/layouts/layouts.stories.tsx +13 -2
  140. package/src/components/layouts/zoomed-full-body.css +1 -3
  141. package/src/helpers/message.ts +1 -0
  142. package/src/helpers/stt/useSTT.ts +101 -16
  143. package/src/index.stories.tsx +26 -22
  144. package/src/index.tsx +46 -0
  145. package/src/mocks/data.ts +258 -0
  146. package/src/styles.css +5 -0
@@ -0,0 +1,319 @@
1
+ /**
2
+ * ArtifactHistory CSS Styles
3
+ * Following the project's design system and CSS patterns
4
+ */
5
+
6
+ .memori-artifact-history {
7
+ display: flex;
8
+ height: 100%;
9
+ min-height: 0;
10
+ flex-direction: column;
11
+ }
12
+
13
+ /* Header */
14
+ .memori-artifact-history-header {
15
+ display: flex;
16
+ align-items: center;
17
+ justify-content: space-between;
18
+ padding: 0.75rem 0;
19
+ border-bottom: 1px solid var(--memori-button-border-color, #e9ecef);
20
+ margin-bottom: 1rem;
21
+ }
22
+
23
+ .memori-artifact-history-title {
24
+ margin: 0;
25
+ color: var(--memori-text-color, #333);
26
+ font-size: 1rem;
27
+ font-weight: 600;
28
+ }
29
+
30
+ .memori-artifact-history-actions {
31
+ display: flex;
32
+ align-items: center;
33
+ gap: 0.5rem;
34
+ }
35
+
36
+ .memori-artifact-history-clear-btn {
37
+ padding: 0.375rem;
38
+ border-radius: var(--memori-border-radius, 4px);
39
+ font-size: 0.875rem;
40
+ transition: all 0.2s ease;
41
+ }
42
+
43
+ .memori-artifact-history-clear-btn:hover {
44
+ border-color: var(--memori-error-color, #ff4d4f);
45
+ background: var(--memori-error-color, #ff4d4f);
46
+ color: white;
47
+ }
48
+
49
+ /* Empty State */
50
+ .memori-artifact-history-empty {
51
+ display: flex;
52
+ flex: 1;
53
+ flex-direction: column;
54
+ align-items: center;
55
+ justify-content: center;
56
+ padding: 2rem 1rem;
57
+ color: var(--memori-text-color, #666);
58
+ text-align: center;
59
+ }
60
+
61
+ .memori-artifact-history-empty-icon {
62
+ margin-bottom: 1rem;
63
+ font-size: 3rem;
64
+ opacity: 0.5;
65
+ }
66
+
67
+ .memori-artifact-history-empty-text {
68
+ margin: 0 0 0.5rem;
69
+ color: var(--memori-text-color, #333);
70
+ font-size: 1rem;
71
+ font-weight: 500;
72
+ }
73
+
74
+ .memori-artifact-history-empty-subtext {
75
+ margin: 0;
76
+ font-size: 0.875rem;
77
+ opacity: 0.7;
78
+ }
79
+
80
+ /* History List */
81
+ .memori-artifact-history-list {
82
+ flex: 1;
83
+ padding-right: 0.25rem;
84
+ overflow-y: auto;
85
+ }
86
+
87
+ .memori-artifact-history-item {
88
+ border: 1px solid var(--memori-button-border-color, #e9ecef);
89
+ border-radius: var(--memori-border-radius, 8px);
90
+ margin-bottom: 0.75rem;
91
+ animation: fadeInUp 0.4s ease forwards;
92
+ background: var(--memori-chat-bubble-bg, #fff);
93
+ cursor: pointer;
94
+ opacity: 0;
95
+ transform: translateY(10px);
96
+ transition: all 0.3s ease;
97
+ }
98
+
99
+ .memori-artifact-history-item:hover {
100
+ border-color: var(--memori-primary);
101
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
102
+ transform: translateY(-2px);
103
+ }
104
+
105
+ .memori-artifact-history-item--active {
106
+ border-color: var(--memori-primary);
107
+ background: linear-gradient(135deg, var(--memori-primary) 0%, #764ba2 100%);
108
+ box-shadow: 0 4px 12px rgba(130, 70, 175, 0.3);
109
+ color: var(--memori-primary-text, #fff);
110
+ }
111
+
112
+ .memori-artifact-history-item--active:hover {
113
+ box-shadow: 0 6px 16px rgba(130, 70, 175, 0.4);
114
+ transform: translateY(-2px);
115
+ }
116
+
117
+ .memori-artifact-history-item-content {
118
+ display: flex;
119
+ align-items: center;
120
+ padding: 1rem;
121
+ gap: 0.75rem;
122
+ }
123
+
124
+ .memori-artifact-history-item-icon {
125
+ flex-shrink: 0;
126
+ font-size: 1.5rem;
127
+ line-height: 1;
128
+ }
129
+
130
+ .memori-artifact-history-item-info {
131
+ min-width: 0;
132
+ flex: 1;
133
+ }
134
+
135
+ .memori-artifact-history-item-title {
136
+ overflow: hidden;
137
+ margin-bottom: 0.25rem;
138
+ color: inherit;
139
+ font-size: 0.875rem;
140
+ font-weight: 600;
141
+ text-overflow: ellipsis;
142
+ white-space: nowrap;
143
+ }
144
+
145
+ .memori-artifact-history-item-subtitle {
146
+ overflow: hidden;
147
+ margin-bottom: 0.25rem;
148
+ color: inherit;
149
+ font-size: 0.75rem;
150
+ opacity: 0.7;
151
+ text-overflow: ellipsis;
152
+ white-space: nowrap;
153
+ }
154
+
155
+ .memori-artifact-history-item-meta {
156
+ display: flex;
157
+ flex-wrap: wrap;
158
+ font-size: 0.625rem;
159
+ gap: 0.5rem;
160
+ opacity: 0.6;
161
+ }
162
+
163
+ .memori-artifact-history-item-type {
164
+ padding: 0.125rem 0.375rem;
165
+ border-radius: 10px;
166
+ background: rgba(0, 0, 0, 0.1);
167
+ font-weight: 500;
168
+ letter-spacing: 0.025em;
169
+ text-transform: uppercase;
170
+ }
171
+
172
+ .memori-artifact-history-item-custom-title {
173
+ overflow: hidden;
174
+ max-width: 100px;
175
+ padding: 0.125rem 0.375rem;
176
+ border-radius: 10px;
177
+ background: rgba(0, 0, 0, 0.1);
178
+ font-style: italic;
179
+ text-overflow: ellipsis;
180
+ white-space: nowrap;
181
+ }
182
+
183
+ .memori-artifact-history-item--active .memori-artifact-history-item-type,
184
+ .memori-artifact-history-item--active .memori-artifact-history-item-custom-title {
185
+ background: rgba(255, 255, 255, 0.2);
186
+ }
187
+
188
+ .memori-artifact-history-item-actions {
189
+ flex-shrink: 0;
190
+ }
191
+
192
+ .memori-artifact-history-item-toggle {
193
+ padding: 0.375rem;
194
+ border: 1px solid rgba(0, 0, 0, 0.1);
195
+ border-radius: var(--memori-border-radius, 4px);
196
+ background: rgba(0, 0, 0, 0.05);
197
+ transition: all 0.2s ease;
198
+ }
199
+
200
+ .memori-artifact-history-item-toggle:hover {
201
+ background: rgba(0, 0, 0, 0.1);
202
+ transform: scale(1.05);
203
+ }
204
+
205
+ .memori-artifact-history-item--active .memori-artifact-history-item-toggle {
206
+ border-color: rgba(255, 255, 255, 0.3);
207
+ background: rgba(255, 255, 255, 0.2);
208
+ color: inherit;
209
+ }
210
+
211
+ .memori-artifact-history-item--active .memori-artifact-history-item-toggle:hover {
212
+ background: rgba(255, 255, 255, 0.3);
213
+ }
214
+
215
+ /* More Items Indicator */
216
+ .memori-artifact-history-more {
217
+ padding: 1rem;
218
+ border-top: 1px solid var(--memori-button-border-color, #e9ecef);
219
+ margin-top: 1rem;
220
+ text-align: center;
221
+ }
222
+
223
+ .memori-artifact-history-more-text {
224
+ margin: 0;
225
+ color: var(--memori-text-color, #666);
226
+ font-size: 0.75rem;
227
+ opacity: 0.7;
228
+ }
229
+
230
+ /* Animations */
231
+ @keyframes fadeInUp {
232
+ from {
233
+ opacity: 0;
234
+ transform: translateY(10px);
235
+ }
236
+ to {
237
+ opacity: 1;
238
+ transform: translateY(0);
239
+ }
240
+ }
241
+
242
+ /* Scrollbar Styling */
243
+ .memori-artifact-history-list::-webkit-scrollbar {
244
+ width: 4px;
245
+ }
246
+
247
+ .memori-artifact-history-list::-webkit-scrollbar-track {
248
+ background: transparent;
249
+ }
250
+
251
+ .memori-artifact-history-list::-webkit-scrollbar-thumb {
252
+ border-radius: 2px;
253
+ background: var(--memori-button-border-color, #e9ecef);
254
+ }
255
+
256
+ .memori-artifact-history-list::-webkit-scrollbar-thumb:hover {
257
+ background: var(--memori-text-color, #999);
258
+ }
259
+
260
+ /* Responsive Design */
261
+ @media (max-width: 768px) {
262
+ .memori-artifact-history-header {
263
+ flex-direction: column;
264
+ align-items: flex-start;
265
+ gap: 0.75rem;
266
+ }
267
+
268
+ .memori-artifact-history-actions {
269
+ width: 100%;
270
+ justify-content: flex-end;
271
+ }
272
+
273
+ .memori-artifact-history-item-content {
274
+ padding: 0.75rem;
275
+ gap: 0.5rem;
276
+ }
277
+
278
+ .memori-artifact-history-item-icon {
279
+ font-size: 1.25rem;
280
+ }
281
+
282
+ .memori-artifact-history-item-title {
283
+ font-size: 0.8125rem;
284
+ }
285
+
286
+ .memori-artifact-history-item-subtitle {
287
+ font-size: 0.6875rem;
288
+ }
289
+
290
+ .memori-artifact-history-item-meta {
291
+ font-size: 0.5625rem;
292
+ }
293
+ }
294
+
295
+ /* Dark Mode Support */
296
+ @media (prefers-color-scheme: dark) {
297
+ .memori-artifact-history-item {
298
+ border-color: var(--memori-button-border-color, #404040);
299
+ background: var(--memori-chat-bubble-bg, #1a1a1a);
300
+ }
301
+
302
+ .memori-artifact-history-item:hover {
303
+ box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
304
+ }
305
+
306
+ .memori-artifact-history-item-type,
307
+ .memori-artifact-history-item-custom-title {
308
+ background: rgba(255, 255, 255, 0.1);
309
+ }
310
+
311
+ .memori-artifact-history-item-toggle {
312
+ border-color: rgba(255, 255, 255, 0.1);
313
+ background: rgba(255, 255, 255, 0.05);
314
+ }
315
+
316
+ .memori-artifact-history-item-toggle:hover {
317
+ background: rgba(255, 255, 255, 0.1);
318
+ }
319
+ }
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ArtifactHistoryProps } from '../../types/artifact.types';
3
+ declare const ArtifactHistory: React.FC<ArtifactHistoryProps>;
4
+ export default ArtifactHistory;
@@ -0,0 +1,47 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useCallback, useMemo } from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import cx from 'classnames';
5
+ import Button from '../../../ui/Button';
6
+ import Close from '../../../icons/Close';
7
+ import Clear from '../../../icons/Clear';
8
+ import ArrowUp from '../../../icons/ArrowUp';
9
+ const ArtifactHistory = ({ history, onSelectArtifact, onClearHistory, maxItems = 50, }) => {
10
+ const { t } = useTranslation();
11
+ const formatBytes = useCallback((bytes) => {
12
+ if (bytes === 0)
13
+ return '0 Bytes';
14
+ const k = 1024;
15
+ const sizes = ['Bytes', 'KB', 'MB'];
16
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
17
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
18
+ }, []);
19
+ const formatTimestamp = useCallback((timestamp) => {
20
+ return timestamp.toLocaleTimeString('en-US', {
21
+ hour: '2-digit',
22
+ minute: '2-digit',
23
+ });
24
+ }, []);
25
+ const handleSelectArtifact = useCallback((artifact) => {
26
+ onSelectArtifact(artifact);
27
+ }, [onSelectArtifact]);
28
+ const handleClearHistory = useCallback(() => {
29
+ if (onClearHistory && window.confirm(t('artifact.clearHistoryConfirm', 'Are you sure you want to clear all artifact history?') || 'Are you sure you want to clear all artifact history?')) {
30
+ onClearHistory();
31
+ }
32
+ }, [onClearHistory, t]);
33
+ const limitedHistory = useMemo(() => {
34
+ return history.slice(0, maxItems);
35
+ }, [history, maxItems]);
36
+ const hasMoreItems = useMemo(() => {
37
+ return history.length > maxItems;
38
+ }, [history.length, maxItems]);
39
+ if (history.length === 0) {
40
+ return (_jsxs("div", { className: "memori-artifact-history", children: [_jsx("div", { className: "memori-artifact-history-header", children: _jsx("h3", { className: "memori-artifact-history-title", children: t('artifact.history', 'Artifact History') }) }), _jsxs("div", { className: "memori-artifact-history-empty", children: [_jsx("div", { className: "memori-artifact-history-empty-icon", children: "\uD83D\uDCC4" }), _jsx("p", { className: "memori-artifact-history-empty-text", children: t('artifact.noHistory', 'No artifacts yet') }), _jsx("p", { className: "memori-artifact-history-empty-subtext", children: t('artifact.noHistorySubtext', 'Artifacts will appear here when generated') })] })] }));
41
+ }
42
+ return (_jsxs("div", { className: "memori-artifact-history", children: [_jsxs("div", { className: "memori-artifact-history-header", children: [_jsx("h3", { className: "memori-artifact-history-title", children: t('artifact.history', 'Artifact History') }), _jsx("div", { className: "memori-artifact-history-actions", children: onClearHistory && (_jsx(Button, { onClick: handleClearHistory, className: "memori-artifact-history-clear-btn", ghost: true, title: t('artifact.clearHistory', 'Clear history') || 'Clear history', children: _jsx(Clear, { className: "memori-artifact-history-clear-btn-icon" }) })) })] }), _jsxs("div", { className: "memori-artifact-history-list", children: [limitedHistory.map((artifact) => (_jsx("div", { className: cx('memori-artifact-history-item', {
43
+ 'memori-artifact-history-item--active': artifact.isActive,
44
+ }), onClick: () => handleSelectArtifact(artifact), children: _jsxs("div", { className: "memori-artifact-history-item-content", children: [_jsx("div", { className: "memori-artifact-history-item-icon", children: artifact.typeInfo.icon }), _jsxs("div", { className: "memori-artifact-history-item-info", children: [_jsx("div", { className: "memori-artifact-history-item-title", children: artifact.title }), _jsxs("div", { className: "memori-artifact-history-item-subtitle", children: [t('artifact.generatedAt', 'Generated at'), " ", formatTimestamp(artifact.timestamp), " \u2022 ", formatBytes(artifact.size)] }), _jsxs("div", { className: "memori-artifact-history-item-meta", children: [_jsx("span", { className: "memori-artifact-history-item-type", children: artifact.typeInfo.name }), artifact.customTitle && (_jsx("span", { className: "memori-artifact-history-item-custom-title", children: artifact.customTitle }))] })] }), _jsx("div", { className: "memori-artifact-history-item-actions", children: _jsx(Button, { className: "memori-artifact-history-item-toggle", ghost: true, title: artifact.isActive ? (t('artifact.close', 'Close') || 'Close') : (t('artifact.open', 'Open') || 'Open'), children: artifact.isActive ? (_jsx(Close, { className: "memori-artifact-history-item-toggle-icon" })) : (_jsx(ArrowUp, { className: "memori-artifact-history-item-toggle-icon" })) }) })] }) }, artifact.id))), hasMoreItems && (_jsx("div", { className: "memori-artifact-history-more", children: _jsx("p", { className: "memori-artifact-history-more-text", children: t('artifact.moreItems', `+${history.length - maxItems} more items`) }) }))] })] }));
45
+ };
46
+ export default ArtifactHistory;
47
+ //# sourceMappingURL=ArtifactHistory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArtifactHistory.js","sourceRoot":"","sources":["../../../../../src/components/MemoriArtifactSystem/components/ArtifactHistory/ArtifactHistory.tsx"],"names":[],"mappings":";AAMA,OAAc,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,MAAM,MAAM,oBAAoB,CAAC;AAExC,OAAO,KAAK,MAAM,sBAAsB,CAAC;AACzC,OAAO,KAAK,MAAM,sBAAsB,CAAC;AACzC,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAE7C,MAAM,eAAe,GAAmC,CAAC,EACvD,OAAO,EACP,gBAAgB,EAChB,cAAc,EACd,QAAQ,GAAG,EAAE,GACd,EAAE,EAAE;IACH,MAAM,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,CAAC;IAK/B,MAAM,WAAW,GAAG,WAAW,CAAC,CAAC,KAAa,EAAU,EAAE;QACxD,IAAI,KAAK,KAAK,CAAC;YAAE,OAAO,SAAS,CAAC;QAClC,MAAM,CAAC,GAAG,IAAI,CAAC;QACf,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACpC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACpD,OAAO,UAAU,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC1E,CAAC,EAAE,EAAE,CAAC,CAAC;IAKP,MAAM,eAAe,GAAG,WAAW,CAAC,CAAC,SAAe,EAAU,EAAE;QAC9D,OAAO,SAAS,CAAC,k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