react-instantsearch 7.3.0 → 7.4.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/ui/SearchBox.js +6 -2
- package/dist/cjs/ui/SortBy.js +2 -1
- package/dist/cjs/widgets/Stats.js +29 -1
- package/dist/es/ui/SearchBox.js +6 -2
- package/dist/es/ui/SortBy.js +2 -1
- package/dist/es/widgets/Stats.js +29 -1
- package/dist/umd/ReactInstantSearch.js +551 -356
- 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
package/dist/cjs/ui/SearchBox.js
CHANGED
|
@@ -61,6 +61,7 @@ var _ref6 = /*#__PURE__*/_react.default.createElement("g", {
|
|
|
61
61
|
function DefaultLoadingIcon(_ref5) {
|
|
62
62
|
var classNames = _ref5.classNames;
|
|
63
63
|
return /*#__PURE__*/_react.default.createElement("svg", {
|
|
64
|
+
"aria-label": "Results are loading",
|
|
64
65
|
width: "16",
|
|
65
66
|
height: "16",
|
|
66
67
|
viewBox: "0 0 38 38",
|
|
@@ -76,7 +77,8 @@ function SearchBox(_ref7) {
|
|
|
76
77
|
onChange = _ref7.onChange,
|
|
77
78
|
onReset = _ref7.onReset,
|
|
78
79
|
onSubmit = _ref7.onSubmit,
|
|
79
|
-
placeholder = _ref7.placeholder,
|
|
80
|
+
_ref7$placeholder = _ref7.placeholder,
|
|
81
|
+
placeholder = _ref7$placeholder === void 0 ? '' : _ref7$placeholder,
|
|
80
82
|
value = _ref7.value,
|
|
81
83
|
autoFocus = _ref7.autoFocus,
|
|
82
84
|
_ref7$resetIconCompon = _ref7.resetIconComponent,
|
|
@@ -115,10 +117,12 @@ function SearchBox(_ref7) {
|
|
|
115
117
|
className: (0, _cx.cx)('ais-SearchBox-form', classNames.form),
|
|
116
118
|
noValidate: true,
|
|
117
119
|
onSubmit: handleSubmit,
|
|
118
|
-
onReset: handleReset
|
|
120
|
+
onReset: handleReset,
|
|
121
|
+
role: "search"
|
|
119
122
|
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
120
123
|
ref: inputRef,
|
|
121
124
|
className: (0, _cx.cx)('ais-SearchBox-input', classNames.input),
|
|
125
|
+
"aria-label": "Search",
|
|
122
126
|
autoComplete: "off",
|
|
123
127
|
autoCorrect: "off",
|
|
124
128
|
autoCapitalize: "off",
|
package/dist/cjs/ui/SortBy.js
CHANGED
|
@@ -26,7 +26,8 @@ function SortBy(_ref) {
|
|
|
26
26
|
onChange: function onChange(event) {
|
|
27
27
|
return _onChange(event.target.value);
|
|
28
28
|
},
|
|
29
|
-
value: value
|
|
29
|
+
value: value,
|
|
30
|
+
"aria-label": "Sort results by"
|
|
30
31
|
}, items.map(function (item) {
|
|
31
32
|
return /*#__PURE__*/_react.default.createElement("option", {
|
|
32
33
|
className: (0, _cx.cx)('ais-SortBy-option', classNames.option),
|
|
@@ -35,9 +35,37 @@ function Stats(_ref) {
|
|
|
35
35
|
areHitsSorted: areHitsSorted,
|
|
36
36
|
translations: _objectSpread({
|
|
37
37
|
rootElementText: function rootElementText(options) {
|
|
38
|
-
return
|
|
38
|
+
return "".concat(options.areHitsSorted ? getSortedResultsSentence(options) : getResultsSentence(options), " found in ").concat(options.processingTimeMS.toLocaleString(), "ms");
|
|
39
39
|
}
|
|
40
40
|
}, translations)
|
|
41
41
|
};
|
|
42
42
|
return /*#__PURE__*/_react.default.createElement(_Stats.Stats, _extends({}, props, uiProps));
|
|
43
|
+
}
|
|
44
|
+
function getSortedResultsSentence(_ref2) {
|
|
45
|
+
var nbHits = _ref2.nbHits,
|
|
46
|
+
nbSortedHits = _ref2.nbSortedHits;
|
|
47
|
+
var suffix = "sorted out of ".concat(nbHits.toLocaleString());
|
|
48
|
+
if (nbSortedHits === 0) {
|
|
49
|
+
return "No relevant results ".concat(suffix);
|
|
50
|
+
}
|
|
51
|
+
if (nbSortedHits === 1) {
|
|
52
|
+
return "1 relevant result ".concat(suffix);
|
|
53
|
+
}
|
|
54
|
+
if (nbSortedHits > 1) {
|
|
55
|
+
return "".concat((nbSortedHits || 0).toLocaleString(), " relevant results ").concat(suffix);
|
|
56
|
+
}
|
|
57
|
+
return '';
|
|
58
|
+
}
|
|
59
|
+
function getResultsSentence(_ref3) {
|
|
60
|
+
var nbHits = _ref3.nbHits;
|
|
61
|
+
if (nbHits === 0) {
|
|
62
|
+
return 'No results';
|
|
63
|
+
}
|
|
64
|
+
if (nbHits === 1) {
|
|
65
|
+
return '1 result';
|
|
66
|
+
}
|
|
67
|
+
if (nbHits > 1) {
|
|
68
|
+
return "".concat(nbHits.toLocaleString(), " results");
|
|
69
|
+
}
|
|
70
|
+
return '';
|
|
43
71
|
}
|
package/dist/es/ui/SearchBox.js
CHANGED
|
@@ -54,6 +54,7 @@ var _ref6 = /*#__PURE__*/React.createElement("g", {
|
|
|
54
54
|
function DefaultLoadingIcon(_ref5) {
|
|
55
55
|
var classNames = _ref5.classNames;
|
|
56
56
|
return /*#__PURE__*/React.createElement("svg", {
|
|
57
|
+
"aria-label": "Results are loading",
|
|
57
58
|
width: "16",
|
|
58
59
|
height: "16",
|
|
59
60
|
viewBox: "0 0 38 38",
|
|
@@ -69,7 +70,8 @@ export function SearchBox(_ref7) {
|
|
|
69
70
|
onChange = _ref7.onChange,
|
|
70
71
|
onReset = _ref7.onReset,
|
|
71
72
|
onSubmit = _ref7.onSubmit,
|
|
72
|
-
placeholder = _ref7.placeholder,
|
|
73
|
+
_ref7$placeholder = _ref7.placeholder,
|
|
74
|
+
placeholder = _ref7$placeholder === void 0 ? '' : _ref7$placeholder,
|
|
73
75
|
value = _ref7.value,
|
|
74
76
|
autoFocus = _ref7.autoFocus,
|
|
75
77
|
_ref7$resetIconCompon = _ref7.resetIconComponent,
|
|
@@ -108,10 +110,12 @@ export function SearchBox(_ref7) {
|
|
|
108
110
|
className: cx('ais-SearchBox-form', classNames.form),
|
|
109
111
|
noValidate: true,
|
|
110
112
|
onSubmit: handleSubmit,
|
|
111
|
-
onReset: handleReset
|
|
113
|
+
onReset: handleReset,
|
|
114
|
+
role: "search"
|
|
112
115
|
}, /*#__PURE__*/React.createElement("input", {
|
|
113
116
|
ref: inputRef,
|
|
114
117
|
className: cx('ais-SearchBox-input', classNames.input),
|
|
118
|
+
"aria-label": "Search",
|
|
115
119
|
autoComplete: "off",
|
|
116
120
|
autoCorrect: "off",
|
|
117
121
|
autoCapitalize: "off",
|
package/dist/es/ui/SortBy.js
CHANGED
|
@@ -19,7 +19,8 @@ export function SortBy(_ref) {
|
|
|
19
19
|
onChange: function onChange(event) {
|
|
20
20
|
return _onChange(event.target.value);
|
|
21
21
|
},
|
|
22
|
-
value: value
|
|
22
|
+
value: value,
|
|
23
|
+
"aria-label": "Sort results by"
|
|
23
24
|
}, items.map(function (item) {
|
|
24
25
|
return /*#__PURE__*/React.createElement("option", {
|
|
25
26
|
className: cx('ais-SortBy-option', classNames.option),
|
package/dist/es/widgets/Stats.js
CHANGED
|
@@ -28,9 +28,37 @@ export function Stats(_ref) {
|
|
|
28
28
|
areHitsSorted: areHitsSorted,
|
|
29
29
|
translations: _objectSpread({
|
|
30
30
|
rootElementText: function rootElementText(options) {
|
|
31
|
-
return
|
|
31
|
+
return "".concat(options.areHitsSorted ? getSortedResultsSentence(options) : getResultsSentence(options), " found in ").concat(options.processingTimeMS.toLocaleString(), "ms");
|
|
32
32
|
}
|
|
33
33
|
}, translations)
|
|
34
34
|
};
|
|
35
35
|
return /*#__PURE__*/React.createElement(StatsUiComponent, _extends({}, props, uiProps));
|
|
36
|
+
}
|
|
37
|
+
function getSortedResultsSentence(_ref2) {
|
|
38
|
+
var nbHits = _ref2.nbHits,
|
|
39
|
+
nbSortedHits = _ref2.nbSortedHits;
|
|
40
|
+
var suffix = "sorted out of ".concat(nbHits.toLocaleString());
|
|
41
|
+
if (nbSortedHits === 0) {
|
|
42
|
+
return "No relevant results ".concat(suffix);
|
|
43
|
+
}
|
|
44
|
+
if (nbSortedHits === 1) {
|
|
45
|
+
return "1 relevant result ".concat(suffix);
|
|
46
|
+
}
|
|
47
|
+
if (nbSortedHits > 1) {
|
|
48
|
+
return "".concat((nbSortedHits || 0).toLocaleString(), " relevant results ").concat(suffix);
|
|
49
|
+
}
|
|
50
|
+
return '';
|
|
51
|
+
}
|
|
52
|
+
function getResultsSentence(_ref3) {
|
|
53
|
+
var nbHits = _ref3.nbHits;
|
|
54
|
+
if (nbHits === 0) {
|
|
55
|
+
return 'No results';
|
|
56
|
+
}
|
|
57
|
+
if (nbHits === 1) {
|
|
58
|
+
return '1 result';
|
|
59
|
+
}
|
|
60
|
+
if (nbHits > 1) {
|
|
61
|
+
return "".concat(nbHits.toLocaleString(), " results");
|
|
62
|
+
}
|
|
63
|
+
return '';
|
|
36
64
|
}
|