@scandit/web-datacapture-barcode
Version:
Scandit Data Capture SDK for the Web
1 lines • 2.18 kB
JavaScript
import{Color as e}from"@scandit/web-datacapture-core";import{css as t}from"@scandit/web-datacapture-core/build/js/private/utils/index.js";import{html as n}from"@scandit/web-datacapture-core/build/js/private/utils/html.js";const r=`.container`,i=`.icon-text`,a=`.text`;function o(){return n`<div class="container"><div class="icon-text"><slot name="barcode-icon"></slot><div class="text">Text</div></div></div>`}function s(){return t`:host{--background-color:#0000;--text-color:#000;--top-left-corner-radius:0px;--top-right-corner-radius:0px;--bottom-left-corner-radius:0px;--bottom-right-corner-radius:0px;--text-size:16px}.container{align-items:center;background-color:var(--background-color);border-radius:var(--top-left-corner-radius) var(--top-right-corner-radius) var(--bottom-right-corner-radius) var(--bottom-left-corner-radius);display:flex;flex-direction:row;justify-content:center;overflow:hidden;padding:.75rem;transition:.3s ease}.container.highlighted{opacity:.75}.icon-text{align-items:center;display:flex;gap:.5rem}.text{color:var(--text-color);font-size:var(--text-size);font-weight:600;width:100%}`}function c(e){var t;return(t=e.shadowRoot)==null||(t=t.querySelector(`[slot='barcode-icon']`))==null?void 0:t.assignedElements()[0]}function l(e,t){let n=c(e);n!==t&&(n&&t==null&&n.remove(),t&&(t.slot=`barcode-icon`,e.append(t)))}function u(t,n){let r=t.style.getPropertyValue(`--background-color`);return r===``?n:e.fromHex(r)}function d(e,t){e.style.setProperty(`--background-color`,`#${t.toJSON()}`)}function f(t,n){let r=t.style.getPropertyValue(`--text-color`);return r===``?n:e.fromHex(r)}function p(e,t){e.style.setProperty(`--text-color`,`#${t.toJSON()}`)}function m(e){return Number.parseFloat(e.style.getPropertyValue(`--text-size`))}function h(e,t){e.style.setProperty(`--text-size`,`${t}px`)}function g(e){return e.textContent??``}function _(e,t){e.textContent=t}export{r as CONTAINER_SELECTOR,i as ICON_TEXT_SELECTOR,a as TEXT_SELECTOR,s as createStyles,o as createTemplate,u as getBackgroundColor,c as getIcon,g as getText,f as getTextColor,m as getTextSize,d as setBackgroundColor,_ as setText,p as setTextColor,h as setTextSize,l as updateIcon};