'use strict';

var index = require('./index-B2lA-USD.js');
var jsSdk = require('@verdocs/js-sdk');

const verdocsDropdownCss = "@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-dropdown{height:26px;display:block;position:relative;font-family:\"Inter\", \"Barlow\", sans-serif}verdocs-dropdown .arrow{height:26px;padding:0 4px;background:#fff;cursor:pointer;border-radius:4px;-ms-flex-align:center;align-items:center;display:-ms-inline-flexbox;display:inline-flex;border:1px solid #cccccc;-ms-flex-pack:center;justify-content:center}verdocs-dropdown .arrow svg{fill:#55bc81;-webkit-transition:0.3s;transition:0.3s}verdocs-dropdown.open .arrow{background:#4c56cb;border:1px solid #707ae5}verdocs-dropdown.open .arrow svg{-webkit-transform:scaleY(-1);transform:scaleY(-1);fill:#fff}#verdocs-dropdown-menu-items{width:200px;z-index:10000;position:absolute;border-radius:5px;background:#33354c;border:1px solid #654dcb}.verdocs-dropdown-menu-separator{height:1px;margin-top:5px;padding-top:5px;border-top:1px solid rgba(255, 255, 255, 0.3725490196)}.verdocs-dropdown-menu-option{width:100%;color:#fff;border:none;display:block;text-align:left;background:none;text-wrap:nowrap;padding:10px 20px}.verdocs-dropdown-menu-option:hover{cursor:pointer;background:#55bc81}.verdocs-dropdown-menu-option[disabled]{color:#aaaaaa}.verdocs-dropdown-menu-option[disabled]:hover{cursor:inherit;background:transparent;color:#aaaaaa}";

const DropdownArrow = `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#50BE80"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M7 10l5 5 5-5H7z"/></svg>`;
const VerdocsDropdown = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        this.optionSelected = index.createEvent(this, "optionSelected");
        /**
         * The menu options to display.
         */
        this.options = [];
        this.containerId = `verdocs-send-${Math.random().toString(36).substring(2, 11)}`;
        this.showPicker = false;
    }
    handleSelectOption(e, option) {
        var _a;
        e.stopPropagation();
        (_a = this.optionSelected) === null || _a === void 0 ? void 0 : _a.emit(option);
        this.showPicker = false;
    }
    toggle() {
        this.showPicker = !this.showPicker;
    }
    render() {
        const elId = `verdocs-dropdown-${jsSdk.randomString(8)}`;
        return (index.h(index.Host, { key: '466a4c33a9d8867a5740fd05b49dfba52ae07334' }, index.h("button", { key: '7e0493bac43d60b5116c604a0012951e69380eb6', class: "arrow", innerHTML: DropdownArrow, "aria-label": "Open Menu", id: elId, onClick: () => (this.showPicker = !this.showPicker) }), this.showPicker && (index.h("verdocs-portal", { key: '8fcdfbf97c8f3a859dfa523eed4660195f246124', anchor: elId, onClickAway: () => (this.showPicker = false), id: "verdocs-dropdown-menu-items" }, this.options.map(option => {
            if (!option.label) {
                return index.h("div", { class: "verdocs-dropdown-menu-separator" });
            }
            else {
                return (index.h("button", { class: "verdocs-dropdown-menu-option", disabled: option.disabled || false, onClick: e => this.handleSelectOption(e, option) }, option.label));
            }
        })))));
    }
    get el() { return index.getElement(this); }
};
VerdocsDropdown.style = verdocsDropdownCss;

exports.verdocs_dropdown = VerdocsDropdown;
//# sourceMappingURL=verdocs-dropdown.entry.cjs.js.map

//# sourceMappingURL=verdocs-dropdown.cjs.entry.js.map