@bulmil/core
Version:

115 lines (114 loc) • 2.96 kB
JavaScript
/*!
* Bulmil - MIT License
*/
import { h } from '@stencil/core';
export class Dropdown {
constructor() {
/**
* Handle Trigger click action
*/
this.handleTriggerClick = () => {
this.isActive = !this.isActive;
};
this.isActive = false;
this.isRight = false;
this.isUp = false;
this.isHoverable = false;
}
render() {
return (h("div", { class: {
dropdown: true,
'is-active': this.isActive,
'is-right': this.isRight,
'is-up': this.isUp,
'is-hoverable': this.isHoverable,
} }, h("div", { onClick: this.handleTriggerClick, class: "dropdown-trigger" }, h("slot", { name: "trigger", "aria-haspopup": "true" })), h("div", { class: "dropdown-menu", role: "menu" }, h("div", { class: "dropdown-content" }, h("slot", null)))));
}
static get is() { return "bm-dropdown"; }
static get originalStyleUrls() {
return {
"$": ["dropdown.scss"]
};
}
static get styleUrls() {
return {
"$": ["dropdown.css"]
};
}
static get properties() {
return {
"isActive": {
"type": "boolean",
"mutable": true,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "The dropdown visibility"
},
"attribute": "is-active",
"reflect": true,
"defaultValue": "false"
},
"isRight": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "Align the dropdown to the right"
},
"attribute": "is-right",
"reflect": false,
"defaultValue": "false"
},
"isUp": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "Dropdown menu that appears above the dropdown button"
},
"attribute": "is-up",
"reflect": false,
"defaultValue": "false"
},
"isHoverable": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "The dropdown will show up when hovering the dropdown-trigger"
},
"attribute": "is-hoverable",
"reflect": false,
"defaultValue": "false"
}
};
}
}