downshift 6.1.9 → 6.1.10
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/downshift.cjs.js +35 -34
- package/dist/downshift.esm.js +35 -34
- package/dist/downshift.native.cjs.js +35 -34
- package/dist/downshift.umd.js +35 -34
- 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/src/hooks/utils.d.ts +1 -1
- package/package.json +1 -1
- package/preact/dist/downshift.cjs.js +35 -34
- package/preact/dist/downshift.esm.js +35 -34
- package/preact/dist/downshift.umd.js +35 -34
- package/preact/dist/downshift.umd.js.map +1 -1
- package/preact/dist/downshift.umd.min.js +1 -1
- package/preact/dist/downshift.umd.min.js.map +1 -1
|
@@ -188,7 +188,7 @@ function getA11yStatusMessage$1(_ref2) {
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
if (resultCount !== previousResultCount) {
|
|
191
|
-
return resultCount
|
|
191
|
+
return `${resultCount} result${resultCount === 1 ? ' is' : 's are'} available, use up and down arrow keys to navigate. Press Enter key to select.`;
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
return '';
|
|
@@ -244,7 +244,7 @@ function getElementProps(element) {
|
|
|
244
244
|
|
|
245
245
|
function requiredProp(fnName, propName) {
|
|
246
246
|
// eslint-disable-next-line no-console
|
|
247
|
-
console.error(
|
|
247
|
+
console.error(`The property "${propName}" is required in "${fnName}"`);
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
const stateKeys = ['highlightedIndex', 'inputValue', 'isOpen', 'selectedItem', 'type'];
|
|
@@ -314,7 +314,7 @@ function normalizeArrowKey(event) {
|
|
|
314
314
|
/* istanbul ignore next (ie) */
|
|
315
315
|
|
|
316
316
|
if (keyCode >= 37 && keyCode <= 40 && key.indexOf('Arrow') !== 0) {
|
|
317
|
-
return
|
|
317
|
+
return `Arrow${key}`;
|
|
318
318
|
}
|
|
319
319
|
|
|
320
320
|
return key;
|
|
@@ -438,14 +438,14 @@ let validateControlledUnchanged = noop;
|
|
|
438
438
|
|
|
439
439
|
if (process.env.NODE_ENV !== 'production') {
|
|
440
440
|
validateControlledUnchanged = (state, prevProps, nextProps) => {
|
|
441
|
-
const warningDescription =
|
|
441
|
+
const warningDescription = `This prop should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled Downshift element for the lifetime of the component. More info: https://github.com/downshift-js/downshift#control-props`;
|
|
442
442
|
Object.keys(state).forEach(propKey => {
|
|
443
443
|
if (prevProps[propKey] !== undefined && nextProps[propKey] === undefined) {
|
|
444
444
|
// eslint-disable-next-line no-console
|
|
445
|
-
console.error(
|
|
445
|
+
console.error(`downshift: A component has changed the controlled prop "${propKey}" to be uncontrolled. ${warningDescription}`);
|
|
446
446
|
} else if (prevProps[propKey] === undefined && nextProps[propKey] !== undefined) {
|
|
447
447
|
// eslint-disable-next-line no-console
|
|
448
|
-
console.error(
|
|
448
|
+
console.error(`downshift: A component has changed the uncontrolled prop "${propKey}" to be controlled. ${warningDescription}`);
|
|
449
449
|
}
|
|
450
450
|
});
|
|
451
451
|
};
|
|
@@ -554,12 +554,12 @@ const Downshift = /*#__PURE__*/(() => {
|
|
|
554
554
|
|
|
555
555
|
super(_props);
|
|
556
556
|
_this = this;
|
|
557
|
-
this.id = this.props.id ||
|
|
558
|
-
this.menuId = this.props.menuId || this.id
|
|
559
|
-
this.labelId = this.props.labelId || this.id
|
|
560
|
-
this.inputId = this.props.inputId || this.id
|
|
557
|
+
this.id = this.props.id || `downshift-${generateId()}`;
|
|
558
|
+
this.menuId = this.props.menuId || `${this.id}-menu`;
|
|
559
|
+
this.labelId = this.props.labelId || `${this.id}-label`;
|
|
560
|
+
this.inputId = this.props.inputId || `${this.id}-input`;
|
|
561
561
|
|
|
562
|
-
this.getItemId = this.props.getItemId || (index => this.id
|
|
562
|
+
this.getItemId = this.props.getItemId || (index => `${this.id}-item-${index}`);
|
|
563
563
|
|
|
564
564
|
this.input = null;
|
|
565
565
|
this.items = [];
|
|
@@ -1615,7 +1615,7 @@ function validateGetMenuPropsCalledCorrectly(node, _ref3) {
|
|
|
1615
1615
|
|
|
1616
1616
|
if (!node) {
|
|
1617
1617
|
// eslint-disable-next-line no-console
|
|
1618
|
-
console.error(
|
|
1618
|
+
console.error(`downshift: The ref prop "${refKey}" from getMenuProps was not applied correctly on your menu element.`);
|
|
1619
1619
|
}
|
|
1620
1620
|
}
|
|
1621
1621
|
|
|
@@ -1631,12 +1631,12 @@ function validateGetRootPropsCalledCorrectly(element, _ref4) {
|
|
|
1631
1631
|
console.error('downshift: You returned a non-DOM element. You must specify a refKey in getRootProps');
|
|
1632
1632
|
} else if (!isComposite && refKeySpecified) {
|
|
1633
1633
|
// eslint-disable-next-line no-console
|
|
1634
|
-
console.error(
|
|
1634
|
+
console.error(`downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "${refKey}"`);
|
|
1635
1635
|
}
|
|
1636
1636
|
|
|
1637
1637
|
if (!reactIs.isForwardRef(element) && !getElementProps(element)[refKey]) {
|
|
1638
1638
|
// eslint-disable-next-line no-console
|
|
1639
|
-
console.error(
|
|
1639
|
+
console.error(`downshift: You must apply the ref prop "${refKey}" from getRootProps onto your root element.`);
|
|
1640
1640
|
}
|
|
1641
1641
|
}
|
|
1642
1642
|
|
|
@@ -1674,7 +1674,7 @@ function invokeOnChangeHandler(key, action, state, newState) {
|
|
|
1674
1674
|
props,
|
|
1675
1675
|
type
|
|
1676
1676
|
} = action;
|
|
1677
|
-
const handler =
|
|
1677
|
+
const handler = `on${capitalizeString(key)}Change`;
|
|
1678
1678
|
|
|
1679
1679
|
if (props[handler] && newState[key] !== undefined && newState[key] !== state[key]) {
|
|
1680
1680
|
props[handler]({
|
|
@@ -1708,7 +1708,7 @@ function getA11ySelectionMessage(selectionParameters) {
|
|
|
1708
1708
|
selectedItem,
|
|
1709
1709
|
itemToString: itemToStringLocal
|
|
1710
1710
|
} = selectionParameters;
|
|
1711
|
-
return selectedItem ? itemToStringLocal(selectedItem)
|
|
1711
|
+
return selectedItem ? `${itemToStringLocal(selectedItem)} has been selected.` : '';
|
|
1712
1712
|
}
|
|
1713
1713
|
/**
|
|
1714
1714
|
* Debounced call for updating the a11y message.
|
|
@@ -1723,7 +1723,7 @@ const useIsomorphicLayoutEffect = typeof window !== 'undefined' && typeof window
|
|
|
1723
1723
|
|
|
1724
1724
|
function useElementIds(_ref) {
|
|
1725
1725
|
let {
|
|
1726
|
-
id =
|
|
1726
|
+
id = `downshift-${generateId()}`,
|
|
1727
1727
|
labelId,
|
|
1728
1728
|
menuId,
|
|
1729
1729
|
getItemId,
|
|
@@ -1731,11 +1731,11 @@ function useElementIds(_ref) {
|
|
|
1731
1731
|
inputId
|
|
1732
1732
|
} = _ref;
|
|
1733
1733
|
const elementIdsRef = react.useRef({
|
|
1734
|
-
labelId: labelId || id
|
|
1735
|
-
menuId: menuId || id
|
|
1736
|
-
getItemId: getItemId || (index => id
|
|
1737
|
-
toggleButtonId: toggleButtonId || id
|
|
1738
|
-
inputId: inputId || id
|
|
1734
|
+
labelId: labelId || `${id}-label`,
|
|
1735
|
+
menuId: menuId || `${id}-menu`,
|
|
1736
|
+
getItemId: getItemId || (index => `${id}-item-${index}`),
|
|
1737
|
+
toggleButtonId: toggleButtonId || `${id}-toggle-button`,
|
|
1738
|
+
inputId: inputId || `${id}-input`
|
|
1739
1739
|
});
|
|
1740
1740
|
return elementIdsRef.current;
|
|
1741
1741
|
}
|
|
@@ -1761,7 +1761,7 @@ function isAcceptedCharacterKey(key) {
|
|
|
1761
1761
|
}
|
|
1762
1762
|
|
|
1763
1763
|
function capitalizeString(string) {
|
|
1764
|
-
return
|
|
1764
|
+
return `${string.slice(0, 1).toUpperCase()}${string.slice(1)}`;
|
|
1765
1765
|
}
|
|
1766
1766
|
|
|
1767
1767
|
function useLatestRef(val) {
|
|
@@ -1846,7 +1846,7 @@ function getDefaultValue$1(props, propKey, defaultStateValues) {
|
|
|
1846
1846
|
defaultStateValues = dropdownDefaultStateValues;
|
|
1847
1847
|
}
|
|
1848
1848
|
|
|
1849
|
-
const defaultValue = props[
|
|
1849
|
+
const defaultValue = props[`default${capitalizeString(propKey)}`];
|
|
1850
1850
|
|
|
1851
1851
|
if (defaultValue !== undefined) {
|
|
1852
1852
|
return defaultValue;
|
|
@@ -1866,7 +1866,7 @@ function getInitialValue$1(props, propKey, defaultStateValues) {
|
|
|
1866
1866
|
return value;
|
|
1867
1867
|
}
|
|
1868
1868
|
|
|
1869
|
-
const initialValue = props[
|
|
1869
|
+
const initialValue = props[`initial${capitalizeString(propKey)}`];
|
|
1870
1870
|
|
|
1871
1871
|
if (initialValue !== undefined) {
|
|
1872
1872
|
return initialValue;
|
|
@@ -2020,7 +2020,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
2020
2020
|
if (isInitialMountRef.current) {
|
|
2021
2021
|
if (!Object.keys(propCallInfo).length) {
|
|
2022
2022
|
// eslint-disable-next-line no-console
|
|
2023
|
-
console.error(
|
|
2023
|
+
console.error(`downshift: You forgot to call the ${propKey} getter function on your component / element.`);
|
|
2024
2024
|
return;
|
|
2025
2025
|
}
|
|
2026
2026
|
}
|
|
@@ -2033,7 +2033,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
2033
2033
|
|
|
2034
2034
|
if ((!elementRef || !elementRef.current) && !suppressRefError) {
|
|
2035
2035
|
// eslint-disable-next-line no-console
|
|
2036
|
-
console.error(
|
|
2036
|
+
console.error(`downshift: The ref prop "${refKey}" from ${propKey} was not applied correctly on your element.`);
|
|
2037
2037
|
}
|
|
2038
2038
|
});
|
|
2039
2039
|
isInitialMountRef.current = false;
|
|
@@ -2354,7 +2354,7 @@ function downshiftSelectReducer(state, action) {
|
|
|
2354
2354
|
case ToggleButtonKeyDownCharacter:
|
|
2355
2355
|
{
|
|
2356
2356
|
const lowercasedKey = action.key;
|
|
2357
|
-
const inputValue =
|
|
2357
|
+
const inputValue = `${state.inputValue}${lowercasedKey}`;
|
|
2358
2358
|
const itemIndex = getItemIndexByCharacterKey({
|
|
2359
2359
|
keysSoFar: inputValue,
|
|
2360
2360
|
highlightedIndex: state.selectedItem ? props.items.indexOf(state.selectedItem) : -1,
|
|
@@ -2425,7 +2425,7 @@ function downshiftSelectReducer(state, action) {
|
|
|
2425
2425
|
case MenuKeyDownCharacter:
|
|
2426
2426
|
{
|
|
2427
2427
|
const lowercasedKey = action.key;
|
|
2428
|
-
const inputValue =
|
|
2428
|
+
const inputValue = `${state.inputValue}${lowercasedKey}`;
|
|
2429
2429
|
const highlightedIndex = getItemIndexByCharacterKey({
|
|
2430
2430
|
keysSoFar: inputValue,
|
|
2431
2431
|
highlightedIndex: state.highlightedIndex,
|
|
@@ -2864,7 +2864,7 @@ function useSelect(userProps) {
|
|
|
2864
2864
|
id: elementIds.toggleButtonId,
|
|
2865
2865
|
'aria-haspopup': 'listbox',
|
|
2866
2866
|
'aria-expanded': latest.current.state.isOpen,
|
|
2867
|
-
'aria-labelledby': elementIds.labelId
|
|
2867
|
+
'aria-labelledby': `${elementIds.labelId} ${elementIds.toggleButtonId}`,
|
|
2868
2868
|
...rest
|
|
2869
2869
|
};
|
|
2870
2870
|
|
|
@@ -2918,7 +2918,7 @@ function useSelect(userProps) {
|
|
|
2918
2918
|
|
|
2919
2919
|
const itemProps = {
|
|
2920
2920
|
role: 'option',
|
|
2921
|
-
'aria-selected':
|
|
2921
|
+
'aria-selected': `${itemIndex === latestState.highlightedIndex}`,
|
|
2922
2922
|
id: elementIds.getItemId(itemIndex),
|
|
2923
2923
|
[refKey]: handleRefs(ref, itemNode => {
|
|
2924
2924
|
if (itemNode) {
|
|
@@ -3391,10 +3391,11 @@ function useCombobox(userProps) {
|
|
|
3391
3391
|
});
|
|
3392
3392
|
},
|
|
3393
3393
|
|
|
3394
|
-
Escape() {
|
|
3394
|
+
Escape(event) {
|
|
3395
3395
|
const latestState = latest.current.state;
|
|
3396
3396
|
|
|
3397
3397
|
if (latestState.isOpen || latestState.inputValue || latestState.selectedItem || latestState.highlightedIndex > -1) {
|
|
3398
|
+
event.preventDefault();
|
|
3398
3399
|
dispatch({
|
|
3399
3400
|
type: InputKeyDownEscape
|
|
3400
3401
|
});
|
|
@@ -3505,7 +3506,7 @@ function useCombobox(userProps) {
|
|
|
3505
3506
|
}
|
|
3506
3507
|
}),
|
|
3507
3508
|
role: 'option',
|
|
3508
|
-
'aria-selected':
|
|
3509
|
+
'aria-selected': `${itemIndex === latestState.highlightedIndex}`,
|
|
3509
3510
|
id: elementIds.getItemId(itemIndex),
|
|
3510
3511
|
...(!rest.disabled && {
|
|
3511
3512
|
onMouseMove: callAllEventHandlers(onMouseMove, itemHandleMouseMove),
|
|
@@ -3806,7 +3807,7 @@ function getA11yRemovalMessage(selectionParameters) {
|
|
|
3806
3807
|
removedSelectedItem,
|
|
3807
3808
|
itemToString: itemToStringLocal
|
|
3808
3809
|
} = selectionParameters;
|
|
3809
|
-
return itemToStringLocal(removedSelectedItem)
|
|
3810
|
+
return `${itemToStringLocal(removedSelectedItem)} has been removed.`;
|
|
3810
3811
|
}
|
|
3811
3812
|
|
|
3812
3813
|
const propTypes = {
|
package/dist/downshift.umd.js
CHANGED
|
@@ -1440,7 +1440,7 @@
|
|
|
1440
1440
|
}
|
|
1441
1441
|
|
|
1442
1442
|
if (resultCount !== previousResultCount) {
|
|
1443
|
-
return resultCount
|
|
1443
|
+
return `${resultCount} result${resultCount === 1 ? ' is' : 's are'} available, use up and down arrow keys to navigate. Press Enter key to select.`;
|
|
1444
1444
|
}
|
|
1445
1445
|
|
|
1446
1446
|
return '';
|
|
@@ -1496,7 +1496,7 @@
|
|
|
1496
1496
|
|
|
1497
1497
|
function requiredProp(fnName, propName) {
|
|
1498
1498
|
// eslint-disable-next-line no-console
|
|
1499
|
-
console.error(
|
|
1499
|
+
console.error(`The property "${propName}" is required in "${fnName}"`);
|
|
1500
1500
|
}
|
|
1501
1501
|
|
|
1502
1502
|
const stateKeys = ['highlightedIndex', 'inputValue', 'isOpen', 'selectedItem', 'type'];
|
|
@@ -1566,7 +1566,7 @@
|
|
|
1566
1566
|
/* istanbul ignore next (ie) */
|
|
1567
1567
|
|
|
1568
1568
|
if (keyCode >= 37 && keyCode <= 40 && key.indexOf('Arrow') !== 0) {
|
|
1569
|
-
return
|
|
1569
|
+
return `Arrow${key}`;
|
|
1570
1570
|
}
|
|
1571
1571
|
|
|
1572
1572
|
return key;
|
|
@@ -1690,14 +1690,14 @@
|
|
|
1690
1690
|
|
|
1691
1691
|
{
|
|
1692
1692
|
validateControlledUnchanged = (state, prevProps, nextProps) => {
|
|
1693
|
-
const warningDescription =
|
|
1693
|
+
const warningDescription = `This prop should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled Downshift element for the lifetime of the component. More info: https://github.com/downshift-js/downshift#control-props`;
|
|
1694
1694
|
Object.keys(state).forEach(propKey => {
|
|
1695
1695
|
if (prevProps[propKey] !== undefined && nextProps[propKey] === undefined) {
|
|
1696
1696
|
// eslint-disable-next-line no-console
|
|
1697
|
-
console.error(
|
|
1697
|
+
console.error(`downshift: A component has changed the controlled prop "${propKey}" to be uncontrolled. ${warningDescription}`);
|
|
1698
1698
|
} else if (prevProps[propKey] === undefined && nextProps[propKey] !== undefined) {
|
|
1699
1699
|
// eslint-disable-next-line no-console
|
|
1700
|
-
console.error(
|
|
1700
|
+
console.error(`downshift: A component has changed the uncontrolled prop "${propKey}" to be controlled. ${warningDescription}`);
|
|
1701
1701
|
}
|
|
1702
1702
|
});
|
|
1703
1703
|
};
|
|
@@ -1806,12 +1806,12 @@
|
|
|
1806
1806
|
|
|
1807
1807
|
super(_props);
|
|
1808
1808
|
_this = this;
|
|
1809
|
-
this.id = this.props.id ||
|
|
1810
|
-
this.menuId = this.props.menuId || this.id
|
|
1811
|
-
this.labelId = this.props.labelId || this.id
|
|
1812
|
-
this.inputId = this.props.inputId || this.id
|
|
1809
|
+
this.id = this.props.id || `downshift-${generateId()}`;
|
|
1810
|
+
this.menuId = this.props.menuId || `${this.id}-menu`;
|
|
1811
|
+
this.labelId = this.props.labelId || `${this.id}-label`;
|
|
1812
|
+
this.inputId = this.props.inputId || `${this.id}-input`;
|
|
1813
1813
|
|
|
1814
|
-
this.getItemId = this.props.getItemId || (index => this.id
|
|
1814
|
+
this.getItemId = this.props.getItemId || (index => `${this.id}-item-${index}`);
|
|
1815
1815
|
|
|
1816
1816
|
this.input = null;
|
|
1817
1817
|
this.items = [];
|
|
@@ -2926,7 +2926,7 @@
|
|
|
2926
2926
|
|
|
2927
2927
|
if (!node) {
|
|
2928
2928
|
// eslint-disable-next-line no-console
|
|
2929
|
-
console.error(
|
|
2929
|
+
console.error(`downshift: The ref prop "${refKey}" from getMenuProps was not applied correctly on your menu element.`);
|
|
2930
2930
|
}
|
|
2931
2931
|
}
|
|
2932
2932
|
|
|
@@ -2942,12 +2942,12 @@
|
|
|
2942
2942
|
console.error('downshift: You returned a non-DOM element. You must specify a refKey in getRootProps');
|
|
2943
2943
|
} else if (!isComposite && refKeySpecified) {
|
|
2944
2944
|
// eslint-disable-next-line no-console
|
|
2945
|
-
console.error(
|
|
2945
|
+
console.error(`downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "${refKey}"`);
|
|
2946
2946
|
}
|
|
2947
2947
|
|
|
2948
2948
|
if (!reactIs.exports.isForwardRef(element) && !getElementProps(element)[refKey]) {
|
|
2949
2949
|
// eslint-disable-next-line no-console
|
|
2950
|
-
console.error(
|
|
2950
|
+
console.error(`downshift: You must apply the ref prop "${refKey}" from getRootProps onto your root element.`);
|
|
2951
2951
|
}
|
|
2952
2952
|
}
|
|
2953
2953
|
|
|
@@ -2985,7 +2985,7 @@
|
|
|
2985
2985
|
props,
|
|
2986
2986
|
type
|
|
2987
2987
|
} = action;
|
|
2988
|
-
const handler =
|
|
2988
|
+
const handler = `on${capitalizeString(key)}Change`;
|
|
2989
2989
|
|
|
2990
2990
|
if (props[handler] && newState[key] !== undefined && newState[key] !== state[key]) {
|
|
2991
2991
|
props[handler]({
|
|
@@ -3019,7 +3019,7 @@
|
|
|
3019
3019
|
selectedItem,
|
|
3020
3020
|
itemToString: itemToStringLocal
|
|
3021
3021
|
} = selectionParameters;
|
|
3022
|
-
return selectedItem ? itemToStringLocal(selectedItem)
|
|
3022
|
+
return selectedItem ? `${itemToStringLocal(selectedItem)} has been selected.` : '';
|
|
3023
3023
|
}
|
|
3024
3024
|
/**
|
|
3025
3025
|
* Debounced call for updating the a11y message.
|
|
@@ -3034,7 +3034,7 @@
|
|
|
3034
3034
|
|
|
3035
3035
|
function useElementIds(_ref) {
|
|
3036
3036
|
let {
|
|
3037
|
-
id =
|
|
3037
|
+
id = `downshift-${generateId()}`,
|
|
3038
3038
|
labelId,
|
|
3039
3039
|
menuId,
|
|
3040
3040
|
getItemId,
|
|
@@ -3042,11 +3042,11 @@
|
|
|
3042
3042
|
inputId
|
|
3043
3043
|
} = _ref;
|
|
3044
3044
|
const elementIdsRef = react.useRef({
|
|
3045
|
-
labelId: labelId || id
|
|
3046
|
-
menuId: menuId || id
|
|
3047
|
-
getItemId: getItemId || (index => id
|
|
3048
|
-
toggleButtonId: toggleButtonId || id
|
|
3049
|
-
inputId: inputId || id
|
|
3045
|
+
labelId: labelId || `${id}-label`,
|
|
3046
|
+
menuId: menuId || `${id}-menu`,
|
|
3047
|
+
getItemId: getItemId || (index => `${id}-item-${index}`),
|
|
3048
|
+
toggleButtonId: toggleButtonId || `${id}-toggle-button`,
|
|
3049
|
+
inputId: inputId || `${id}-input`
|
|
3050
3050
|
});
|
|
3051
3051
|
return elementIdsRef.current;
|
|
3052
3052
|
}
|
|
@@ -3072,7 +3072,7 @@
|
|
|
3072
3072
|
}
|
|
3073
3073
|
|
|
3074
3074
|
function capitalizeString(string) {
|
|
3075
|
-
return
|
|
3075
|
+
return `${string.slice(0, 1).toUpperCase()}${string.slice(1)}`;
|
|
3076
3076
|
}
|
|
3077
3077
|
|
|
3078
3078
|
function useLatestRef(val) {
|
|
@@ -3157,7 +3157,7 @@
|
|
|
3157
3157
|
defaultStateValues = dropdownDefaultStateValues;
|
|
3158
3158
|
}
|
|
3159
3159
|
|
|
3160
|
-
const defaultValue = props[
|
|
3160
|
+
const defaultValue = props[`default${capitalizeString(propKey)}`];
|
|
3161
3161
|
|
|
3162
3162
|
if (defaultValue !== undefined) {
|
|
3163
3163
|
return defaultValue;
|
|
@@ -3177,7 +3177,7 @@
|
|
|
3177
3177
|
return value;
|
|
3178
3178
|
}
|
|
3179
3179
|
|
|
3180
|
-
const initialValue = props[
|
|
3180
|
+
const initialValue = props[`initial${capitalizeString(propKey)}`];
|
|
3181
3181
|
|
|
3182
3182
|
if (initialValue !== undefined) {
|
|
3183
3183
|
return initialValue;
|
|
@@ -3331,7 +3331,7 @@
|
|
|
3331
3331
|
if (isInitialMountRef.current) {
|
|
3332
3332
|
if (!Object.keys(propCallInfo).length) {
|
|
3333
3333
|
// eslint-disable-next-line no-console
|
|
3334
|
-
console.error(
|
|
3334
|
+
console.error(`downshift: You forgot to call the ${propKey} getter function on your component / element.`);
|
|
3335
3335
|
return;
|
|
3336
3336
|
}
|
|
3337
3337
|
}
|
|
@@ -3344,7 +3344,7 @@
|
|
|
3344
3344
|
|
|
3345
3345
|
if ((!elementRef || !elementRef.current) && !suppressRefError) {
|
|
3346
3346
|
// eslint-disable-next-line no-console
|
|
3347
|
-
console.error(
|
|
3347
|
+
console.error(`downshift: The ref prop "${refKey}" from ${propKey} was not applied correctly on your element.`);
|
|
3348
3348
|
}
|
|
3349
3349
|
});
|
|
3350
3350
|
isInitialMountRef.current = false;
|
|
@@ -3691,7 +3691,7 @@
|
|
|
3691
3691
|
case ToggleButtonKeyDownCharacter:
|
|
3692
3692
|
{
|
|
3693
3693
|
const lowercasedKey = action.key;
|
|
3694
|
-
const inputValue =
|
|
3694
|
+
const inputValue = `${state.inputValue}${lowercasedKey}`;
|
|
3695
3695
|
const itemIndex = getItemIndexByCharacterKey({
|
|
3696
3696
|
keysSoFar: inputValue,
|
|
3697
3697
|
highlightedIndex: state.selectedItem ? props.items.indexOf(state.selectedItem) : -1,
|
|
@@ -3762,7 +3762,7 @@
|
|
|
3762
3762
|
case MenuKeyDownCharacter:
|
|
3763
3763
|
{
|
|
3764
3764
|
const lowercasedKey = action.key;
|
|
3765
|
-
const inputValue =
|
|
3765
|
+
const inputValue = `${state.inputValue}${lowercasedKey}`;
|
|
3766
3766
|
const highlightedIndex = getItemIndexByCharacterKey({
|
|
3767
3767
|
keysSoFar: inputValue,
|
|
3768
3768
|
highlightedIndex: state.highlightedIndex,
|
|
@@ -4201,7 +4201,7 @@
|
|
|
4201
4201
|
id: elementIds.toggleButtonId,
|
|
4202
4202
|
'aria-haspopup': 'listbox',
|
|
4203
4203
|
'aria-expanded': latest.current.state.isOpen,
|
|
4204
|
-
'aria-labelledby': elementIds.labelId
|
|
4204
|
+
'aria-labelledby': `${elementIds.labelId} ${elementIds.toggleButtonId}`,
|
|
4205
4205
|
...rest
|
|
4206
4206
|
};
|
|
4207
4207
|
|
|
@@ -4255,7 +4255,7 @@
|
|
|
4255
4255
|
|
|
4256
4256
|
const itemProps = {
|
|
4257
4257
|
role: 'option',
|
|
4258
|
-
'aria-selected':
|
|
4258
|
+
'aria-selected': `${itemIndex === latestState.highlightedIndex}`,
|
|
4259
4259
|
id: elementIds.getItemId(itemIndex),
|
|
4260
4260
|
[refKey]: handleRefs(ref, itemNode => {
|
|
4261
4261
|
if (itemNode) {
|
|
@@ -4728,10 +4728,11 @@
|
|
|
4728
4728
|
});
|
|
4729
4729
|
},
|
|
4730
4730
|
|
|
4731
|
-
Escape() {
|
|
4731
|
+
Escape(event) {
|
|
4732
4732
|
const latestState = latest.current.state;
|
|
4733
4733
|
|
|
4734
4734
|
if (latestState.isOpen || latestState.inputValue || latestState.selectedItem || latestState.highlightedIndex > -1) {
|
|
4735
|
+
event.preventDefault();
|
|
4735
4736
|
dispatch({
|
|
4736
4737
|
type: InputKeyDownEscape
|
|
4737
4738
|
});
|
|
@@ -4840,7 +4841,7 @@
|
|
|
4840
4841
|
}
|
|
4841
4842
|
}),
|
|
4842
4843
|
role: 'option',
|
|
4843
|
-
'aria-selected':
|
|
4844
|
+
'aria-selected': `${itemIndex === latestState.highlightedIndex}`,
|
|
4844
4845
|
id: elementIds.getItemId(itemIndex),
|
|
4845
4846
|
...(!rest.disabled && {
|
|
4846
4847
|
onMouseMove: callAllEventHandlers(onMouseMove, itemHandleMouseMove),
|
|
@@ -5126,7 +5127,7 @@
|
|
|
5126
5127
|
removedSelectedItem,
|
|
5127
5128
|
itemToString: itemToStringLocal
|
|
5128
5129
|
} = selectionParameters;
|
|
5129
|
-
return itemToStringLocal(removedSelectedItem)
|
|
5130
|
+
return `${itemToStringLocal(removedSelectedItem)} has been removed.`;
|
|
5130
5131
|
}
|
|
5131
5132
|
|
|
5132
5133
|
const propTypes = {
|