instantsearch-ui-components 0.15.1 → 0.16.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/autocomplete/AutocompleteIndex.js +4 -2
- package/dist/cjs/components/autocomplete/AutocompleteRecentSearch.js +17 -7
- package/dist/cjs/components/autocomplete/AutocompleteSearch.js +5 -5
- package/dist/cjs/components/autocomplete/AutocompleteSuggestion.js +20 -6
- package/dist/cjs/components/autocomplete/createAutocompletePropGetters.js +12 -4
- package/dist/cjs/components/autocomplete/icons.js +10 -0
- package/dist/cjs/components/chat/Chat.js +16 -16
- package/dist/cjs/components/chat/ChatHeader.js +16 -16
- package/dist/cjs/components/chat/ChatMessageError.js +5 -5
- package/dist/cjs/components/chat/ChatMessageLoader.js +3 -3
- package/dist/cjs/components/chat/ChatToggleButton.js +8 -8
- package/dist/cjs/version.js +1 -1
- package/dist/es/components/autocomplete/AutocompleteIndex.d.ts +2 -0
- package/dist/es/components/autocomplete/AutocompleteIndex.js +4 -2
- package/dist/es/components/autocomplete/AutocompleteRecentSearch.d.ts +6 -1
- package/dist/es/components/autocomplete/AutocompleteRecentSearch.js +18 -8
- package/dist/es/components/autocomplete/AutocompleteSearch.d.ts +2 -2
- package/dist/es/components/autocomplete/AutocompleteSearch.js +5 -5
- package/dist/es/components/autocomplete/AutocompleteSuggestion.d.ts +4 -1
- package/dist/es/components/autocomplete/AutocompleteSuggestion.js +21 -7
- package/dist/es/components/autocomplete/createAutocompletePropGetters.d.ts +20 -6
- package/dist/es/components/autocomplete/createAutocompletePropGetters.js +12 -4
- package/dist/es/components/autocomplete/icons.d.ts +1 -0
- package/dist/es/components/autocomplete/icons.js +9 -0
- package/dist/es/components/chat/Chat.d.ts +1 -1
- package/dist/es/components/chat/Chat.js +16 -16
- package/dist/es/components/chat/ChatHeader.d.ts +1 -1
- package/dist/es/components/chat/ChatHeader.js +16 -16
- package/dist/es/components/chat/ChatMessageError.d.ts +1 -1
- package/dist/es/components/chat/ChatMessageError.js +5 -5
- package/dist/es/components/chat/ChatMessageLoader.d.ts +1 -1
- package/dist/es/components/chat/ChatMessageLoader.js +3 -3
- package/dist/es/components/chat/ChatPrompt.d.ts +2 -2
- package/dist/es/components/chat/ChatToggleButton.d.ts +1 -1
- package/dist/es/components/chat/ChatToggleButton.js +8 -8
- package/dist/es/version.d.ts +1 -1
- package/dist/es/version.js +1 -1
- package/package.json +2 -2
|
@@ -8,7 +8,7 @@ exports.createAutocompleteIndexComponent = createAutocompleteIndexComponent;
|
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _cx = require("../../lib/cx");
|
|
11
|
-
var _excluded = ["className", "onSelect"];
|
|
11
|
+
var _excluded = ["className", "onSelect", "onApply"];
|
|
12
12
|
function createAutocompleteIndexComponent(_ref) {
|
|
13
13
|
var createElement = _ref.createElement;
|
|
14
14
|
return function AutocompleteIndex(userProps) {
|
|
@@ -30,6 +30,7 @@ function createAutocompleteIndexComponent(_ref) {
|
|
|
30
30
|
var _getItemProps = getItemProps(item, index),
|
|
31
31
|
className = _getItemProps.className,
|
|
32
32
|
onSelect = _getItemProps.onSelect,
|
|
33
|
+
onApply = _getItemProps.onApply,
|
|
33
34
|
itemProps = (0, _objectWithoutProperties2.default)(_getItemProps, _excluded);
|
|
34
35
|
return createElement("li", (0, _extends2.default)({
|
|
35
36
|
key: "".concat(itemProps.id, ":").concat(item.objectID)
|
|
@@ -37,7 +38,8 @@ function createAutocompleteIndexComponent(_ref) {
|
|
|
37
38
|
className: (0, _cx.cx)('ais-AutocompleteIndexItem', classNames.item, className)
|
|
38
39
|
}), createElement(ItemComponent, {
|
|
39
40
|
item: item,
|
|
40
|
-
onSelect: onSelect
|
|
41
|
+
onSelect: onSelect,
|
|
42
|
+
onApply: onApply
|
|
41
43
|
}));
|
|
42
44
|
})));
|
|
43
45
|
};
|
|
@@ -8,13 +8,14 @@ var _lib = require("../../lib");
|
|
|
8
8
|
var _icons = require("./icons");
|
|
9
9
|
function createAutocompleteRecentSearchComponent(_ref) {
|
|
10
10
|
var createElement = _ref.createElement;
|
|
11
|
-
return function AutocompleteRecentSearch(
|
|
12
|
-
var item =
|
|
13
|
-
children =
|
|
14
|
-
onSelect =
|
|
15
|
-
onRemoveRecentSearch =
|
|
16
|
-
|
|
17
|
-
classNames =
|
|
11
|
+
return function AutocompleteRecentSearch(userProps) {
|
|
12
|
+
var item = userProps.item,
|
|
13
|
+
children = userProps.children,
|
|
14
|
+
onSelect = userProps.onSelect,
|
|
15
|
+
onRemoveRecentSearch = userProps.onRemoveRecentSearch,
|
|
16
|
+
onApply = userProps.onApply,
|
|
17
|
+
_userProps$classNames = userProps.classNames,
|
|
18
|
+
classNames = _userProps$classNames === void 0 ? {} : _userProps$classNames;
|
|
18
19
|
return createElement("div", {
|
|
19
20
|
onClick: onSelect,
|
|
20
21
|
className: (0, _lib.cx)('ais-AutocompleteItemWrapper ais-AutocompleteRecentSearchWrapper', classNames.root)
|
|
@@ -37,6 +38,15 @@ function createAutocompleteRecentSearchComponent(_ref) {
|
|
|
37
38
|
}
|
|
38
39
|
}, createElement(_icons.TrashIcon, {
|
|
39
40
|
createElement: createElement
|
|
41
|
+
})), createElement("button", {
|
|
42
|
+
className: (0, _lib.cx)('ais-AutocompleteItemActionButton', 'ais-AutocompleteRecentSearchItemApplyButton', classNames.applyButton),
|
|
43
|
+
title: "Apply ".concat(item.query, " as search"),
|
|
44
|
+
onClick: function onClick(evt) {
|
|
45
|
+
evt.stopPropagation();
|
|
46
|
+
onApply();
|
|
47
|
+
}
|
|
48
|
+
}, createElement(_icons.ApplyIcon, {
|
|
49
|
+
createElement: createElement
|
|
40
50
|
}))));
|
|
41
51
|
};
|
|
42
52
|
}
|
|
@@ -9,11 +9,11 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var _icons = require("./icons");
|
|
10
10
|
function createAutocompleteSearchComponent(_ref) {
|
|
11
11
|
var createElement = _ref.createElement;
|
|
12
|
-
return function AutocompleteSearch(
|
|
13
|
-
var inputProps =
|
|
14
|
-
onClear =
|
|
15
|
-
query =
|
|
16
|
-
isSearchStalled =
|
|
12
|
+
return function AutocompleteSearch(userProps) {
|
|
13
|
+
var inputProps = userProps.inputProps,
|
|
14
|
+
onClear = userProps.onClear,
|
|
15
|
+
query = userProps.query,
|
|
16
|
+
isSearchStalled = userProps.isSearchStalled;
|
|
17
17
|
var inputRef = inputProps.ref;
|
|
18
18
|
return createElement("form", {
|
|
19
19
|
className: "ais-AutocompleteForm",
|
|
@@ -8,11 +8,13 @@ var _lib = require("../../lib");
|
|
|
8
8
|
var _icons = require("./icons");
|
|
9
9
|
function createAutocompleteSuggestionComponent(_ref) {
|
|
10
10
|
var createElement = _ref.createElement;
|
|
11
|
-
return function AutocompleteSuggestion(
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
return function AutocompleteSuggestion(userProps) {
|
|
12
|
+
var item = userProps.item,
|
|
13
|
+
children = userProps.children,
|
|
14
|
+
onSelect = userProps.onSelect,
|
|
15
|
+
onApply = userProps.onApply,
|
|
16
|
+
_userProps$classNames = userProps.classNames,
|
|
17
|
+
classNames = _userProps$classNames === void 0 ? {} : _userProps$classNames;
|
|
16
18
|
return createElement("div", {
|
|
17
19
|
onClick: onSelect,
|
|
18
20
|
className: (0, _lib.cx)('ais-AutocompleteItemWrapper', 'ais-AutocompleteSuggestionWrapper', classNames.root)
|
|
@@ -24,6 +26,18 @@ function createAutocompleteSuggestionComponent(_ref) {
|
|
|
24
26
|
createElement: createElement
|
|
25
27
|
})), createElement("div", {
|
|
26
28
|
className: (0, _lib.cx)('ais-AutocompleteItemContentBody', 'ais-AutocompleteSuggestionItemContentBody', classNames.content)
|
|
27
|
-
}, children))
|
|
29
|
+
}, children)), createElement("div", {
|
|
30
|
+
className: (0, _lib.cx)('ais-AutocompleteItemActions', 'ais-AutocompleteSuggestionItemActions', classNames.actions)
|
|
31
|
+
}, createElement("button", {
|
|
32
|
+
className: (0, _lib.cx)('ais-AutocompleteItemActionButton', 'ais-AutocompleteSuggestionItemApplyButton', classNames.applyButton),
|
|
33
|
+
type: "button",
|
|
34
|
+
title: "Apply ".concat(item.query, " as search"),
|
|
35
|
+
onClick: function onClick(evt) {
|
|
36
|
+
evt.stopPropagation();
|
|
37
|
+
onApply();
|
|
38
|
+
}
|
|
39
|
+
}, createElement(_icons.ApplyIcon, {
|
|
40
|
+
createElement: createElement
|
|
41
|
+
}))));
|
|
28
42
|
};
|
|
29
43
|
}
|
|
@@ -18,6 +18,7 @@ function createAutocompletePropGetters(_ref) {
|
|
|
18
18
|
indicesConfig = _ref2.indicesConfig,
|
|
19
19
|
onRefine = _ref2.onRefine,
|
|
20
20
|
globalOnSelect = _ref2.onSelect,
|
|
21
|
+
_onApply = _ref2.onApply,
|
|
21
22
|
placeholder = _ref2.placeholder;
|
|
22
23
|
var getElementId = createGetElementId(useId());
|
|
23
24
|
var inputRef = useRef(null);
|
|
@@ -185,6 +186,13 @@ function createAutocompletePropGetters(_ref) {
|
|
|
185
186
|
return submit({
|
|
186
187
|
activeDescendant: id
|
|
187
188
|
});
|
|
189
|
+
},
|
|
190
|
+
onApply: function onApply() {
|
|
191
|
+
var _getQuery2;
|
|
192
|
+
var _ref4 = items.get(id),
|
|
193
|
+
currentItem = _ref4.item,
|
|
194
|
+
getQuery = _ref4.config.getQuery;
|
|
195
|
+
_onApply((_getQuery2 = getQuery === null || getQuery === void 0 ? void 0 : getQuery(currentItem)) !== null && _getQuery2 !== void 0 ? _getQuery2 : '');
|
|
188
196
|
}
|
|
189
197
|
};
|
|
190
198
|
},
|
|
@@ -204,10 +212,10 @@ function createAutocompletePropGetters(_ref) {
|
|
|
204
212
|
};
|
|
205
213
|
};
|
|
206
214
|
}
|
|
207
|
-
function buildItems(
|
|
208
|
-
var indices =
|
|
209
|
-
indicesConfig =
|
|
210
|
-
getElementId =
|
|
215
|
+
function buildItems(_ref5) {
|
|
216
|
+
var indices = _ref5.indices,
|
|
217
|
+
indicesConfig = _ref5.indicesConfig,
|
|
218
|
+
getElementId = _ref5.getElementId;
|
|
211
219
|
var itemsIds = [];
|
|
212
220
|
var items = new Map();
|
|
213
221
|
for (var i = 0; i < indicesConfig.length; i++) {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.ApplyIcon = ApplyIcon;
|
|
6
7
|
exports.ClearIcon = ClearIcon;
|
|
7
8
|
exports.ClockIcon = ClockIcon;
|
|
8
9
|
exports.LoadingIcon = LoadingIcon;
|
|
@@ -67,4 +68,13 @@ function TrashIcon(_ref5) {
|
|
|
67
68
|
}, createElement("path", {
|
|
68
69
|
d: "M18 7v13c0 0.276-0.111 0.525-0.293 0.707s-0.431 0.293-0.707 0.293h-10c-0.276 0-0.525-0.111-0.707-0.293s-0.293-0.431-0.293-0.707v-13zM17 5v-1c0-0.828-0.337-1.58-0.879-2.121s-1.293-0.879-2.121-0.879h-4c-0.828 0-1.58 0.337-2.121 0.879s-0.879 1.293-0.879 2.121v1h-4c-0.552 0-1 0.448-1 1s0.448 1 1 1h1v13c0 0.828 0.337 1.58 0.879 2.121s1.293 0.879 2.121 0.879h10c0.828 0 1.58-0.337 2.121-0.879s0.879-1.293 0.879-2.121v-13h1c0.552 0 1-0.448 1-1s-0.448-1-1-1zM9 5v-1c0-0.276 0.111-0.525 0.293-0.707s0.431-0.293 0.707-0.293h4c0.276 0 0.525 0.111 0.707 0.293s0.293 0.431 0.293 0.707v1zM9 11v6c0 0.552 0.448 1 1 1s1-0.448 1-1v-6c0-0.552-0.448-1-1-1s-1 0.448-1 1zM13 11v6c0 0.552 0.448 1 1 1s1-0.448 1-1v-6c0-0.552-0.448-1-1-1s-1 0.448-1 1z"
|
|
69
70
|
}));
|
|
71
|
+
}
|
|
72
|
+
function ApplyIcon(_ref6) {
|
|
73
|
+
var createElement = _ref6.createElement;
|
|
74
|
+
return createElement("svg", {
|
|
75
|
+
viewBox: "0 0 24 24",
|
|
76
|
+
fill: "currentColor"
|
|
77
|
+
}, createElement("path", {
|
|
78
|
+
d: "M8 17v-7.586l8.293 8.293c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414l-8.293-8.293h7.586c0.552 0 1-0.448 1-1s-0.448-1-1-1h-10c-0.552 0-1 0.448-1 1v10c0 0.552 0.448 1 1 1s1-0.448 1-1z"
|
|
79
|
+
}));
|
|
70
80
|
}
|
|
@@ -35,22 +35,22 @@ function createChatComponent(_ref) {
|
|
|
35
35
|
createElement: createElement,
|
|
36
36
|
Fragment: Fragment
|
|
37
37
|
});
|
|
38
|
-
return function Chat(
|
|
39
|
-
var open =
|
|
40
|
-
|
|
41
|
-
maximized =
|
|
42
|
-
headerProps =
|
|
43
|
-
toggleButtonProps =
|
|
44
|
-
messagesProps =
|
|
45
|
-
|
|
46
|
-
promptProps =
|
|
47
|
-
HeaderComponent =
|
|
48
|
-
PromptComponent =
|
|
49
|
-
ToggleButtonComponent =
|
|
50
|
-
|
|
51
|
-
classNames =
|
|
52
|
-
className =
|
|
53
|
-
props = (0, _objectWithoutProperties2.default)(
|
|
38
|
+
return function Chat(userProps) {
|
|
39
|
+
var open = userProps.open,
|
|
40
|
+
_userProps$maximized = userProps.maximized,
|
|
41
|
+
maximized = _userProps$maximized === void 0 ? false : _userProps$maximized,
|
|
42
|
+
headerProps = userProps.headerProps,
|
|
43
|
+
toggleButtonProps = userProps.toggleButtonProps,
|
|
44
|
+
messagesProps = userProps.messagesProps,
|
|
45
|
+
_userProps$promptProp = userProps.promptProps,
|
|
46
|
+
promptProps = _userProps$promptProp === void 0 ? {} : _userProps$promptProp,
|
|
47
|
+
HeaderComponent = userProps.headerComponent,
|
|
48
|
+
PromptComponent = userProps.promptComponent,
|
|
49
|
+
ToggleButtonComponent = userProps.toggleButtonComponent,
|
|
50
|
+
_userProps$classNames = userProps.classNames,
|
|
51
|
+
classNames = _userProps$classNames === void 0 ? {} : _userProps$classNames,
|
|
52
|
+
className = userProps.className,
|
|
53
|
+
props = (0, _objectWithoutProperties2.default)(userProps, _excluded);
|
|
54
54
|
return createElement("div", (0, _extends2.default)({}, props, {
|
|
55
55
|
className: (0, _lib.cx)('ais-Chat', maximized && 'ais-Chat--maximized', classNames.root, className)
|
|
56
56
|
}), createElement("div", {
|
|
@@ -19,22 +19,22 @@ function createChatHeaderComponent(_ref) {
|
|
|
19
19
|
var Button = (0, _Button.createButtonComponent)({
|
|
20
20
|
createElement: createElement
|
|
21
21
|
});
|
|
22
|
-
return function ChatHeader(
|
|
23
|
-
var
|
|
24
|
-
maximized =
|
|
25
|
-
onToggleMaximize =
|
|
26
|
-
onClose =
|
|
27
|
-
onClear =
|
|
28
|
-
|
|
29
|
-
canClear =
|
|
30
|
-
CloseIcon =
|
|
31
|
-
MinimizeIcon =
|
|
32
|
-
MaximizeIcon =
|
|
33
|
-
TitleIcon =
|
|
34
|
-
|
|
35
|
-
classNames =
|
|
36
|
-
userTranslations =
|
|
37
|
-
props = (0, _objectWithoutProperties2.default)(
|
|
22
|
+
return function ChatHeader(userProps) {
|
|
23
|
+
var _userProps$maximized = userProps.maximized,
|
|
24
|
+
maximized = _userProps$maximized === void 0 ? false : _userProps$maximized,
|
|
25
|
+
onToggleMaximize = userProps.onToggleMaximize,
|
|
26
|
+
onClose = userProps.onClose,
|
|
27
|
+
onClear = userProps.onClear,
|
|
28
|
+
_userProps$canClear = userProps.canClear,
|
|
29
|
+
canClear = _userProps$canClear === void 0 ? false : _userProps$canClear,
|
|
30
|
+
CloseIcon = userProps.closeIconComponent,
|
|
31
|
+
MinimizeIcon = userProps.minimizeIconComponent,
|
|
32
|
+
MaximizeIcon = userProps.maximizeIconComponent,
|
|
33
|
+
TitleIcon = userProps.titleIconComponent,
|
|
34
|
+
_userProps$classNames = userProps.classNames,
|
|
35
|
+
classNames = _userProps$classNames === void 0 ? {} : _userProps$classNames,
|
|
36
|
+
userTranslations = userProps.translations,
|
|
37
|
+
props = (0, _objectWithoutProperties2.default)(userProps, _excluded);
|
|
38
38
|
var translations = _objectSpread({
|
|
39
39
|
title: 'Chat',
|
|
40
40
|
minimizeLabel: 'Minimize chat',
|
|
@@ -18,11 +18,11 @@ function createChatMessageErrorComponent(_ref) {
|
|
|
18
18
|
var Button = (0, _Button.createButtonComponent)({
|
|
19
19
|
createElement: createElement
|
|
20
20
|
});
|
|
21
|
-
return function ChatMessageError(
|
|
22
|
-
var onReload =
|
|
23
|
-
actions =
|
|
24
|
-
userTranslations =
|
|
25
|
-
props = (0, _objectWithoutProperties2.default)(
|
|
21
|
+
return function ChatMessageError(userProps) {
|
|
22
|
+
var onReload = userProps.onReload,
|
|
23
|
+
actions = userProps.actions,
|
|
24
|
+
userTranslations = userProps.translations,
|
|
25
|
+
props = (0, _objectWithoutProperties2.default)(userProps, _excluded);
|
|
26
26
|
var translations = _objectSpread({
|
|
27
27
|
errorMessage: 'Sorry, we are not able to generate a response at the moment. Please retry or contact support.',
|
|
28
28
|
retryText: 'Retry'
|
|
@@ -14,9 +14,9 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
14
14
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
15
|
function createChatMessageLoaderComponent(_ref) {
|
|
16
16
|
var createElement = _ref.createElement;
|
|
17
|
-
return function ChatMessageLoader(
|
|
18
|
-
var userTranslations =
|
|
19
|
-
props = (0, _objectWithoutProperties2.default)(
|
|
17
|
+
return function ChatMessageLoader(userProps) {
|
|
18
|
+
var userTranslations = userProps.translations,
|
|
19
|
+
props = (0, _objectWithoutProperties2.default)(userProps, _excluded);
|
|
20
20
|
var translations = _objectSpread({
|
|
21
21
|
loaderText: 'Thinking...'
|
|
22
22
|
}, userTranslations);
|
|
@@ -16,14 +16,14 @@ function createChatToggleButtonComponent(_ref) {
|
|
|
16
16
|
var Button = (0, _Button.createButtonComponent)({
|
|
17
17
|
createElement: createElement
|
|
18
18
|
});
|
|
19
|
-
return function ChatToggleButton(
|
|
20
|
-
var open =
|
|
21
|
-
onClick =
|
|
22
|
-
ToggleIcon =
|
|
23
|
-
|
|
24
|
-
classNames =
|
|
25
|
-
className =
|
|
26
|
-
props = (0, _objectWithoutProperties2.default)(
|
|
19
|
+
return function ChatToggleButton(userProps) {
|
|
20
|
+
var open = userProps.open,
|
|
21
|
+
onClick = userProps.onClick,
|
|
22
|
+
ToggleIcon = userProps.toggleIconComponent,
|
|
23
|
+
_userProps$classNames = userProps.classNames,
|
|
24
|
+
classNames = _userProps$classNames === void 0 ? {} : _userProps$classNames,
|
|
25
|
+
className = userProps.className,
|
|
26
|
+
props = (0, _objectWithoutProperties2.default)(userProps, _excluded);
|
|
27
27
|
var defaultIcon = open ? createElement(_icons.ChevronUpIcon, {
|
|
28
28
|
createElement: createElement
|
|
29
29
|
}) : createElement(_icons.SparklesIcon, {
|
package/dist/cjs/version.js
CHANGED
|
@@ -11,9 +11,11 @@ export type AutocompleteIndexProps<T = {
|
|
|
11
11
|
ItemComponent: (props: {
|
|
12
12
|
item: T;
|
|
13
13
|
onSelect: () => void;
|
|
14
|
+
onApply: () => void;
|
|
14
15
|
}) => JSX.Element;
|
|
15
16
|
getItemProps: (item: T, index: number) => Omit<ComponentProps<'li'>, 'onSelect'> & {
|
|
16
17
|
onSelect: () => void;
|
|
18
|
+
onApply: () => void;
|
|
17
19
|
};
|
|
18
20
|
classNames?: Partial<AutocompleteIndexClassNames>;
|
|
19
21
|
};
|
|
@@ -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 = ["className", "onSelect"];
|
|
3
|
+
var _excluded = ["className", "onSelect", "onApply"];
|
|
4
4
|
import { cx } from "../../lib/cx.js";
|
|
5
5
|
export function createAutocompleteIndexComponent(_ref) {
|
|
6
6
|
var createElement = _ref.createElement;
|
|
@@ -23,6 +23,7 @@ export function createAutocompleteIndexComponent(_ref) {
|
|
|
23
23
|
var _getItemProps = getItemProps(item, index),
|
|
24
24
|
className = _getItemProps.className,
|
|
25
25
|
onSelect = _getItemProps.onSelect,
|
|
26
|
+
onApply = _getItemProps.onApply,
|
|
26
27
|
itemProps = _objectWithoutProperties(_getItemProps, _excluded);
|
|
27
28
|
return createElement("li", _extends({
|
|
28
29
|
key: "".concat(itemProps.id, ":").concat(item.objectID)
|
|
@@ -30,7 +31,8 @@ export function createAutocompleteIndexComponent(_ref) {
|
|
|
30
31
|
className: cx('ais-AutocompleteIndexItem', classNames.item, className)
|
|
31
32
|
}), createElement(ItemComponent, {
|
|
32
33
|
item: item,
|
|
33
|
-
onSelect: onSelect
|
|
34
|
+
onSelect: onSelect,
|
|
35
|
+
onApply: onApply
|
|
34
36
|
}));
|
|
35
37
|
})));
|
|
36
38
|
};
|
|
@@ -7,6 +7,7 @@ export type AutocompleteRecentSearchProps<T = {
|
|
|
7
7
|
children?: ComponentChildren;
|
|
8
8
|
onSelect: () => void;
|
|
9
9
|
onRemoveRecentSearch: () => void;
|
|
10
|
+
onApply: () => void;
|
|
10
11
|
classNames?: Partial<AutocompleteRecentSearchClassNames>;
|
|
11
12
|
};
|
|
12
13
|
export type AutocompleteRecentSearchClassNames = {
|
|
@@ -34,5 +35,9 @@ export type AutocompleteRecentSearchClassNames = {
|
|
|
34
35
|
* Class names to apply to the delete button element
|
|
35
36
|
**/
|
|
36
37
|
deleteButton: string | string[];
|
|
38
|
+
/**
|
|
39
|
+
* Class names to apply to the apply button element
|
|
40
|
+
**/
|
|
41
|
+
applyButton: string | string[];
|
|
37
42
|
};
|
|
38
|
-
export declare function createAutocompleteRecentSearchComponent({ createElement, }: Renderer): (
|
|
43
|
+
export declare function createAutocompleteRecentSearchComponent({ createElement, }: Renderer): (userProps: AutocompleteRecentSearchProps) => JSX.Element;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { cx } from "../../lib/index.js";
|
|
2
|
-
import { ClockIcon, TrashIcon } from "./icons.js";
|
|
2
|
+
import { ApplyIcon, ClockIcon, TrashIcon } from "./icons.js";
|
|
3
3
|
export function createAutocompleteRecentSearchComponent(_ref) {
|
|
4
4
|
var createElement = _ref.createElement;
|
|
5
|
-
return function AutocompleteRecentSearch(
|
|
6
|
-
var item =
|
|
7
|
-
children =
|
|
8
|
-
onSelect =
|
|
9
|
-
onRemoveRecentSearch =
|
|
10
|
-
|
|
11
|
-
classNames =
|
|
5
|
+
return function AutocompleteRecentSearch(userProps) {
|
|
6
|
+
var item = userProps.item,
|
|
7
|
+
children = userProps.children,
|
|
8
|
+
onSelect = userProps.onSelect,
|
|
9
|
+
onRemoveRecentSearch = userProps.onRemoveRecentSearch,
|
|
10
|
+
onApply = userProps.onApply,
|
|
11
|
+
_userProps$classNames = userProps.classNames,
|
|
12
|
+
classNames = _userProps$classNames === void 0 ? {} : _userProps$classNames;
|
|
12
13
|
return createElement("div", {
|
|
13
14
|
onClick: onSelect,
|
|
14
15
|
className: cx('ais-AutocompleteItemWrapper ais-AutocompleteRecentSearchWrapper', classNames.root)
|
|
@@ -31,6 +32,15 @@ export function createAutocompleteRecentSearchComponent(_ref) {
|
|
|
31
32
|
}
|
|
32
33
|
}, createElement(TrashIcon, {
|
|
33
34
|
createElement: createElement
|
|
35
|
+
})), createElement("button", {
|
|
36
|
+
className: cx('ais-AutocompleteItemActionButton', 'ais-AutocompleteRecentSearchItemApplyButton', classNames.applyButton),
|
|
37
|
+
title: "Apply ".concat(item.query, " as search"),
|
|
38
|
+
onClick: function onClick(evt) {
|
|
39
|
+
evt.stopPropagation();
|
|
40
|
+
onApply();
|
|
41
|
+
}
|
|
42
|
+
}, createElement(ApplyIcon, {
|
|
43
|
+
createElement: createElement
|
|
34
44
|
}))));
|
|
35
45
|
};
|
|
36
46
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ComponentProps, Renderer } from '../..';
|
|
2
2
|
export type AutocompleteSearchProps = {
|
|
3
|
-
inputProps:
|
|
3
|
+
inputProps: ComponentProps<'input'>;
|
|
4
4
|
onClear: () => void;
|
|
5
5
|
query: string;
|
|
6
6
|
isSearchStalled: boolean;
|
|
7
7
|
};
|
|
8
|
-
export declare function createAutocompleteSearchComponent({ createElement }: Renderer): (
|
|
8
|
+
export declare function createAutocompleteSearchComponent({ createElement }: Renderer): (userProps: AutocompleteSearchProps) => JSX.Element;
|
|
@@ -2,11 +2,11 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import { ClearIcon, LoadingIcon, SubmitIcon } from "./icons.js";
|
|
3
3
|
export function createAutocompleteSearchComponent(_ref) {
|
|
4
4
|
var createElement = _ref.createElement;
|
|
5
|
-
return function AutocompleteSearch(
|
|
6
|
-
var inputProps =
|
|
7
|
-
onClear =
|
|
8
|
-
query =
|
|
9
|
-
isSearchStalled =
|
|
5
|
+
return function AutocompleteSearch(userProps) {
|
|
6
|
+
var inputProps = userProps.inputProps,
|
|
7
|
+
onClear = userProps.onClear,
|
|
8
|
+
query = userProps.query,
|
|
9
|
+
isSearchStalled = userProps.isSearchStalled;
|
|
10
10
|
var inputRef = inputProps.ref;
|
|
11
11
|
return createElement("form", {
|
|
12
12
|
className: "ais-AutocompleteForm",
|
|
@@ -5,6 +5,7 @@ export type AutocompleteSuggestionProps<T = {
|
|
|
5
5
|
} & Record<string, unknown>> = {
|
|
6
6
|
item: T;
|
|
7
7
|
onSelect: () => void;
|
|
8
|
+
onApply: () => void;
|
|
8
9
|
children: ComponentChildren;
|
|
9
10
|
classNames?: Partial<AutocompleteSuggestionClassNames>;
|
|
10
11
|
};
|
|
@@ -21,5 +22,7 @@ export type AutocompleteSuggestionClassNames = {
|
|
|
21
22
|
icon: string | string[];
|
|
22
23
|
/** Class names to apply to the body element **/
|
|
23
24
|
body: string | string[];
|
|
25
|
+
/** Class names to apply to the apply button element **/
|
|
26
|
+
applyButton: string | string[];
|
|
24
27
|
};
|
|
25
|
-
export declare function createAutocompleteSuggestionComponent({ createElement, }: Renderer): (
|
|
28
|
+
export declare function createAutocompleteSuggestionComponent({ createElement, }: Renderer): (userProps: AutocompleteSuggestionProps) => JSX.Element;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { cx } from "../../lib/index.js";
|
|
2
|
-
import { SubmitIcon } from "./icons.js";
|
|
2
|
+
import { SubmitIcon, ApplyIcon } from "./icons.js";
|
|
3
3
|
export function createAutocompleteSuggestionComponent(_ref) {
|
|
4
4
|
var createElement = _ref.createElement;
|
|
5
|
-
return function AutocompleteSuggestion(
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
return function AutocompleteSuggestion(userProps) {
|
|
6
|
+
var item = userProps.item,
|
|
7
|
+
children = userProps.children,
|
|
8
|
+
onSelect = userProps.onSelect,
|
|
9
|
+
onApply = userProps.onApply,
|
|
10
|
+
_userProps$classNames = userProps.classNames,
|
|
11
|
+
classNames = _userProps$classNames === void 0 ? {} : _userProps$classNames;
|
|
10
12
|
return createElement("div", {
|
|
11
13
|
onClick: onSelect,
|
|
12
14
|
className: cx('ais-AutocompleteItemWrapper', 'ais-AutocompleteSuggestionWrapper', classNames.root)
|
|
@@ -18,6 +20,18 @@ export function createAutocompleteSuggestionComponent(_ref) {
|
|
|
18
20
|
createElement: createElement
|
|
19
21
|
})), createElement("div", {
|
|
20
22
|
className: cx('ais-AutocompleteItemContentBody', 'ais-AutocompleteSuggestionItemContentBody', classNames.content)
|
|
21
|
-
}, children))
|
|
23
|
+
}, children)), createElement("div", {
|
|
24
|
+
className: cx('ais-AutocompleteItemActions', 'ais-AutocompleteSuggestionItemActions', classNames.actions)
|
|
25
|
+
}, createElement("button", {
|
|
26
|
+
className: cx('ais-AutocompleteItemActionButton', 'ais-AutocompleteSuggestionItemApplyButton', classNames.applyButton),
|
|
27
|
+
type: "button",
|
|
28
|
+
title: "Apply ".concat(item.query, " as search"),
|
|
29
|
+
onClick: function onClick(evt) {
|
|
30
|
+
evt.stopPropagation();
|
|
31
|
+
onApply();
|
|
32
|
+
}
|
|
33
|
+
}, createElement(ApplyIcon, {
|
|
34
|
+
createElement: createElement
|
|
35
|
+
}))));
|
|
22
36
|
};
|
|
23
37
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComponentProps } from '../../types';
|
|
1
|
+
import type { ComponentProps, MutableRef } from '../../types';
|
|
2
2
|
type BaseHit = Record<string, unknown>;
|
|
3
3
|
export type AutocompleteIndexConfig<TItem extends BaseHit> = {
|
|
4
4
|
indexName: string;
|
|
@@ -11,14 +11,27 @@ export type AutocompleteIndexConfig<TItem extends BaseHit> = {
|
|
|
11
11
|
url?: string;
|
|
12
12
|
}) => void;
|
|
13
13
|
};
|
|
14
|
-
type GetInputProps = () =>
|
|
14
|
+
type GetInputProps = () => ComponentProps<'input'>;
|
|
15
|
+
type ValidAriaRole = 'combobox' | 'row' | 'grid';
|
|
15
16
|
type GetItemProps = (item: {
|
|
16
17
|
__indexName: string;
|
|
17
|
-
} & Record<string, unknown>, index: number) =>
|
|
18
|
+
} & Record<string, unknown>, index: number) => {
|
|
19
|
+
id?: string;
|
|
20
|
+
role?: ValidAriaRole;
|
|
21
|
+
'aria-selected'?: boolean;
|
|
22
|
+
} & {
|
|
18
23
|
onSelect: () => void;
|
|
24
|
+
onApply: () => void;
|
|
25
|
+
};
|
|
26
|
+
type GetPanelProps = () => {
|
|
27
|
+
id?: string;
|
|
28
|
+
hidden?: boolean;
|
|
29
|
+
role?: ValidAriaRole;
|
|
30
|
+
'aria-labelledby'?: string;
|
|
31
|
+
};
|
|
32
|
+
type GetRootProps = () => {
|
|
33
|
+
ref?: MutableRef<HTMLDivElement | null>;
|
|
19
34
|
};
|
|
20
|
-
type GetPanelProps = () => Pick<ComponentProps<'div'>, 'id' | 'hidden' | 'role' | 'aria-labelledby'>;
|
|
21
|
-
type GetRootProps = () => Pick<ComponentProps<'div'>, 'ref'>;
|
|
22
35
|
type CreateAutocompletePropGettersParams = {
|
|
23
36
|
useEffect: (effect: () => void, inputs?: readonly unknown[]) => void;
|
|
24
37
|
useId: () => string;
|
|
@@ -39,6 +52,7 @@ export type UsePropGetters<TItem extends BaseHit> = (params: {
|
|
|
39
52
|
indicesConfig: Array<AutocompleteIndexConfig<TItem>>;
|
|
40
53
|
onRefine: (query: string) => void;
|
|
41
54
|
onSelect: NonNullable<AutocompleteIndexConfig<TItem>['onSelect']>;
|
|
55
|
+
onApply: (query: string) => void;
|
|
42
56
|
placeholder?: string;
|
|
43
57
|
}) => {
|
|
44
58
|
getInputProps: GetInputProps;
|
|
@@ -46,5 +60,5 @@ export type UsePropGetters<TItem extends BaseHit> = (params: {
|
|
|
46
60
|
getPanelProps: GetPanelProps;
|
|
47
61
|
getRootProps: GetRootProps;
|
|
48
62
|
};
|
|
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>>;
|
|
63
|
+
export declare function createAutocompletePropGetters({ useEffect, useId, useMemo, useRef, useState, }: CreateAutocompletePropGettersParams): <TItem extends BaseHit>({ indices, indicesConfig, onRefine, onSelect: globalOnSelect, onApply, placeholder, }: Parameters<UsePropGetters<TItem>>[0]) => ReturnType<UsePropGetters<TItem>>;
|
|
50
64
|
export {};
|
|
@@ -11,6 +11,7 @@ export function createAutocompletePropGetters(_ref) {
|
|
|
11
11
|
indicesConfig = _ref2.indicesConfig,
|
|
12
12
|
onRefine = _ref2.onRefine,
|
|
13
13
|
globalOnSelect = _ref2.onSelect,
|
|
14
|
+
_onApply = _ref2.onApply,
|
|
14
15
|
placeholder = _ref2.placeholder;
|
|
15
16
|
var getElementId = createGetElementId(useId());
|
|
16
17
|
var inputRef = useRef(null);
|
|
@@ -178,6 +179,13 @@ export function createAutocompletePropGetters(_ref) {
|
|
|
178
179
|
return submit({
|
|
179
180
|
activeDescendant: id
|
|
180
181
|
});
|
|
182
|
+
},
|
|
183
|
+
onApply: function onApply() {
|
|
184
|
+
var _getQuery2;
|
|
185
|
+
var _ref4 = items.get(id),
|
|
186
|
+
currentItem = _ref4.item,
|
|
187
|
+
getQuery = _ref4.config.getQuery;
|
|
188
|
+
_onApply((_getQuery2 = getQuery === null || getQuery === void 0 ? void 0 : getQuery(currentItem)) !== null && _getQuery2 !== void 0 ? _getQuery2 : '');
|
|
181
189
|
}
|
|
182
190
|
};
|
|
183
191
|
},
|
|
@@ -197,10 +205,10 @@ export function createAutocompletePropGetters(_ref) {
|
|
|
197
205
|
};
|
|
198
206
|
};
|
|
199
207
|
}
|
|
200
|
-
function buildItems(
|
|
201
|
-
var indices =
|
|
202
|
-
indicesConfig =
|
|
203
|
-
getElementId =
|
|
208
|
+
function buildItems(_ref5) {
|
|
209
|
+
var indices = _ref5.indices,
|
|
210
|
+
indicesConfig = _ref5.indicesConfig,
|
|
211
|
+
getElementId = _ref5.getElementId;
|
|
204
212
|
var itemsIds = [];
|
|
205
213
|
var items = new Map();
|
|
206
214
|
for (var i = 0; i < indicesConfig.length; i++) {
|
|
@@ -6,4 +6,5 @@ export declare function LoadingIcon({ createElement }: IconProps): JSX.Element;
|
|
|
6
6
|
export declare function ClearIcon({ createElement }: IconProps): JSX.Element;
|
|
7
7
|
export declare function ClockIcon({ createElement }: IconProps): JSX.Element;
|
|
8
8
|
export declare function TrashIcon({ createElement }: IconProps): JSX.Element;
|
|
9
|
+
export declare function ApplyIcon({ createElement }: IconProps): JSX.Element;
|
|
9
10
|
export {};
|
|
@@ -57,4 +57,13 @@ export function TrashIcon(_ref5) {
|
|
|
57
57
|
}, createElement("path", {
|
|
58
58
|
d: "M18 7v13c0 0.276-0.111 0.525-0.293 0.707s-0.431 0.293-0.707 0.293h-10c-0.276 0-0.525-0.111-0.707-0.293s-0.293-0.431-0.293-0.707v-13zM17 5v-1c0-0.828-0.337-1.58-0.879-2.121s-1.293-0.879-2.121-0.879h-4c-0.828 0-1.58 0.337-2.121 0.879s-0.879 1.293-0.879 2.121v1h-4c-0.552 0-1 0.448-1 1s0.448 1 1 1h1v13c0 0.828 0.337 1.58 0.879 2.121s1.293 0.879 2.121 0.879h10c0.828 0 1.58-0.337 2.121-0.879s0.879-1.293 0.879-2.121v-13h1c0.552 0 1-0.448 1-1s-0.448-1-1-1zM9 5v-1c0-0.276 0.111-0.525 0.293-0.707s0.431-0.293 0.707-0.293h4c0.276 0 0.525 0.111 0.707 0.293s0.293 0.431 0.293 0.707v1zM9 11v6c0 0.552 0.448 1 1 1s1-0.448 1-1v-6c0-0.552-0.448-1-1-1s-1 0.448-1 1zM13 11v6c0 0.552 0.448 1 1 1s1-0.448 1-1v-6c0-0.552-0.448-1-1-1s-1 0.448-1 1z"
|
|
59
59
|
}));
|
|
60
|
+
}
|
|
61
|
+
export function ApplyIcon(_ref6) {
|
|
62
|
+
var createElement = _ref6.createElement;
|
|
63
|
+
return createElement("svg", {
|
|
64
|
+
viewBox: "0 0 24 24",
|
|
65
|
+
fill: "currentColor"
|
|
66
|
+
}, createElement("path", {
|
|
67
|
+
d: "M8 17v-7.586l8.293 8.293c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414l-8.293-8.293h7.586c0.552 0 1-0.448 1-1s-0.448-1-1-1h-10c-0.552 0-1 0.448-1 1v10c0 0.552 0.448 1 1 1s1-0.448 1-1z"
|
|
68
|
+
}));
|
|
60
69
|
}
|
|
@@ -40,4 +40,4 @@ export type ChatProps = Omit<ComponentProps<'div'>, 'onError' | 'title'> & {
|
|
|
40
40
|
*/
|
|
41
41
|
toggleButtonComponent?: (props: ChatToggleButtonOwnProps) => JSX.Element;
|
|
42
42
|
};
|
|
43
|
-
export declare function createChatComponent({ createElement, Fragment }: Renderer): (
|
|
43
|
+
export declare function createChatComponent({ createElement, Fragment }: Renderer): (userProps: ChatProps) => JSX.Element;
|
|
@@ -28,22 +28,22 @@ export function createChatComponent(_ref) {
|
|
|
28
28
|
createElement: createElement,
|
|
29
29
|
Fragment: Fragment
|
|
30
30
|
});
|
|
31
|
-
return function Chat(
|
|
32
|
-
var open =
|
|
33
|
-
|
|
34
|
-
maximized =
|
|
35
|
-
headerProps =
|
|
36
|
-
toggleButtonProps =
|
|
37
|
-
messagesProps =
|
|
38
|
-
|
|
39
|
-
promptProps =
|
|
40
|
-
HeaderComponent =
|
|
41
|
-
PromptComponent =
|
|
42
|
-
ToggleButtonComponent =
|
|
43
|
-
|
|
44
|
-
classNames =
|
|
45
|
-
className =
|
|
46
|
-
props = _objectWithoutProperties(
|
|
31
|
+
return function Chat(userProps) {
|
|
32
|
+
var open = userProps.open,
|
|
33
|
+
_userProps$maximized = userProps.maximized,
|
|
34
|
+
maximized = _userProps$maximized === void 0 ? false : _userProps$maximized,
|
|
35
|
+
headerProps = userProps.headerProps,
|
|
36
|
+
toggleButtonProps = userProps.toggleButtonProps,
|
|
37
|
+
messagesProps = userProps.messagesProps,
|
|
38
|
+
_userProps$promptProp = userProps.promptProps,
|
|
39
|
+
promptProps = _userProps$promptProp === void 0 ? {} : _userProps$promptProp,
|
|
40
|
+
HeaderComponent = userProps.headerComponent,
|
|
41
|
+
PromptComponent = userProps.promptComponent,
|
|
42
|
+
ToggleButtonComponent = userProps.toggleButtonComponent,
|
|
43
|
+
_userProps$classNames = userProps.classNames,
|
|
44
|
+
classNames = _userProps$classNames === void 0 ? {} : _userProps$classNames,
|
|
45
|
+
className = userProps.className,
|
|
46
|
+
props = _objectWithoutProperties(userProps, _excluded);
|
|
47
47
|
return createElement("div", _extends({}, props, {
|
|
48
48
|
className: cx('ais-Chat', maximized && 'ais-Chat--maximized', classNames.root, className)
|
|
49
49
|
}), createElement("div", {
|
|
@@ -96,4 +96,4 @@ export type ChatHeaderOwnProps = {
|
|
|
96
96
|
translations?: Partial<ChatHeaderTranslations>;
|
|
97
97
|
};
|
|
98
98
|
export type ChatHeaderProps = ComponentProps<'div'> & ChatHeaderOwnProps;
|
|
99
|
-
export declare function createChatHeaderComponent({ createElement }: Renderer): (
|
|
99
|
+
export declare function createChatHeaderComponent({ createElement }: Renderer): (userProps: ChatHeaderProps) => JSX.Element;
|
|
@@ -12,22 +12,22 @@ export function createChatHeaderComponent(_ref) {
|
|
|
12
12
|
var Button = createButtonComponent({
|
|
13
13
|
createElement: createElement
|
|
14
14
|
});
|
|
15
|
-
return function ChatHeader(
|
|
16
|
-
var
|
|
17
|
-
maximized =
|
|
18
|
-
onToggleMaximize =
|
|
19
|
-
onClose =
|
|
20
|
-
onClear =
|
|
21
|
-
|
|
22
|
-
canClear =
|
|
23
|
-
CloseIcon =
|
|
24
|
-
MinimizeIcon =
|
|
25
|
-
MaximizeIcon =
|
|
26
|
-
TitleIcon =
|
|
27
|
-
|
|
28
|
-
classNames =
|
|
29
|
-
userTranslations =
|
|
30
|
-
props = _objectWithoutProperties(
|
|
15
|
+
return function ChatHeader(userProps) {
|
|
16
|
+
var _userProps$maximized = userProps.maximized,
|
|
17
|
+
maximized = _userProps$maximized === void 0 ? false : _userProps$maximized,
|
|
18
|
+
onToggleMaximize = userProps.onToggleMaximize,
|
|
19
|
+
onClose = userProps.onClose,
|
|
20
|
+
onClear = userProps.onClear,
|
|
21
|
+
_userProps$canClear = userProps.canClear,
|
|
22
|
+
canClear = _userProps$canClear === void 0 ? false : _userProps$canClear,
|
|
23
|
+
CloseIcon = userProps.closeIconComponent,
|
|
24
|
+
MinimizeIcon = userProps.minimizeIconComponent,
|
|
25
|
+
MaximizeIcon = userProps.maximizeIconComponent,
|
|
26
|
+
TitleIcon = userProps.titleIconComponent,
|
|
27
|
+
_userProps$classNames = userProps.classNames,
|
|
28
|
+
classNames = _userProps$classNames === void 0 ? {} : _userProps$classNames,
|
|
29
|
+
userTranslations = userProps.translations,
|
|
30
|
+
props = _objectWithoutProperties(userProps, _excluded);
|
|
31
31
|
var translations = _objectSpread({
|
|
32
32
|
title: 'Chat',
|
|
33
33
|
minimizeLabel: 'Minimize chat',
|
|
@@ -24,4 +24,4 @@ export type ChatMessageErrorProps = ComponentProps<'article'> & {
|
|
|
24
24
|
*/
|
|
25
25
|
translations?: Partial<ChatMessageErrorTranslations>;
|
|
26
26
|
};
|
|
27
|
-
export declare function createChatMessageErrorComponent({ createElement, }: Pick<Renderer, 'createElement'>): (
|
|
27
|
+
export declare function createChatMessageErrorComponent({ createElement, }: Pick<Renderer, 'createElement'>): (userProps: ChatMessageErrorProps) => JSX.Element;
|
|
@@ -11,11 +11,11 @@ export function createChatMessageErrorComponent(_ref) {
|
|
|
11
11
|
var Button = createButtonComponent({
|
|
12
12
|
createElement: createElement
|
|
13
13
|
});
|
|
14
|
-
return function ChatMessageError(
|
|
15
|
-
var onReload =
|
|
16
|
-
actions =
|
|
17
|
-
userTranslations =
|
|
18
|
-
props = _objectWithoutProperties(
|
|
14
|
+
return function ChatMessageError(userProps) {
|
|
15
|
+
var onReload = userProps.onReload,
|
|
16
|
+
actions = userProps.actions,
|
|
17
|
+
userTranslations = userProps.translations,
|
|
18
|
+
props = _objectWithoutProperties(userProps, _excluded);
|
|
19
19
|
var translations = _objectSpread({
|
|
20
20
|
errorMessage: 'Sorry, we are not able to generate a response at the moment. Please retry or contact support.',
|
|
21
21
|
retryText: 'Retry'
|
|
@@ -12,4 +12,4 @@ export type ChatMessageLoaderProps = ComponentProps<'article'> & {
|
|
|
12
12
|
*/
|
|
13
13
|
translations?: Partial<ChatMessageLoaderTranslations>;
|
|
14
14
|
};
|
|
15
|
-
export declare function createChatMessageLoaderComponent({ createElement, }: Pick<Renderer, 'createElement'>): (
|
|
15
|
+
export declare function createChatMessageLoaderComponent({ createElement, }: Pick<Renderer, 'createElement'>): (userProps: ChatMessageLoaderProps) => JSX.Element;
|
|
@@ -7,9 +7,9 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
7
7
|
import { LoadingSpinnerIcon } from "./icons.js";
|
|
8
8
|
export function createChatMessageLoaderComponent(_ref) {
|
|
9
9
|
var createElement = _ref.createElement;
|
|
10
|
-
return function ChatMessageLoader(
|
|
11
|
-
var userTranslations =
|
|
12
|
-
props = _objectWithoutProperties(
|
|
10
|
+
return function ChatMessageLoader(userProps) {
|
|
11
|
+
var userTranslations = userProps.translations,
|
|
12
|
+
props = _objectWithoutProperties(userProps, _excluded);
|
|
13
13
|
var translations = _objectSpread({
|
|
14
14
|
loaderText: 'Thinking...'
|
|
15
15
|
}, userTranslations);
|
|
@@ -105,11 +105,11 @@ export type ChatPromptOwnProps = {
|
|
|
105
105
|
/**
|
|
106
106
|
* Callback when the form is submitted
|
|
107
107
|
*/
|
|
108
|
-
onSubmit?:
|
|
108
|
+
onSubmit?: (event: SubmitEvent) => void;
|
|
109
109
|
/**
|
|
110
110
|
* Callback when the textarea value changes
|
|
111
111
|
*/
|
|
112
|
-
onInput?:
|
|
112
|
+
onInput?: (event: InputEvent) => void;
|
|
113
113
|
/**
|
|
114
114
|
* Ref to the prompt textarea element for focus management
|
|
115
115
|
*/
|
|
@@ -26,4 +26,4 @@ export type ChatToggleButtonOwnProps = {
|
|
|
26
26
|
classNames?: Partial<ChatToggleButtonClassNames>;
|
|
27
27
|
};
|
|
28
28
|
export type ChatToggleButtonProps = ComponentProps<'button'> & ChatToggleButtonOwnProps;
|
|
29
|
-
export declare function createChatToggleButtonComponent({ createElement }: Renderer): (
|
|
29
|
+
export declare function createChatToggleButtonComponent({ createElement }: Renderer): (userProps: ChatToggleButtonProps) => JSX.Element;
|
|
@@ -9,14 +9,14 @@ export function createChatToggleButtonComponent(_ref) {
|
|
|
9
9
|
var Button = createButtonComponent({
|
|
10
10
|
createElement: createElement
|
|
11
11
|
});
|
|
12
|
-
return function ChatToggleButton(
|
|
13
|
-
var open =
|
|
14
|
-
onClick =
|
|
15
|
-
ToggleIcon =
|
|
16
|
-
|
|
17
|
-
classNames =
|
|
18
|
-
className =
|
|
19
|
-
props = _objectWithoutProperties(
|
|
12
|
+
return function ChatToggleButton(userProps) {
|
|
13
|
+
var open = userProps.open,
|
|
14
|
+
onClick = userProps.onClick,
|
|
15
|
+
ToggleIcon = userProps.toggleIconComponent,
|
|
16
|
+
_userProps$classNames = userProps.classNames,
|
|
17
|
+
classNames = _userProps$classNames === void 0 ? {} : _userProps$classNames,
|
|
18
|
+
className = userProps.className,
|
|
19
|
+
props = _objectWithoutProperties(userProps, _excluded);
|
|
20
20
|
var defaultIcon = open ? createElement(ChevronUpIcon, {
|
|
21
21
|
createElement: createElement
|
|
22
22
|
}) : createElement(SparklesIcon, {
|
package/dist/es/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "0.
|
|
1
|
+
declare const _default: "0.16.0";
|
|
2
2
|
export default _default;
|
package/dist/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '0.
|
|
1
|
+
export default '0.16.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "instantsearch-ui-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Common UI components for InstantSearch.",
|
|
5
5
|
"types": "dist/es/index.d.ts",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"zod": "^3.25.76 || ^4",
|
|
54
54
|
"zod-to-json-schema": "3.24.6"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "13c7c916b870f34f5f6dde9bd7b16850990dc7ea"
|
|
57
57
|
}
|