'use strict';

var index = require('./index-BjHIBY-I.js');
var getIconProps = require('./get-icon-props-CwpDdQDI.js');

const headerCss = () => `@charset "UTF-8";:host(limel-header){display:flex;align-items:center;box-sizing:border-box;width:100%;background-color:var(--header-background-color, rgb(var(--contrast-300)));border-top-left-radius:var(--header-top-right-left-border-radius, 0.75rem);border-top-right-radius:var(--header-top-right-left-border-radius, 0.75rem);padding:0.25rem}.information{display:flex;flex-grow:1;align-items:center;min-width:0}.icon{--limel-icon-svg-margin:0.25rem;flex-shrink:0;color:var(--limel-header-icon-color, var(--header-icon-color, rgb(var(--contrast-1100))));background-color:var(--limel-header-icon-background-color, var(--header-icon-background-color, transparent));width:2.25rem;border-radius:0.56rem}.headings{min-width:0;margin-left:0.25rem}.heading,.subheading{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin:0;padding:0}.heading{color:var(--header-heading-color, rgb(var(--contrast-1100)));font-size:1rem;font-weight:500}.subheading{color:var(--header-subheading-color, rgb(var(--contrast-900)));font-size:var(--limel-theme-default-small-font-size);font-weight:400}.subheading__supporting-text{color:var(--header-supporting-text-color, var(--header-subheading-color))}.subheading__supporting-text span{margin:0 0.125rem}slot[name=actions]{flex-shrink:0}:host(limel-header.is-narrow){padding:0.125rem 0.25rem}:host(limel-header.is-narrow) .icon{--limel-icon-svg-margin:0;width:1.25rem}:host(limel-header.is-narrow) .heading{font-size:0.9375rem}:host(limel-header.has-responsive-layout){display:grid;grid-template-columns:repeat(auto-fit, minmax(clamp(50%, var(--header-responsive-breakpoint, 22rem), 100%), 1fr))}:host(limel-header.has-responsive-layout) .headings{padding-right:0.5rem}:host(limel-header.has-responsive-layout) slot[name=actions]{display:flex;justify-content:flex-end}`;

const Header = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        /**
         * The visual divider that separates the `subheading` and the `supportingText`.
         * It must be a single character such as `-` or `,`.
         */
        this.subheadingDivider = '·';
    }
    render() {
        return (index.h(index.Host, { key: 'af88692a3c1dcaf463519b33909f8338810437fc' }, index.h("div", { key: 'e5f38998bcae91adf802ec5f6bcf2bf8df25b93b', class: "information" }, this.renderIcon(), index.h("div", { key: '23e44ba0626bf7f0a936c3a2285353efa5fa950d', class: "headings" }, index.h("h1", { key: '66483d8c6ef67101b401c5609a3c7dc606da6f03', class: "heading", title: this.heading }, this.heading), index.h("h2", { key: 'e9748ebc2213157544835ff540400e14fab433dd', class: "subheading", title: this.subheading }, this.subheading, this.renderSupportingText()))), index.h("slot", { key: '8bcdf617951b5da61e75c0c1d8ff6722d6903e4f', name: "actions" }, index.h("slot", { key: '6adf11869362405ad30c0a6a7a7a463844b4022a' }))));
    }
    renderIcon() {
        var _a, _b, _c, _d, _e;
        const icon = getIconProps.getIconName(this.icon);
        if (!icon) {
            return;
        }
        return (index.h("limel-icon", { class: "icon", badge: true, name: icon, style: {
                '--limel-header-icon-color': `${(_b = (_a = this.icon) === null || _a === void 0 ? void 0 : _a.color) !== null && _b !== void 0 ? _b : ''}`,
                '--limel-header-icon-background-color': `${(_d = (_c = this.icon) === null || _c === void 0 ? void 0 : _c.backgroundColor) !== null && _d !== void 0 ? _d : ''}`,
                title: `${(_e = this.icon) === null || _e === void 0 ? void 0 : _e.title}`,
            } }));
    }
    renderSupportingText() {
        if (!this.supportingText) {
            return;
        }
        return (index.h("span", { class: "subheading__supporting-text" }, this.renderSubheadingDivider(), this.supportingText));
    }
    renderSubheadingDivider() {
        if (!this.subheadingDivider) {
            return;
        }
        return index.h("span", null, this.subheadingDivider);
    }
};
Header.style = headerCss();

exports.limel_header = Header;
