UNPKG

@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

82 lines (81 loc) 2.96 kB
import { h, Host, } from "@stencil/core"; import { inheritAriaAttributes } from "../utils"; /** * A customizable accordion component used for showing and hiding related groups of content. * * The component supports a `<slot>` for injecting `<modus-wc-collapse>` elements. See [Collapse](/docs/components-collapse--docs) docs for additional info. */ export class ModusWcAccordion { constructor() { this.inheritedAttributes = {}; /** Custom CSS class to apply to the inner div. */ this.customClass = ''; } componentWillLoad() { this.inheritedAttributes = inheritAriaAttributes(this.el); } getClasses() { const classList = ['']; // 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: '082a0eed0a7e08ccb7e43fdbea50cd493fb44341' }, h("div", Object.assign({ key: '250cda5a3d0ef04fa31285ad87c22acc9526b00c', class: this.getClasses() }, this.inheritedAttributes), h("slot", { key: 'c053e5a177bae7b8e48295fb629988860dda89ee' })))); } static get is() { return "modus-wc-accordion"; } static get originalStyleUrls() { return { "$": ["modus-wc-accordion.scss"] }; } static get styleUrls() { return { "$": ["modus-wc-accordion.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 inner div." }, "getter": false, "setter": false, "reflect": false, "defaultValue": "''" } }; } static get events() { return [{ "method": "expandedChange", "name": "expandedChange", "bubbles": true, "cancelable": true, "composed": true, "docs": { "tags": [], "text": "When a collapse expanded state is changed, this event outputs the relevant index and state" }, "complexType": { "original": "{\n expanded: boolean;\n index: number;\n }", "resolved": "{ expanded: boolean; index: number; }", "references": {} } }]; } static get elementRef() { return "el"; } }