All files / src/form/select PopupSelect.ts

30.18% Statements 16/53
100% Branches 1/1
33.33% Functions 1/3
30.18% Lines 16/53

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 5492x 92x 92x 92x 92x 92x                                                                           92x 92x 92x 92x 92x 92x 92x 92x 92x 92x  
import { css, html } from 'lit';
import { RapidElement } from '../../RapidElement';
import { property } from 'lit/decorators.js';
 
export class PopupSelect extends RapidElement {
  public static styles = css`
    :host {
    }

    .dropdown {
      background: #fff;
      border-radius: 0.5em;
      padding: 0.15em;
      border-radius: var(--curvature);
    }

    temba-select {
      width: 250px;
      display: block;
      --color-widget-border: transparent;
      --widget-box-shadow: none;
    }
  `;

  @property({ type: String })
  placeholder: string = '';

  @property({ type: String })
  endpoint: string = '';

  private handleChange() {
    this.blur();
  }

  public render() {
    return html`
      <div>
        <temba-dropdown>
          <div slot="toggle"><slot name="toggle"></slot></div>
          <div class="dropdown" slot="dropdown">
            <temba-select
              placeholder=${this.placeholder}
              endpoint=${this.endpoint}
              clearable
              searchable
              @change=${this.handleChange}
            ></temba-select>
          </div>
        </temba-dropdown>
      </div>
    `;
  }
}