@limetech/lime-elements
Version:
54 lines (48 loc) • 3.77 kB
JavaScript
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
const index = require('./index-174a078a.js');
const getIconProps = require('./get-icon-props-65f39e40.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);
this.icon = undefined;
this.heading = undefined;
this.subheading = undefined;
this.supportingText = undefined;
this.subheadingDivider = '·';
}
render() {
return [
index.h("div", { class: "information" }, this.renderIcon(), index.h("div", { class: "headings" }, index.h("h1", { class: "heading", title: this.heading }, this.heading), index.h("h2", { class: "subheading", title: this.subheading }, this.subheading, this.renderSupportingText()))),
index.h("slot", { name: "actions" }, index.h("slot", null)),
];
}
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;
//# sourceMappingURL=limel-header.cjs.entry.js.map