@memori.ai/memori-react 7.21.1 → 7.23.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 (106) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/dist/components/CompletionProviderStatus/CompletionProviderStatus.css +33 -23
  3. package/dist/components/CompletionProviderStatus/CompletionProviderStatus.js +85 -8
  4. package/dist/components/CompletionProviderStatus/CompletionProviderStatus.js.map +1 -1
  5. package/dist/components/KnownFacts/KnownFacts.js +1 -1
  6. package/dist/components/KnownFacts/KnownFacts.js.map +1 -1
  7. package/dist/components/StartPanel/StartPanel.css +29 -0
  8. package/dist/components/StartPanel/StartPanel.js +2 -1
  9. package/dist/components/StartPanel/StartPanel.js.map +1 -1
  10. package/dist/components/Typing/Typing.js +49 -47
  11. package/dist/components/Typing/Typing.js.map +1 -1
  12. package/dist/components/UploadButton/UploadButton.d.ts +1 -0
  13. package/dist/components/UploadButton/UploadButton.js +142 -3
  14. package/dist/components/UploadButton/UploadButton.js.map +1 -1
  15. package/dist/components/icons/Alert.d.ts +5 -0
  16. package/dist/components/icons/Alert.js +6 -0
  17. package/dist/components/icons/Alert.js.map +1 -0
  18. package/dist/components/icons/Info.d.ts +5 -0
  19. package/dist/components/icons/Info.js +6 -0
  20. package/dist/components/icons/Info.js.map +1 -0
  21. package/dist/components/icons/Warning.js +1 -1
  22. package/dist/components/icons/Warning.js.map +1 -1
  23. package/dist/components/ui/ConfirmDialog.css +42 -0
  24. package/dist/components/ui/ConfirmDialog.d.ts +11 -0
  25. package/dist/components/ui/ConfirmDialog.js +12 -0
  26. package/dist/components/ui/ConfirmDialog.js.map +1 -0
  27. package/dist/components/ui/Drawer.css +121 -96
  28. package/dist/components/ui/Drawer.d.ts +15 -6
  29. package/dist/components/ui/Drawer.js +44 -13
  30. package/dist/components/ui/Drawer.js.map +1 -1
  31. package/dist/locales/de.json +15 -0
  32. package/dist/locales/en.json +15 -0
  33. package/dist/locales/es.json +15 -0
  34. package/dist/locales/fr.json +7 -0
  35. package/dist/locales/it.json +15 -0
  36. package/dist/styles.css +6 -4
  37. package/esm/components/CompletionProviderStatus/CompletionProviderStatus.css +33 -23
  38. package/esm/components/CompletionProviderStatus/CompletionProviderStatus.js +85 -8
  39. package/esm/components/CompletionProviderStatus/CompletionProviderStatus.js.map +1 -1
  40. package/esm/components/KnownFacts/KnownFacts.js +1 -1
  41. package/esm/components/KnownFacts/KnownFacts.js.map +1 -1
  42. package/esm/components/StartPanel/StartPanel.css +29 -0
  43. package/esm/components/StartPanel/StartPanel.js +2 -1
  44. package/esm/components/StartPanel/StartPanel.js.map +1 -1
  45. package/esm/components/Typing/Typing.js +49 -47
  46. package/esm/components/Typing/Typing.js.map +1 -1
  47. package/esm/components/UploadButton/UploadButton.d.ts +1 -0
  48. package/esm/components/UploadButton/UploadButton.js +142 -3
  49. package/esm/components/UploadButton/UploadButton.js.map +1 -1
  50. package/esm/components/icons/Alert.d.ts +5 -0
  51. package/esm/components/icons/Alert.js +4 -0
  52. package/esm/components/icons/Alert.js.map +1 -0
  53. package/esm/components/icons/Info.d.ts +5 -0
  54. package/esm/components/icons/Info.js +4 -0
  55. package/esm/components/icons/Info.js.map +1 -0
  56. package/esm/components/icons/Warning.js +1 -1
  57. package/esm/components/icons/Warning.js.map +1 -1
  58. package/esm/components/ui/ConfirmDialog.css +42 -0
  59. package/esm/components/ui/ConfirmDialog.d.ts +11 -0
  60. package/esm/components/ui/ConfirmDialog.js +9 -0
  61. package/esm/components/ui/ConfirmDialog.js.map +1 -0
  62. package/esm/components/ui/Drawer.css +121 -96
  63. package/esm/components/ui/Drawer.d.ts +15 -6
  64. package/esm/components/ui/Drawer.js +45 -14
  65. package/esm/components/ui/Drawer.js.map +1 -1
  66. package/esm/locales/de.json +15 -0
  67. package/esm/locales/en.json +15 -0
  68. package/esm/locales/es.json +15 -0
  69. package/esm/locales/fr.json +7 -0
  70. package/esm/locales/it.json +15 -0
  71. package/esm/styles.css +6 -4
  72. package/package.json +1 -1
  73. package/src/components/BlockedMemoriBadge/__snapshots__/BlockedMemoriBadge.test.tsx.snap +10 -0
  74. package/src/components/CompletionProviderStatus/CompletionProviderStatus.css +33 -23
  75. package/src/components/CompletionProviderStatus/CompletionProviderStatus.stories.tsx +274 -21
  76. package/src/components/CompletionProviderStatus/CompletionProviderStatus.tsx +117 -21
  77. package/src/components/CompletionProviderStatus/__snapshots__/CompletionProviderStatus.test.tsx.snap +39 -21
  78. package/src/components/KnownFacts/KnownFacts.tsx +1 -1
  79. package/src/components/StartPanel/StartPanel.css +29 -0
  80. package/src/components/StartPanel/StartPanel.tsx +47 -0
  81. package/src/components/StartPanel/__snapshots__/StartPanel.test.tsx.snap +827 -7
  82. package/src/components/Typing/Typing.tsx +52 -47
  83. package/src/components/UploadButton/UploadButton.tsx +206 -5
  84. package/src/components/UploadButton/__snapshots__/UploadButton.test.tsx.snap +1 -1
  85. package/src/components/icons/Alert.tsx +31 -0
  86. package/src/components/icons/Info.tsx +31 -0
  87. package/src/components/icons/Warning.tsx +2 -1
  88. package/src/components/layouts/__snapshots__/Chat.test.tsx.snap +74 -0
  89. package/src/components/layouts/__snapshots__/FullPage.test.tsx.snap +148 -0
  90. package/src/components/layouts/__snapshots__/Totem.test.tsx.snap +74 -0
  91. package/src/components/layouts/__snapshots__/ZoomedFullBody.test.tsx.snap +74 -0
  92. package/src/components/ui/ConfirmDialog.css +42 -0
  93. package/src/components/ui/ConfirmDialog.stories.tsx +216 -0
  94. package/src/components/ui/ConfirmDialog.test.tsx +124 -0
  95. package/src/components/ui/ConfirmDialog.tsx +58 -0
  96. package/src/components/ui/Drawer.css +121 -96
  97. package/src/components/ui/Drawer.stories.tsx +152 -67
  98. package/src/components/ui/Drawer.test.tsx +6 -2
  99. package/src/components/ui/Drawer.tsx +195 -89
  100. package/src/components/ui/__snapshots__/ConfirmDialog.test.tsx.snap +35 -0
  101. package/src/locales/de.json +15 -0
  102. package/src/locales/en.json +15 -0
  103. package/src/locales/es.json +15 -0
  104. package/src/locales/fr.json +7 -0
  105. package/src/locales/it.json +15 -0
  106. package/src/styles.css +6 -4
