UNPKG

2.83 kBJavaScriptView Raw
1import { r as registerInstance, h } from './core-98b1cff0.js';
2var Dropdown = /** @class */ (function () {
3 function Dropdown(hostRef) {
4 var _this = this;
5 registerInstance(this, hostRef);
6 /**
7 * CSS Classes
8 */
9 this.class = '';
10 /**
11 * The dropdown visibility
12 */
13 this.isActive = false;
14 /**
15 * Align the dropdown to the right
16 */
17 this.isRight = false;
18 /**
19 * Dropdown menu that appears above the dropdown button
20 */
21 this.isUp = false;
22 /**
23 * The dropdown will show up when hovering the dropdown-trigger
24 */
25 this.isHoverable = false;
26 /**
27 * Handle Trigger click action
28 */
29 this.handleTriggerClick = function () {
30 _this.isActive = !_this.isActive;
31 };
32 }
33 Dropdown.prototype.render = function () {
34 return (h("div", { class: {
35 dropdown: true,
36 'is-active': this.isActive,
37 'is-right': this.isRight,
38 'is-up': this.isUp,
39 'is-hoverable': this.isHoverable,
40 } }, 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)))));
41 };
42 Object.defineProperty(Dropdown, "style", {
43 get: function () { return ".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:0;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:#fff;border-radius:4px;-webkit-box-shadow:0 .5em 1em -.125em rgba(10,10,10,.1),0 0 0 1px rgba(10,10,10,.02);box-shadow:0 .5em 1em -.125em rgba(10,10,10,.1),0 0 0 1px rgba(10,10,10,.02);padding-bottom:.5rem;padding-top:.5rem}.dropdown-item{color:#4a4a4a;display:block;font-size:.875rem;line-height:1.5;padding:.375rem 1rem;position:relative}a.dropdown-item,button.dropdown-item{padding-right:3rem;text-align:left;white-space:nowrap;width:100%}a.dropdown-item:hover,button.dropdown-item:hover{background-color:#f5f5f5;color:#0a0a0a}a.dropdown-item.is-active,button.dropdown-item.is-active{background-color:#5851ff;color:#fff}.dropdown-divider{background-color:#ededed;border:none;display:block;height:1px;margin:.5rem 0}"; },
44 enumerable: true,
45 configurable: true
46 });
47 return Dropdown;
48}());
49export { Dropdown as bm_dropdown };