import { create, tsx } from '@dojo/framework/core/vdom';
import theme from '../middleware/theme';
import TextInput from '../text-input';
import * as textInputCss from '../theme/default/text-input.m.css';
import * as numberInputCss from '../theme/default/number-input.m.css';
const factory = create({ theme })
    .properties()
    .children();
export default factory(function NumberInput({ properties, children, middleware: { theme } }) {
    const { initialValue, value, onValue } = properties();
    function onValueAdapter(valueAsString) {
        if (!onValue) {
            return;
        }
        if (valueAsString === undefined || valueAsString === '') {
            onValue();
        }
        else {
            onValue(parseFloat(valueAsString));
        }
    }
    return (tsx(TextInput, Object.assign({}, properties(), { value: value === undefined ? value : `${value}`, initialValue: initialValue === undefined ? initialValue : `${initialValue}`, onValue: onValueAdapter, type: "number", theme: theme.compose(textInputCss, numberInputCss) }), children()[0]));
});

/*# sourceMappingURL=index.mjs.map*/