import { create, tsx } from '@dojo/framework/core/vdom';
import theme from '../middleware/theme';
import * as fixedCss from './styles/tooltip.m.css';
import * as css from '../theme/default/tooltip.m.css';
import { formatAriaProperties } from '../common/util';
/**
 * @deprecated this enum will be removed in the next major release
 */
export var Orientation;
(function (Orientation) {
    Orientation["bottom"] = "bottom";
    Orientation["left"] = "left";
    Orientation["right"] = "right";
    Orientation["top"] = "top";
})(Orientation || (Orientation = {}));
const factory = create({ theme })
    .properties()
    .children();
export const Tooltip = factory(function Tooltip({ children, properties, middleware: { theme } }) {
    const { open, aria = {}, orientation = 'right' } = properties();
    const classes = theme.classes(css);
    const fixedClasses = theme.classes(fixedCss);
    const [{ trigger, content }] = children();
    let fixedOrientation;
    let classesOrientation;
    if (orientation === 'bottom') {
        fixedOrientation = fixedClasses.bottomFixed;
        classesOrientation = classes.bottom;
    }
    else if (orientation === 'right') {
        fixedOrientation = fixedClasses.rightFixed;
        classesOrientation = classes.right;
    }
    else if (orientation === 'left') {
        fixedOrientation = fixedClasses.leftFixed;
        classesOrientation = classes.left;
    }
    else if (orientation === 'top') {
        fixedOrientation = fixedClasses.topFixed;
        classesOrientation = classes.top;
    }
    return (tsx("div", { classes: [
            theme.variant(),
            classesOrientation,
            fixedClasses.rootFixed,
            fixedOrientation
        ] },
        tsx("div", { key: "target" },
            trigger,
            open ? (tsx("div", Object.assign({ key: "content" }, formatAriaProperties(aria), { classes: [classes.content, fixedClasses.contentFixed] }), content)) : null)));
});
export default Tooltip;

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