UNPKG

@scandit/web-datacapture-barcode

Version:

Scandit Data Capture SDK for the Web

1 lines 1.77 kB
import{Color as e,ScanditIconBuilder as t,ScanditIconShape as n,ScanditIconType as r}from"@scandit/web-datacapture-core";import{ScanditHTMLElement as i,css as a,defineCustomElements as o,html as s}from"@scandit/web-datacapture-core/build/js/private/utils/index.js";import{gray900 as c}from"@scandit/web-datacapture-core/build/js/private/ui/colors.js";const l=e.fromRGBA(255,255,255,1);var u=class e extends i{constructor(){super(),this.onPressedHandler=this.onPressed.bind(this),this.onReleasedHandler=this.onReleased.bind(this);let t=this.attachShadow({mode:`open`});t.innerHTML=s`<button type="button"><slot></slot></button>`,t.append(e.createStyleElement().cloneNode(!0))}static create(){return document.createElement(e.tag)}static register(){o({[e.tag]:e})}static createStyleElement(){return a`:host[hidden]{display:none}:host button{background:none;border:none;display:flex;margin:0;outline:none;padding:0;-webkit-tap-highlight-color:transparent}`}async connectedCallback(){var e,i,a;let o=new t;this.icon=await o.withIcon(r.CameraSwitch).withBackgroundShape(n.Circle).withBackgroundColor(c.withAlpha(.3)).withBackgroundStrokeColor(c).withWidth(36).withHeight(36).withIconSize(28).build(),(e=this.shadowRoot)==null||e.append(this.icon),(i=this.shadowRoot)==null||i.addEventListener(`pointerdown`,this.onPressedHandler),(a=this.shadowRoot)==null||a.addEventListener(`pointerup`,this.onReleasedHandler)}disconnectedCallback(){var e,t;(e=this.shadowRoot)==null||e.removeEventListener(`pointerdown`,this.onPressedHandler),(t=this.shadowRoot)==null||t.removeEventListener(`pointerup`,this.onReleasedHandler)}onPressed(){this.icon.iconColor=l.withAlpha(.3)}onReleased(){this.icon.iconColor=l}};u.tag=`scandit-check-switch-camera-button`;export{u as CameraSwitchButton};