@mezzanine-ui/react 0.15.1 → 0.15.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/Select/AutoComplete.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction, MutableRefObject } from 'react';
|
|
1
2
|
import { SelectInputSize } from '@mezzanine-ui/core/select';
|
|
2
3
|
import { SelectValue } from './typings';
|
|
3
4
|
import { MenuProps } from '../Menu';
|
|
@@ -47,6 +48,12 @@ export interface AutoCompleteBaseProps extends Omit<SelectTriggerProps, 'active'
|
|
|
47
48
|
* @default false
|
|
48
49
|
*/
|
|
49
50
|
required?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
*/
|
|
54
|
+
searchTextControlRef?: MutableRefObject<{
|
|
55
|
+
setSearchText: Dispatch<SetStateAction<string>>;
|
|
56
|
+
} | undefined>;
|
|
50
57
|
/**
|
|
51
58
|
* The size of input.
|
|
52
59
|
*/
|
package/Select/AutoComplete.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { forwardRef, useContext, useState, useRef, useMemo } from 'react';
|
|
2
|
+
import { forwardRef, useContext, useState, useImperativeHandle, useRef, useMemo } from 'react';
|
|
3
3
|
import { selectClasses } from '@mezzanine-ui/core/select';
|
|
4
4
|
import { PlusIcon } from '@mezzanine-ui/icons';
|
|
5
5
|
import isArray from 'lodash/isArray';
|
|
@@ -24,7 +24,7 @@ const MENU_ID = 'mzn-select-autocomplete-menu-id';
|
|
|
24
24
|
const AutoComplete = forwardRef(function Select(props, ref) {
|
|
25
25
|
var _a, _b;
|
|
26
26
|
const { disabled: disabledFromFormControl, fullWidth: fullWidthFromFormControl, required: requiredFromFormControl, severity, } = useContext(FormControlContext) || {};
|
|
27
|
-
const { addable = false, className, disabled = disabledFromFormControl || false, disabledOptionsFilter = false, defaultValue, error = severity === 'error' || false, fullWidth = fullWidthFromFormControl || false, inputRef, inputProps, itemsInView = 4, menuMaxHeight, menuRole = 'listbox', menuSize, mode = 'single', onChange: onChangeProp, onClear: onClearProp, onInsert, onSearch, options: optionsProp, popperOptions = {}, placeholder = '', prefix, required = requiredFromFormControl || false, size, value: valueProp, } = props;
|
|
27
|
+
const { addable = false, className, disabled = disabledFromFormControl || false, disabledOptionsFilter = false, defaultValue, error = severity === 'error' || false, fullWidth = fullWidthFromFormControl || false, inputRef, inputProps, itemsInView = 4, menuMaxHeight, menuRole = 'listbox', menuSize, mode = 'single', onChange: onChangeProp, onClear: onClearProp, onInsert, onSearch, options: optionsProp, popperOptions = {}, placeholder = '', prefix, required = requiredFromFormControl || false, searchTextControlRef, size, value: valueProp, } = props;
|
|
28
28
|
const [open, toggleOpen] = useState(false);
|
|
29
29
|
const { focused, onFocus, onChange, onClear, options, searchText, selectedOptions, setSearchText, unselectedOptions, value, } = useAutoCompleteValueControl({
|
|
30
30
|
defaultValue,
|
|
@@ -37,6 +37,10 @@ const AutoComplete = forwardRef(function Select(props, ref) {
|
|
|
37
37
|
options: optionsProp,
|
|
38
38
|
value: valueProp,
|
|
39
39
|
});
|
|
40
|
+
/** export set search text action to props (allow user to customize search text) */
|
|
41
|
+
useImperativeHandle(searchTextControlRef, () => ({
|
|
42
|
+
setSearchText,
|
|
43
|
+
}));
|
|
40
44
|
/** insert feature */
|
|
41
45
|
const [insertText, setInsertText] = useState('');
|
|
42
46
|
const nodeRef = useRef(null);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mezzanine-ui/react",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.3",
|
|
4
4
|
"description": "React components for mezzanine-ui",
|
|
5
5
|
"author": "Mezzanine",
|
|
6
6
|
"repository": {
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@hello-pangea/dnd": "^16.6.0",
|
|
32
|
-
"@mezzanine-ui/core": "^0.15.
|
|
33
|
-
"@mezzanine-ui/icons": "^0.15.
|
|
34
|
-
"@mezzanine-ui/system": "^0.15.
|
|
32
|
+
"@mezzanine-ui/core": "^0.15.3",
|
|
33
|
+
"@mezzanine-ui/icons": "^0.15.3",
|
|
34
|
+
"@mezzanine-ui/system": "^0.15.3",
|
|
35
35
|
"@popperjs/core": "^2.11.6",
|
|
36
36
|
"@types/react-transition-group": "^4.4.8",
|
|
37
37
|
"clsx": "^2.1.1",
|