raft-ui
Version:
React UI components for Raft.
287 lines (286 loc) • 6.48 kB
CSS
/* Options-driven combobox. Visual rules consume rui semantic tokens. */
.r-combobox-select {
min-width: 0;
position: relative;
}
.r-combobox-select__control {
box-sizing: border-box;
min-width: 0;
min-height: 44px;
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0 6px 0 12px;
border: 1.5px solid var(--line-strong);
border-radius: 8px;
outline: 0;
background: var(--layer-card);
color: var(--foreground);
box-shadow: none;
font-size: 16px;
line-height: 24px;
transition: box-shadow 90ms ease-out;
}
.r-combobox-select__control:focus-within {
box-shadow: var(--theme-focus-ring);
}
.r-combobox-select__input {
box-sizing: border-box;
min-width: 3rem;
width: 100%;
flex: 1;
padding: 0;
border: 0;
outline: 0;
background: transparent;
color: inherit;
font: inherit;
}
.r-combobox-select__input::placeholder {
color: var(--foreground-placeholder);
}
.r-combobox-select__chips {
min-height: 28px;
min-width: 0;
margin-inline-start: -6px;
padding: 6px 0;
display: flex;
flex: 1;
flex-wrap: wrap;
align-items: center;
gap: 6px;
border: 0;
}
.r-combobox-select__chips .r-combobox-select__input {
min-height: 28px;
padding: 0 4px;
}
.r-combobox-select__chip {
max-width: 100%;
min-height: 28px;
padding: 0 2px 0 8px;
display: inline-flex;
align-items: center;
gap: 6px;
overflow: hidden;
border-radius: 6px;
background: var(--fill-muted);
color: var(--foreground);
font-size: 13px;
line-height: 18px;
font-weight: 600;
}
.r-combobox-select__control:not(:focus-within) .r-combobox-select__chip[data-overflow] {
display: none;
}
.r-combobox-select__text {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.r-combobox-select__actions {
display: inline-flex;
align-items: center;
gap: 0.125rem;
flex: 0 0 auto;
}
.r-combobox-select__action,
.r-combobox-select__remove {
display: inline-flex;
align-items: center;
justify-content: center;
flex: 0 0 auto;
padding: 0;
border: 0;
background: transparent;
outline: 0;
transition:
color 150ms ease,
background-color 150ms ease;
}
.r-combobox-select__remove {
width: 22px;
height: 22px;
border-radius: 4px;
color: var(--foreground-hint);
}
.r-combobox-select__action {
width: 32px;
height: 32px;
border-radius: 8px;
color: var(--foreground-hint);
}
.r-combobox-select__action > svg,
.r-combobox-select__remove > svg {
pointer-events: none;
}
.r-combobox-select__action > svg {
width: 16px;
height: 16px;
}
.r-combobox-select__remove > svg {
width: 0.875rem;
height: 0.875rem;
}
.r-combobox-select__action:hover,
.r-combobox-select__remove:hover {
background: var(--fill-pressed);
color: var(--foreground);
}
.r-combobox-select__action:focus-visible,
.r-combobox-select__remove:focus-visible {
box-shadow: var(--theme-focus-ring);
}
.r-combobox-select__positioner {
z-index: 50;
isolation: isolate;
outline: 0;
}
.r-combobox-select__popup {
box-sizing: border-box;
width: var(--anchor-width, max-content);
min-width: 13.75rem;
max-width: var(--available-width);
max-height: min(var(--available-height), 24rem);
overflow: hidden;
border: 0;
border-radius: 10px;
background: var(--layer-popover);
color: var(--foreground);
box-shadow:
0 0 0 1px var(--line-seam),
var(--theme-shadow-float);
outline: 0;
}
.r-combobox-select__list {
max-height: 16rem;
overflow-y: auto;
overscroll-behavior: contain;
scroll-padding-block: 6px;
padding: 6px;
}
.r-combobox-select__option {
box-sizing: border-box;
width: 100%;
min-height: 36px;
padding: 0 10px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
overflow: hidden;
border-radius: 8px;
cursor: default;
user-select: none;
color: var(--foreground);
font-size: 14px;
line-height: 20px;
font-weight: 500;
outline: 0;
transition:
background-color 120ms ease,
color 120ms ease;
}
.r-combobox-select__option:hover,
.r-combobox-select__option[data-highlighted] {
background: var(--primary-soft);
color: var(--foreground);
}
.r-combobox-select__option[data-selected] {
font-weight: 700;
}
.r-combobox-select__option[data-disabled] {
pointer-events: none;
background: transparent;
color: var(--foreground-disabled);
}
.r-combobox-select__option > svg {
width: 16px;
height: 16px;
flex: 0 0 auto;
pointer-events: none;
color: var(--foreground-icon);
}
.r-combobox-select__indicator {
margin-inline-start: auto;
display: inline-flex;
align-items: center;
justify-content: center;
flex: 0 0 auto;
color: var(--foreground);
}
.r-combobox-select__indicator > svg {
width: 16px;
height: 16px;
}
.r-combobox-select__group-label {
padding: 8px 10px 4px;
color: var(--foreground-hint);
font-size: 12px;
line-height: 16px;
font-weight: 700;
}
.r-combobox-select__message {
padding: 14px 16px;
color: var(--foreground-hint);
font-size: 14px;
line-height: 20px;
text-align: start;
}
.r-combobox-select__overflow {
color: var(--foreground-hint);
font-family: var(--mono-font, ui-monospace, monospace);
font-size: 12px;
line-height: 16px;
}
.r-combobox-select__spinner {
width: 0.875rem;
height: 0.875rem;
animation: r-combobox-select-spin 700ms linear infinite;
}
.r-combobox-select--sm.r-combobox-select__control {
min-height: 1.75rem;
font-size: 13px;
line-height: 18px;
}
.r-combobox-select--sm .r-combobox-select__chips {
min-height: 1.5rem;
padding: 1px 0;
}
.r-combobox-select--sm .r-combobox-select__chip {
min-height: 1.375rem;
}
.r-combobox-select--sm .r-combobox-select__action {
width: 1.5rem;
height: 1.5rem;
}
.r-combobox-select--lg.r-combobox-select__control {
min-height: 52px;
}
.r-combobox-select__control[data-status="error"] {
border-color: var(--danger-strong);
}
.r-combobox-select__control[data-invalid] {
border-color: var(--danger-strong);
}
.r-combobox-select__control[data-status="warning"] {
border-color: var(--warning-strong);
}
.r-combobox-select__control[data-disabled] {
border-color: var(--line-muted);
background: var(--fill-muted);
color: var(--foreground-disabled);
}
@keyframes r-combobox-select-spin {
to {
transform: rotate(360deg);
}
}
@media (prefers-reduced-motion: reduce) {
.r-combobox-select *,
.r-combobox-select__positioner {
transition-duration: 0.01ms ;
animation-duration: 0.01ms ;
}
}