@algolia/autocomplete-core 1.8.1 → 1.8.3
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/esm/getPropGetters.js +24 -9
- package/dist/esm/types/AutocompletePropGetters.d.ts +2 -0
- package/dist/umd/index.development.js +26 -11
- package/dist/umd/index.development.js.map +1 -1
- package/dist/umd/index.production.js +2 -2
- package/dist/umd/index.production.js.map +1 -1
- package/package.json +3 -3
|
@@ -2,7 +2,9 @@ var _excluded = ["props", "refresh", "store"],
|
|
|
2
2
|
_excluded2 = ["inputElement", "formElement", "panelElement"],
|
|
3
3
|
_excluded3 = ["inputElement"],
|
|
4
4
|
_excluded4 = ["inputElement", "maxLength"],
|
|
5
|
-
_excluded5 = ["
|
|
5
|
+
_excluded5 = ["sourceIndex"],
|
|
6
|
+
_excluded6 = ["sourceIndex"],
|
|
7
|
+
_excluded7 = ["item", "source", "sourceIndex"];
|
|
6
8
|
|
|
7
9
|
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; }
|
|
8
10
|
|
|
@@ -214,18 +216,30 @@ export function getPropGetters(_ref) {
|
|
|
214
216
|
}, rest);
|
|
215
217
|
};
|
|
216
218
|
|
|
217
|
-
var
|
|
219
|
+
var getAutocompleteId = function getAutocompleteId(instanceId, sourceId) {
|
|
220
|
+
return typeof sourceId !== 'undefined' ? "".concat(instanceId, "-").concat(sourceId) : instanceId;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
var getLabelProps = function getLabelProps(providedProps) {
|
|
224
|
+
var _ref3 = providedProps || {},
|
|
225
|
+
sourceIndex = _ref3.sourceIndex,
|
|
226
|
+
rest = _objectWithoutProperties(_ref3, _excluded5);
|
|
227
|
+
|
|
218
228
|
return _objectSpread({
|
|
219
|
-
htmlFor: "".concat(props.id, "-input"),
|
|
220
|
-
id: "".concat(props.id, "-label")
|
|
229
|
+
htmlFor: "".concat(getAutocompleteId(props.id, sourceIndex), "-input"),
|
|
230
|
+
id: "".concat(getAutocompleteId(props.id, sourceIndex), "-label")
|
|
221
231
|
}, rest);
|
|
222
232
|
};
|
|
223
233
|
|
|
224
|
-
var getListProps = function getListProps(
|
|
234
|
+
var getListProps = function getListProps(providedProps) {
|
|
235
|
+
var _ref4 = providedProps || {},
|
|
236
|
+
sourceIndex = _ref4.sourceIndex,
|
|
237
|
+
rest = _objectWithoutProperties(_ref4, _excluded6);
|
|
238
|
+
|
|
225
239
|
return _objectSpread({
|
|
226
240
|
role: 'listbox',
|
|
227
|
-
'aria-labelledby': "".concat(props.id, "-label"),
|
|
228
|
-
id: "".concat(props.id, "-list")
|
|
241
|
+
'aria-labelledby': "".concat(getAutocompleteId(props.id, sourceIndex), "-label"),
|
|
242
|
+
id: "".concat(getAutocompleteId(props.id, sourceIndex), "-list")
|
|
229
243
|
}, rest);
|
|
230
244
|
};
|
|
231
245
|
|
|
@@ -246,10 +260,11 @@ export function getPropGetters(_ref) {
|
|
|
246
260
|
var getItemProps = function getItemProps(providedProps) {
|
|
247
261
|
var item = providedProps.item,
|
|
248
262
|
source = providedProps.source,
|
|
249
|
-
|
|
263
|
+
sourceIndex = providedProps.sourceIndex,
|
|
264
|
+
rest = _objectWithoutProperties(providedProps, _excluded7);
|
|
250
265
|
|
|
251
266
|
return _objectSpread({
|
|
252
|
-
id: "".concat(props.id, "-item-").concat(item.__autocomplete_id),
|
|
267
|
+
id: "".concat(getAutocompleteId(props.id, sourceIndex), "-item-").concat(item.__autocomplete_id),
|
|
253
268
|
role: 'option',
|
|
254
269
|
'aria-selected': store.getState().activeItemId === item.__autocomplete_id,
|
|
255
270
|
onMouseMove: function onMouseMove(event) {
|
|
@@ -41,6 +41,7 @@ export declare type GetFormProps<TEvent = Event> = (props: {
|
|
|
41
41
|
};
|
|
42
42
|
export declare type GetLabelProps = (props?: {
|
|
43
43
|
[key: string]: unknown;
|
|
44
|
+
sourceIndex?: number;
|
|
44
45
|
}) => {
|
|
45
46
|
htmlFor: string;
|
|
46
47
|
id: string;
|
|
@@ -79,6 +80,7 @@ export declare type GetPanelProps<TMouseEvent> = (props?: {
|
|
|
79
80
|
};
|
|
80
81
|
export declare type GetListProps = (props?: {
|
|
81
82
|
[key: string]: unknown;
|
|
83
|
+
sourceIndex?: number;
|
|
82
84
|
}) => {
|
|
83
85
|
role: string;
|
|
84
86
|
'aria-labelledby': string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @algolia/autocomplete-core 1.8.
|
|
1
|
+
/*! @algolia/autocomplete-core 1.8.3 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
@@ -264,7 +264,7 @@
|
|
|
264
264
|
|
|
265
265
|
var noop = function noop() {};
|
|
266
266
|
|
|
267
|
-
var version = '1.8.
|
|
267
|
+
var version = '1.8.3';
|
|
268
268
|
|
|
269
269
|
var userAgents = [{
|
|
270
270
|
segment: 'autocomplete-core',
|
|
@@ -1290,7 +1290,9 @@
|
|
|
1290
1290
|
_excluded2 = ["inputElement", "formElement", "panelElement"],
|
|
1291
1291
|
_excluded3 = ["inputElement"],
|
|
1292
1292
|
_excluded4 = ["inputElement", "maxLength"],
|
|
1293
|
-
_excluded5 = ["
|
|
1293
|
+
_excluded5 = ["sourceIndex"],
|
|
1294
|
+
_excluded6 = ["sourceIndex"],
|
|
1295
|
+
_excluded7 = ["item", "source", "sourceIndex"];
|
|
1294
1296
|
function getPropGetters(_ref) {
|
|
1295
1297
|
var props = _ref.props,
|
|
1296
1298
|
refresh = _ref.refresh,
|
|
@@ -1487,18 +1489,30 @@
|
|
|
1487
1489
|
}, rest);
|
|
1488
1490
|
};
|
|
1489
1491
|
|
|
1490
|
-
var
|
|
1492
|
+
var getAutocompleteId = function getAutocompleteId(instanceId, sourceId) {
|
|
1493
|
+
return typeof sourceId !== 'undefined' ? "".concat(instanceId, "-").concat(sourceId) : instanceId;
|
|
1494
|
+
};
|
|
1495
|
+
|
|
1496
|
+
var getLabelProps = function getLabelProps(providedProps) {
|
|
1497
|
+
var _ref3 = providedProps || {},
|
|
1498
|
+
sourceIndex = _ref3.sourceIndex,
|
|
1499
|
+
rest = _objectWithoutProperties(_ref3, _excluded5);
|
|
1500
|
+
|
|
1491
1501
|
return _objectSpread2({
|
|
1492
|
-
htmlFor: "".concat(props.id, "-input"),
|
|
1493
|
-
id: "".concat(props.id, "-label")
|
|
1502
|
+
htmlFor: "".concat(getAutocompleteId(props.id, sourceIndex), "-input"),
|
|
1503
|
+
id: "".concat(getAutocompleteId(props.id, sourceIndex), "-label")
|
|
1494
1504
|
}, rest);
|
|
1495
1505
|
};
|
|
1496
1506
|
|
|
1497
|
-
var getListProps = function getListProps(
|
|
1507
|
+
var getListProps = function getListProps(providedProps) {
|
|
1508
|
+
var _ref4 = providedProps || {},
|
|
1509
|
+
sourceIndex = _ref4.sourceIndex,
|
|
1510
|
+
rest = _objectWithoutProperties(_ref4, _excluded6);
|
|
1511
|
+
|
|
1498
1512
|
return _objectSpread2({
|
|
1499
1513
|
role: 'listbox',
|
|
1500
|
-
'aria-labelledby': "".concat(props.id, "-label"),
|
|
1501
|
-
id: "".concat(props.id, "-list")
|
|
1514
|
+
'aria-labelledby': "".concat(getAutocompleteId(props.id, sourceIndex), "-label"),
|
|
1515
|
+
id: "".concat(getAutocompleteId(props.id, sourceIndex), "-list")
|
|
1502
1516
|
}, rest);
|
|
1503
1517
|
};
|
|
1504
1518
|
|
|
@@ -1519,10 +1533,11 @@
|
|
|
1519
1533
|
var getItemProps = function getItemProps(providedProps) {
|
|
1520
1534
|
var item = providedProps.item,
|
|
1521
1535
|
source = providedProps.source,
|
|
1522
|
-
|
|
1536
|
+
sourceIndex = providedProps.sourceIndex,
|
|
1537
|
+
rest = _objectWithoutProperties(providedProps, _excluded7);
|
|
1523
1538
|
|
|
1524
1539
|
return _objectSpread2({
|
|
1525
|
-
id: "".concat(props.id, "-item-").concat(item.__autocomplete_id),
|
|
1540
|
+
id: "".concat(getAutocompleteId(props.id, sourceIndex), "-item-").concat(item.__autocomplete_id),
|
|
1526
1541
|
role: 'option',
|
|
1527
1542
|
'aria-selected': store.getState().activeItemId === item.__autocomplete_id,
|
|
1528
1543
|
onMouseMove: function onMouseMove(event) {
|