instantsearch-ui-components 0.11.1 → 0.12.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/dist/cjs/components/Button.js +29 -0
- package/dist/cjs/components/Carousel.js +26 -6
- package/dist/cjs/components/autocomplete/Autocomplete.js +23 -0
- package/dist/cjs/components/autocomplete/AutocompleteIndex.js +39 -0
- package/dist/cjs/components/autocomplete/AutocompletePanel.js +25 -0
- package/dist/cjs/components/autocomplete/AutocompleteSuggestion.js +20 -0
- package/dist/cjs/components/autocomplete/index.js +49 -0
- package/dist/cjs/components/chat/Chat.js +79 -0
- package/dist/cjs/components/chat/ChatHeader.js +89 -0
- package/dist/cjs/components/chat/ChatMessage.js +138 -0
- package/dist/cjs/components/chat/ChatMessageError.js +57 -0
- package/dist/cjs/components/chat/ChatMessageLoader.js +47 -0
- package/dist/cjs/components/chat/ChatMessages.js +192 -0
- package/dist/cjs/components/chat/ChatPrompt.js +179 -0
- package/dist/cjs/components/chat/ChatToggleButton.js +46 -0
- package/dist/cjs/components/chat/icons.js +375 -0
- package/dist/cjs/components/chat/types.js +1 -0
- package/dist/cjs/components/index.js +132 -0
- package/dist/cjs/lib/index.js +22 -0
- package/dist/cjs/lib/stickToBottom.js +481 -0
- package/dist/cjs/lib/utils/find.js +15 -0
- package/dist/cjs/lib/utils/index.js +27 -0
- package/dist/cjs/lib/utils/startsWith.js +9 -0
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/warn.js +40 -0
- package/dist/es/components/Button.d.ts +38 -0
- package/dist/es/components/Button.js +22 -0
- package/dist/es/components/Carousel.d.ts +11 -0
- package/dist/es/components/Carousel.js +26 -6
- package/dist/es/components/autocomplete/Autocomplete.d.ts +13 -0
- package/dist/es/components/autocomplete/Autocomplete.js +16 -0
- package/dist/es/components/autocomplete/AutocompleteIndex.d.ts +31 -0
- package/dist/es/components/autocomplete/AutocompleteIndex.js +32 -0
- package/dist/es/components/autocomplete/AutocompletePanel.d.ts +17 -0
- package/dist/es/components/autocomplete/AutocompletePanel.js +18 -0
- package/dist/es/components/autocomplete/AutocompleteSuggestion.d.ts +16 -0
- package/dist/es/components/autocomplete/AutocompleteSuggestion.js +14 -0
- package/dist/es/components/autocomplete/index.d.ts +4 -0
- package/dist/es/components/autocomplete/index.js +4 -0
- package/dist/es/components/chat/Chat.d.ts +42 -0
- package/dist/es/components/chat/Chat.js +72 -0
- package/dist/es/components/chat/ChatHeader.d.ts +99 -0
- package/dist/es/components/chat/ChatHeader.js +82 -0
- package/dist/es/components/chat/ChatMessage.d.ts +124 -0
- package/dist/es/components/chat/ChatMessage.js +131 -0
- package/dist/es/components/chat/ChatMessageError.d.ts +27 -0
- package/dist/es/components/chat/ChatMessageError.js +50 -0
- package/dist/es/components/chat/ChatMessageLoader.d.ts +15 -0
- package/dist/es/components/chat/ChatMessageLoader.js +40 -0
- package/dist/es/components/chat/ChatMessages.d.ts +139 -0
- package/dist/es/components/chat/ChatMessages.js +185 -0
- package/dist/es/components/chat/ChatPrompt.d.ts +119 -0
- package/dist/es/components/chat/ChatPrompt.js +172 -0
- package/dist/es/components/chat/ChatToggleButton.d.ts +29 -0
- package/dist/es/components/chat/ChatToggleButton.js +39 -0
- package/dist/es/components/chat/icons.d.ts +22 -0
- package/dist/es/components/chat/icons.js +355 -0
- package/dist/es/components/chat/types.d.ts +29 -0
- package/dist/es/components/chat/types.js +1 -0
- package/dist/es/components/index.d.ts +12 -0
- package/dist/es/components/index.js +12 -0
- package/dist/es/lib/index.d.ts +2 -0
- package/dist/es/lib/index.js +3 -1
- package/dist/es/lib/stickToBottom.d.ts +114 -0
- package/dist/es/lib/stickToBottom.js +474 -0
- package/dist/es/lib/utils/find.d.ts +1 -0
- package/dist/es/lib/utils/find.js +9 -0
- package/dist/es/lib/utils/index.d.ts +2 -0
- package/dist/es/lib/utils/index.js +2 -0
- package/dist/es/lib/utils/startsWith.d.ts +1 -0
- package/dist/es/lib/utils/startsWith.js +3 -0
- package/dist/es/types/Renderer.d.ts +1 -1
- package/dist/es/version.d.ts +1 -1
- package/dist/es/version.js +1 -1
- package/dist/es/warn.d.ts +10 -0
- package/dist/es/warn.js +33 -0
- package/package.json +7 -3
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
export function SparklesIconComponent(_ref) {
|
|
2
|
+
var createElement = _ref.createElement,
|
|
3
|
+
_ref$width = _ref.width,
|
|
4
|
+
width = _ref$width === void 0 ? 20 : _ref$width,
|
|
5
|
+
_ref$height = _ref.height,
|
|
6
|
+
height = _ref$height === void 0 ? 20 : _ref$height;
|
|
7
|
+
return createElement("svg", {
|
|
8
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9
|
+
width: width,
|
|
10
|
+
height: height,
|
|
11
|
+
fill: "none",
|
|
12
|
+
viewBox: "0 0 20 20"
|
|
13
|
+
}, createElement("path", {
|
|
14
|
+
fill: "currentColor",
|
|
15
|
+
fillRule: "evenodd",
|
|
16
|
+
d: "M10 1.875c.27 0 .51.173.594.43l1.593 4.844a1.043 1.043 0 0 0 .664.664l4.844 1.593a.625.625 0 0 1 0 1.188l-4.844 1.593a1.043 1.043 0 0 0-.664.664l-1.593 4.844a.625.625 0 0 1-1.188 0l-1.593-4.844a1.042 1.042 0 0 0-.664-.664l-4.844-1.593a.625.625 0 0 1 0-1.188l4.844-1.593a1.042 1.042 0 0 0 .664-.664l1.593-4.844a.625.625 0 0 1 .594-.43ZM9 7.539A2.292 2.292 0 0 1 7.54 9L4.5 10l3.04 1A2.292 2.292 0 0 1 9 12.46l1 3.04 1-3.04A2.293 2.293 0 0 1 12.46 11l3.04-1-3.04-1A2.292 2.292 0 0 1 11 7.54L10 4.5 9 7.54ZM4.167 1.875c.345 0 .625.28.625.625v3.333a.625.625 0 0 1-1.25 0V2.5c0-.345.28-.625.625-.625ZM15.833 13.542c.345 0 .625.28.625.625V17.5a.625.625 0 1 1-1.25 0v-3.333c0-.345.28-.625.625-.625Z",
|
|
17
|
+
clipRule: "evenodd"
|
|
18
|
+
}), createElement("path", {
|
|
19
|
+
fill: "currentColor",
|
|
20
|
+
fillRule: "evenodd",
|
|
21
|
+
d: "M1.875 4.167c0-.346.28-.625.625-.625h3.333a.625.625 0 1 1 0 1.25H2.5a.625.625 0 0 1-.625-.625ZM13.542 15.833c0-.345.28-.625.625-.625H17.5a.625.625 0 0 1 0 1.25h-3.333a.625.625 0 0 1-.625-.625Z",
|
|
22
|
+
clipRule: "evenodd"
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
export function ArrowUpIconComponent(_ref2) {
|
|
26
|
+
var createElement = _ref2.createElement,
|
|
27
|
+
_ref2$width = _ref2.width,
|
|
28
|
+
width = _ref2$width === void 0 ? 16 : _ref2$width,
|
|
29
|
+
_ref2$height = _ref2.height,
|
|
30
|
+
height = _ref2$height === void 0 ? 16 : _ref2$height;
|
|
31
|
+
return createElement("svg", {
|
|
32
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
33
|
+
width: width,
|
|
34
|
+
height: height,
|
|
35
|
+
viewBox: "0 0 24 24",
|
|
36
|
+
fill: "none",
|
|
37
|
+
stroke: "currentColor",
|
|
38
|
+
strokeWidth: "2",
|
|
39
|
+
strokeLinecap: "round",
|
|
40
|
+
strokeLinejoin: "round"
|
|
41
|
+
}, createElement("path", {
|
|
42
|
+
d: "m5 12 7-7 7 7"
|
|
43
|
+
}), createElement("path", {
|
|
44
|
+
d: "M12 19V5"
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
export function ArrowRightIconComponent(_ref3) {
|
|
48
|
+
var createElement = _ref3.createElement,
|
|
49
|
+
_ref3$width = _ref3.width,
|
|
50
|
+
width = _ref3$width === void 0 ? 16 : _ref3$width,
|
|
51
|
+
_ref3$height = _ref3.height,
|
|
52
|
+
height = _ref3$height === void 0 ? 16 : _ref3$height;
|
|
53
|
+
return createElement("svg", {
|
|
54
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
55
|
+
width: width,
|
|
56
|
+
height: height,
|
|
57
|
+
viewBox: "0 0 24 24",
|
|
58
|
+
fill: "none",
|
|
59
|
+
stroke: "currentColor",
|
|
60
|
+
strokeWidth: "2",
|
|
61
|
+
strokeLinecap: "round",
|
|
62
|
+
strokeLinejoin: "round"
|
|
63
|
+
}, createElement("path", {
|
|
64
|
+
d: "M5 12h14"
|
|
65
|
+
}), createElement("path", {
|
|
66
|
+
d: "m12 5 7 7-7 7"
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
export function ChevronUpIconComponent(_ref4) {
|
|
70
|
+
var createElement = _ref4.createElement,
|
|
71
|
+
_ref4$width = _ref4.width,
|
|
72
|
+
width = _ref4$width === void 0 ? 16 : _ref4$width,
|
|
73
|
+
_ref4$height = _ref4.height,
|
|
74
|
+
height = _ref4$height === void 0 ? 16 : _ref4$height;
|
|
75
|
+
return createElement("svg", {
|
|
76
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
77
|
+
width: width,
|
|
78
|
+
height: height,
|
|
79
|
+
viewBox: "0 0 24 24",
|
|
80
|
+
fill: "none",
|
|
81
|
+
stroke: "currentColor",
|
|
82
|
+
strokeWidth: "2",
|
|
83
|
+
strokeLinecap: "round",
|
|
84
|
+
strokeLinejoin: "round"
|
|
85
|
+
}, createElement("path", {
|
|
86
|
+
d: "m18 15-6-6-6 6"
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
export function ChevronDownIconComponent(_ref5) {
|
|
90
|
+
var createElement = _ref5.createElement,
|
|
91
|
+
_ref5$width = _ref5.width,
|
|
92
|
+
width = _ref5$width === void 0 ? 16 : _ref5$width,
|
|
93
|
+
_ref5$height = _ref5.height,
|
|
94
|
+
height = _ref5$height === void 0 ? 16 : _ref5$height;
|
|
95
|
+
return createElement("svg", {
|
|
96
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
97
|
+
width: width,
|
|
98
|
+
height: height,
|
|
99
|
+
viewBox: "0 0 24 24",
|
|
100
|
+
fill: "none",
|
|
101
|
+
stroke: "currentColor",
|
|
102
|
+
strokeWidth: "2",
|
|
103
|
+
strokeLinecap: "round",
|
|
104
|
+
strokeLinejoin: "round"
|
|
105
|
+
}, createElement("path", {
|
|
106
|
+
d: "m6 9 6 6 6-6"
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
export function CloseIconComponent(_ref6) {
|
|
110
|
+
var createElement = _ref6.createElement,
|
|
111
|
+
_ref6$width = _ref6.width,
|
|
112
|
+
width = _ref6$width === void 0 ? 16 : _ref6$width,
|
|
113
|
+
_ref6$height = _ref6.height,
|
|
114
|
+
height = _ref6$height === void 0 ? 16 : _ref6$height;
|
|
115
|
+
return createElement("svg", {
|
|
116
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
117
|
+
width: width,
|
|
118
|
+
height: height,
|
|
119
|
+
viewBox: "0 0 24 24",
|
|
120
|
+
fill: "none",
|
|
121
|
+
stroke: "currentColor",
|
|
122
|
+
strokeWidth: "2",
|
|
123
|
+
strokeLinecap: "round",
|
|
124
|
+
strokeLinejoin: "round"
|
|
125
|
+
}, createElement("path", {
|
|
126
|
+
d: "M18 6 6 18"
|
|
127
|
+
}), createElement("path", {
|
|
128
|
+
d: "m6 6 12 12"
|
|
129
|
+
}));
|
|
130
|
+
}
|
|
131
|
+
export function MaximizeIconComponent(_ref7) {
|
|
132
|
+
var createElement = _ref7.createElement,
|
|
133
|
+
_ref7$width = _ref7.width,
|
|
134
|
+
width = _ref7$width === void 0 ? 16 : _ref7$width,
|
|
135
|
+
_ref7$height = _ref7.height,
|
|
136
|
+
height = _ref7$height === void 0 ? 16 : _ref7$height;
|
|
137
|
+
return createElement("svg", {
|
|
138
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
139
|
+
width: width,
|
|
140
|
+
height: height,
|
|
141
|
+
viewBox: "0 0 24 24",
|
|
142
|
+
fill: "none",
|
|
143
|
+
strokeWidth: "2",
|
|
144
|
+
stroke: "currentColor",
|
|
145
|
+
strokeLinecap: "round",
|
|
146
|
+
strokeLinejoin: "round"
|
|
147
|
+
}, createElement("path", {
|
|
148
|
+
d: "M15 3h6v6"
|
|
149
|
+
}), createElement("path", {
|
|
150
|
+
d: "m21 3-7 7"
|
|
151
|
+
}), createElement("path", {
|
|
152
|
+
d: "m3 21 7-7"
|
|
153
|
+
}), createElement("path", {
|
|
154
|
+
d: "M9 21H3v-6"
|
|
155
|
+
}));
|
|
156
|
+
}
|
|
157
|
+
export function MinimizeIconComponent(_ref8) {
|
|
158
|
+
var createElement = _ref8.createElement,
|
|
159
|
+
_ref8$width = _ref8.width,
|
|
160
|
+
width = _ref8$width === void 0 ? 16 : _ref8$width,
|
|
161
|
+
_ref8$height = _ref8.height,
|
|
162
|
+
height = _ref8$height === void 0 ? 16 : _ref8$height;
|
|
163
|
+
return createElement("svg", {
|
|
164
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
165
|
+
width: width,
|
|
166
|
+
height: height,
|
|
167
|
+
viewBox: "0 0 24 24",
|
|
168
|
+
fill: "none",
|
|
169
|
+
strokeWidth: "2",
|
|
170
|
+
stroke: "currentColor",
|
|
171
|
+
strokeLinecap: "round",
|
|
172
|
+
strokeLinejoin: "round"
|
|
173
|
+
}, createElement("path", {
|
|
174
|
+
d: "m14 10 7-7"
|
|
175
|
+
}), createElement("path", {
|
|
176
|
+
d: "M20 10h-6V4"
|
|
177
|
+
}), createElement("path", {
|
|
178
|
+
d: "m3 21 7-7"
|
|
179
|
+
}), createElement("path", {
|
|
180
|
+
d: "M4 14h6v6"
|
|
181
|
+
}));
|
|
182
|
+
}
|
|
183
|
+
export function StopIconComponent(_ref9) {
|
|
184
|
+
var createElement = _ref9.createElement,
|
|
185
|
+
_ref9$width = _ref9.width,
|
|
186
|
+
width = _ref9$width === void 0 ? 16 : _ref9$width,
|
|
187
|
+
_ref9$height = _ref9.height,
|
|
188
|
+
height = _ref9$height === void 0 ? 16 : _ref9$height;
|
|
189
|
+
return createElement("svg", {
|
|
190
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
191
|
+
width: width,
|
|
192
|
+
height: height,
|
|
193
|
+
viewBox: "0 0 24 24",
|
|
194
|
+
fill: "none",
|
|
195
|
+
stroke: "currentColor",
|
|
196
|
+
strokeWidth: "2",
|
|
197
|
+
strokeLinecap: "round",
|
|
198
|
+
strokeLinejoin: "round"
|
|
199
|
+
}, createElement("circle", {
|
|
200
|
+
cx: "12",
|
|
201
|
+
cy: "12",
|
|
202
|
+
r: "10"
|
|
203
|
+
}), createElement("rect", {
|
|
204
|
+
x: "9",
|
|
205
|
+
y: "9",
|
|
206
|
+
width: "6",
|
|
207
|
+
height: "6",
|
|
208
|
+
rx: "1"
|
|
209
|
+
}));
|
|
210
|
+
}
|
|
211
|
+
export function ReloadIconComponent(_ref10) {
|
|
212
|
+
var createElement = _ref10.createElement,
|
|
213
|
+
_ref10$width = _ref10.width,
|
|
214
|
+
width = _ref10$width === void 0 ? 16 : _ref10$width,
|
|
215
|
+
_ref10$height = _ref10.height,
|
|
216
|
+
height = _ref10$height === void 0 ? 16 : _ref10$height;
|
|
217
|
+
return createElement("svg", {
|
|
218
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
219
|
+
width: width,
|
|
220
|
+
height: height,
|
|
221
|
+
viewBox: "0 0 24 24",
|
|
222
|
+
fill: "none",
|
|
223
|
+
stroke: "currentColor",
|
|
224
|
+
strokeWidth: "2",
|
|
225
|
+
strokeLinecap: "round",
|
|
226
|
+
strokeLinejoin: "round"
|
|
227
|
+
}, createElement("path", {
|
|
228
|
+
d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"
|
|
229
|
+
}), createElement("path", {
|
|
230
|
+
d: "M21 3v5h-5"
|
|
231
|
+
}), createElement("path", {
|
|
232
|
+
d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"
|
|
233
|
+
}), createElement("path", {
|
|
234
|
+
d: "M3 21v-5h5"
|
|
235
|
+
}));
|
|
236
|
+
}
|
|
237
|
+
export function CopyIconComponent(_ref11) {
|
|
238
|
+
var createElement = _ref11.createElement,
|
|
239
|
+
_ref11$width = _ref11.width,
|
|
240
|
+
width = _ref11$width === void 0 ? 16 : _ref11$width,
|
|
241
|
+
_ref11$height = _ref11.height,
|
|
242
|
+
height = _ref11$height === void 0 ? 16 : _ref11$height;
|
|
243
|
+
return createElement("svg", {
|
|
244
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
245
|
+
width: width,
|
|
246
|
+
height: height,
|
|
247
|
+
viewBox: "0 0 24 24",
|
|
248
|
+
fill: "none",
|
|
249
|
+
stroke: "currentColor",
|
|
250
|
+
strokeWidth: "2",
|
|
251
|
+
strokeLinecap: "round",
|
|
252
|
+
strokeLinejoin: "round"
|
|
253
|
+
}, createElement("rect", {
|
|
254
|
+
width: "14",
|
|
255
|
+
height: "14",
|
|
256
|
+
x: "8",
|
|
257
|
+
y: "8",
|
|
258
|
+
rx: "2",
|
|
259
|
+
ry: "2"
|
|
260
|
+
}), createElement("path", {
|
|
261
|
+
d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
|
|
262
|
+
}));
|
|
263
|
+
}
|
|
264
|
+
export function MenuIconComponent(_ref12) {
|
|
265
|
+
var createElement = _ref12.createElement,
|
|
266
|
+
_ref12$width = _ref12.width,
|
|
267
|
+
width = _ref12$width === void 0 ? 16 : _ref12$width,
|
|
268
|
+
_ref12$height = _ref12.height,
|
|
269
|
+
height = _ref12$height === void 0 ? 16 : _ref12$height;
|
|
270
|
+
return createElement("svg", {
|
|
271
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
272
|
+
width: width,
|
|
273
|
+
height: height,
|
|
274
|
+
viewBox: "0 0 24 24",
|
|
275
|
+
fill: "none",
|
|
276
|
+
stroke: "currentColor",
|
|
277
|
+
strokeWidth: "2",
|
|
278
|
+
strokeLinecap: "round",
|
|
279
|
+
strokeLinejoin: "round"
|
|
280
|
+
}, createElement("circle", {
|
|
281
|
+
cx: "12",
|
|
282
|
+
cy: "12",
|
|
283
|
+
r: "1"
|
|
284
|
+
}), createElement("circle", {
|
|
285
|
+
cx: "12",
|
|
286
|
+
cy: "5",
|
|
287
|
+
r: "1"
|
|
288
|
+
}), createElement("circle", {
|
|
289
|
+
cx: "12",
|
|
290
|
+
cy: "19",
|
|
291
|
+
r: "1"
|
|
292
|
+
}));
|
|
293
|
+
}
|
|
294
|
+
export function LoadingSpinnerIconComponent(_ref13) {
|
|
295
|
+
var createElement = _ref13.createElement,
|
|
296
|
+
_ref13$width = _ref13.width,
|
|
297
|
+
width = _ref13$width === void 0 ? 24 : _ref13$width,
|
|
298
|
+
_ref13$height = _ref13.height,
|
|
299
|
+
height = _ref13$height === void 0 ? 24 : _ref13$height;
|
|
300
|
+
return createElement("svg", {
|
|
301
|
+
viewBox: "12 12 24 24",
|
|
302
|
+
width: width,
|
|
303
|
+
height: height,
|
|
304
|
+
role: "status",
|
|
305
|
+
"aria-busy": "true",
|
|
306
|
+
"aria-live": "polite"
|
|
307
|
+
}, createElement("title", null, "Loading spinner"), createElement("circle", {
|
|
308
|
+
cx: "24",
|
|
309
|
+
cy: "24",
|
|
310
|
+
r: "11",
|
|
311
|
+
fill: "none",
|
|
312
|
+
strokeWidth: "2",
|
|
313
|
+
stroke: "currentColor"
|
|
314
|
+
}));
|
|
315
|
+
}
|
|
316
|
+
export function ChevronLeftIconComponent(_ref14) {
|
|
317
|
+
var createElement = _ref14.createElement,
|
|
318
|
+
_ref14$width = _ref14.width,
|
|
319
|
+
width = _ref14$width === void 0 ? 16 : _ref14$width,
|
|
320
|
+
_ref14$height = _ref14.height,
|
|
321
|
+
height = _ref14$height === void 0 ? 16 : _ref14$height;
|
|
322
|
+
return createElement("svg", {
|
|
323
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
324
|
+
width: width,
|
|
325
|
+
height: height,
|
|
326
|
+
viewBox: "0 0 24 24",
|
|
327
|
+
fill: "none",
|
|
328
|
+
stroke: "currentColor",
|
|
329
|
+
strokeWidth: "2",
|
|
330
|
+
strokeLinecap: "round",
|
|
331
|
+
strokeLinejoin: "round"
|
|
332
|
+
}, createElement("path", {
|
|
333
|
+
d: "m15 18-6-6 6-6"
|
|
334
|
+
}));
|
|
335
|
+
}
|
|
336
|
+
export function ChevronRightIconComponent(_ref15) {
|
|
337
|
+
var createElement = _ref15.createElement,
|
|
338
|
+
_ref15$width = _ref15.width,
|
|
339
|
+
width = _ref15$width === void 0 ? 16 : _ref15$width,
|
|
340
|
+
_ref15$height = _ref15.height,
|
|
341
|
+
height = _ref15$height === void 0 ? 16 : _ref15$height;
|
|
342
|
+
return createElement("svg", {
|
|
343
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
344
|
+
width: width,
|
|
345
|
+
height: height,
|
|
346
|
+
viewBox: "0 0 24 24",
|
|
347
|
+
fill: "none",
|
|
348
|
+
stroke: "currentColor",
|
|
349
|
+
strokeWidth: "2",
|
|
350
|
+
strokeLinecap: "round",
|
|
351
|
+
strokeLinejoin: "round"
|
|
352
|
+
}, createElement("path", {
|
|
353
|
+
d: "m9 18 6-6-6-6"
|
|
354
|
+
}));
|
|
355
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { AbstractChat, ChatInit, UIMessage } from 'ai';
|
|
2
|
+
export type ChatStatus = 'ready' | 'submitted' | 'streaming' | 'error';
|
|
3
|
+
export type ChatRole = 'data' | 'user' | 'assistant' | 'system';
|
|
4
|
+
export type ChatMessageBase = UIMessage;
|
|
5
|
+
export type ChatToolMessage = Extract<ChatMessageBase['parts'][number], {
|
|
6
|
+
type: `tool-${string}`;
|
|
7
|
+
}>;
|
|
8
|
+
export type ChatToolType = ChatToolMessage['type'];
|
|
9
|
+
export type { ChatInit } from 'ai';
|
|
10
|
+
export type AddToolResult = AbstractChat<UIMessage>['addToolResult'];
|
|
11
|
+
export type AddToolResultWithOutput = (params: Pick<Parameters<AddToolResult>[0], 'output'>) => ReturnType<AddToolResult>;
|
|
12
|
+
export type ClientSideToolComponentProps = {
|
|
13
|
+
message: ChatToolMessage;
|
|
14
|
+
indexUiState: object;
|
|
15
|
+
setIndexUiState: (state: object) => void;
|
|
16
|
+
onClose: () => void;
|
|
17
|
+
addToolResult: AddToolResultWithOutput;
|
|
18
|
+
};
|
|
19
|
+
export type ClientSideToolComponent = (props: ClientSideToolComponentProps) => JSX.Element;
|
|
20
|
+
export type ClientSideTool = {
|
|
21
|
+
layoutComponent: ClientSideToolComponent;
|
|
22
|
+
addToolResult: AddToolResult;
|
|
23
|
+
onToolCall?: (params: Parameters<NonNullable<ChatInit<UIMessage>['onToolCall']>>[0]['toolCall'] & {
|
|
24
|
+
addToolResult: AddToolResultWithOutput;
|
|
25
|
+
}) => void;
|
|
26
|
+
};
|
|
27
|
+
export type ClientSideTools = Record<string, ClientSideTool>;
|
|
28
|
+
export type UserClientSideTool = Omit<ClientSideTool, 'addToolResult'>;
|
|
29
|
+
export type UserClientSideTools = Record<string, UserClientSideTool>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
+
export * from './autocomplete';
|
|
2
|
+
export * from './Button';
|
|
1
3
|
export * from './Carousel';
|
|
4
|
+
export * from './chat/Chat';
|
|
5
|
+
export * from './chat/ChatHeader';
|
|
6
|
+
export * from './chat/ChatMessage';
|
|
7
|
+
export * from './chat/ChatMessages';
|
|
8
|
+
export * from './chat/ChatMessageLoader';
|
|
9
|
+
export * from './chat/ChatMessageError';
|
|
10
|
+
export * from './chat/ChatPrompt';
|
|
11
|
+
export * from './chat/ChatToggleButton';
|
|
12
|
+
export * from './chat/icons';
|
|
13
|
+
export * from './chat/types';
|
|
2
14
|
export * from './FrequentlyBoughtTogether';
|
|
3
15
|
export * from './Highlight';
|
|
4
16
|
export * from './Hits';
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
+
export * from "./autocomplete/index.js";
|
|
2
|
+
export * from "./Button.js";
|
|
1
3
|
export * from "./Carousel.js";
|
|
4
|
+
export * from "./chat/Chat.js";
|
|
5
|
+
export * from "./chat/ChatHeader.js";
|
|
6
|
+
export * from "./chat/ChatMessage.js";
|
|
7
|
+
export * from "./chat/ChatMessages.js";
|
|
8
|
+
export * from "./chat/ChatMessageLoader.js";
|
|
9
|
+
export * from "./chat/ChatMessageError.js";
|
|
10
|
+
export * from "./chat/ChatPrompt.js";
|
|
11
|
+
export * from "./chat/ChatToggleButton.js";
|
|
12
|
+
export * from "./chat/icons.js";
|
|
13
|
+
export * from "./chat/types.js";
|
|
2
14
|
export * from "./FrequentlyBoughtTogether.js";
|
|
3
15
|
export * from "./Highlight.js";
|
|
4
16
|
export * from "./Hits.js";
|
package/dist/es/lib/index.d.ts
CHANGED
package/dist/es/lib/index.js
CHANGED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
export interface StickToBottomState {
|
|
2
|
+
scrollTop: number;
|
|
3
|
+
lastScrollTop?: number;
|
|
4
|
+
ignoreScrollToTop?: number;
|
|
5
|
+
targetScrollTop: number;
|
|
6
|
+
calculatedTargetScrollTop: number;
|
|
7
|
+
scrollDifference: number;
|
|
8
|
+
resizeDifference: number;
|
|
9
|
+
animation?: {
|
|
10
|
+
behavior: 'instant' | Required<SpringAnimation>;
|
|
11
|
+
ignoreEscapes: boolean;
|
|
12
|
+
promise: Promise<boolean>;
|
|
13
|
+
};
|
|
14
|
+
lastTick?: number;
|
|
15
|
+
velocity: number;
|
|
16
|
+
accumulated: number;
|
|
17
|
+
escapedFromLock: boolean;
|
|
18
|
+
isAtBottom: boolean;
|
|
19
|
+
isNearBottom: boolean;
|
|
20
|
+
resizeObserver?: ResizeObserver;
|
|
21
|
+
}
|
|
22
|
+
declare const DEFAULT_SPRING_ANIMATION: {
|
|
23
|
+
/**
|
|
24
|
+
* A value from 0 to 1, on how much to damp the animation.
|
|
25
|
+
* 0 means no damping, 1 means full damping.
|
|
26
|
+
*
|
|
27
|
+
* @default 0.7
|
|
28
|
+
*/
|
|
29
|
+
damping: number;
|
|
30
|
+
/**
|
|
31
|
+
* The stiffness of how fast/slow the animation gets up to speed.
|
|
32
|
+
*
|
|
33
|
+
* @default 0.05
|
|
34
|
+
*/
|
|
35
|
+
stiffness: number;
|
|
36
|
+
/**
|
|
37
|
+
* The inertial mass associated with the animation.
|
|
38
|
+
* Higher numbers make the animation slower.
|
|
39
|
+
*
|
|
40
|
+
* @default 1.25
|
|
41
|
+
*/
|
|
42
|
+
mass: number;
|
|
43
|
+
};
|
|
44
|
+
export type SpringAnimation = Partial<typeof DEFAULT_SPRING_ANIMATION>;
|
|
45
|
+
export type Animation = ScrollBehavior | SpringAnimation;
|
|
46
|
+
export interface ScrollElements {
|
|
47
|
+
scrollElement: HTMLElement;
|
|
48
|
+
contentElement: HTMLElement;
|
|
49
|
+
}
|
|
50
|
+
export type GetTargetScrollTop = (targetScrollTop: number, context: ScrollElements) => number;
|
|
51
|
+
export interface StickToBottomOptions extends SpringAnimation {
|
|
52
|
+
resize?: Animation;
|
|
53
|
+
initial?: Animation | boolean;
|
|
54
|
+
targetScrollTop?: GetTargetScrollTop;
|
|
55
|
+
}
|
|
56
|
+
export type ScrollToBottomOptions = ScrollBehavior | {
|
|
57
|
+
animation?: Animation;
|
|
58
|
+
/**
|
|
59
|
+
* Whether to wait for any existing scrolls to finish before
|
|
60
|
+
* performing this one. Or if a millisecond is passed,
|
|
61
|
+
* it will wait for that duration before performing the scroll.
|
|
62
|
+
*
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
wait?: boolean | number;
|
|
66
|
+
/**
|
|
67
|
+
* Whether to prevent the user from escaping the scroll,
|
|
68
|
+
* by scrolling up with their mouse.
|
|
69
|
+
*/
|
|
70
|
+
ignoreEscapes?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Only scroll to the bottom if we're already at the bottom.
|
|
73
|
+
*
|
|
74
|
+
* @default false
|
|
75
|
+
*/
|
|
76
|
+
preserveScrollPosition?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* The extra duration in ms that this scroll event should persist for.
|
|
79
|
+
* (in addition to the time that it takes to get to the bottom)
|
|
80
|
+
*
|
|
81
|
+
* Not to be confused with the duration of the animation -
|
|
82
|
+
* for that you should adjust the animation option.
|
|
83
|
+
*
|
|
84
|
+
* @default 0
|
|
85
|
+
*/
|
|
86
|
+
duration?: number | Promise<void>;
|
|
87
|
+
};
|
|
88
|
+
export type ScrollToBottom = (scrollOptions?: ScrollToBottomOptions) => Promise<boolean> | boolean;
|
|
89
|
+
export type StopScroll = () => void;
|
|
90
|
+
export interface StickToBottomInstance {
|
|
91
|
+
contentRef: {
|
|
92
|
+
current: HTMLDivElement | null;
|
|
93
|
+
};
|
|
94
|
+
scrollRef: {
|
|
95
|
+
current: HTMLDivElement | null;
|
|
96
|
+
};
|
|
97
|
+
scrollToBottom: ScrollToBottom;
|
|
98
|
+
stopScroll: StopScroll;
|
|
99
|
+
isAtBottom: boolean;
|
|
100
|
+
isNearBottom: boolean;
|
|
101
|
+
escapedFromLock: boolean;
|
|
102
|
+
state: StickToBottomState;
|
|
103
|
+
}
|
|
104
|
+
type CreateStickToBottomParams = {
|
|
105
|
+
useCallback: <T extends (...args: any[]) => any>(callback: T, deps: readonly unknown[]) => T;
|
|
106
|
+
useEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
|
|
107
|
+
useMemo: <TType>(factory: () => TType, deps: readonly unknown[]) => TType;
|
|
108
|
+
useRef: <TType>(initialValue: TType) => {
|
|
109
|
+
current: TType;
|
|
110
|
+
};
|
|
111
|
+
useState: <TType>(initialState: TType) => [TType, (newState: TType) => void];
|
|
112
|
+
};
|
|
113
|
+
export declare function createStickToBottom({ useCallback, useEffect, useMemo, useRef, useState, }: CreateStickToBottomParams): (options?: StickToBottomOptions) => StickToBottomInstance;
|
|
114
|
+
export {};
|