Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: porting of volto-form-block autocomplete changes #779

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: porting of volto-form-block autocomplete changes
sabrina-bongiovanni committed Sep 30, 2024
commit 75af0da0414dcc8586e2b485c00ff8931f6e9a4c
2 changes: 2 additions & 0 deletions src/components/TextInput.jsx
Original file line number Diff line number Diff line change
@@ -17,6 +17,8 @@ export default function TextInput(props) {
groupClassName,
...otherProps
} = props;

console.log(props);
const [isFocused, setIsFocused] = useState(false);

const toggleFocusLabel = () => {
9 changes: 9 additions & 0 deletions src/customizations/volto-form-block/components/Field.jsx
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@ import FileWidget from 'design-comuni-plone-theme/components/ItaliaTheme/manage/
import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
import { TextBlockView } from '@plone/volto-slate/blocks/Text';
import { TextEditorWidget } from 'design-comuni-plone-theme/components/ItaliaTheme';
import { TextInput } from 'design-comuni-plone-theme/components';
import config from '@plone/volto/registry';

import { fromHtml } from 'design-comuni-plone-theme/config/Slate/utils';
@@ -70,7 +71,9 @@ const Field = ({
errorMessage,
id,
reactSelect,
autocomplete,
}) => {
console.log(autocomplete);
const intl = useIntl();
const Select = reactSelect.default;

@@ -117,6 +120,7 @@ const Field = ({
onChange(name, e.target.value);
}}
value={value ?? ''}
autoComplete={autocomplete}
/>
)}
{field_type === 'textarea' && (
@@ -135,6 +139,7 @@ const Field = ({
onChange(name, e.target.value);
}}
value={value ?? undefined}
autoComplete={autocomplete}
/>
)}
{field_type === 'select' && (
@@ -166,6 +171,7 @@ const Field = ({
classNamePrefix="react-select"
className={isInvalid() ? 'is-invalid' : ''}
value={value ? [{ value: value, label: value }] : []}
autoComplete={autocomplete}
/>
{description && <small className="form-text">{description}</small>}
{errorMessage && (
@@ -301,6 +307,7 @@ const Field = ({
onChange(name, e.target.value);
}}
value={value ?? ''}
autoComplete={autocomplete}
/>
)}
{field_type === 'attachment' && (
@@ -335,6 +342,7 @@ const Field = ({
onChange(name, e.target.value);
}}
value={value ?? ''}
autoComplete={autocomplete}
/>
)}

@@ -405,6 +413,7 @@ Field.propTypes = {
value: PropTypes.any,
formHasErrors: PropTypes.bool,
onChange: PropTypes.func,
autoComplete: PropTypes.string,
};

export default injectLazyLibs('reactSelect')(Field);
Loading