All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.sxp_blueprint_admin.js.shared.SearchInput.js Maven / Gradle / Ivy

/**
 * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
 * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
 */

import ClayButton from '@clayui/button';
import {ClayInput} from '@clayui/form';
import ClayIcon from '@clayui/icon';
import React, {useState} from 'react';

function SearchInput({disabled, onChange, onEnter}) {
	const [value, setValue] = useState('');

	return (
		
			
				 {
						onChange(event.target.value);
						setValue(event.target.value);
					}}
					onKeyDown={(event) => {
						if (event.key === 'Enter') {
							event.preventDefault();

							if (onEnter) {
								onEnter();
							}
						}
					}}
					placeholder={Liferay.Language.get('search')}
					type="text"
					value={value}
				/>

				{value && !onEnter ? (
					
						 {
								onChange('');
								setValue('');
							}}
							title={Liferay.Language.get('clear')}
						>
							
						
					
				) : (
					
						
							
						
					
				)}
			
		
	);
}

export default SearchInput;




© 2015 - 2025 Weber Informatics LLC | Privacy Policy