1/* 2 * Copyright (C) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import {BaseElement, element} from "../BaseElement.js"; 17 18@element("lit-popover-title") 19export class LitPopoverTitle extends BaseElement { 20 private titleText: HTMLElement | null | undefined; 21 22 static get observedAttributes() { 23 return ['title'] 24 } 25 26 initElements(): void { 27 this.titleText = this.shadowRoot?.querySelector('.pop-title'); 28 } 29 30 initHtml(): string { 31 return ` 32 <style> 33 .pop-title{ 34 font-family: Helvetica,serif; 35 font-size: 14px; 36 opacity: 0.6; 37 color: #000000; 38 text-align: left; 39 line-height: 14px; 40 font-weight: 400; 41 padding-bottom: 5px; 42 } 43 </style> 44 <div class="pop-title"></div> 45 `; 46 } 47 48 attributeChangedCallback(name: string, oldValue: string, newValue: string) { 49 switch (name) { 50 case "title": 51 if (this.titleText) this.titleText.textContent = newValue 52 break; 53 default: 54 break; 55 } 56 } 57 58}