UNPKG

@logo-elements/logo-elements-styles

Version:

Logo Elements Design System is a design system library for modern web applications which gives your web apps Logo Applications look and feel, used by Logo Elements

182 lines (147 loc) 4.69 kB
/** * @license * Copyright LOGO YAZILIM SANAYİ VE TİCARET A.Ş. * * Save to the extent permitted by law, you may not use, copy, modify, * distribute or create derivative works of this material or any part * of it without the prior written consent of LOGO YAZILIM SANAYİ VE TİCARET A.Ş. Limited. * Any reproduction of this material must contain this notice. */ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; import './style.js'; import './color.js'; import './typography.js'; import {style} from "./style"; const badge = css` [theme~='badge'] { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; padding: 0.4em calc(0.5em + var(--leds-border-radius-s) / 4); color: var(--leds-primary-text-color); background-color: var(--leds-primary-color-10pct); border-radius: var(--leds-border-radius-s); font-family: var(--leds-font-family); font-size: var(--leds-font-size-s); line-height: 1; font-weight: 500; text-transform: initial; letter-spacing: initial; min-width: calc(var(--leds-line-height-xs) * 1em + 0.45em); } /* Ensure proper vertical alignment */ [theme~='badge']::before { display: inline-block; content: '\\2003'; width: 0; } [theme~='badge'][theme~='small'] { font-size: var(--leds-font-size-xxs); line-height: 1; } /* Colors */ [theme~='badge'][theme~='success'] { color: var(--leds-success-text-color); background-color: var(--leds-success-color-10pct); } [theme~='badge'][theme~='error'] { color: var(--leds-error-text-color); background-color: var(--leds-error-color-10pct); } [theme~='badge'][theme~='contrast'] { color: var(--leds-contrast-80pct); background-color: var(--leds-contrast-5pct); } /* Primary */ [theme~='badge'][theme~='primary'] { color: var(--leds-primary-contrast-color); background-color: var(--leds-primary-color); } [theme~='badge'][theme~='success'][theme~='primary'] { color: var(--leds-success-contrast-color); background-color: var(--leds-success-color); } [theme~='badge'][theme~='error'][theme~='primary'] { color: var(--leds-error-contrast-color); background-color: var(--leds-error-color); } [theme~='badge'][theme~='contrast'][theme~='primary'] { color: var(--leds-base-color); background-color: var(--leds-contrast); } /* Links */ [theme~='badge'][href]:hover { text-decoration: none; } /* Icon */ [theme~='badge'] logo-elements-icon, [theme~='badge'] iron-icon { margin: -0.25em 0; --iron-icon-width: 1.5em; --iron-icon-height: 1.5em; } [theme~='badge'] logo-elements-icon:first-child, [theme~='badge'] iron-icon:first-child { margin-left: -0.375em; } [theme~='badge'] logo-elements-icon:last-child, [theme~='badge'] iron-icon:last-child { margin-right: -0.375em; } iron-icon[theme~='badge'][icon], logo-elements-icon[theme~='badge'][icon] { min-width: 0; padding: 0; font-size: 1rem; width: var(--leds-icon-size-m); height: var(--leds-icon-size-m); } iron-icon[theme~='badge'][icon][theme~='small'], logo-elements-icon[theme~='badge'][icon][theme~='small'] { width: var(--leds-icon-size-s); height: var(--leds-icon-size-s); } /* Empty */ [theme~='badge']:not([icon]):empty { min-width: 0; width: 1em; height: 1em; padding: 0; border-radius: 50%; background-color: var(--leds-primary-color); } [theme~='badge'][theme~='small']:not([icon]):empty { width: 0.75em; height: 0.75em; } [theme~='badge'][theme~='contrast']:not([icon]):empty { background-color: var(--leds-contrast); } [theme~='badge'][theme~='success']:not([icon]):empty { background-color: var(--leds-success-color); } [theme~='badge'][theme~='error']:not([icon]):empty { background-color: var(--leds-error-color); } /* Pill */ [theme~='badge'][theme~='pill'] { --leds-border-radius-s: 1em; } /* RTL specific styles */ [dir='rtl'][theme~='badge'] logo-elements-icon:first-child, [dir='rtl'][theme~='badge'] iron-icon:first-child { margin-right: -0.375em; margin-left: 0; } [dir='rtl'][theme~='badge'] logo-elements-icon:last-child, [dir='rtl'][theme~='badge'] iron-icon:last-child { margin-left: -0.375em; margin-right: 0; } `; registerStyles('', badge, { moduleId: 'leds-badge' }); const $tpl = document.createElement('template'); $tpl.innerHTML = `<style>${badge.toString().replace(':host', 'html')}</style>`; document.head.appendChild($tpl.content); export { badge };