UNPKG

2.78 kBJavaScriptView Raw
1import { r as registerInstance, h } from './index-c5baf484.js';
2var dropdownCss = ".dropdown{display:-ms-inline-flexbox;display:inline-flex;position:relative;vertical-align:top}.dropdown.is-active .dropdown-menu,.dropdown.is-hoverable:hover .dropdown-menu{display:block}.dropdown.is-right .dropdown-menu{left:auto;right:0}.dropdown.is-up .dropdown-menu{bottom:100%;padding-bottom:4px;padding-top:initial;top:auto}.dropdown-menu{display:none;left:0;min-width:12rem;padding-top:4px;position:absolute;top:100%;z-index:20}.dropdown-content{background-color:white;border-radius:4px;-webkit-box-shadow:0 0.5em 1em -0.125em rgba(10, 10, 10, 0.1), 0 0px 0 1px rgba(10, 10, 10, 0.02);box-shadow:0 0.5em 1em -0.125em rgba(10, 10, 10, 0.1), 0 0px 0 1px rgba(10, 10, 10, 0.02);padding-bottom:0.5rem;padding-top:0.5rem}.dropdown-item{color:#4a4a4a;display:block;font-size:0.875rem;line-height:1.5;padding:0.375rem 1rem;position:relative}a.dropdown-item,button.dropdown-item{padding-right:3rem;text-align:inherit;white-space:nowrap;width:100%}a.dropdown-item:hover,button.dropdown-item:hover{background-color:whitesmoke;color:#0a0a0a}a.dropdown-item.is-active,button.dropdown-item.is-active{background-color:#3273dc;color:#fff}.dropdown-divider{background-color:#ededed;border:none;display:block;height:1px;margin:0.5rem 0}";
3var Dropdown = /** @class */ (function () {
4 function Dropdown(hostRef) {
5 var _this = this;
6 registerInstance(this, hostRef);
7 /**
8 * CSS Classes
9 */
10 this.class = '';
11 /**
12 * The dropdown visibility
13 */
14 this.isActive = false;
15 /**
16 * Align the dropdown to the right
17 */
18 this.isRight = false;
19 /**
20 * Dropdown menu that appears above the dropdown button
21 */
22 this.isUp = false;
23 /**
24 * The dropdown will show up when hovering the dropdown-trigger
25 */
26 this.isHoverable = false;
27 /**
28 * Handle Trigger click action
29 */
30 this.handleTriggerClick = function () {
31 _this.isActive = !_this.isActive;
32 };
33 }
34 Dropdown.prototype.render = function () {
35 return (h("div", { class: {
36 dropdown: true,
37 'is-active': this.isActive,
38 'is-right': this.isRight,
39 'is-up': this.isUp,
40 'is-hoverable': this.isHoverable,
41 } }, 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)))));
42 };
43 return Dropdown;
44}());
45Dropdown.style = dropdownCss;
46export { Dropdown as bm_dropdown };