react-instantsearch 7.5.3 → 7.5.4
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/widgets/SearchBox.js +6 -5
- package/dist/es/widgets/SearchBox.d.ts +7 -1
- package/dist/es/widgets/SearchBox.js +6 -5
- package/dist/umd/ReactInstantSearch.js +8 -7
- package/dist/umd/ReactInstantSearch.js.map +1 -1
- package/dist/umd/ReactInstantSearch.min.js +1 -1
- package/dist/umd/ReactInstantSearch.min.js.map +1 -1
- package/package.json +4 -4
|
@@ -8,7 +8,7 @@ exports.SearchBox = SearchBox;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _reactInstantsearchCore = require("react-instantsearch-core");
|
|
10
10
|
var _SearchBox = require("../ui/SearchBox");
|
|
11
|
-
var _excluded = ["queryHook", "searchAsYouType", "translations"];
|
|
11
|
+
var _excluded = ["queryHook", "searchAsYouType", "ignoreCompositionEvents", "translations"];
|
|
12
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
14
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
@@ -29,6 +29,8 @@ function SearchBox(_ref) {
|
|
|
29
29
|
var queryHook = _ref.queryHook,
|
|
30
30
|
_ref$searchAsYouType = _ref.searchAsYouType,
|
|
31
31
|
searchAsYouType = _ref$searchAsYouType === void 0 ? true : _ref$searchAsYouType,
|
|
32
|
+
_ref$ignoreCompositio = _ref.ignoreCompositionEvents,
|
|
33
|
+
ignoreCompositionEvents = _ref$ignoreCompositio === void 0 ? false : _ref$ignoreCompositio,
|
|
32
34
|
translations = _ref.translations,
|
|
33
35
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
34
36
|
var _useSearchBox = (0, _reactInstantsearchCore.useSearchBox)({
|
|
@@ -45,9 +47,9 @@ function SearchBox(_ref) {
|
|
|
45
47
|
setInputValue = _useState2[1];
|
|
46
48
|
var inputRef = (0, _react.useRef)(null);
|
|
47
49
|
function setQuery(newQuery) {
|
|
48
|
-
var
|
|
50
|
+
var isComposing = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
49
51
|
setInputValue(newQuery);
|
|
50
|
-
if (searchAsYouType &&
|
|
52
|
+
if (searchAsYouType && !(ignoreCompositionEvents && isComposing)) {
|
|
51
53
|
refine(newQuery);
|
|
52
54
|
}
|
|
53
55
|
}
|
|
@@ -58,8 +60,7 @@ function SearchBox(_ref) {
|
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
function onChange(event) {
|
|
61
|
-
|
|
62
|
-
setQuery(event.currentTarget.value, compositionComplete);
|
|
63
|
+
setQuery(event.currentTarget.value, event.nativeEvent.isComposing);
|
|
63
64
|
}
|
|
64
65
|
function onSubmit(event) {
|
|
65
66
|
if (!searchAsYouType) {
|
|
@@ -7,7 +7,13 @@ export type SearchBoxProps = Omit<SearchBoxUiComponentProps, Exclude<keyof UiPro
|
|
|
7
7
|
* @default true
|
|
8
8
|
*/
|
|
9
9
|
searchAsYouType?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Whether to update the search state in the middle of a
|
|
12
|
+
* composition session.
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
ignoreCompositionEvents?: boolean;
|
|
10
16
|
translations?: Partial<UiProps['translations']>;
|
|
11
17
|
};
|
|
12
|
-
export declare function SearchBox({ queryHook, searchAsYouType, translations, ...props }: SearchBoxProps): JSX.Element;
|
|
18
|
+
export declare function SearchBox({ queryHook, searchAsYouType, ignoreCompositionEvents, translations, ...props }: SearchBoxProps): JSX.Element;
|
|
13
19
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
var _excluded = ["queryHook", "searchAsYouType", "translations"];
|
|
2
|
+
var _excluded = ["queryHook", "searchAsYouType", "ignoreCompositionEvents", "translations"];
|
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -21,6 +21,8 @@ export function SearchBox(_ref) {
|
|
|
21
21
|
var queryHook = _ref.queryHook,
|
|
22
22
|
_ref$searchAsYouType = _ref.searchAsYouType,
|
|
23
23
|
searchAsYouType = _ref$searchAsYouType === void 0 ? true : _ref$searchAsYouType,
|
|
24
|
+
_ref$ignoreCompositio = _ref.ignoreCompositionEvents,
|
|
25
|
+
ignoreCompositionEvents = _ref$ignoreCompositio === void 0 ? false : _ref$ignoreCompositio,
|
|
24
26
|
translations = _ref.translations,
|
|
25
27
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
26
28
|
var _useSearchBox = useSearchBox({
|
|
@@ -37,9 +39,9 @@ export function SearchBox(_ref) {
|
|
|
37
39
|
setInputValue = _useState2[1];
|
|
38
40
|
var inputRef = useRef(null);
|
|
39
41
|
function setQuery(newQuery) {
|
|
40
|
-
var
|
|
42
|
+
var isComposing = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
41
43
|
setInputValue(newQuery);
|
|
42
|
-
if (searchAsYouType &&
|
|
44
|
+
if (searchAsYouType && !(ignoreCompositionEvents && isComposing)) {
|
|
43
45
|
refine(newQuery);
|
|
44
46
|
}
|
|
45
47
|
}
|
|
@@ -50,8 +52,7 @@ export function SearchBox(_ref) {
|
|
|
50
52
|
}
|
|
51
53
|
}
|
|
52
54
|
function onChange(event) {
|
|
53
|
-
|
|
54
|
-
setQuery(event.currentTarget.value, compositionComplete);
|
|
55
|
+
setQuery(event.currentTarget.value, event.nativeEvent.isComposing);
|
|
55
56
|
}
|
|
56
57
|
function onSubmit(event) {
|
|
57
58
|
if (!searchAsYouType) {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
var React__default = 'default' in React ? React['default'] : React;
|
|
9
9
|
|
|
10
|
-
var version = '7.5.
|
|
10
|
+
var version = '7.5.4';
|
|
11
11
|
|
|
12
12
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
13
13
|
//
|
|
@@ -12204,7 +12204,7 @@
|
|
|
12204
12204
|
};
|
|
12205
12205
|
}
|
|
12206
12206
|
|
|
12207
|
-
var version$3 = '4.64.
|
|
12207
|
+
var version$3 = '4.64.2';
|
|
12208
12208
|
|
|
12209
12209
|
function _typeof$o(obj) {
|
|
12210
12210
|
"@babel/helpers - typeof";
|
|
@@ -20344,11 +20344,13 @@
|
|
|
20344
20344
|
}));
|
|
20345
20345
|
}
|
|
20346
20346
|
|
|
20347
|
-
var _excluded$E = ["queryHook", "searchAsYouType", "translations"];
|
|
20347
|
+
var _excluded$E = ["queryHook", "searchAsYouType", "ignoreCompositionEvents", "translations"];
|
|
20348
20348
|
function SearchBox$1(_ref) {
|
|
20349
20349
|
var queryHook = _ref.queryHook,
|
|
20350
20350
|
_ref$searchAsYouType = _ref.searchAsYouType,
|
|
20351
20351
|
searchAsYouType = _ref$searchAsYouType === void 0 ? true : _ref$searchAsYouType,
|
|
20352
|
+
_ref$ignoreCompositio = _ref.ignoreCompositionEvents,
|
|
20353
|
+
ignoreCompositionEvents = _ref$ignoreCompositio === void 0 ? false : _ref$ignoreCompositio,
|
|
20352
20354
|
translations = _ref.translations,
|
|
20353
20355
|
props = _objectWithoutProperties$c(_ref, _excluded$E);
|
|
20354
20356
|
var _useSearchBox = useSearchBox({
|
|
@@ -20365,9 +20367,9 @@
|
|
|
20365
20367
|
setInputValue = _useState2[1];
|
|
20366
20368
|
var inputRef = React.useRef(null);
|
|
20367
20369
|
function setQuery(newQuery) {
|
|
20368
|
-
var
|
|
20370
|
+
var isComposing = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
20369
20371
|
setInputValue(newQuery);
|
|
20370
|
-
if (searchAsYouType &&
|
|
20372
|
+
if (searchAsYouType && !(ignoreCompositionEvents && isComposing)) {
|
|
20371
20373
|
refine(newQuery);
|
|
20372
20374
|
}
|
|
20373
20375
|
}
|
|
@@ -20378,8 +20380,7 @@
|
|
|
20378
20380
|
}
|
|
20379
20381
|
}
|
|
20380
20382
|
function onChange(event) {
|
|
20381
|
-
|
|
20382
|
-
setQuery(event.currentTarget.value, compositionComplete);
|
|
20383
|
+
setQuery(event.currentTarget.value, event.nativeEvent.isComposing);
|
|
20383
20384
|
}
|
|
20384
20385
|
function onSubmit(event) {
|
|
20385
20386
|
if (!searchAsYouType) {
|