@vendorflow/components 2.0.96 → 2.0.97
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeEvent, ReactNode } from 'react';
|
|
1
|
+
import { ChangeEvent, ReactNode, Ref } from 'react';
|
|
2
2
|
import { AutocompleteProps, AutocompleteChangeReason, AutocompleteRenderInputParams } from '@mui/material';
|
|
3
3
|
import { Variant } from '../../../types';
|
|
4
4
|
declare type MaybeBoolean = boolean | undefined;
|
|
@@ -17,6 +17,7 @@ declare type Props<T> = {
|
|
|
17
17
|
count?: number;
|
|
18
18
|
onChange: (event: ChangeEvent<any>, value: any, reason: AutocompleteChangeReason) => void;
|
|
19
19
|
getKey?: (value: T) => string;
|
|
20
|
+
mRef?: Ref<HTMLElement>;
|
|
20
21
|
} & Omit<AutocompleteProps<T, MaybeBoolean, MaybeBoolean, MaybeBoolean, any>, 'onChange' | 'renderInput' | 'id'>;
|
|
21
22
|
export default function InputSearchDropdown<T>(props: Props<T>): JSX.Element;
|
|
22
23
|
export {};
|
|
@@ -55,7 +55,7 @@ var useStyles = (0, styles_1.makeStyles)({
|
|
|
55
55
|
},
|
|
56
56
|
});
|
|
57
57
|
function InputSearchDropdown(props) {
|
|
58
|
-
var _a = props.autoHighlight, autoHighlight = _a === void 0 ? true : _a, _b = props.clearOnEscape, clearOnEscape = _b === void 0 ? true : _b, count = props.count, disableFilter = props.disableFilter, error = props.error, errors = props.errors, filterOptions = props.filterOptions, _c = props.filterSelectedOptions, filterSelectedOptions = _c === void 0 ? true : _c, getKey = props.getKey, label = props.label, helperText = props.helperText, name = props.name, onChange = props.onChange, _d = props.openOnFocus, openOnFocus = _d === void 0 ? true : _d, _e = props.renderInput, renderInput = _e === void 0 ? null : _e, renderTags = props.renderTags, _f = props.selectOnFocus, selectOnFocus = _f === void 0 ? true : _f, _g = props.variant, variant = _g === void 0 ? 'outlined' : _g, multiple = props.multiple, max = props.max, autoFocus = props.autoFocus, _h = props.size, size = _h === void 0 ? 'small' : _h, restOfProps = __rest(props, ["autoHighlight", "clearOnEscape", "count", "disableFilter", "error", "errors", "filterOptions", "filterSelectedOptions", "getKey", "label", "helperText", "name", "onChange", "openOnFocus", "renderInput", "renderTags", "selectOnFocus", "variant", "multiple", "max", "autoFocus", "size"]);
|
|
58
|
+
var mRef = props.mRef, _a = props.autoHighlight, autoHighlight = _a === void 0 ? true : _a, _b = props.clearOnEscape, clearOnEscape = _b === void 0 ? true : _b, count = props.count, disableFilter = props.disableFilter, error = props.error, errors = props.errors, filterOptions = props.filterOptions, _c = props.filterSelectedOptions, filterSelectedOptions = _c === void 0 ? true : _c, getKey = props.getKey, label = props.label, helperText = props.helperText, name = props.name, onChange = props.onChange, _d = props.openOnFocus, openOnFocus = _d === void 0 ? true : _d, _e = props.renderInput, renderInput = _e === void 0 ? null : _e, renderTags = props.renderTags, _f = props.selectOnFocus, selectOnFocus = _f === void 0 ? true : _f, _g = props.variant, variant = _g === void 0 ? 'outlined' : _g, multiple = props.multiple, max = props.max, autoFocus = props.autoFocus, _h = props.size, size = _h === void 0 ? 'small' : _h, restOfProps = __rest(props, ["mRef", "autoHighlight", "clearOnEscape", "count", "disableFilter", "error", "errors", "filterOptions", "filterSelectedOptions", "getKey", "label", "helperText", "name", "onChange", "openOnFocus", "renderInput", "renderTags", "selectOnFocus", "variant", "multiple", "max", "autoFocus", "size"]);
|
|
59
59
|
var id = (0, react_2.useRef)((0, nanoid_1.nanoid)());
|
|
60
60
|
var _j = __read((0, react_2.useState)(null), 2), value = _j[0], setValue = _j[1];
|
|
61
61
|
var mainStyles = useStyles();
|
|
@@ -125,7 +125,7 @@ function InputSearchDropdown(props) {
|
|
|
125
125
|
return ((_a = value) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
126
126
|
}
|
|
127
127
|
return ((0, react_1.jsx)("div", null,
|
|
128
|
-
(0, react_1.jsx)(material_1.Autocomplete, __assign({ id: id.current, css: (0, react_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n // TODO: this is due to a bug in MaterialUI clear up when resolve -- should file a PR ticket\n &&& .MuiInputBase-root {\n padding-right: 39px;\n }\n "], ["\n // TODO: this is due to a bug in MaterialUI clear up when resolve -- should file a PR ticket\n &&& .MuiInputBase-root {\n padding-right: 39px;\n }\n "]))), autoHighlight: autoHighlight, clearOnEscape: clearOnEscape, filterOptions: !disableFilter ? filterOptions || handleOptionFilter() : function (options) { return options; }, filterSelectedOptions: filterSelectedOptions, onChange: handleOnChange, openOnFocus: openOnFocus, renderInput: renderInput || renderDefaultInput, renderTags: renderTags || renderDefaultTags, selectOnFocus: selectOnFocus, multiple: multiple, classes: mainStyles, size: size }, restOfProps, { value: getValue() })),
|
|
128
|
+
(0, react_1.jsx)(material_1.Autocomplete, __assign({ id: id.current, css: (0, react_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n // TODO: this is due to a bug in MaterialUI clear up when resolve -- should file a PR ticket\n &&& .MuiInputBase-root {\n padding-right: 39px;\n }\n "], ["\n // TODO: this is due to a bug in MaterialUI clear up when resolve -- should file a PR ticket\n &&& .MuiInputBase-root {\n padding-right: 39px;\n }\n "]))), autoHighlight: autoHighlight, clearOnEscape: clearOnEscape, filterOptions: !disableFilter ? filterOptions || handleOptionFilter() : function (options) { return options; }, filterSelectedOptions: filterSelectedOptions, onChange: handleOnChange, openOnFocus: openOnFocus, renderInput: renderInput || renderDefaultInput, renderTags: renderTags || renderDefaultTags, selectOnFocus: selectOnFocus, multiple: multiple, classes: mainStyles, size: size }, restOfProps, { value: getValue(), ref: mRef })),
|
|
129
129
|
(0, react_1.jsx)("div", null,
|
|
130
130
|
helperText && ((0, react_1.jsx)(material_1.Typography, { css: (0, react_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n float: left;\n margin-left: 14px;\n margin-top: 4px;\n color: ", ";\n width: calc(100% - 82px);\n "], ["\n float: left;\n margin-left: 14px;\n margin-top: 4px;\n color: ", ";\n width: calc(100% - 82px);\n "])), error ? 'red' : 'rgba(0, 0, 0, 0.54)'), variant: "caption" }, helperText)),
|
|
131
131
|
multiple && max && ((0, react_1.jsx)(material_1.Typography, { css: (0, react_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-size: 0.75rem;\n text-align: right;\n float: right;\n margin-left: 14px;\n margin-right: 14px;\n margin-top: 4px;\n color: ", ";\n width: 40px;\n "], ["\n font-size: 0.75rem;\n text-align: right;\n float: right;\n margin-left: 14px;\n margin-right: 14px;\n margin-top: 4px;\n color: ", ";\n width: 40px;\n "])), error ? 'red' : 'rgba(0, 0, 0, 0.54)'), variant: "subtitle1" },
|