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

114 lines (96 loc) 2.91 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/register-styles.js'; import '../color.js'; import '../spacing.js'; import '../style.js'; import '../typography.js'; const requiredField = css` [part='label'] { align-self: flex-start; color: var(--leds-secondary-text-color); font-weight: 500; font-size: var(--leds-font-size-s); margin-left: calc(var(--leds-border-radius-m) / 4); transition: color 0.2s; line-height: 1; padding-right: 1em; padding-bottom: 0.5em; // overflow: hidden; white-space: nowrap; text-overflow: ellipsis; position: relative; max-width: 100%; box-sizing: border-box; } :host([has-label])::before { margin-top: calc(var(--leds-font-size-s) * 1.5); } :host([has-label][theme~='small'])::before { margin-top: calc(var(--leds-font-size-xs) * 1.5); } :host([has-label]) { padding-top: var(--leds-space-m); } [part='required-indicator']::after { content: var(--leds-required-field-indicator, '•'); transition: opacity 0.2s; opacity: 0; color: var(--leds-primary-text-color); position: absolute; right: 0; width: 1em; text-align: center; } :host([required]:not([has-value])) [part='required-indicator']::after { opacity: 1; } :host([invalid]) [part='required-indicator']::after { color: var(--leds-error-text-color); } [part='error-message'] { margin-left: calc(var(--leds-border-radius-m) / 4); font-size: var(--leds-font-size-xs); line-height: var(--leds-line-height-xs); color: var(--leds-error-text-color); will-change: max-height; transition: 0.4s max-height; max-height: 5em; } :host([has-error-message]) [part='error-message']::before, :host([has-error-message]) [part='error-message']::after { content: ''; display: block; height: 0.4em; } :host(:not([invalid])) [part='error-message'] { max-height: 0; overflow: hidden; } /* RTL specific styles */ :host([dir='rtl']) [part='label'] { margin-left: 0; margin-right: calc(var(--leds-border-radius-m) / 4); } :host([dir='rtl']) [part='label'] { padding-left: 1em; padding-right: 0; } :host([dir='rtl']) [part='required-indicator']::after { right: auto; left: 0; } :host([dir='rtl']) [part='error-message'] { margin-left: 0; margin-right: calc(var(--leds-border-radius-m) / 4); } `; registerStyles('', requiredField, { moduleId: 'leds-required-field' }); export { requiredField };