instantsearch-ui-components 0.14.0 → 0.15.1

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 (46) hide show
  1. package/dist/cjs/components/Carousel.js +4 -4
  2. package/dist/cjs/components/autocomplete/AutocompleteIndex.js +1 -1
  3. package/dist/cjs/components/autocomplete/AutocompletePanel.js +9 -2
  4. package/dist/cjs/components/autocomplete/AutocompleteRecentSearch.js +4 -3
  5. package/dist/cjs/components/autocomplete/AutocompleteSearch.js +8 -4
  6. package/dist/cjs/components/autocomplete/AutocompleteSuggestion.js +3 -3
  7. package/dist/cjs/components/autocomplete/createAutocompletePropGetters.js +41 -16
  8. package/dist/cjs/components/autocomplete/createAutocompleteStorage.js +29 -5
  9. package/dist/cjs/components/autocomplete/icons.js +11 -17
  10. package/dist/cjs/components/chat/ChatHeader.js +10 -12
  11. package/dist/cjs/components/chat/ChatMessage.js +1 -1
  12. package/dist/cjs/components/chat/ChatMessageError.js +1 -1
  13. package/dist/cjs/components/chat/ChatMessageLoader.js +1 -1
  14. package/dist/cjs/components/chat/ChatMessages.js +3 -3
  15. package/dist/cjs/components/chat/ChatPrompt.js +2 -2
  16. package/dist/cjs/components/chat/ChatToggleButton.js +6 -10
  17. package/dist/cjs/components/chat/icons.js +45 -149
  18. package/dist/cjs/version.js +1 -1
  19. package/dist/es/components/Carousel.js +4 -4
  20. package/dist/es/components/autocomplete/AutocompleteIndex.js +1 -1
  21. package/dist/es/components/autocomplete/AutocompletePanel.js +9 -2
  22. package/dist/es/components/autocomplete/AutocompleteRecentSearch.d.ts +3 -2
  23. package/dist/es/components/autocomplete/AutocompleteRecentSearch.js +5 -4
  24. package/dist/es/components/autocomplete/AutocompleteSearch.js +9 -5
  25. package/dist/es/components/autocomplete/AutocompleteSuggestion.d.ts +3 -2
  26. package/dist/es/components/autocomplete/AutocompleteSuggestion.js +4 -4
  27. package/dist/es/components/autocomplete/createAutocompletePropGetters.d.ts +2 -1
  28. package/dist/es/components/autocomplete/createAutocompletePropGetters.js +41 -16
  29. package/dist/es/components/autocomplete/createAutocompleteStorage.d.ts +11 -0
  30. package/dist/es/components/autocomplete/createAutocompleteStorage.js +29 -5
  31. package/dist/es/components/autocomplete/icons.d.ts +5 -5
  32. package/dist/es/components/autocomplete/icons.js +6 -12
  33. package/dist/es/components/chat/ChatHeader.d.ts +1 -1
  34. package/dist/es/components/chat/ChatHeader.js +11 -13
  35. package/dist/es/components/chat/ChatMessage.js +2 -2
  36. package/dist/es/components/chat/ChatMessageError.js +2 -2
  37. package/dist/es/components/chat/ChatMessageLoader.js +2 -2
  38. package/dist/es/components/chat/ChatMessages.js +4 -4
  39. package/dist/es/components/chat/ChatPrompt.js +3 -3
  40. package/dist/es/components/chat/ChatToggleButton.d.ts +1 -1
  41. package/dist/es/components/chat/ChatToggleButton.js +7 -11
  42. package/dist/es/components/chat/icons.d.ts +16 -19
  43. package/dist/es/components/chat/icons.js +30 -134
  44. package/dist/es/version.d.ts +1 -1
  45. package/dist/es/version.js +1 -1
  46. package/package.json +2 -2
