import { WiredBase, BaseCSS, Point } from './wired-base'; import { rectangle, line, svgNode, ellipse } from './wired-lib'; import { css, TemplateResult, html, CSSResultArray } from 'lit'; import { customElement, property, query } from 'lit/decorators.js'; @customElement('wired-search-input') export class WiredSearchInput extends WiredBase { @property({ type: Boolean, reflect: true }) disabled = false; @property({ type: String }) placeholder = ''; @property({ type: String }) autocomplete = ''; @property({ type: String }) autocorrect = ''; @property({ type: Boolean }) autofocus = false; @query('input') private textInput?: HTMLInputElement; private pendingValue?: string; private searchIcon?: SVGElement; private closeIcon?: SVGElement; static get styles(): CSSResultArray { return [ BaseCSS, css` :host { display: inline-block; position: relative; padding: 10px 40px 10px 5px; font-family: sans-serif; width: 180px; outline: none; } :host([disabled]) { opacity: 0.6 !important; cursor: default; pointer-events: none; } :host([disabled]) svg { background: rgba(0, 0, 0, 0.07); } input { display: block; width: 100%; box-sizing: border-box; outline: none; border: none; font-family: inherit; font-size: inherit; font-weight: inherit; color: inherit; padding: 6px; } input[type=search]::-ms-clear { display: none; width : 0; height: 0; } input[type=search]::-ms-reveal { display: none; width : 0; height: 0; } input[type="search"]::-webkit-search-decoration, input[type="search"]::-webkit-search-cancel-button, input[type="search"]::-webkit-search-results-button, input[type="search"]::-webkit-search-results-decoration { display: none; } .thicker path { stroke-width: 1.5; } button { position: absolute; top: 0; right: 2px; width: 32px; height: 100%; box-sizing: border-box; background: none; border: none; cursor: pointer; outline: none; opacity: 0; } ` ]; } render(): TemplateResult { return html`