import pluralize from 'pluralize';
import React from 'react';
import { BaseTextPropertyWidget } from './TextPropertyWidget';
import { InputAdornment } from '@material-ui/core';
const parse = value => value && parseInt(value);
/**
 * `integer` property widget
 *
 * Outputs a type=number TextField with an optional unit
 */
const IntegerPropertyWidget = props => {
    const { property } = props;
    const { unit } = property;
    let endAdornment;
    if (unit) {
        endAdornment = (React.createElement(InputAdornment, { position: "end" }, pluralize(unit)));
    }
    return (React.createElement(BaseTextPropertyWidget, Object.assign({ type: "number", step: 1, InputProps: { endAdornment }, parse: parse }, props)));
};
export default IntegerPropertyWidget;
//# sourceMappingURL=IntegerPropertyWidget.js.map