"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
const classNames = require("classnames");
const mobx_react_1 = require("mobx-react");
const React = require("react");
const Styles_1 = require("../styles/Styles");
const PiLogging_1 = require("../../../util/PiLogging");
const LOGGER = new PiLogging_1.PiLogger("LabelComponent");
let LabelComponent = class LabelComponent extends React.Component {
    constructor() {
        super(...arguments);
        this.element = null;
        this.setElement = (element) => {
            this.element = element;
        };
        this.setFocus = () => {
            LOGGER.info(this, "set focus on " + this.element);
            if (this.element) {
                this.element.focus();
            }
        };
    }
    componentDidMount() {
        PiLogging_1.RENDER_LOG.info(this, "componentDidMount");
        this.props.box.setFocus = this.setFocus;
    }
    render() {
        PiLogging_1.RENDER_LOG.info(this, "render");
        const styleClasses = classNames(Styles_1.STYLES.text, this.props.box.style);
        return (React.createElement("div", { id: this.props.box.id, className: styleClasses, ref: this.setElement, tabIndex: 0 }, this.props.box.getLabel()));
    }
};
LabelComponent = __decorate([
    mobx_react_1.observer
], LabelComponent);
exports.LabelComponent = LabelComponent;
//# sourceMappingURL=LabelComponent.js.map