@trimble-oss/moduswebcomponents
Version:
Modus Web Components is a modern, accessible UI library built with Stencil JS that provides reusable web components following Trimble's Modus design system. This updated version focuses on improved flexibility, enhanced theming options, comprehensive cust
62 lines (61 loc) • 2.55 kB
JavaScript
import { h, Host } from "@stencil/core";
import { inheritAriaAttributes } from "../utils";
/**
* A customizable toolbar component used to organize content across the entire page.
*/
export class ModusWcToolbar {
constructor() {
this.inheritedAttributes = {};
/** Custom CSS class to apply to the outer div. */
this.customClass = '';
}
componentWillLoad() {
this.inheritedAttributes = inheritAriaAttributes(this.el);
}
getClasses() {
const classList = ['modus-wc-navbar'];
// The order CSS classes are added matters to CSS specificity
if (this.customClass)
classList.push(this.customClass);
return classList.join(' ');
}
render() {
return (h(Host, { key: 'a8d3ef8dd8fa3dddeeb30f95771641e23b3dd28e' }, h("div", Object.assign({ key: 'f12b47d6b385aa312868e65d488b1d2252e91fa4', class: this.getClasses() }, this.inheritedAttributes), h("div", { key: '35d694bc5c7d1db9e340da5ead6e98571fc9c6f7', class: "modus-wc-navbar-start" }, h("slot", { key: '9a4738e0f60a4d9cbe5865e7a5a4a2f32e05e239', name: "start" })), h("div", { key: 'a62ac4e3c85430d0727d704eae724de05d7067b2', class: "modus-wc-navbar-center" }, h("slot", { key: 'e154ccfb62fa6f273e6c0e4eaef9d455fc1c6472', name: "center" })), h("div", { key: 'd224cf4b79fe16191b0b231f403f8a04af2c673d', class: "modus-wc-navbar-end" }, h("slot", { key: 'b9027b5aec445137f05adb338583ab4b2bbee093', name: "end" })))));
}
static get is() { return "modus-wc-toolbar"; }
static get originalStyleUrls() {
return {
"$": ["modus-wc-toolbar.scss"]
};
}
static get styleUrls() {
return {
"$": ["modus-wc-toolbar.css"]
};
}
static get properties() {
return {
"customClass": {
"type": "string",
"attribute": "custom-class",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string | undefined",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": "Custom CSS class to apply to the outer div."
},
"getter": false,
"setter": false,
"reflect": false,
"defaultValue": "''"
}
};
}
static get elementRef() { return "el"; }
}