@@ -0,0 +1,124 @@
1
+ import React from 'react';
2
+ import { render, screen, fireEvent } from '@testing-library/react';
3
+ import ConfirmDialog from './ConfirmDialog';
4
+
5
+ beforeEach(() => {
6
+ // @ts-ignore
7
+ window.IntersectionObserver = jest.fn(() => ({
8
+ observe: jest.fn(),
9
+ unobserve: jest.fn(),
10
+ disconnect: jest.fn(),
11
+ takeRecords: jest.fn(),
12
+ }));
13
+ });
14
+
15
+ it('renders ConfirmDialog unchanged', () => {
16
+ const { container } = render(
17
+ <ConfirmDialog
18
+ isOpen={false}
19
+ onClose={jest.fn()}
20
+ onConfirm={jest.fn()}
21
+ title="Test Title"
22
+ message="Test Message"
23
+ confirmText="Confirm"
24
+ cancelText="Cancel"
25
+ />
26
+ );
27
+ expect(container).toMatchSnapshot();
28
+ });
29
+
30
+ it('renders ConfirmDialog open unchanged', () => {
31
+ const { container } = render(
32
+ <ConfirmDialog
33
+ isOpen={true}
34
+ onClose={jest.fn()}
35
+ onConfirm={jest.fn()}
36
+ title="Test Title"
37
+ message="Test Message"
38
+ confirmText="Confirm"
39
+ cancelText="Cancel"
40
+ />
41
+ );
42
+ expect(container).toMatchSnapshot();
43
+ });
44
+
45
+ it('renders ConfirmDialog with custom title unchanged', () => {
46
+ const { container } = render(
47
+ <ConfirmDialog
48
+ isOpen={true}
49
+ onClose={jest.fn()}
50
+ onConfirm={jest.fn()}
51
+ title="Custom Title"
52
+ message="Test Message"
53
+ confirmText="Confirm"
54
+ cancelText="Cancel"
55
+ />
56
+ );
57
+ expect(container).toMatchSnapshot();
58
+ });
59
+
60
+ it('renders ConfirmDialog with custom message unchanged', () => {
61
+ const { container } = render(
62
+ <ConfirmDialog
63
+ isOpen={true}
64
+ onClose={jest.fn()}
65
+ onConfirm={jest.fn()}
66
+ title="Test Title"
67
+ message="Custom confirmation message for testing purposes"
68
+ confirmText="Confirm"
69
+ cancelText="Cancel"
70
+ />
71
+ );
72
+ expect(container).toMatchSnapshot();
73
+ });
74
+
75
+ it('renders ConfirmDialog with custom button text unchanged', () => {
76
+ const { container } = render(
77
+ <ConfirmDialog
78
+ isOpen={true}
79
+ onClose={jest.fn()}
80
+ onConfirm={jest.fn()}
81
+ title="Test Title"
82
+ message="Test Message"
83
+ confirmText="Yes, proceed"
84
+ cancelText="No, go back"
85
+ />
86
+ );
87
+ expect(container).toMatchSnapshot();
88
+ });
89
+
90
+ it('calls onClose when cancel button is clicked', () => {
91
+ const onCloseMock = jest.fn();
92
+ render(
93
+ <ConfirmDialog
94
+ isOpen={true}
95
+ onClose={onCloseMock}
96
+ onConfirm={jest.fn()}
97
+ title="Test Title"
98
+ message="Test Message"
99
+ confirmText="Confirm"
100
+ cancelText="Cancel"
101
+ />
102
+ );
103
+
104
+ fireEvent.click(screen.getByText('Cancel'));
105
+ expect(onCloseMock).toHaveBeenCalledTimes(1);
106
+ });
107
+
108
+ it('calls onConfirm when confirm button is clicked', () => {
109
+ const onConfirmMock = jest.fn();
110
+ render(
111
+ <ConfirmDialog
112
+ isOpen={true}
113
+ onClose={jest.fn()}
114
+ onConfirm={onConfirmMock}
115
+ title="Test Title"
116
+ message="Test Message"
117
+ confirmText="Confirm"
118
+ cancelText="Cancel"
119
+ />
120
+ );
121
+
122
+ fireEvent.click(screen.getByText('Confirm'));
123
+ expect(onConfirmMock).toHaveBeenCalledTimes(1);
124
+ });
@@ -0,0 +1,58 @@
1
+ import React from 'react';
2
+ import { Dialog, Transition } from '@headlessui/react';
3
+ import Button from './Button';
4
+
5
+ // Custom confirm dialog component
6
+ const ConfirmDialog: React.FC<{
7
+ isOpen: boolean;
8
+ onClose: () => void;
9
+ onConfirm: () => void;
10
+ title: string;
11
+ message: string;
12
+ confirmText: string;
13
+ cancelText: string;
14
+ }> = ({
15
+ isOpen,
16
+ onClose,
17
+ onConfirm,
18
+ title,
19
+ message,
20
+ confirmText,
21
+ cancelText,
22
+ }) => {
23
+ return (
24
+ <Transition appear show={isOpen} as={React.Fragment}>
25
+ <Dialog as="div" className="memori-confirm-dialog" onClose={onClose}>
26
+ <div className="memori-confirm-dialog--backdrop" />
27
+ <div className="memori-confirm-dialog--container">
28
+ <Transition.Child
29
+ as={React.Fragment}
30
+ enter="ease-out duration-300"
31
+ enterFrom="opacity-0 scale-95"
32
+ enterTo="opacity-100 scale-100"
33
+ leave="ease-in duration-200"
34
+ leaveFrom="opacity-100 scale-100"
35
+ leaveTo="opacity-0 scale-95"
36
+ >
37
+ <Dialog.Panel className="memori-confirm-dialog--panel">
38
+ <Dialog.Title className="memori-confirm-dialog--title">
39
+ {title}
40
+ </Dialog.Title>
41
+ <Dialog.Description className="memori-confirm-dialog--message">
42
+ {message}
43
+ </Dialog.Description>
44
+ <div className="memori-confirm-dialog--actions">
45
+ <Button onClick={onClose}>{cancelText}</Button>
46
+ <Button primary onClick={onConfirm}>
47
+ {confirmText}
48
+ </Button>
49
+ </div>
50
+ </Dialog.Panel>
51
+ </Transition.Child>
52
+ </div>
53
+ </Dialog>
54
+ </Transition>
55
+ );
56
+ };
57
+
58
+ export default ConfirmDialog;
@@ -1,180 +1,205 @@
1
1
  .memori-drawer {
2
- position: relative;
3
- z-index: 10000;
2
+ position: relative;
3
+ z-index: 50;
4
4
  }