@@ -3,31 +3,25 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.ArrowRightIconComponent = ArrowRightIconComponent;
7
- exports.ArrowUpIconComponent = ArrowUpIconComponent;
8
- exports.ChevronDownIconComponent = ChevronDownIconComponent;
9
- exports.ChevronLeftIconComponent = ChevronLeftIconComponent;
10
- exports.ChevronRightIconComponent = ChevronRightIconComponent;
11
- exports.ChevronUpIconComponent = ChevronUpIconComponent;
12
- exports.CloseIconComponent = CloseIconComponent;
13
- exports.CopyIconComponent = CopyIconComponent;
14
- exports.LoadingSpinnerIconComponent = LoadingSpinnerIconComponent;
15
- exports.MaximizeIconComponent = MaximizeIconComponent;
16
- exports.MenuIconComponent = MenuIconComponent;
17
- exports.MinimizeIconComponent = MinimizeIconComponent;
18
- exports.ReloadIconComponent = ReloadIconComponent;
19
- exports.SparklesIconComponent = SparklesIconComponent;
20
- exports.StopIconComponent = StopIconComponent;
21
- function SparklesIconComponent(_ref) {
22
- var createElement = _ref.createElement,
23
- _ref$width = _ref.width,
24
- width = _ref$width === void 0 ? 20 : _ref$width,
25
- _ref$height = _ref.height,
26
- height = _ref$height === void 0 ? 20 : _ref$height;
6
+ exports.ArrowRightIcon = ArrowRightIcon;
7
+ exports.ArrowUpIcon = ArrowUpIcon;
8
+ exports.ChevronDownIcon = ChevronDownIcon;
9
+ exports.ChevronLeftIcon = ChevronLeftIcon;
10
+ exports.ChevronRightIcon = ChevronRightIcon;
11
+ exports.ChevronUpIcon = ChevronUpIcon;
12
+ exports.CloseIcon = CloseIcon;
13
+ exports.CopyIcon = CopyIcon;
14
+ exports.LoadingSpinnerIcon = LoadingSpinnerIcon;
15
+ exports.MaximizeIcon = MaximizeIcon;
16
+ exports.MenuIcon = MenuIcon;
17
+ exports.MinimizeIcon = MinimizeIcon;
18
+ exports.ReloadIcon = ReloadIcon;
19
+ exports.SparklesIcon = SparklesIcon;
20
+ exports.StopIcon = StopIcon;
21
+ function SparklesIcon(_ref) {
22
+ var createElement = _ref.createElement;
27
23
  return createElement("svg", {
28
24
  xmlns: "http://www.w3.org/2000/svg",
29
- width: width,
30
- height: height,
31
25
  fill: "none",
32
26
  viewBox: "0 0 20 20"
33
27
  }, createElement("path", {
@@ -42,20 +36,13 @@ function SparklesIconComponent(_ref) {
42
36
  clipRule: "evenodd"
43
37
  }));
44
38
  }
45
- function ArrowUpIconComponent(_ref2) {
46
- var createElement = _ref2.createElement,
47
- _ref2$width = _ref2.width,
48
- width = _ref2$width === void 0 ? 16 : _ref2$width,
49
- _ref2$height = _ref2.height,
50
- height = _ref2$height === void 0 ? 16 : _ref2$height;
39
+ function ArrowUpIcon(_ref2) {
40
+ var createElement = _ref2.createElement;
51
41
  return createElement("svg", {
52
42
  xmlns: "http://www.w3.org/2000/svg",
53
- width: width,
54
- height: height,
55
43
  viewBox: "0 0 24 24",
56
44
  fill: "none",
57
45
  stroke: "currentColor",
58
- strokeWidth: "2",
59
46
  strokeLinecap: "round",
60
47
  strokeLinejoin: "round"
61
48
  }, createElement("path", {
@@ -64,20 +51,13 @@ function ArrowUpIconComponent(_ref2) {
64
51
  d: "M12 19V5"
65
52
  }));
66
53
  }
67
- function ArrowRightIconComponent(_ref3) {
68
- var createElement = _ref3.createElement,
69
- _ref3$width = _ref3.width,
70
- width = _ref3$width === void 0 ? 16 : _ref3$width,
71
- _ref3$height = _ref3.height,
72
- height = _ref3$height === void 0 ? 16 : _ref3$height;
54
+ function ArrowRightIcon(_ref3) {
55
+ var createElement = _ref3.createElement;
73
56
  return createElement("svg", {
74
57
  xmlns: "http://www.w3.org/2000/svg",
75
- width: width,
76
- height: height,
77
58
  viewBox: "0 0 24 24",
78
59
  fill: "none",
79
60
  stroke: "currentColor",
80
- strokeWidth: "2",
81
61
  strokeLinecap: "round",
82
62
  strokeLinejoin: "round"
83
63
  }, createElement("path", {
@@ -86,60 +66,39 @@ function ArrowRightIconComponent(_ref3) {
86
66
  d: "m12 5 7 7-7 7"
87
67
  }));
88
68
  }
89
- function ChevronUpIconComponent(_ref4) {
90
- var createElement = _ref4.createElement,
91
- _ref4$width = _ref4.width,
92
- width = _ref4$width === void 0 ? 16 : _ref4$width,
93
- _ref4$height = _ref4.height,
94
- height = _ref4$height === void 0 ? 16 : _ref4$height;
69
+ function ChevronUpIcon(_ref4) {
70
+ var createElement = _ref4.createElement;
95
71
  return createElement("svg", {
96
72
  xmlns: "http://www.w3.org/2000/svg",
97
- width: width,
98
- height: height,
99
73
  viewBox: "0 0 24 24",
100
74
  fill: "none",
101
75
  stroke: "currentColor",
102
- strokeWidth: "2",
103
76
  strokeLinecap: "round",
104
77
  strokeLinejoin: "round"
105
78
  }, createElement("path", {
106
79
  d: "m18 15-6-6-6 6"
107
80
  }));
108
81
  }
109
- function ChevronDownIconComponent(_ref5) {
110
- var createElement = _ref5.createElement,
111
- _ref5$width = _ref5.width,
112
- width = _ref5$width === void 0 ? 16 : _ref5$width,
113
- _ref5$height = _ref5.height,
114
- height = _ref5$height === void 0 ? 16 : _ref5$height;
82
+ function ChevronDownIcon(_ref5) {
83
+ var createElement = _ref5.createElement;
115
84
  return createElement("svg", {
116
85
  xmlns: "http://www.w3.org/2000/svg",
117
- width: width,
118
- height: height,
119
86
  viewBox: "0 0 24 24",
120
87
  fill: "none",
121
88
  stroke: "currentColor",
122
- strokeWidth: "2",
123
89
  strokeLinecap: "round",
124
90
  strokeLinejoin: "round"
125
91
  }, createElement("path", {
126
92
  d: "m6 9 6 6 6-6"
127
93
  }));
128
94
  }
129
- function CloseIconComponent(_ref6) {
130
- var createElement = _ref6.createElement,
131
- _ref6$width = _ref6.width,
132
- width = _ref6$width === void 0 ? 16 : _ref6$width,
133
- _ref6$height = _ref6.height,
134
- height = _ref6$height === void 0 ? 16 : _ref6$height;
95
+ function CloseIcon(_ref6) {
96
+ var createElement = _ref6.createElement;
135
97
  return createElement("svg", {
136
98
  xmlns: "http://www.w3.org/2000/svg",
137
- width: width,
138
- height: height,
139
99
  viewBox: "0 0 24 24",
140
100
  fill: "none",
141
101
  stroke: "currentColor",
142
- strokeWidth: "2",
143
102
  strokeLinecap: "round",
144
103
  strokeLinejoin: "round"
145
104
  }, createElement("path", {
@@ -148,19 +107,12 @@ function CloseIconComponent(_ref6) {
148
107
  d: "m6 6 12 12"
149
108
  }));
150
109
  }
151
- function MaximizeIconComponent(_ref7) {
152
- var createElement = _ref7.createElement,
153
- _ref7$width = _ref7.width,
154
- width = _ref7$width === void 0 ? 16 : _ref7$width,
155
- _ref7$height = _ref7.height,
156
- height = _ref7$height === void 0 ? 16 : _ref7$height;
110
+ function MaximizeIcon(_ref7) {
111
+ var createElement = _ref7.createElement;
157
112
  return createElement("svg", {
158
113
  xmlns: "http://www.w3.org/2000/svg",
159
- width: width,
160
- height: height,
161
114
  viewBox: "0 0 24 24",
162
115
  fill: "none",
163
- strokeWidth: "2",
164
116
  stroke: "currentColor",
165
117
  strokeLinecap: "round",
166
118
  strokeLinejoin: "round"
@@ -174,19 +126,12 @@ function MaximizeIconComponent(_ref7) {
174
126
  d: "M9 21H3v-6"
175
127
  }));
176
128
  }
177
- function MinimizeIconComponent(_ref8) {
178
- var createElement = _ref8.createElement,
179
- _ref8$width = _ref8.width,
180
- width = _ref8$width === void 0 ? 16 : _ref8$width,
181
- _ref8$height = _ref8.height,
182
- height = _ref8$height === void 0 ? 16 : _ref8$height;
129
+ function MinimizeIcon(_ref8) {
130
+ var createElement = _ref8.createElement;
183
131
  return createElement("svg", {
184
132
  xmlns: "http://www.w3.org/2000/svg",
185
- width: width,
186
- height: height,
187
133
  viewBox: "0 0 24 24",
188
134
  fill: "none",
189
- strokeWidth: "2",
190
135
  stroke: "currentColor",
191
136
  strokeLinecap: "round",
192
137
  strokeLinejoin: "round"
@@ -200,20 +145,13 @@ function MinimizeIconComponent(_ref8) {
200
145
  d: "M4 14h6v6"
201
146
  }));
202
147
  }
203
- function StopIconComponent(_ref9) {
204
- var createElement = _ref9.createElement,
205
- _ref9$width = _ref9.width,
206
- width = _ref9$width === void 0 ? 16 : _ref9$width,
207
- _ref9$height = _ref9.height,
208
- height = _ref9$height === void 0 ? 16 : _ref9$height;
148
+ function StopIcon(_ref9) {
149
+ var createElement = _ref9.createElement;
209
150
  return createElement("svg", {
210
151
  xmlns: "http://www.w3.org/2000/svg",
211
- width: width,
212
- height: height,
213
152
  viewBox: "0 0 24 24",
214
153
  fill: "none",
215
154
  stroke: "currentColor",
216
- strokeWidth: "2",
217
155
  strokeLinecap: "round",
218
156
  strokeLinejoin: "round"
219
157
  }, createElement("circle", {
@@ -228,20 +166,13 @@ function StopIconComponent(_ref9) {
228
166
  rx: "1"
229
167
  }));
230
168
  }
231
- function ReloadIconComponent(_ref0) {
232
- var createElement = _ref0.createElement,
233
- _ref0$width = _ref0.width,
234
- width = _ref0$width === void 0 ? 16 : _ref0$width,
235
- _ref0$height = _ref0.height,
236
- height = _ref0$height === void 0 ? 16 : _ref0$height;
169
+ function ReloadIcon(_ref0) {
170
+ var createElement = _ref0.createElement;
237
171
  return createElement("svg", {
238
172
  xmlns: "http://www.w3.org/2000/svg",
239
- width: width,
240
- height: height,
241
173
  viewBox: "0 0 24 24",
242
174
  fill: "none",
243
175
  stroke: "currentColor",
244
- strokeWidth: "2",
245
176
  strokeLinecap: "round",
246
177
  strokeLinejoin: "round"
247
178
  }, createElement("path", {
@@ -254,20 +185,13 @@ function ReloadIconComponent(_ref0) {
254
185
  d: "M3 21v-5h5"
255
186
  }));
256
187
  }
257
- function CopyIconComponent(_ref1) {
258
- var createElement = _ref1.createElement,
259
- _ref1$width = _ref1.width,
260
- width = _ref1$width === void 0 ? 16 : _ref1$width,
261
- _ref1$height = _ref1.height,
262
- height = _ref1$height === void 0 ? 16 : _ref1$height;
188
+ function CopyIcon(_ref1) {
189
+ var createElement = _ref1.createElement;
263
190
  return createElement("svg", {
264
191
  xmlns: "http://www.w3.org/2000/svg",
265
- width: width,
266
- height: height,
267
192
  viewBox: "0 0 24 24",
268
193
  fill: "none",
269
194
  stroke: "currentColor",
270
- strokeWidth: "2",
271
195
  strokeLinecap: "round",
272
196
  strokeLinejoin: "round"
273
197
  }, createElement("rect", {
@@ -281,20 +205,13 @@ function CopyIconComponent(_ref1) {
281
205
  d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
282
206
  }));
283
207
  }
284
- function MenuIconComponent(_ref10) {
285
- var createElement = _ref10.createElement,
286
- _ref10$width = _ref10.width,
287
- width = _ref10$width === void 0 ? 16 : _ref10$width,
288
- _ref10$height = _ref10.height,
289
- height = _ref10$height === void 0 ? 16 : _ref10$height;
208
+ function MenuIcon(_ref10) {
209
+ var createElement = _ref10.createElement;
290
210
  return createElement("svg", {
291
211
  xmlns: "http://www.w3.org/2000/svg",
292
- width: width,
293
- height: height,
294
212
  viewBox: "0 0 24 24",
295
213
  fill: "none",
296
214
  stroke: "currentColor",
297
- strokeWidth: "2",
298
215
  strokeLinecap: "round",
299
216
  strokeLinejoin: "round"
300
217
  }, createElement("circle", {
@@ -311,16 +228,10 @@ function MenuIconComponent(_ref10) {
311
228
  r: "1"
312
229
  }));
313
230
  }
314
- function LoadingSpinnerIconComponent(_ref11) {
315
- var createElement = _ref11.createElement,
316
- _ref11$width = _ref11.width,
317
- width = _ref11$width === void 0 ? 24 : _ref11$width,
318
- _ref11$height = _ref11.height,
319
- height = _ref11$height === void 0 ? 24 : _ref11$height;
231
+ function LoadingSpinnerIcon(_ref11) {
232
+ var createElement = _ref11.createElement;
320
233
  return createElement("svg", {
321
234
  viewBox: "12 12 24 24",
322
- width: width,
323
- height: height,
324
235
  role: "status",
325
236
  "aria-busy": "true",
326
237
  "aria-live": "polite"
@@ -329,44 +240,29 @@ function LoadingSpinnerIconComponent(_ref11) {
329
240
  cy: "24",
330
241
  r: "11",
331
242
  fill: "none",
332
- strokeWidth: "2",
333
243
  stroke: "currentColor"
334
244
  }));
335
245
  }
336
- function ChevronLeftIconComponent(_ref12) {
337
- var createElement = _ref12.createElement,
338
- _ref12$width = _ref12.width,
339
- width = _ref12$width === void 0 ? 16 : _ref12$width,
340
- _ref12$height = _ref12.height,
341
- height = _ref12$height === void 0 ? 16 : _ref12$height;
246
+ function ChevronLeftIcon(_ref12) {
247
+ var createElement = _ref12.createElement;
342
248
  return createElement("svg", {
343
249
  xmlns: "http://www.w3.org/2000/svg",
344
- width: width,
345
- height: height,
346
250
  viewBox: "0 0 24 24",
347
251
  fill: "none",
348
252
  stroke: "currentColor",
349
- strokeWidth: "2",
350
253
  strokeLinecap: "round",
351
254
  strokeLinejoin: "round"
352
255
  }, createElement("path", {
353
256
  d: "m15 18-6-6 6-6"
354
257
  }));
355
258
  }
356
- function ChevronRightIconComponent(_ref13) {
357
- var createElement = _ref13.createElement,
358
- _ref13$width = _ref13.width,
359
- width = _ref13$width === void 0 ? 16 : _ref13$width,
360
- _ref13$height = _ref13.height,
361
- height = _ref13$height === void 0 ? 16 : _ref13$height;
259
+ function ChevronRightIcon(_ref13) {
260
+ var createElement = _ref13.createElement;
362
261
  return createElement("svg", {
363
262
  xmlns: "http://www.w3.org/2000/svg",
364
- width: width,
365
- height: height,
366
263
  viewBox: "0 0 24 24",
367
264
  fill: "none",
368
265
  stroke: "currentColor",
369
- strokeWidth: "2",
370
266
  strokeLinecap: "round",
371
267
  strokeLinejoin: "round"
372
268
  }, createElement("path", {
@@ -4,4 +4,4 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = exports.default = '0.14.0';
7
+ var _default = exports.default = '0.15.1';
@@ -58,9 +58,9 @@ export function createCarouselComponent(_ref3) {
58
58
  Fragment: Fragment
59
59
  }) : _userProps$itemCompon,
60
60
  _userProps$previousIc = userProps.previousIconComponent,
61
- PreviousIconComponent = _userProps$previousIc === void 0 ? PreviousIconDefaultComponent : _userProps$previousIc,
61
+ PreviousIcon = _userProps$previousIc === void 0 ? PreviousIconDefaultComponent : _userProps$previousIc,
62
62
  _userProps$nextIconCo = userProps.nextIconComponent,
63
- NextIconComponent = _userProps$nextIconCo === void 0 ? NextIconDefaultComponent : _userProps$nextIconCo,
63
+ NextIcon = _userProps$nextIconCo === void 0 ? NextIconDefaultComponent : _userProps$nextIconCo,
64
64
  HeaderComponent = userProps.headerComponent,
65
65
  _userProps$showNaviga = userProps.showNavigation,
66
66
  showNavigation = _userProps$showNaviga === void 0 ? true : _userProps$showNaviga,
@@ -129,7 +129,7 @@ export function createCarouselComponent(_ref3) {
129
129
  event.preventDefault();
130
130
  scrollLeft();
131
131
  }
132
- }, createElement(PreviousIconComponent, {
132
+ }, createElement(PreviousIcon, {
133
133
  createElement: createElement
134
134
  })), createElement("ol", {
135
135
  className: cx(cssClasses.list),
@@ -175,7 +175,7 @@ export function createCarouselComponent(_ref3) {
175
175
  event.preventDefault();
176
176
  scrollRight();
177
177
  }
178
- }, createElement(NextIconComponent, {
178
+ }, createElement(NextIcon, {
179
179
  createElement: createElement
180
180
  })));
181
181
  };
@@ -25,7 +25,7 @@ export function createAutocompleteIndexComponent(_ref) {
25
25
  onSelect = _getItemProps.onSelect,
26
26
  itemProps = _objectWithoutProperties(_getItemProps, _excluded);
27
27
  return createElement("li", _extends({
28
- key: item.objectID
28
+ key: "".concat(itemProps.id, ":").concat(item.objectID)
29
29
  }, itemProps, {
30
30
  className: cx('ais-AutocompleteIndexItem', classNames.item, className)
31
31
  }), createElement(ItemComponent, {
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["children", "classNames"];
3
+ var _excluded = ["children", "classNames", "hidden"];
4
4
  import { cx } from "../../lib/cx.js";
5
5
  export function createAutocompletePanelComponent(_ref) {
6
6
  var createElement = _ref.createElement;
@@ -8,9 +8,16 @@ export function createAutocompletePanelComponent(_ref) {
8
8
  var children = userProps.children,
9
9
  _userProps$classNames = userProps.classNames,
10
10
  classNames = _userProps$classNames === void 0 ? {} : _userProps$classNames,
11
+ hidden = userProps.hidden,
11
12
  props = _objectWithoutProperties(userProps, _excluded);
12
13
  return createElement("div", _extends({}, props, {
13
- className: cx('ais-AutocompletePanel', classNames.root, props.className)
14
+ "aria-hidden": hidden,
15
+ className: cx('ais-AutocompletePanel', !hidden && 'ais-AutocompletePanel--open', classNames.root, props.className),
16
+ onMouseDown: function onMouseDown(event) {
17
+ // Prevents the autocomplete panel from blurring the input when
18
+ // clicking inside the panel.
19
+ event.preventDefault();
20
+ }
14
21
  }), createElement("div", {
15
22
  className: cx('ais-AutocompletePanelLayout', classNames.layout)
16
23
  }, children));
@@ -1,9 +1,10 @@
1
1
  /** @jsx createElement */
2
- import type { Renderer } from '../../types';
2
+ import type { ComponentChildren, Renderer } from '../../types';
3
3
  export type AutocompleteRecentSearchProps<T = {
4
4
  query: string;
5
5
  } & Record<string, unknown>> = {
6
6
  item: T;
7
+ children?: ComponentChildren;
7
8
  onSelect: () => void;
8
9
  onRemoveRecentSearch: () => void;
9
10
  classNames?: Partial<AutocompleteRecentSearchClassNames>;
@@ -34,4 +35,4 @@ export type AutocompleteRecentSearchClassNames = {
34
35
  **/
35
36
  deleteButton: string | string[];
36
37
  };
37
- export declare function createAutocompleteRecentSearchComponent({ createElement, }: Renderer): ({ item, onSelect, onRemoveRecentSearch, classNames, }: AutocompleteRecentSearchProps) => JSX.Element;
38
+ export declare function createAutocompleteRecentSearchComponent({ createElement, }: Renderer): ({ item, children, onSelect, onRemoveRecentSearch, classNames, }: AutocompleteRecentSearchProps) => JSX.Element;
@@ -1,9 +1,10 @@
1
1
  import { cx } from "../../lib/index.js";
2
- import { AutocompleteClockIcon, AutocompleteTrashIcon } from "./icons.js";
2
+ import { ClockIcon, TrashIcon } from "./icons.js";
3
3
  export function createAutocompleteRecentSearchComponent(_ref) {
4
4
  var createElement = _ref.createElement;
5
5
  return function AutocompleteRecentSearch(_ref2) {
6
6
  var item = _ref2.item,
7
+ children = _ref2.children,
7
8
  onSelect = _ref2.onSelect,
8
9
  onRemoveRecentSearch = _ref2.onRemoveRecentSearch,
9
10
  _ref2$classNames = _ref2.classNames,
@@ -15,11 +16,11 @@ export function createAutocompleteRecentSearchComponent(_ref) {
15
16
  className: cx('ais-AutocompleteItemContent', 'ais-AutocompleteRecentSearchItemContent', classNames.content)
16
17
  }, createElement("div", {
17
18
  className: cx('ais-AutocompleteItemIcon', 'ais-AutocompleteRecentSearchItemIcon', classNames.content)
18
- }, createElement(AutocompleteClockIcon, {
19
+ }, createElement(ClockIcon, {
19
20
  createElement: createElement
20
21
  })), createElement("div", {
21
22
  className: cx('ais-AutocompleteItemContentBody', 'ais-AutocompleteRecentSearchItemContentBody', classNames.content)
22
- }, item.query)), createElement("div", {
23
+ }, children)), createElement("div", {
23
24
  className: cx('ais-AutocompleteItemActions', 'ais-AutocompleteRecentSearchItemActions', classNames.actions)
24
25
  }, createElement("button", {
25
26
  className: cx('ais-AutocompleteItemActionButton', 'ais-AutocompleteRecentSearchItemDeleteButton', classNames.deleteButton),
@@ -28,7 +29,7 @@ export function createAutocompleteRecentSearchComponent(_ref) {
28
29
  evt.stopPropagation();
29
30
  onRemoveRecentSearch();
30
31
  }
31
- }, createElement(AutocompleteTrashIcon, {
32
+ }, createElement(TrashIcon, {
32
33
  createElement: createElement
33
34
  }))));
34
35
  };
@@ -1,5 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import { AutocompleteClearIcon, AutocompleteLoadingIcon, AutocompleteSubmitIcon } from "./icons.js";
2
+ import { ClearIcon, LoadingIcon, SubmitIcon } from "./icons.js";
3
3
  export function createAutocompleteSearchComponent(_ref) {
4
4
  var createElement = _ref.createElement;
5
5
  return function AutocompleteSearch(_ref2) {
@@ -7,6 +7,7 @@ export function createAutocompleteSearchComponent(_ref) {
7
7
  onClear = _ref2.onClear,
8
8
  query = _ref2.query,
9
9
  isSearchStalled = _ref2.isSearchStalled;
10
+ var inputRef = inputProps.ref;
10
11
  return createElement("form", {
11
12
  className: "ais-AutocompleteForm",
12
13
  action: "",
@@ -14,6 +15,10 @@ export function createAutocompleteSearchComponent(_ref) {
14
15
  role: "search",
15
16
  onSubmit: function onSubmit(e) {
16
17
  return e.preventDefault();
18
+ },
19
+ onReset: function onReset() {
20
+ var _inputRef$current;
21
+ return (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
17
22
  }
18
23
  }, createElement("div", {
19
24
  className: "ais-AutocompleteInputWrapperPrefix"
@@ -26,12 +31,12 @@ export function createAutocompleteSearchComponent(_ref) {
26
31
  className: "ais-AutocompleteSubmitButton",
27
32
  type: "submit",
28
33
  title: "Submit"
29
- }, createElement(AutocompleteSubmitIcon, {
34
+ }, createElement(SubmitIcon, {
30
35
  createElement: createElement
31
36
  }))), createElement("div", {
32
37
  className: "ais-AutocompleteLoadingIndicator",
33
38
  hidden: !isSearchStalled
34
- }, createElement(AutocompleteLoadingIcon, {
39
+ }, createElement(LoadingIcon, {
35
40
  createElement: createElement
36
41
  }))), createElement("div", {
37
42
  className: "ais-AutocompleteInputWrapper"
@@ -44,7 +49,6 @@ export function createAutocompleteSearchComponent(_ref) {
44
49
  autoCapitalize: "off",
45
50
  enterKeyHint: "search",
46
51
  spellCheck: "false",
47
- placeholder: "",
48
52
  maxLength: 512,
49
53
  type: "search",
50
54
  value: query
@@ -56,7 +60,7 @@ export function createAutocompleteSearchComponent(_ref) {
56
60
  title: "Clear",
57
61
  hidden: query.length === 0 || isSearchStalled,
58
62
  onClick: onClear
59
- }, createElement(AutocompleteClearIcon, {
63
+ }, createElement(ClearIcon, {
60
64
  createElement: createElement
61
65
  }))));
62
66
  };
@@ -1,10 +1,11 @@
1
1
  /** @jsx createElement */
2
- import type { Renderer } from '../../types';
2
+ import type { ComponentChildren, Renderer } from '../../types';
3
3
  export type AutocompleteSuggestionProps<T = {
4
4
  query: string;
5
5
  } & Record<string, unknown>> = {
6
6
  item: T;
7
7
  onSelect: () => void;
8
+ children: ComponentChildren;
8
9
  classNames?: Partial<AutocompleteSuggestionClassNames>;
9
10
  };
10
11
  export type AutocompleteSuggestionClassNames = {
@@ -21,4 +22,4 @@ export type AutocompleteSuggestionClassNames = {
21
22
  /** Class names to apply to the body element **/
22
23
  body: string | string[];
23
24
  };
24
- export declare function createAutocompleteSuggestionComponent({ createElement, }: Renderer): ({ item, onSelect, classNames, }: AutocompleteSuggestionProps) => JSX.Element;
25
+ export declare function createAutocompleteSuggestionComponent({ createElement, }: Renderer): ({ children, onSelect, classNames, }: AutocompleteSuggestionProps) => JSX.Element;
@@ -1,9 +1,9 @@
1
1
  import { cx } from "../../lib/index.js";
2
- import { AutocompleteSubmitIcon } from "./icons.js";
2
+ import { SubmitIcon } from "./icons.js";
3
3
  export function createAutocompleteSuggestionComponent(_ref) {
4
4
  var createElement = _ref.createElement;
5
5
  return function AutocompleteSuggestion(_ref2) {
6
- var item = _ref2.item,
6
+ var children = _ref2.children,
7
7
  onSelect = _ref2.onSelect,
8
8
  _ref2$classNames = _ref2.classNames,
9
9
  classNames = _ref2$classNames === void 0 ? {} : _ref2$classNames;
@@ -14,10 +14,10 @@ export function createAutocompleteSuggestionComponent(_ref) {
14
14
  className: cx('ais-AutocompleteItemContent', 'ais-AutocompleteSuggestionItemContent', classNames.content)
15
15
  }, createElement("div", {
16
16
  className: cx('ais-AutocompleteItemIcon', 'ais-AutocompleteSuggestionItemIcon', classNames.content)
17
- }, createElement(AutocompleteSubmitIcon, {
17
+ }, createElement(SubmitIcon, {
18
18
  createElement: createElement
19
19
  })), createElement("div", {
20
20
  className: cx('ais-AutocompleteItemContentBody', 'ais-AutocompleteSuggestionItemContentBody', classNames.content)
21
- }, item.query)));
21
+ }, children)));
22
22
  };
23
23
  }
@@ -39,11 +39,12 @@ export type UsePropGetters<TItem extends BaseHit> = (params: {
39
39
  indicesConfig: Array<AutocompleteIndexConfig<TItem>>;
40
40
  onRefine: (query: string) => void;
41
41
  onSelect: NonNullable<AutocompleteIndexConfig<TItem>['onSelect']>;
42
+ placeholder?: string;
42
43
  }) => {
43
44
  getInputProps: GetInputProps;
44
45
  getItemProps: GetItemProps;
45
46
  getPanelProps: GetPanelProps;
46
47
  getRootProps: GetRootProps;
47
48
  };
48
- export declare function createAutocompletePropGetters({ useEffect, useId, useMemo, useRef, useState, }: CreateAutocompletePropGettersParams): <TItem extends BaseHit>({ indices, indicesConfig, onRefine, onSelect: globalOnSelect, }: Parameters<UsePropGetters<TItem>>[0]) => ReturnType<UsePropGetters<TItem>>;
49
+ export declare function createAutocompletePropGetters({ useEffect, useId, useMemo, useRef, useState, }: CreateAutocompletePropGettersParams): <TItem extends BaseHit>({ indices, indicesConfig, onRefine, onSelect: globalOnSelect, placeholder, }: Parameters<UsePropGetters<TItem>>[0]) => ReturnType<UsePropGetters<TItem>>;
49
50
  export {};