import { LitElement, css, html, svg } from 'lit' import { property, state } from 'lit/decorators.js' import type { DirectiveClass, DirectiveResult } from 'lit/directive.js' import { unsafeSVG } from 'lit/directives/unsafe-svg.js' import { map } from 'lit/directives/map.js' import { classMap } from 'lit/directives/class-map.js' import { when } from 'lit/directives/when.js' import { formatNumber } from '@upswot/core' import { dispatchCustomEvent } from '../../utils/dispatchCustomEvent' import { customElementIfNotExist } from '../../utils/customElementIfNotExist' import { getLocale } from '../../dependencies' import { UsBaseElement } from '../base/UsBaseElement' import UsCurrenciesSwitcher_css from './currenciesSwitcher.pcss' import type { ICurrency } from './models/ICurrency' import '../loader/UsLoader' import '../button/UsButton' declare global { interface HTMLElementTagNameMap { 'us-currencies-switcher': UsCurrenciesSwitcher } } @customElementIfNotExist('us-currencies-switcher') export class UsCurrenciesSwitcher extends LitElement { static styles = [ UsBaseElement.styles, css([UsCurrenciesSwitcher_css] as TemplateStringsArray | any), ] @property({ type: Object }) activeCurrency = {} as ICurrency @property({ type: Array }) switcherData: ICurrency[] = [] @property({ type: Boolean }) isLoading = false @property({ type: String, attribute: 'data-testid', reflect: true }) dataTestId = 'switcher_currencies' @property({ type: String }) popupTitle = '' @property({ type: String }) mainText = '' @property({ type: String }) buttonText = '' @property({ type: String }) currenciesSwitcherTotal = '' @property({ type: String }) currenciesSwitcherPay = '' @property({ type: String }) currenciesSwitcherReceive = '' @property({ type: Boolean }) readonly = false @state() isSwitcherOpen = false @state() selectedCurrency = this.activeCurrency disconnectedCallback() { super.disconnectedCallback() } render() { return html`
${this.mainText}
${this.renderCurrenciesSwitcherItem()}`, )}${this.currenciesSwitcherTotal}
${this.currenciesSwitcherPay}
${this.currenciesSwitcherReceive}