@memori.ai/memori-react 8.11.0 → 8.13.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.
- package/CHANGELOG.md +74 -0
- package/dist/components/AgeVerificationModal/AgeVerificationModal.css +41 -14
- package/dist/components/AgeVerificationModal/AgeVerificationModal.js +2 -2
- package/dist/components/AgeVerificationModal/AgeVerificationModal.js.map +1 -1
- package/dist/components/Auth/Auth.js +36 -8
- package/dist/components/Auth/Auth.js.map +1 -1
- package/dist/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.css +2 -2
- package/dist/components/Chat/Chat.css +37 -3
- package/dist/components/Chat/Chat.js +61 -23
- package/dist/components/Chat/Chat.js.map +1 -1
- package/dist/components/ChatBubble/ChatBubble.css +87 -15
- package/dist/components/ChatBubble/ChatBubble.js +129 -19
- package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
- package/dist/components/ChatHistoryDrawer/ChatHistory.css +5 -1
- package/dist/components/ChatInputs/ChatInputs.css +293 -17
- package/dist/components/ChatInputs/ChatInputs.d.ts +1 -0
- package/dist/components/ChatInputs/ChatInputs.js +48 -27
- package/dist/components/ChatInputs/ChatInputs.js.map +1 -1
- package/dist/components/ChatTextArea/ChatTextArea.css +75 -31
- package/dist/components/ChatTextArea/ChatTextArea.js +47 -18
- package/dist/components/ChatTextArea/ChatTextArea.js.map +1 -1
- package/dist/components/DateSelector/DateSelector.css +125 -104
- package/dist/components/DateSelector/DateSelector.d.ts +1 -1
- package/dist/components/DateSelector/DateSelector.js +110 -52
- package/dist/components/DateSelector/DateSelector.js.map +1 -1
- package/dist/components/FilePreview/FilePreview.css +225 -146
- package/dist/components/FilePreview/FilePreview.d.ts +1 -2
- package/dist/components/FilePreview/FilePreview.js +20 -6
- package/dist/components/FilePreview/FilePreview.js.map +1 -1
- package/dist/components/Header/Header.css +2 -2
- package/dist/components/Header/Header.js +1 -1
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/LoginDrawer/LoginDrawer.css +37 -5
- package/dist/components/LoginDrawer/LoginDrawer.d.ts +1 -2
- package/dist/components/LoginDrawer/LoginDrawer.js +2 -9
- package/dist/components/LoginDrawer/LoginDrawer.js.map +1 -1
- package/dist/components/MediaWidget/MediaItemWidget.js +2 -1
- package/dist/components/MediaWidget/MediaItemWidget.js.map +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.js +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.js.map +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyButtonWithDropdown.js +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyButtonWithDropdown.js.map +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyMenuItem.js +3 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyMenuItem.js.map +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +2 -2
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +16 -7
- package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js +6 -4
- package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js.map +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.css +11 -2
- package/dist/components/MemoriWidget/MemoriWidget.js +105 -25
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/MicrophoneButton/MicrophoneButton.css +2 -2
- package/dist/components/StartPanel/StartPanel.css +8 -0
- package/dist/components/UploadButton/UploadButton.css +20 -17
- package/dist/components/UploadButton/UploadButton.js +218 -87
- package/dist/components/UploadButton/UploadButton.js.map +1 -1
- package/dist/components/UploadButton/UploadDocuments/UploadDocuments.js +14 -4
- package/dist/components/UploadButton/UploadDocuments/UploadDocuments.js.map +1 -1
- package/dist/components/UploadButton/UploadImages/UploadImages.js +143 -16
- package/dist/components/UploadButton/UploadImages/UploadImages.js.map +1 -1
- package/dist/components/layouts/chat.css +1 -1
- package/dist/components/ui/Drawer.css +8 -0
- package/dist/components/ui/Drawer.d.ts +2 -0
- package/dist/components/ui/Drawer.js +2 -2
- package/dist/components/ui/Drawer.js.map +1 -1
- package/dist/components/ui/Tooltip.css +49 -1
- package/dist/components/ui/Tooltip.d.ts +1 -1
- package/dist/helpers/constants.d.ts +1 -0
- package/dist/helpers/constants.js +2 -1
- package/dist/helpers/constants.js.map +1 -1
- package/dist/helpers/imageCompression.d.ts +7 -0
- package/dist/helpers/imageCompression.js +123 -0
- package/dist/helpers/imageCompression.js.map +1 -0
- package/dist/locales/de.json +13 -5
- package/dist/locales/en.json +17 -6
- package/dist/locales/es.json +13 -5
- package/dist/locales/fr.json +12 -5
- package/dist/locales/it.json +16 -6
- package/dist/styles.css +4 -4
- package/esm/components/AgeVerificationModal/AgeVerificationModal.css +41 -14
- package/esm/components/AgeVerificationModal/AgeVerificationModal.js +2 -2
- package/esm/components/AgeVerificationModal/AgeVerificationModal.js.map +1 -1
- package/esm/components/Auth/Auth.js +36 -8
- package/esm/components/Auth/Auth.js.map +1 -1
- package/esm/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.css +2 -2
- package/esm/components/Chat/Chat.css +37 -3
- package/esm/components/Chat/Chat.js +61 -23
- package/esm/components/Chat/Chat.js.map +1 -1
- package/esm/components/ChatBubble/ChatBubble.css +87 -15
- package/esm/components/ChatBubble/ChatBubble.js +130 -20
- package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
- package/esm/components/ChatHistoryDrawer/ChatHistory.css +5 -1
- package/esm/components/ChatInputs/ChatInputs.css +293 -17
- package/esm/components/ChatInputs/ChatInputs.d.ts +1 -0
- package/esm/components/ChatInputs/ChatInputs.js +49 -28
- package/esm/components/ChatInputs/ChatInputs.js.map +1 -1
- package/esm/components/ChatTextArea/ChatTextArea.css +75 -31
- package/esm/components/ChatTextArea/ChatTextArea.js +49 -20
- package/esm/components/ChatTextArea/ChatTextArea.js.map +1 -1
- package/esm/components/DateSelector/DateSelector.css +125 -104
- package/esm/components/DateSelector/DateSelector.d.ts +1 -1
- package/esm/components/DateSelector/DateSelector.js +111 -52
- package/esm/components/DateSelector/DateSelector.js.map +1 -1
- package/esm/components/FilePreview/FilePreview.css +225 -146
- package/esm/components/FilePreview/FilePreview.d.ts +1 -2
- package/esm/components/FilePreview/FilePreview.js +21 -7
- package/esm/components/FilePreview/FilePreview.js.map +1 -1
- package/esm/components/Header/Header.css +2 -2
- package/esm/components/Header/Header.js +1 -1
- package/esm/components/Header/Header.js.map +1 -1
- package/esm/components/LoginDrawer/LoginDrawer.css +37 -5
- package/esm/components/LoginDrawer/LoginDrawer.d.ts +1 -2
- package/esm/components/LoginDrawer/LoginDrawer.js +2 -9
- package/esm/components/LoginDrawer/LoginDrawer.js.map +1 -1
- package/esm/components/MediaWidget/MediaItemWidget.js +2 -1
- package/esm/components/MediaWidget/MediaItemWidget.js.map +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.js +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.js.map +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyButtonWithDropdown.js +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyButtonWithDropdown.js.map +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyMenuItem.js +3 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyMenuItem.js.map +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +2 -2
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +16 -7
- package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js +6 -4
- package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.css +11 -2
- package/esm/components/MemoriWidget/MemoriWidget.js +105 -25
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/MicrophoneButton/MicrophoneButton.css +2 -2
- package/esm/components/StartPanel/StartPanel.css +8 -0
- package/esm/components/UploadButton/UploadButton.css +20 -17
- package/esm/components/UploadButton/UploadButton.js +219 -88
- package/esm/components/UploadButton/UploadButton.js.map +1 -1
- package/esm/components/UploadButton/UploadDocuments/UploadDocuments.js +14 -4
- package/esm/components/UploadButton/UploadDocuments/UploadDocuments.js.map +1 -1
- package/esm/components/UploadButton/UploadImages/UploadImages.js +143 -16
- package/esm/components/UploadButton/UploadImages/UploadImages.js.map +1 -1
- package/esm/components/layouts/chat.css +1 -1
- package/esm/components/ui/Drawer.css +8 -0
- package/esm/components/ui/Drawer.d.ts +2 -0
- package/esm/components/ui/Drawer.js +2 -2
- package/esm/components/ui/Drawer.js.map +1 -1
- package/esm/components/ui/Tooltip.css +49 -1
- package/esm/components/ui/Tooltip.d.ts +1 -1
- package/esm/helpers/constants.d.ts +1 -0
- package/esm/helpers/constants.js +1 -0
- package/esm/helpers/constants.js.map +1 -1
- package/esm/helpers/imageCompression.d.ts +7 -0
- package/esm/helpers/imageCompression.js +119 -0
- package/esm/helpers/imageCompression.js.map +1 -0
- package/esm/locales/de.json +13 -5
- package/esm/locales/en.json +17 -6
- package/esm/locales/es.json +13 -5
- package/esm/locales/fr.json +12 -5
- package/esm/locales/it.json +16 -6
- package/esm/styles.css +4 -4
- package/package.json +2 -2
- package/src/components/AgeVerificationModal/AgeVerificationModal.css +41 -14
- package/src/components/AgeVerificationModal/AgeVerificationModal.tsx +3 -1
- package/src/components/Auth/Auth.tsx +55 -11
- package/src/components/Avatar/Avatar.stories.tsx +3 -0
- package/src/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.css +2 -2
- package/src/components/Chat/Chat.css +37 -3
- package/src/components/Chat/Chat.stories.tsx +16 -2
- package/src/components/Chat/Chat.tsx +90 -21
- package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +1752 -812
- package/src/components/ChatBubble/ChatBubble.css +87 -15
- package/src/components/ChatBubble/ChatBubble.stories.tsx +16 -2
- package/src/components/ChatBubble/ChatBubble.test.tsx +17 -0
- package/src/components/ChatBubble/ChatBubble.tsx +237 -33
- package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +304 -8
- package/src/components/ChatHistoryDrawer/ChatHistory.css +5 -1
- package/src/components/ChatInputs/ChatInputs.css +293 -17
- package/src/components/ChatInputs/ChatInputs.tsx +156 -86
- package/src/components/ChatInputs/__snapshots__/ChatInputs.test.tsx.snap +430 -424
- package/src/components/ChatTextArea/ChatTextArea.css +75 -31
- package/src/components/ChatTextArea/ChatTextArea.test.tsx +1 -16
- package/src/components/ChatTextArea/ChatTextArea.tsx +51 -22
- package/src/components/ChatTextArea/__snapshots__/ChatTextArea.test.tsx.snap +9 -72
- package/src/components/DateSelector/DateSelector.css +125 -104
- package/src/components/DateSelector/DateSelector.stories.tsx +1 -1
- package/src/components/DateSelector/DateSelector.test.tsx +137 -23
- package/src/components/DateSelector/DateSelector.tsx +203 -177
- package/src/components/FilePreview/FilePreview.css +225 -146
- package/src/components/FilePreview/FilePreview.tsx +49 -36
- package/src/components/FilePreview/__snapshots__/FilePreview.test.tsx.snap +2 -2
- package/src/components/Header/Header.css +2 -2
- package/src/components/Header/Header.stories.tsx +5 -1
- package/src/components/Header/Header.tsx +1 -1
- package/src/components/Header/__snapshots__/Header.test.tsx.snap +1 -1
- package/src/components/LoginDrawer/LoginDrawer.css +37 -5
- package/src/components/LoginDrawer/LoginDrawer.stories.tsx +0 -1
- package/src/components/LoginDrawer/LoginDrawer.test.tsx +0 -1
- package/src/components/LoginDrawer/LoginDrawer.tsx +0 -19
- package/src/components/MediaWidget/MediaItemWidget.tsx +2 -1
- package/src/components/MemoriArtifactSystem/ArtifactDrawer.stories.tsx +996 -204
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.tsx +2 -2
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyButtonWithDropdown.tsx +1 -1
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyMenuItem.tsx +3 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.tsx +56 -54
- package/src/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +16 -7
- package/src/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.tsx +12 -3
- package/src/components/MemoriWidget/MemoriWidget.css +11 -2
- package/src/components/MemoriWidget/MemoriWidget.stories.tsx +6 -3
- package/src/components/MemoriWidget/MemoriWidget.tsx +173 -49
- package/src/components/MicrophoneButton/MicrophoneButton.css +2 -2
- package/src/components/StartPanel/StartPanel.css +8 -0
- package/src/components/UploadButton/UploadButton.css +20 -17
- package/src/components/UploadButton/UploadButton.stories.tsx +247 -35
- package/src/components/UploadButton/UploadButton.tsx +280 -173
- package/src/components/UploadButton/UploadDocuments/UploadDocuments.tsx +19 -4
- package/src/components/UploadButton/UploadImages/UploadImages.tsx +196 -35
- package/src/components/UploadButton/__snapshots__/UploadButton.test.tsx.snap +10 -1
- package/src/components/layouts/FullBody/FullBody.stories.tsx +9 -10
- package/src/components/layouts/Totem/Totem.stories.tsx +8 -9
- package/src/components/layouts/ZoomedFullBody/ZoomedFullBody.stories.tsx +8 -9
- package/src/components/layouts/chat.css +1 -1
- package/src/components/layouts/layouts.stories.tsx +10 -9
- package/src/components/ui/Drawer.css +8 -0
- package/src/components/ui/Drawer.tsx +16 -12
- package/src/components/ui/Tooltip.css +49 -1
- package/src/components/ui/Tooltip.tsx +1 -1
- package/src/helpers/constants.ts +1 -1
- package/src/helpers/imageCompression.ts +230 -0
- package/src/index.stories.tsx +18 -0
- package/src/locales/de.json +13 -5
- package/src/locales/en.json +17 -6
- package/src/locales/es.json +13 -5
- package/src/locales/fr.json +12 -5
- package/src/locales/it.json +16 -6
- package/src/mocks/data.ts +4 -2
- package/src/styles.css +4 -4
- package/src/components/SignupForm/SignupForm.test.tsx +0 -40
- package/src/components/SignupForm/SignupForm.tsx +0 -457
- package/src/components/SignupForm/__snapshots__/SignupForm.test.tsx.snap +0 -247
- package/src/components/UploadMenu/UploadMenu.css +0 -47
- package/src/components/UploadMenu/UploadMenu.stories.tsx +0 -66
- package/src/components/UploadMenu/UploadMenu.test.tsx +0 -34
- package/src/components/UploadMenu/UploadMenu.tsx +0 -68
- package/src/components/UploadMenu/__snapshots__/UploadMenu.test.tsx.snap +0 -137
|
@@ -1,78 +1,128 @@
|
|
|
1
1
|
.memori-chat-textarea {
|
|
2
2
|
position: relative;
|
|
3
|
-
|
|
3
|
+
display: flex;
|
|
4
|
+
width: 100%;
|
|
5
|
+
min-height: 36px;
|
|
4
6
|
box-sizing: border-box;
|
|
5
|
-
flex: 1
|
|
6
|
-
|
|
7
|
+
flex: 1;
|
|
8
|
+
align-items: center;
|
|
7
9
|
transition: height 0.2s ease-in-out;
|
|
8
|
-
/* margin-left: 0.5rem; */
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
.memori-chat-textarea--expanded {
|
|
12
|
-
height:
|
|
13
|
+
min-height: 36px;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
/* Responsive adjustments for small screens */
|
|
16
17
|
@media (max-width: 768px) {
|
|
17
18
|
.memori-chat-textarea--expanded {
|
|
18
|
-
height:
|
|
19
|
+
min-height: 36px;
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
@media (max-width: 480px) {
|
|
23
24
|
.memori-chat-textarea--expanded {
|
|
24
|
-
height:
|
|
25
|
+
min-height: 36px;
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
.memori-chat-textarea--inner {
|
|
29
|
-
position:
|
|
30
|
-
right: 0;
|
|
31
|
-
bottom: 0;
|
|
32
|
-
left: 0;
|
|
30
|
+
position: relative;
|
|
33
31
|
display: flex;
|
|
34
32
|
overflow: hidden;
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
width: 100%;
|
|
34
|
+
min-height: 36px;
|
|
35
|
+
max-height: 208px;
|
|
37
36
|
box-sizing: border-box;
|
|
38
|
-
border:
|
|
39
|
-
border-radius:
|
|
40
|
-
background:
|
|
41
|
-
transition:
|
|
37
|
+
border: none;
|
|
38
|
+
border-radius: 0;
|
|
39
|
+
background: transparent;
|
|
40
|
+
transition: height 0.2s ease-in-out;
|
|
42
41
|
}
|
|
43
42
|
|
|
44
43
|
.memori-chat-textarea--expanded .memori-chat-textarea--inner {
|
|
45
|
-
max-height:
|
|
44
|
+
max-height: 208px;
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
/* Responsive adjustments for textarea inner */
|
|
49
48
|
@media (max-width: 768px) {
|
|
49
|
+
.memori-chat-textarea--inner {
|
|
50
|
+
max-height: 200px;
|
|
51
|
+
}
|
|
52
|
+
|
|
50
53
|
.memori-chat-textarea--expanded .memori-chat-textarea--inner {
|
|
51
54
|
max-height: 200px;
|
|
52
55
|
}
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
@media (max-width: 480px) {
|
|
59
|
+
.memori-chat-textarea--inner {
|
|
60
|
+
max-height: 150px;
|
|
61
|
+
}
|
|
62
|
+
|
|
56
63
|
.memori-chat-textarea--expanded .memori-chat-textarea--inner {
|
|
57
64
|
max-height: 150px;
|
|
58
65
|
}
|
|
59
66
|
}
|
|
60
67
|
|
|
61
68
|
.memori-chat-textarea--disabled .memori-chat-textarea--inner {
|
|
62
|
-
|
|
63
|
-
opacity: 0.8;
|
|
69
|
+
opacity: 0.5;
|
|
64
70
|
}
|
|
65
71
|
|
|
66
72
|
textarea.memori-chat-textarea--input {
|
|
67
73
|
width: 100%;
|
|
68
|
-
height:
|
|
74
|
+
min-height: 36px;
|
|
75
|
+
max-height: 208px;
|
|
69
76
|
box-sizing: border-box;
|
|
70
|
-
padding:
|
|
77
|
+
/* padding: 8px 0; */
|
|
71
78
|
border: none;
|
|
72
|
-
background:
|
|
79
|
+
background: transparent;
|
|
73
80
|
color: #000;
|
|
74
|
-
font-family: var(--memori-font-family);
|
|
81
|
+
font-family: var(--memori-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif);
|
|
82
|
+
font-size: 16px;
|
|
83
|
+
line-height: 1.5;
|
|
84
|
+
overflow-y: auto;
|
|
75
85
|
resize: none;
|
|
86
|
+
scrollbar-width: thin;
|
|
87
|
+
transition: height 0.2s ease-in-out;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Placeholder styling */
|
|
91
|
+
textarea.memori-chat-textarea--input::placeholder {
|
|
92
|
+
color: rgba(0, 0, 0, 0.5);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* Scrollbar styling */
|
|
96
|
+
textarea.memori-chat-textarea--input::-webkit-scrollbar {
|
|
97
|
+
width: 6px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
textarea.memori-chat-textarea--input::-webkit-scrollbar-track {
|
|
101
|
+
background: transparent;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
textarea.memori-chat-textarea--input::-webkit-scrollbar-thumb {
|
|
105
|
+
border-radius: 3px;
|
|
106
|
+
background: rgba(0, 0, 0, 0.2);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
textarea.memori-chat-textarea--input::-webkit-scrollbar-thumb:hover {
|
|
110
|
+
background: rgba(0, 0, 0, 0.3);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* Responsive adjustments for textarea input */
|
|
114
|
+
@media (max-width: 768px) {
|
|
115
|
+
textarea.memori-chat-textarea--input {
|
|
116
|
+
max-height: 200px;
|
|
117
|
+
font-size: 16px; /* Prevent zoom on iOS */
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
@media (max-width: 480px) {
|
|
122
|
+
textarea.memori-chat-textarea--input {
|
|
123
|
+
max-height: 150px;
|
|
124
|
+
font-size: 16px; /* Prevent zoom on iOS */
|
|
125
|
+
}
|
|
76
126
|
}
|
|
77
127
|
|
|
78
128
|
textarea.memori-chat-textarea--input:focus {
|
|
@@ -81,6 +131,7 @@ textarea.memori-chat-textarea--input:focus {
|
|
|
81
131
|
|
|
82
132
|
.memori-chat-textarea--disabled textarea.memori-chat-textarea--input {
|
|
83
133
|
cursor: not-allowed;
|
|
134
|
+
opacity: 0.5;
|
|
84
135
|
}
|
|
85
136
|
|
|
86
137
|
.memori-chat-textarea--expand {
|
|
@@ -97,15 +148,12 @@ button.memori-chat-textarea--expand-button {
|
|
|
97
148
|
|
|
98
149
|
button.memori-chat-textarea--expand-button:hover,
|
|
99
150
|
button.memori-chat-textarea--expand-button:focus {
|
|
100
|
-
color: #000;
|
|
101
151
|
opacity: 1;
|
|
102
152
|
}
|
|
103
153
|
|
|
104
154
|
.memori-chat-textarea:not(.memori-chat-textarea--disabled) .memori-chat-textarea--inner:hover,
|
|
105
155
|
.memori-chat-textarea:not(.memori-chat-textarea--disabled) .memori-chat-textarea--inner:focus,
|
|
106
156
|
.memori-chat-textarea:not(.memori-chat-textarea--disabled) .memori-chat-textarea--inner:focus-within {
|
|
107
|
-
border-color: var(--memori-primary);
|
|
108
|
-
box-shadow: none;
|
|
109
157
|
outline: none;
|
|
110
158
|
}
|
|
111
159
|
|
|
@@ -117,7 +165,3 @@ button.memori-chat-textarea--expand-button:focus {
|
|
|
117
165
|
.memori-chat-textarea--expand-button {
|
|
118
166
|
opacity: 1;
|
|
119
167
|
}
|
|
120
|
-
|
|
121
|
-
.memori-chat-textarea:not(.memori-chat-textarea--disabled) .memori-chat-textarea-inner:focus-within {
|
|
122
|
-
box-shadow: 0 0.2rem 0.33rem #b5b6c4;
|
|
123
|
-
}
|
|
@@ -25,19 +25,4 @@ it('renders ChatTextArea with long text unchanged', () => {
|
|
|
25
25
|
/>
|
|
26
26
|
);
|
|
27
27
|
expect(container).toMatchSnapshot();
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('renders ChatTextArea expanded unchanged', () => {
|
|
31
|
-
render(
|
|
32
|
-
<ChatTextArea
|
|
33
|
-
value="Suspendisse sit amet volutpat velit. Nunc at commodo tortor, id rutrum nunc. Vivamus condimentum vel nunc et congue. Ut laoreet imperdiet nisi ac finibus. Suspendisse molestie risus a justo sagittis efficitur. Suspendisse sit amet volutpat velit. Nunc at commodo tortor, id rutrum nunc. Vivamus condimentum vel nunc et congue. Ut laoreet imperdiet nisi ac finibus. Suspendisse molestie risus a justo sagittis efficitur."
|
|
34
|
-
onChange={jest.fn()}
|
|
35
|
-
/>
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
fireEvent.click(screen.getByRole('button'));
|
|
39
|
-
|
|
40
|
-
expect(screen.getByTestId('chat-textarea').classList).toContain(
|
|
41
|
-
'memori-chat-textarea--expanded'
|
|
42
|
-
);
|
|
43
|
-
});
|
|
28
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
2
2
|
import cx from 'classnames';
|
|
3
3
|
import Button from '../ui/Button';
|
|
4
4
|
import Expand from '../icons/Expand';
|
|
@@ -25,29 +25,70 @@ const ChatTextArea: React.FC<Props> = ({
|
|
|
25
25
|
onExpandedChange,
|
|
26
26
|
}) => {
|
|
27
27
|
const { t } = useTranslation();
|
|
28
|
-
const
|
|
28
|
+
const textareaRef = useRef<HTMLTextAreaElement>(null);
|
|
29
|
+
const innerRef = useRef<HTMLDivElement>(null);
|
|
30
|
+
const MIN_HEIGHT = 36;
|
|
31
|
+
const MAX_HEIGHT = 208;
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
// Auto-expand textarea based on content (only when not manually expanded)
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const textarea = textareaRef.current;
|
|
36
|
+
const inner = innerRef.current;
|
|
37
|
+
|
|
38
|
+
if (textarea && inner) {
|
|
39
|
+
if (value.length === 0) {
|
|
40
|
+
textarea.style.height = `${MIN_HEIGHT}px`;
|
|
41
|
+
inner.style.height = `${MIN_HEIGHT}px`;
|
|
42
|
+
if (onExpandedChange) {
|
|
43
|
+
onExpandedChange(false);
|
|
44
|
+
}
|
|
45
|
+
//reset the padding bottom of the chat
|
|
46
|
+
const chat = document.getElementsByClassName('memori-chat--content');
|
|
47
|
+
if (chat) {
|
|
48
|
+
const lastChild = chat[chat.length - 1];
|
|
49
|
+
if (lastChild) {
|
|
50
|
+
(lastChild as HTMLElement).style.paddingBottom = '0px';
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
} else {
|
|
54
|
+
textarea.style.height = 'auto';
|
|
55
|
+
const scrollHeight = textarea.scrollHeight;
|
|
56
|
+
const newHeight = Math.min(Math.max(scrollHeight, MIN_HEIGHT), MAX_HEIGHT);
|
|
57
|
+
textarea.style.height = `${newHeight}px`;
|
|
58
|
+
inner.style.height = `${newHeight}px`;
|
|
59
|
+
|
|
60
|
+
//set the padding bottom to the chat in order to keep the whole chat visible
|
|
61
|
+
// take last child of chat wrapper and set the padding bottom to the height of the textarea
|
|
62
|
+
const chat = document.getElementsByClassName('memori-chat--content');
|
|
63
|
+
if (chat) {
|
|
64
|
+
const lastChild = chat[chat.length - 1];
|
|
65
|
+
if (lastChild) {
|
|
66
|
+
// (lastChild as HTMLElement).style.paddingBottom = `${newHeight}px`;
|
|
67
|
+
//then scroll to the bottom of the chat
|
|
68
|
+
(chat[0] as HTMLElement).scrollTo({
|
|
69
|
+
top: (chat[0] as HTMLElement).scrollHeight,
|
|
70
|
+
behavior: 'smooth'
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
35
75
|
}
|
|
36
|
-
};
|
|
76
|
+
}, [value]);
|
|
37
77
|
|
|
38
78
|
return (
|
|
39
79
|
<div
|
|
40
80
|
data-testid="chat-textarea"
|
|
41
81
|
className={cx('memori-chat-textarea', {
|
|
42
|
-
'memori-chat-textarea--expanded': expanded,
|
|
43
82
|
'memori-chat-textarea--disabled': disabled,
|
|
44
83
|
})}
|
|
45
84
|
>
|
|
46
|
-
<div className="memori-chat-textarea--inner">
|
|
85
|
+
<div ref={innerRef} className="memori-chat-textarea--inner">
|
|
47
86
|
<textarea
|
|
87
|
+
ref={textareaRef}
|
|
48
88
|
className="memori-chat-textarea--input"
|
|
49
89
|
disabled={disabled}
|
|
50
90
|
value={value}
|
|
91
|
+
placeholder={t('placeholder', 'Ask a question') || 'Ask a question'}
|
|
51
92
|
onChange={e => {
|
|
52
93
|
onChange(e.target.value);
|
|
53
94
|
}}
|
|
@@ -60,18 +101,6 @@ const ChatTextArea: React.FC<Props> = ({
|
|
|
60
101
|
onBlur={onBlur}
|
|
61
102
|
maxLength={100000}
|
|
62
103
|
/>
|
|
63
|
-
<div className="memori-chat-textarea--expand">
|
|
64
|
-
<Button
|
|
65
|
-
className={cx('memori-chat-textarea--expand-button')}
|
|
66
|
-
onClick={handleExpandToggle}
|
|
67
|
-
padded={false}
|
|
68
|
-
ghost
|
|
69
|
-
title={
|
|
70
|
-
expanded ? t('collapse') || 'Collapse' : t('expand') || 'Expand'
|
|
71
|
-
}
|
|
72
|
-
icon={expanded ? <FullscreenExit /> : <Expand />}
|
|
73
|
-
/>
|
|
74
|
-
</div>
|
|
75
104
|
</div>
|
|
76
105
|
</div>
|
|
77
106
|
);
|
|
@@ -8,35 +8,14 @@ exports[`renders ChatTextArea unchanged 1`] = `
|
|
|
8
8
|
>
|
|
9
9
|
<div
|
|
10
10
|
class="memori-chat-textarea--inner"
|
|
11
|
+
style="height: 36px;"
|
|
11
12
|
>
|
|
12
13
|
<textarea
|
|
13
14
|
class="memori-chat-textarea--input"
|
|
14
15
|
maxlength="100000"
|
|
16
|
+
placeholder="placeholder"
|
|
17
|
+
style="height: 36px;"
|
|
15
18
|
/>
|
|
16
|
-
<div
|
|
17
|
-
class="memori-chat-textarea--expand"
|
|
18
|
-
>
|
|
19
|
-
<button
|
|
20
|
-
class="memori-button memori-button--ghost memori-button--rounded memori-button--icon-only memori-chat-textarea--expand-button"
|
|
21
|
-
title="expand"
|
|
22
|
-
>
|
|
23
|
-
<span
|
|
24
|
-
class="memori-button--icon"
|
|
25
|
-
>
|
|
26
|
-
<svg
|
|
27
|
-
aria-hidden="true"
|
|
28
|
-
focusable="false"
|
|
29
|
-
role="img"
|
|
30
|
-
viewBox="0 0 1024 1024"
|
|
31
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
32
|
-
>
|
|
33
|
-
<path
|
|
34
|
-
d="M855 160.1l-189.2 23.5c-6.6.8-9.3 8.8-4.7 13.5l54.7 54.7-153.5 153.5a8.03 8.03 0 0 0 0 11.3l45.1 45.1c3.1 3.1 8.2 3.1 11.3 0l153.6-153.6 54.7 54.7a7.94 7.94 0 0 0 13.5-4.7L863.9 169a7.9 7.9 0 0 0-8.9-8.9zM416.6 562.3a8.03 8.03 0 0 0-11.3 0L251.8 715.9l-54.7-54.7a7.94 7.94 0 0 0-13.5 4.7L160.1 855c-.6 5.2 3.7 9.5 8.9 8.9l189.2-23.5c6.6-.8 9.3-8.8 4.7-13.5l-54.7-54.7 153.6-153.6c3.1-3.1 3.1-8.2 0-11.3l-45.2-45z"
|
|
35
|
-
/>
|
|
36
|
-
</svg>
|
|
37
|
-
</span>
|
|
38
|
-
</button>
|
|
39
|
-
</div>
|
|
40
19
|
</div>
|
|
41
20
|
</div>
|
|
42
21
|
</div>
|
|
@@ -50,37 +29,16 @@ exports[`renders ChatTextArea with long text unchanged 1`] = `
|
|
|
50
29
|
>
|
|
51
30
|
<div
|
|
52
31
|
class="memori-chat-textarea--inner"
|
|
32
|
+
style="height: 36px;"
|
|
53
33
|
>
|
|
54
34
|
<textarea
|
|
55
35
|
class="memori-chat-textarea--input"
|
|
56
36
|
maxlength="100000"
|
|
37
|
+
placeholder="placeholder"
|
|
38
|
+
style="height: 36px;"
|
|
57
39
|
>
|
|
58
40
|
Suspendisse sit amet volutpat velit. Nunc at commodo tortor, id rutrum nunc. Vivamus condimentum vel nunc et congue. Ut laoreet imperdiet nisi ac finibus. Suspendisse molestie risus a justo sagittis efficitur. Suspendisse sit amet volutpat velit. Nunc at commodo tortor, id rutrum nunc. Vivamus condimentum vel nunc et congue. Ut laoreet imperdiet nisi ac finibus. Suspendisse molestie risus a justo sagittis efficitur.
|
|
59
41
|
</textarea>
|
|
60
|
-
<div
|
|
61
|
-
class="memori-chat-textarea--expand"
|
|
62
|
-
>
|
|
63
|
-
<button
|
|
64
|
-
class="memori-button memori-button--ghost memori-button--rounded memori-button--icon-only memori-chat-textarea--expand-button"
|
|
65
|
-
title="expand"
|
|
66
|
-
>
|
|
67
|
-
<span
|
|
68
|
-
class="memori-button--icon"
|
|
69
|
-
>
|
|
70
|
-
<svg
|
|
71
|
-
aria-hidden="true"
|
|
72
|
-
focusable="false"
|
|
73
|
-
role="img"
|
|
74
|
-
viewBox="0 0 1024 1024"
|
|
75
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
76
|
-
>
|
|
77
|
-
<path
|
|
78
|
-
d="M855 160.1l-189.2 23.5c-6.6.8-9.3 8.8-4.7 13.5l54.7 54.7-153.5 153.5a8.03 8.03 0 0 0 0 11.3l45.1 45.1c3.1 3.1 8.2 3.1 11.3 0l153.6-153.6 54.7 54.7a7.94 7.94 0 0 0 13.5-4.7L863.9 169a7.9 7.9 0 0 0-8.9-8.9zM416.6 562.3a8.03 8.03 0 0 0-11.3 0L251.8 715.9l-54.7-54.7a7.94 7.94 0 0 0-13.5 4.7L160.1 855c-.6 5.2 3.7 9.5 8.9 8.9l189.2-23.5c6.6-.8 9.3-8.8 4.7-13.5l-54.7-54.7 153.6-153.6c3.1-3.1 3.1-8.2 0-11.3l-45.2-45z"
|
|
79
|
-
/>
|
|
80
|
-
</svg>
|
|
81
|
-
</span>
|
|
82
|
-
</button>
|
|
83
|
-
</div>
|
|
84
42
|
</div>
|
|
85
43
|
</div>
|
|
86
44
|
</div>
|
|
@@ -94,37 +52,16 @@ exports[`renders ChatTextArea with value unchanged 1`] = `
|
|
|
94
52
|
>
|
|
95
53
|
<div
|
|
96
54
|
class="memori-chat-textarea--inner"
|
|
55
|
+
style="height: 36px;"
|
|
97
56
|
>
|
|
98
57
|
<textarea
|
|
99
58
|
class="memori-chat-textarea--input"
|
|
100
59
|
maxlength="100000"
|
|
60
|
+
placeholder="placeholder"
|
|
61
|
+
style="height: 36px;"
|
|
101
62
|
>
|
|
102
63
|
Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.
|
|
103
64
|
</textarea>
|
|
104
|
-
<div
|
|
105
|
-
class="memori-chat-textarea--expand"
|
|
106
|
-
>
|
|
107
|
-
<button
|
|
108
|
-
class="memori-button memori-button--ghost memori-button--rounded memori-button--icon-only memori-chat-textarea--expand-button"
|
|
109
|
-
title="expand"
|
|
110
|
-
>
|
|
111
|
-
<span
|
|
112
|
-
class="memori-button--icon"
|
|
113
|
-
>
|
|
114
|
-
<svg
|
|
115
|
-
aria-hidden="true"
|
|
116
|
-
focusable="false"
|
|
117
|
-
role="img"
|
|
118
|
-
viewBox="0 0 1024 1024"
|
|
119
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
120
|
-
>
|
|
121
|
-
<path
|
|
122
|
-
d="M855 160.1l-189.2 23.5c-6.6.8-9.3 8.8-4.7 13.5l54.7 54.7-153.5 153.5a8.03 8.03 0 0 0 0 11.3l45.1 45.1c3.1 3.1 8.2 3.1 11.3 0l153.6-153.6 54.7 54.7a7.94 7.94 0 0 0 13.5-4.7L863.9 169a7.9 7.9 0 0 0-8.9-8.9zM416.6 562.3a8.03 8.03 0 0 0-11.3 0L251.8 715.9l-54.7-54.7a7.94 7.94 0 0 0-13.5 4.7L160.1 855c-.6 5.2 3.7 9.5 8.9 8.9l189.2-23.5c6.6-.8 9.3-8.8 4.7-13.5l-54.7-54.7 153.6-153.6c3.1-3.1 3.1-8.2 0-11.3l-45.2-45z"
|
|
123
|
-
/>
|
|
124
|
-
</svg>
|
|
125
|
-
</span>
|
|
126
|
-
</button>
|
|
127
|
-
</div>
|
|
128
65
|
</div>
|
|
129
66
|
</div>
|
|
130
67
|
</div>
|