UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

233 lines 6.53 kB
/* * Autocomplete component * */ /* * Utilities */ .dnb-autocomplete { --autocomplete-width: 16rem; --autocomplete-height: 2rem; --autocomplete-height--small: 1.5rem; --autocomplete-height--medium: 2.5rem; --autocomplete-height--large: 3rem; --autocomplete-padding-horizontal: 1rem; --autocomplete-focus-border-width: 0.125rem; --autocomplete-text-padding: 0.5rem; --autocomplete-border-radius: 0.25rem; display: inline-flex; align-items: center; font-size: var(--font-size-small); line-height: var(--autocomplete-height); } .dnb-autocomplete__inner { display: inline-flex; flex-direction: column; margin: 0; padding: 0; width: auto; color: inherit; } .dnb-autocomplete--right .dnb-autocomplete__inner { align-items: flex-end; } .dnb-autocomplete__shell { position: relative; width: var(--autocomplete-width); margin: 0; padding: 0; color: inherit; } .dnb-autocomplete__row { display: inline-flex; align-items: center; } .dnb-autocomplete--small { line-height: var(--autocomplete-height--small); } .dnb-autocomplete--medium { line-height: var(--autocomplete-height--medium); } .dnb-autocomplete--large { line-height: var(--autocomplete-height--large); } .dnb-autocomplete__icon { display: inline-flex; justify-content: center; pointer-events: none; } .dnb-autocomplete__show-all .dnb-drawer-list__option__inner { display: flex; justify-content: center; align-items: center; } .dnb-autocomplete__show-all .dnb-drawer-list__option__inner .dnb-drawer-list__option__item { display: flex; flex-direction: column; } .dnb-autocomplete__show-all .dnb-drawer-list__option__inner .dnb-icon { align-self: center; } .dnb-autocomplete__input { display: inline-flex; align-items: center; outline: none; } .dnb-autocomplete__input, .dnb-autocomplete__input .dnb-input__inner, .dnb-autocomplete__input .dnb-input__shell, .dnb-autocomplete__input .dnb-input__input { width: 100%; } .dnb-autocomplete--opened .dnb-input__submit-button__button .dnb-icon { transform: rotate(180deg); transform-origin: 50% 50%; } .dnb-autocomplete .dnb-input__submit-button__button[disabled]:not(.dnb-button--has-text) { --border-color: var(--color-black-55); --border-width: 0.0625rem; box-shadow: inset 0 0 0 var(--border-width) var(--border-color); border-color: transparent; } .dnb-autocomplete .dnb-input__submit-button__button .dnb-icon { transition: transform 400ms ease-out; } html[data-visual-test] .dnb-autocomplete .dnb-input__submit-button__button .dnb-icon { transition-duration: 1ms !important; } .dnb-autocomplete .dnb-input__inner__element { position: relative; z-index: 3; cursor: text; } @media screen and (min-width: 40.00625em) { .dnb-autocomplete .dnb-input--has-inner-element .dnb-input__placeholder, .dnb-autocomplete .dnb-input--has-inner-element .dnb-input__input { padding-right: 0 !important; } } @media screen and (max-width: 40em) { .dnb-autocomplete .dnb-input--has-inner-element .dnb-input__placeholder, .dnb-autocomplete .dnb-input--has-inner-element .dnb-input__input { padding-right: 2.5rem !important; } } .dnb-autocomplete .dnb-input__inner__element.dnb-p { white-space: nowrap; padding: 0 0.5rem; } @media screen and (max-width: 40em) { .dnb-autocomplete .dnb-input__inner__element.dnb-p { display: none; } } .dnb-autocomplete .dnb-input__inner__element.dnb-p, .dnb-spacing .dnb-autocomplete .dnb-input__inner__element.dnb-p { margin: 0; } .dnb-autocomplete .dnb-input--has-submit-element .dnb-input__inner__element { margin-right: 2.5rem !important; } .dnb-autocomplete--icon-position-right .dnb-input__inner__element.dnb-p { padding-right: 3rem; } .dnb-autocomplete--icon-position-right .dnb-input--icon-position-right .dnb-autocomplete--icon-position-right .dnb-input--icon-position-right.dnb-autocomplete--icon-position-right .dnb-input--has-icon .dnb-autocomplete--icon-position-right .dnb-input__input { padding-right: 1rem; } .dnb-autocomplete--disabled .dnb-input__inner__element { cursor: not-allowed; } .dnb-autocomplete__text { order: 1; position: relative; z-index: 4; width: 100%; height: inherit; line-height: inherit; padding: 0 var(--autocomplete-text-padding) 0 0; overflow: hidden; color: inherit; text-align: left; text-overflow: ellipsis; font-size: var(--font-size-basis); } .dnb-autocomplete__text__inner { display: inline-block; width: 100%; height: inherit; padding: 0; overflow: hidden; white-space: nowrap; color: inherit; -webkit-text-decoration: none; text-decoration: none; text-overflow: inherit; text-align: inherit; } .dnb-autocomplete > .dnb-form-label { margin-right: 1rem; line-height: var(--line-height-basis); } @media screen and (max-width: 40em) { .dnb-autocomplete { flex-wrap: wrap; } .dnb-autocomplete > .dnb-form-label { margin-bottom: 0.5rem; margin-top: 0.5rem; } } .dnb-autocomplete--stretch { display: flex; flex-grow: 1; } .dnb-autocomplete--stretch .dnb-autocomplete__inner { flex-grow: 1; } .dnb-autocomplete--stretch .dnb-autocomplete__row, .dnb-autocomplete--stretch .dnb-autocomplete__inner, .dnb-autocomplete--stretch .dnb-autocomplete__shell { width: 100%; } .dnb-autocomplete--stretch .dnb-form-label + .dnb-autocomplete__inner { width: auto; } .dnb-autocomplete--vertical.dnb-autocomplete--stretch .dnb-autocomplete__inner { width: 100%; } .dnb-form-row--horizontal .dnb-autocomplete--stretch { width: 100%; } label + .dnb-autocomplete[class*=__form-status] { vertical-align: top; } label + .dnb-autocomplete[class*=__form-status] .dnb-autocomplete__shell { top: -0.375rem; } .dnb-autocomplete__inner > .dnb-form-status { order: 2; margin-top: 0.5rem; } .dnb-autocomplete--vertical { display: flex; flex-direction: column; align-items: flex-start; } .dnb-autocomplete:not(.dnb-autocomplete--vertical)[class*=__status] { align-items: flex-start; } .dnb-autocomplete:not(.dnb-autocomplete--vertical)[class*=__status] > .dnb-form-label { margin-top: 0.25rem; } @media screen and (max-width: 40em) { .dnb-responsive-component .dnb-autocomplete { display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 0.5rem; } .dnb-responsive-component .dnb-autocomplete > .dnb-form-label { margin-bottom: 0.5rem; } .dnb-responsive-component .dnb-autocomplete__helper { display: none; } } .dnb-autocomplete__list .dnb-drawer-list__option__item > span { padding-right: 0.125em; }