@wulperstudio/cms
Version:
Wulper Studio Library Components CMS
43 lines • 1.56 kB
JavaScript
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
var _excluded = ["textFieldProps"];
import React from 'react';
import { Autocomplete } from '@mui/material';
import { Box, InputLabel, CssTextField } from './styled';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
export var AutocompleteCreate = function AutocompleteCreate(_ref) {
var textFieldProps = _ref.textFieldProps,
props = _objectWithoutProperties(_ref, _excluded);
return /*#__PURE__*/_jsxs(Box, {
showBorder: props.showBorder,
backgroundColor: props.backgroundColor,
showBoxShadow: props.showBoxShadow,
showDivider: props.showDivider,
children: [/*#__PURE__*/_jsx(InputLabel, {
htmlFor: props.id,
children: props.label
}), /*#__PURE__*/_jsx(Autocomplete, Object.assign({
value: props.value,
multiple: true,
limitTags: 2,
id: props.id,
options: props.data,
getOptionLabel: function getOptionLabel(option) {
return option.nickname;
},
fullWidth: true,
renderInput: function renderInput(params) {
return /*#__PURE__*/_jsx(CssTextField, Object.assign({}, params, {
fullWidth: true,
label: "",
id: props.id
}, textFieldProps, {
backgroundColor: props.backgroundColor,
borderColor: props.borderColor
}));
},
onChange: function onChange(_, newValue) {
return props.onChangeAutocomplete(newValue);
}
}, props.autocompleteProps))]
});
};