UNPKG

@reown/appkit-ui

Version:

The full stack toolkit to build onchain app UX.

94 lines 3.2 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; import { LitElement, html, svg } from 'lit'; import { property } from 'lit/decorators.js'; import '../../components/wui-icon/index.js'; import '../../components/wui-image/index.js'; import '../../layout/wui-flex/index.js'; import { QrCodeUtil } from '../../utils/QrCode.js'; import { resetStyles } from '../../utils/ThemeUtil.js'; import { customElement } from '../../utils/WebComponentsUtil.js'; import styles from './styles.js'; let WuiQrCode = class WuiQrCode extends LitElement { constructor() { super(...arguments); this.uri = ''; this.size = 500; this.theme = 'dark'; this.imageSrc = undefined; this.alt = undefined; this.arenaClear = undefined; this.farcaster = undefined; } render() { this.dataset['theme'] = this.theme; this.dataset['clear'] = String(this.arenaClear); return html `<wui-flex alignItems="center" justifyContent="center" class="wui-qr-code" direction="column" gap="4" width="100%" style="height: 100%" > ${this.templateVisual()} ${this.templateSvg()} </wui-flex>`; } templateSvg() { return svg ` <svg viewBox="0 0 ${this.size} ${this.size}" width="100%" height="100%"> ${QrCodeUtil.generate({ uri: this.uri, size: this.size, logoSize: this.arenaClear ? 0 : this.size / 4 })} </svg> `; } templateVisual() { if (this.imageSrc) { return html `<wui-image src=${this.imageSrc} alt=${this.alt ?? 'logo'}></wui-image>`; } if (this.farcaster) { return html `<wui-icon class="farcaster" size="inherit" color="inherit" name="farcaster" ></wui-icon>`; } return html `<wui-icon size="inherit" color="inherit" name="walletConnect"></wui-icon>`; } }; WuiQrCode.styles = [resetStyles, styles]; __decorate([ property() ], WuiQrCode.prototype, "uri", void 0); __decorate([ property({ type: Number }) ], WuiQrCode.prototype, "size", void 0); __decorate([ property() ], WuiQrCode.prototype, "theme", void 0); __decorate([ property() ], WuiQrCode.prototype, "imageSrc", void 0); __decorate([ property() ], WuiQrCode.prototype, "alt", void 0); __decorate([ property({ type: Boolean }) ], WuiQrCode.prototype, "arenaClear", void 0); __decorate([ property({ type: Boolean }) ], WuiQrCode.prototype, "farcaster", void 0); WuiQrCode = __decorate([ customElement('wui-qr-code') ], WuiQrCode); export { WuiQrCode }; //# sourceMappingURL=index.js.map