UNPKG

@limetech/lime-elements

Version:
50 lines (46 loc) 3.64 kB
import { r as registerInstance, h } from './index-2714248e.js'; import { g as getIconName } from './get-icon-props-37514418.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) { registerInstance(this, hostRef); this.icon = undefined; this.heading = undefined; this.subheading = undefined; this.supportingText = undefined; this.subheadingDivider = '·'; } render() { return [ h("div", { class: "information" }, this.renderIcon(), h("div", { class: "headings" }, h("h1", { class: "heading", title: this.heading }, this.heading), h("h2", { class: "subheading", title: this.subheading }, this.subheading, this.renderSupportingText()))), h("slot", { name: "actions" }, h("slot", null)), ]; } renderIcon() { var _a, _b, _c, _d, _e; const icon = getIconName(this.icon); if (!icon) { return; } return (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 (h("span", { class: "subheading__supporting-text" }, this.renderSubheadingDivider(), this.supportingText)); } renderSubheadingDivider() { if (!this.subheadingDivider) { return; } return h("span", null, this.subheadingDivider); } }; Header.style = headerCss; export { Header as limel_header }; //# sourceMappingURL=limel-header.entry.js.map