5
5
 
6
6
  .memori-drawer--backdrop {
7
- position: fixed;
8
- z-index: 40;
9
- top: 0;
10
- left: 0;
11
- width: 100%;
12
- height: 100%;
13
- background-color: rgba(0, 0, 0, 0.3);
7
+ position: fixed;
8
+ z-index: 40;
9
+ top: 0;
10
+ left: 0;
11
+ width: 100%;
12
+ height: 100%;
13
+ background-color: rgba(0, 0, 0, 0.3);
14
14
  }
15
15
 
16
16
  .memori-drawer--container {
17
- position: fixed;
18
- z-index: 50;
19
- top: 0;
20
- right: 0;
21
- bottom: 0;
22
- left: 0;
23
- overflow-y: auto;
17
+ position: fixed;
18
+ z-index: 50;
19
+ top: 0;
20
+ right: 0;
21
+ bottom: 0;
22
+ left: 0;
23
+ overflow-y: auto;
24
24
  }
25
25
 
26
26
  .memori-drawer--container-scrollable {
27
- display: flex;
28
- min-height: 100%;
29
- align-items: center;
30
- justify-content: center;
27
+ display: flex;
28
+ min-height: 100%;
29
+ align-items: center;
30
+ justify-content: center;
31
31
  }
32
32
 
