@oslokommune/punkt-css
Version:
CSS-rammeverket til Punkt, et designsystem laget av Oslo Origo
168 lines (167 loc) • 4.44 kB
CSS
pkt-listbox {
display: contents;
}
.pkt-listbox {
display: none;
position: absolute;
flex-direction: column;
top: 100%;
left: 0;
width: 100%;
visibility: hidden;
overflow: hidden;
list-style: none;
margin: 0;
overflow-y: auto;
border: 2px solid var(--pkt-color-border-gray);
background-color: white;
max-height: 18rem;
}
.pkt-listbox.pkt-listbox__open {
display: flex;
visibility: visible;
z-index: 4;
}
.pkt-listbox .pkt-listbox__options {
padding: 0.25rem;
margin: 0;
list-style: none;
flex-grow: 1;
overflow-y: auto;
}
@supports selector(:not(:has(*))) {
.pkt-listbox .pkt-listbox__options:not(:is(:has(*))) {
display: none;
}
}
.pkt-listbox .pkt-listbox__option {
margin: 0;
padding: 0.75rem 20px;
display: grid;
grid-template-areas: "check label" ". description";
grid-template-columns: min-content 1fr;
align-items: center;
column-gap: 0.25rem;
}
.pkt-listbox .pkt-listbox__option-label {
grid-area: label;
}
.pkt-listbox .pkt-listbox__option pkt-icon[name=check-big] {
height: 1rem;
}
.pkt-listbox .pkt-listbox__option-description {
padding-top: 0.25rem;
grid-area: description;
}
.pkt-listbox .pkt-listbox__option:focus {
padding: 10px 1.125rem;
border: 2px solid var(--pkt-color-brand-warm-blue-1000);
outline: 0.25rem solid var(--pkt-color-border-states-focus);
text-decoration: none;
}
.pkt-listbox .pkt-listbox__option--checkBox {
grid-area: check;
padding: 0.75rem 0.5rem 0.75rem 0.75rem;
column-gap: 0.5rem;
}
.pkt-listbox .pkt-listbox__option--checkBox:focus {
padding-left: 10px;
}
.pkt-listbox .pkt-listbox__option--selected {
padding-left: 0.25rem;
}
.pkt-listbox .pkt-listbox__option--selected:focus {
padding-left: 2px;
}
.pkt-listbox .pkt-listbox__option--highlighted {
background-color: var(--pkt-color-surface-default-light-blue);
}
.pkt-listbox .pkt-listbox__option[data-disabled] {
cursor: not-allowed;
color: var(--pkt-color-grays-gray-500);
}
.pkt-listbox .pkt-listbox__option {
margin-bottom: 0.125rem;
overflow-wrap: break-word;
hyphens: auto;
cursor: pointer;
}
.pkt-listbox .pkt-listbox__option:first-child:not(.pkt-listbox__search, .pkt-listbox__banners) {
margin-top: 0.125rem;
}
.pkt-listbox .pkt-listbox__option:hover:not(.pkt-listbox__search) {
background-color: var(--pkt-color-surface-default-light-blue);
}
.pkt-listbox .pkt-listbox__banners {
padding: 0.25rem;
margin: 0;
flex-grow: 0;
flex-shrink: 1;
}
@supports selector(:not(:has(*))) {
.pkt-listbox .pkt-listbox__banners:not(:is(:has(*))) {
display: none;
}
}
.pkt-listbox .pkt-listbox__banner {
line-height: 1.5;
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.75rem;
width: 100%;
box-sizing: border-box;
}
.pkt-listbox .pkt-listbox__banner--new-option, .pkt-listbox .pkt-listbox__banner--user-message {
background-color: var(--pkt-color-surface-default-gray);
}
.pkt-listbox .pkt-listbox__banner--maximum-reached {
background-color: var(--pkt-color-brand-light-beige-1000);
}
.pkt-listbox .pkt-listbox__banner-icon {
height: 1.5rem;
width: 1.5rem;
}
.pkt-listbox .pkt-listbox__search {
display: flex;
align-items: center;
padding: 0.375rem;
width: 100%;
box-sizing: border-box;
background-color: var(--pkt-color-surface-default-gray);
}
.pkt-listbox .pkt-listbox__search:focus-visible, .pkt-listbox .pkt-listbox__search:focus, .pkt-listbox .pkt-listbox__search:active {
border: none;
outline: none;
}
.pkt-listbox .pkt-listbox__search:focus-within, .pkt-listbox .pkt-listbox__search:active {
padding: 0.25rem;
border: 2px solid var(--pkt-color-brand-warm-blue-1000);
outline: 0.25rem solid var(--pkt-color-border-states-focus);
}
.pkt-listbox .pkt-listbox__search:focus-within input, .pkt-listbox .pkt-listbox__search:active input {
outline: none;
}
.pkt-listbox .pkt-listbox__search-icon {
cursor: default;
display: flex;
align-items: center;
padding-right: 0.25rem;
}
.pkt-listbox .pkt-listbox__search-icon .pkt-icon {
width: 1.25rem;
height: 1.25rem;
}
.pkt-listbox .pkt-listbox__search input {
background-color: var(--pkt-color-surface-default-gray);
border: none;
color: var(--pkt-color-text-body-default);
padding: 0.75rem 0.75rem 0.75rem 0.5rem;
line-height: inherit;
width: 100%;
box-sizing: border-box;
margin: 0;
}
.pkt-listbox .pkt-listbox__search input::placeholder {
color: var(--pkt-color-text-body-default);
}