"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var vdom_1 = require("@dojo/framework/core/vdom");
var theme_1 = require("../middleware/theme");
var text_input_1 = require("../text-input");
var textInputCss = require("../theme/default/text-input.m.css");
var numberInputCss = require("../theme/default/number-input.m.css");
var factory = vdom_1.create({ theme: theme_1.default })
    .properties()
    .children();
exports.default = factory(function NumberInput(_a) {
    var properties = _a.properties, children = _a.children, theme = _a.middleware.theme;
    var _b = properties(), initialValue = _b.initialValue, value = _b.value, onValue = _b.onValue;
    function onValueAdapter(valueAsString) {
        if (!onValue) {
            return;
        }
        if (valueAsString === undefined || valueAsString === '') {
            onValue();
        }
        else {
            onValue(parseFloat(valueAsString));
        }
    }
    return (vdom_1.tsx(text_input_1.default, tslib_1.__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.js.map*/