33
33
  .memori-drawer--panel {
34
- position: relative;
35
- width: var(--memori-drawer--width, 100%);
36
- max-width: 80vw;
37
- height: 100%;
38
- min-height: 100vh;
39
- box-sizing: border-box;
40
- padding: 1rem 1.5rem 1.5rem;
41
- margin-right: 0;
42
- margin-left: auto;
43
- background-color: #fff;
44
- font-family: var(--memori-font-family);
34
+ position: relative;
35
+ display: flex;
36
+ width: var(--memori-drawer--width, 100%);
37
+ max-width: 80vw;
38
+ height: 100%;
39
+ min-height: 100vh;
40
+ box-sizing: border-box;
41
+ flex-direction: column;
42
+ padding: 1rem 1.5rem 1.5rem;
43
+ margin-right: 0;
44
+ margin-left: auto;
45
+ background-color: #fff;
46
+ font-family: var(--memori-font-family);
45
47
  }
46
48
 
47
49
  @media (min-width: 768px) {
48
- .memori-drawer--panel {
49
- width: var(--memori-drawer--width--md, 80%);
50
- max-width: none;
51
- padding-top: 1.5rem;
52
- padding-right: 2rem;
53
- padding-left: 2rem;
54
- }
50
+ .memori-drawer--panel {
51
+ width: var(--memori-drawer--width-md, 80%);
52
+ max-width: none;
53
+ padding-top: 1.5rem;
54
+ padding-right: 2rem;
55
+ padding-left: 2rem;
56
+ }
55
57
  }
