META-INF.resources.js.components.inputs.IntegerInput.tsx Maven / Gradle / Ivy
The newest version!
/**
* 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 {ClaySelectWithOption} from '@clayui/form';
import React, {ChangeEvent} from 'react';
interface Props {
disabled?: boolean;
onChange: (payload: {value: string}) => void;
options?: Array<{
disabled: boolean;
label: string;
value: string;
}>;
propertyLabel?: string;
value?: number | string;
}
function IntegerInput({
disabled,
onChange,
options,
propertyLabel,
value,
}: Props) {
const handleIntegerChange = (
event: ChangeEvent
) => {
const value = parseInt(event.target.value, 10);
if (!isNaN(value)) {
onChange({
value: value.toString(),
});
}
};
return options?.length ? (
) : (
);
}
export default IntegerInput;
© 2015 - 2024 Weber Informatics LLC | Privacy Policy