downshift 7.6.0 → 7.6.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.
- package/README.md +10 -1
- package/dist/downshift.cjs.js +3 -2
- package/dist/downshift.esm.js +3 -2
- package/dist/downshift.native.cjs.js +3 -2
- package/dist/downshift.nativeweb.cjs.js +3 -2
- package/dist/downshift.umd.js +32 -26
- package/dist/downshift.umd.js.map +1 -1
- package/dist/downshift.umd.min.js +1 -1
- package/dist/downshift.umd.min.js.map +1 -1
- package/dist/test/basic.test.d.ts +1 -1
- package/dist/test/custom.test.d.ts +1 -1
- package/package.json +3 -1
- package/preact/dist/downshift.cjs.js +3 -2
- package/preact/dist/downshift.esm.js +3 -2
- package/preact/dist/downshift.umd.js +32 -26
- package/preact/dist/downshift.umd.js.map +1 -1
- package/preact/dist/downshift.umd.min.js +2 -2
- package/preact/dist/downshift.umd.min.js.map +1 -1
package/README.md
CHANGED
|
@@ -70,6 +70,15 @@ to the hook you need by using the links in the list above.
|
|
|
70
70
|
For examples on how to use the hooks or the Downshift component, check out our
|
|
71
71
|
[docsite][docsite]!
|
|
72
72
|
|
|
73
|
+
**🚨 Use the Downshift hooks 🚨**
|
|
74
|
+
|
|
75
|
+
If you are new to the library, consider the _useSelect_ and _useCombobox_ hooks
|
|
76
|
+
as the first option. As mentioned above, the hooks benefit from the updated ARIA
|
|
77
|
+
patterns and are actively maintained and improved. If there are use cases that
|
|
78
|
+
are supported by the _Downshift_ component and not by the hooks, please create
|
|
79
|
+
an issue in our repo. The _Downshift_ component is going to be removed
|
|
80
|
+
completely once the hooks become mature.
|
|
81
|
+
|
|
73
82
|
### Downshift
|
|
74
83
|
|
|
75
84
|
This is a component that controls user interactions and state for you so you can
|
|
@@ -1498,7 +1507,7 @@ MIT
|
|
|
1498
1507
|
[react-training]: https://reacttraining.com/
|
|
1499
1508
|
[advanced-react]: https://courses.reacttraining.com/courses/enrolled/200086
|
|
1500
1509
|
[use-a-render-prop]:
|
|
1501
|
-
https://
|
|
1510
|
+
https://medium.com/@mjackson/use-a-render-prop-50de598f11ce
|
|
1502
1511
|
[semver]: http://semver.org/
|
|
1503
1512
|
[hooks-readme]: https://github.com/downshift-js/downshift/blob/master/src/hooks
|
|
1504
1513
|
[useselect-readme]:
|
package/dist/downshift.cjs.js
CHANGED
|
@@ -3068,7 +3068,7 @@ function useCombobox(userProps) {
|
|
|
3068
3068
|
itemRefs.current = {};
|
|
3069
3069
|
} else if (((_environment$document = environment.document) == null ? void 0 : _environment$document.activeElement) !== inputRef.current) {
|
|
3070
3070
|
var _inputRef$current;
|
|
3071
|
-
inputRef == null
|
|
3071
|
+
inputRef == null || (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
|
|
3072
3072
|
}
|
|
3073
3073
|
}, [isOpen, environment]);
|
|
3074
3074
|
|
|
@@ -3285,9 +3285,10 @@ function useCombobox(userProps) {
|
|
|
3285
3285
|
var inputHandleBlur = function inputHandleBlur(event) {
|
|
3286
3286
|
/* istanbul ignore else */
|
|
3287
3287
|
if (latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) {
|
|
3288
|
+
var isBlurByTabChange = event.relatedTarget === null && environment.document.activeElement !== environment.document.body;
|
|
3288
3289
|
dispatch({
|
|
3289
3290
|
type: InputBlur,
|
|
3290
|
-
selectItem:
|
|
3291
|
+
selectItem: !isBlurByTabChange
|
|
3291
3292
|
});
|
|
3292
3293
|
}
|
|
3293
3294
|
};
|
package/dist/downshift.esm.js
CHANGED
|
@@ -3055,7 +3055,7 @@ function useCombobox(userProps) {
|
|
|
3055
3055
|
itemRefs.current = {};
|
|
3056
3056
|
} else if (((_environment$document = environment.document) == null ? void 0 : _environment$document.activeElement) !== inputRef.current) {
|
|
3057
3057
|
var _inputRef$current;
|
|
3058
|
-
inputRef == null
|
|
3058
|
+
inputRef == null || (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
|
|
3059
3059
|
}
|
|
3060
3060
|
}, [isOpen, environment]);
|
|
3061
3061
|
|
|
@@ -3272,9 +3272,10 @@ function useCombobox(userProps) {
|
|
|
3272
3272
|
var inputHandleBlur = function inputHandleBlur(event) {
|
|
3273
3273
|
/* istanbul ignore else */
|
|
3274
3274
|
if (latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) {
|
|
3275
|
+
var isBlurByTabChange = event.relatedTarget === null && environment.document.activeElement !== environment.document.body;
|
|
3275
3276
|
dispatch({
|
|
3276
3277
|
type: InputBlur,
|
|
3277
|
-
selectItem:
|
|
3278
|
+
selectItem: !isBlurByTabChange
|
|
3278
3279
|
});
|
|
3279
3280
|
}
|
|
3280
3281
|
};
|
|
@@ -2990,7 +2990,7 @@ function useCombobox(userProps) {
|
|
|
2990
2990
|
itemRefs.current = {};
|
|
2991
2991
|
} else if (((_environment$document = environment.document) == null ? void 0 : _environment$document.activeElement) !== inputRef.current) {
|
|
2992
2992
|
var _inputRef$current;
|
|
2993
|
-
inputRef == null
|
|
2993
|
+
inputRef == null || (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
|
|
2994
2994
|
}
|
|
2995
2995
|
}, [isOpen, environment]);
|
|
2996
2996
|
|
|
@@ -3207,9 +3207,10 @@ function useCombobox(userProps) {
|
|
|
3207
3207
|
var inputHandleBlur = function inputHandleBlur(event) {
|
|
3208
3208
|
/* istanbul ignore else */
|
|
3209
3209
|
if (latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) {
|
|
3210
|
+
var isBlurByTabChange = event.relatedTarget === null && environment.document.activeElement !== environment.document.body;
|
|
3210
3211
|
dispatch({
|
|
3211
3212
|
type: InputBlur,
|
|
3212
|
-
selectItem:
|
|
3213
|
+
selectItem: !isBlurByTabChange
|
|
3213
3214
|
});
|
|
3214
3215
|
}
|
|
3215
3216
|
};
|
|
@@ -3050,7 +3050,7 @@ function useCombobox(userProps) {
|
|
|
3050
3050
|
itemRefs.current = {};
|
|
3051
3051
|
} else if (((_environment$document = environment.document) == null ? void 0 : _environment$document.activeElement) !== inputRef.current) {
|
|
3052
3052
|
var _inputRef$current;
|
|
3053
|
-
inputRef == null
|
|
3053
|
+
inputRef == null || (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
|
|
3054
3054
|
}
|
|
3055
3055
|
}, [isOpen, environment]);
|
|
3056
3056
|
|
|
@@ -3267,9 +3267,10 @@ function useCombobox(userProps) {
|
|
|
3267
3267
|
var inputHandleBlur = function inputHandleBlur(event) {
|
|
3268
3268
|
/* istanbul ignore else */
|
|
3269
3269
|
if (latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) {
|
|
3270
|
+
var isBlurByTabChange = event.relatedTarget === null && environment.document.activeElement !== environment.document.body;
|
|
3270
3271
|
dispatch({
|
|
3271
3272
|
type: InputBlur,
|
|
3272
|
-
selectItem:
|
|
3273
|
+
selectItem: !isBlurByTabChange
|
|
3273
3274
|
});
|
|
3274
3275
|
}
|
|
3275
3276
|
};
|
package/dist/downshift.umd.js
CHANGED
|
@@ -3314,30 +3314,35 @@
|
|
|
3314
3314
|
}
|
|
3315
3315
|
/* eslint-enable complexity */
|
|
3316
3316
|
|
|
3317
|
-
/******************************************************************************
|
|
3318
|
-
Copyright (c) Microsoft Corporation.
|
|
3319
|
-
|
|
3320
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
3321
|
-
purpose with or without fee is hereby granted.
|
|
3322
|
-
|
|
3323
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
3324
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
3325
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
3326
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
3327
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
3328
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
3329
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
3330
|
-
***************************************************************************** */
|
|
3331
|
-
|
|
3332
|
-
var __assign = function() {
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3317
|
+
/******************************************************************************
|
|
3318
|
+
Copyright (c) Microsoft Corporation.
|
|
3319
|
+
|
|
3320
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
3321
|
+
purpose with or without fee is hereby granted.
|
|
3322
|
+
|
|
3323
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
3324
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
3325
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
3326
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
3327
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
3328
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
3329
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
3330
|
+
***************************************************************************** */
|
|
3331
|
+
|
|
3332
|
+
var __assign = function() {
|
|
3333
|
+
__assign = Object.assign || function __assign(t) {
|
|
3334
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
3335
|
+
s = arguments[i];
|
|
3336
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
3337
|
+
}
|
|
3338
|
+
return t;
|
|
3339
|
+
};
|
|
3340
|
+
return __assign.apply(this, arguments);
|
|
3341
|
+
};
|
|
3342
|
+
|
|
3343
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
3344
|
+
var e = new Error(message);
|
|
3345
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
3341
3346
|
};
|
|
3342
3347
|
|
|
3343
3348
|
function getItemIndexByCharacterKey(_a) {
|
|
@@ -4380,7 +4385,7 @@
|
|
|
4380
4385
|
itemRefs.current = {};
|
|
4381
4386
|
} else if (((_environment$document = environment.document) == null ? void 0 : _environment$document.activeElement) !== inputRef.current) {
|
|
4382
4387
|
var _inputRef$current;
|
|
4383
|
-
inputRef == null
|
|
4388
|
+
inputRef == null || (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
|
|
4384
4389
|
}
|
|
4385
4390
|
}, [isOpen, environment]);
|
|
4386
4391
|
|
|
@@ -4597,9 +4602,10 @@
|
|
|
4597
4602
|
var inputHandleBlur = function inputHandleBlur(event) {
|
|
4598
4603
|
/* istanbul ignore else */
|
|
4599
4604
|
if (latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) {
|
|
4605
|
+
var isBlurByTabChange = event.relatedTarget === null && environment.document.activeElement !== environment.document.body;
|
|
4600
4606
|
dispatch({
|
|
4601
4607
|
type: InputBlur,
|
|
4602
|
-
selectItem:
|
|
4608
|
+
selectItem: !isBlurByTabChange
|
|
4603
4609
|
});
|
|
4604
4610
|
}
|
|
4605
4611
|
};
|