56
58
 
57
59
  @media (min-width: 1024px) {
58
- .memori-drawer--panel {
59
- width: var(--memori-drawer--width--lg, 60%);
60
- }
60
+ .memori-drawer--panel {
61
+ width: var(--memori-drawer--width-lg, 60%);
62
+ }
61
63
  }
62
64
 
63
65
  .memori-drawer--panel.memori-drawer--with-footer {
64
- padding-bottom: 0;
66
+ padding-bottom: 0;
65
67
  }
66
68
 
67
69
  .memori-drawer--panel .memori-spin {
68
- display: flex;
69
- width: 100%;
70
- height: 100%;
71
- flex-direction: column;
70
+ display: flex;
71
+ width: 100%;
72
+ height: 100%;
73
+ flex: 1;
74
+ flex-direction: column;
75
+ overflow-y: auto;
72
76
  }
73
77
 
74
- .memori-drawer--panel>.memori-spin {
75
- margin-top: -1.75rem;
78
+ .memori-drawer--panel > .memori-spin {
79
+ margin-top: -1.75rem;
76
80
  }
77
81
 
78
82
  .memori-drawer--panel p {
79
- margin: 0 0 1em;
83
+ margin: 0 0 1em;
80
84
  }
81
85
 
82
86
  h2.memori-drawer--title {
83
- margin: 0 0 1rem;
84
- font-size: 1.5rem;
85
- font-weight: 700;
87
+ margin: 0 0 1rem;
88
+ font-size: 1.5rem;
89
+ font-weight: 700;
86
90
  }
87
91
 
88
92
  .memori-drawer--panel-left {
89
- margin-right: auto;
90
- margin-left: 0;
93
+ margin-right: auto;
94
+ margin-left: 0;
91
95
  }
92
96
 
93
97
  .memori-drawer--close {
94
- position: sticky;
95
- z-index: 70;
96
- top: 0;
97
- left: 0;
98
- padding: 0.5rem;
99
- margin-top: -1.5rem;
100
- margin-left: -5.5rem;
98
+ position: sticky;
99
+ z-index: 70;
100
+ top: 0;
101
+ left: 0;
102
+ padding: 0.5rem;
103
+ margin-top: -1.5rem;
104
+ margin-left: -5.5rem;
101
105
  }
102
106
 
103
107
  @media (max-width: 767px) {
104
- .memori-drawer--close {
105
- left: 0.5rem;
106
- }
108
+ .memori-drawer--close {
109
+ left: 0.5rem;
110
+ }
107
111
  }
108
112
 
109
113
  .memori-drawer--close button {
110
- border-color: #fff;
111
- color: #fff;
114
+ border-color: #fff;
115
+ color: #fff;
112
116
  }
113
117
 
114
118
  @media (max-width: 767px) {
115
- .memori-drawer--close button {
116
- color: #000;
117
- }
119
+ .memori-drawer--close button {
120
+ color: #000;
121
+ }
118
122
  }
119
123
 
120
124
  .memori-drawer--panel-left .memori-drawer--close {
121
- right: -3.5rem;
122
- left: auto;
125
+ right: -3.5rem;
126
+ left: auto;
123
127
  }
124
128
 
125
129
  @media (max-width: 767px) {
126
- .memori-drawer--panel-left .memori-drawer--close {
127
- right: 0.5rem;
128
- left: auto;
129
- }
130
+ .memori-drawer--panel-left .memori-drawer--close {
131
+ right: 0.5rem;
132
+ left: auto;
133
+ }
130
134
  }
131
135
 
132
136
  .memori-drawer--footer {
133
- position: sticky;
134
- bottom: 0;
135
- left: 0;
136
- display: flex;
137
- width: 100%;
138
- justify-content: flex-end;
139
- padding-top: 1rem;
140
- padding-bottom: 1rem;
141
- border-top: 1px solid rgba(0, 0, 0, 0.25);
142
- margin-top: auto;
143
- background-color: #fff;
137
+ position: sticky;
138
+ bottom: 0;
139
+ left: 0;
140
+ display: flex;
141
+ width: 100%;
142
+ justify-content: flex-end;
143
+ padding-top: 1rem;
144
+ padding-bottom: 1rem;
145
+ border-top: 1px solid rgba(0, 0, 0, 0.25);
146
+ margin-top: auto;
147
+ background-color: #fff;
148
+ }
149
+
150
+ .memori-drawer--footer-left-action {
151
+ margin-right: auto;
152
+ }
153
+
154
+ .memori-drawer--footer-actions {
155
+ display: flex;
156
+ gap: 0.5rem;
144
157
  }
145
158
 
146
- .memori-drawer--footer button+button {
147
- margin-left: 0.5em;
159
+ .memori-drawer--footer button + button {
160
+ margin-left: 0.5em;
161
+ }
162
+
163
+ .memori-drawer--content{
164
+ flex: 1;
165
+ padding-top: 12px;
166
+ overflow-y: auto;
167
+ }
168
+
169
+ .memori-drawer--content--scrollable{
170
+ flex: 1;
171
+ overflow-y: auto;
148
172
  }
149
173
 
174
+ /* Transition classes */
150
175
  .ease-out {
151
- transition-timing-function: ease-out;
176
+ transition-timing-function: ease-out;
152
177
  }
153
178
 
154
179
  .ease-in {
155
- transition-timing-function: ease-in;
180
+ transition-timing-function: ease-in;
156
181
  }
157
182
 
158
183
  .duration-300 {
159
- transition-duration: 300ms;
184
+ transition-duration: 300ms;
160
185
  }
161
186
 
162
187
  .duration-200 {
163
- transition-duration: 200ms;
188
+ transition-duration: 200ms;
164
189
  }
165
190
 
166
191
  .opacity-0 {
167
- opacity: 0;
192
+ opacity: 0;
168
193
  }
169
194
 
170
195
  .opacity-100 {
171
- opacity: 1;
196
+ opacity: 1;
172
197
  }
173
198
 
174
199
  .max-w-0 {
175
- max-width: 0;
200
+ max-width: 0;
176
201
  }
177
202
 
178
203
  .max-w-80 {
179
- max-width: 80%;
204
+ max-width: 80%;
180
205
  }