Raiju/css/rj-select.css
2026-10-25 06:05:42 +03:00

240 lines
7.3 KiB
CSS

/**
* rj-select — token-styled replacement for native <select> dropdowns.
* Loaded in the admin dashboard and in the visual editor (admin only).
* The base button rule uses :where() so mirrored select classes
* (e.g. .topbar-select) keep full control over sizing and shape.
*/
.rj-select {
position: relative;
display: inline-block;
max-width: 100%;
vertical-align: middle;
}
.form-group .rj-select,
.form-group .rj-select__button {
display: block;
width: 100%;
}
.rj-select .rj-select__native {
position: absolute !important;
width: 1px !important;
height: 1px !important;
margin: 0 !important;
padding: 0 !important;
border: 0 !important;
opacity: 0 !important;
pointer-events: none !important;
}
/* One uniform input-field look for every enhanced select, regardless of the
classes mirrored from the original element (overrides e.g. the
.topbar-select pill shape by specificity). */
.rj-select .rj-select__button {
display: inline-flex !important;
align-items: center;
justify-content: space-between;
gap: 8px;
width: 100%;
/* Same height and type as the text inputs beside it (admin/style.css
reads the same tokens); the literals only serve the inline editor */
height: var(--rj-control-h, 40px);
min-height: var(--rj-control-h, 40px);
padding: 0 var(--rj-space-3, 12px) 0 var(--rj-space-3-5, 14px);
border: 1px solid var(--rj-border, #d4d4d4);
border-radius: var(--rj-radius-md, 8px);
background: var(--rj-bg-elevated, #fff) !important;
color: var(--rj-text, inherit);
font-family: inherit;
font-size: var(--rj-text-md, 0.9375rem);
line-height: 1.3;
cursor: pointer;
text-align: left;
}
/* Modal control rows (.modal-input): selects, text inputs, and inline
buttons share one 36px height so mixed rows align exactly
(icon manager toolbar, iconify import, user form, ...). */
.rj-select--modal-input .rj-select__button {
height: 36px;
min-height: 36px;
padding: 0 var(--rj-select-caret-inset, 14px) 0 12px;
font-size: 0.875rem;
}
input.modal-input {
height: 36px;
min-height: 36px;
}
.iconify-import-controls .btn {
height: 36px;
min-height: 36px;
}
/* Media library toolbar selects: match the 32px Library/Trash toggle. */
.rj-select--rj-imgmgr-folder-filter .rj-select__button,
.rj-select--rj-imgmgr-move-select .rj-select__button {
height: var(--rj-control-h-sm, 32px);
min-height: var(--rj-control-h-sm, 32px);
padding: 0 var(--rj-select-caret-inset, 14px) 0 10px;
font-size: 0.8125rem;
}
/* The upload-type select in the dropzone is as tall as the Upload button beside it */
.rj-select--rj-imgmgr-upload-type .rj-select__button {
height: var(--rj-control-h, 36px);
min-height: var(--rj-control-h, 36px);
padding: 0 var(--rj-select-caret-inset, 14px) 0 12px;
font-size: var(--rj-text-md, 0.875rem);
}
/* Compact variant for the content editor topbar (language/page pickers):
matches the small buttons (.btn-sm, 30px) they sit next to. Scoped to the
topbar container so selects elsewhere keep the regular 40px height. */
.topbar-selectors .rj-select .rj-select__button,
.page-list-header .rj-select .rj-select__button {
height: var(--rj-control-h-sm, 30px);
min-height: var(--rj-control-h-sm, 30px);
padding: 0 var(--rj-select-caret-inset, 14px) 0 12px;
font-size: var(--rj-text-sm, 0.8125rem);
width: auto;
}
.topbar-selectors .rj-select .rj-select__button .rj-select__caret svg {
width: 12px;
height: 12px;
}
/* Same focus/active treatment as regular form inputs (.form-group input). */
.rj-select .rj-select__button:focus,
.rj-select .rj-select__button[aria-expanded="true"] {
outline: none;
border-color: var(--rj-primary, #2e95d2);
box-shadow: 0 0 0 3px var(--rj-primary-muted, rgba(46, 149, 210, 0.25));
}
/* Comboboxes (e.g. #aiChatModel) share the unified 40px control height. */
.rj-combobox input {
height: var(--rj-control-h, 40px);
}
.rj-select__button:disabled {
opacity: 0.55;
cursor: not-allowed;
}
.rj-select__value {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
min-width: 0;
flex: 1 1 auto;
}
.rj-select__caret {
display: inline-flex;
flex: 0 0 auto;
color: var(--rj-text-muted, #888);
}
.rj-select__caret svg {
width: 13px;
height: 13px;
}
.rj-select__list {
position: fixed;
z-index: calc(var(--rj-z-modal, 20000) + 100);
min-width: 140px;
max-width: min(420px, calc(100vw - 24px));
overflow-y: auto;
background: var(--rj-bg-elevated, #fff);
border: 1px solid var(--rj-border, #e5e5e5);
border-radius: var(--rj-radius-md, 10px);
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
padding: 4px;
display: flex;
flex-direction: column;
gap: 1px;
}
.rj-select__list[hidden] {
display: none;
}
/* The list is a flex column with a maximum height: rows must never shrink to fit it
(they would be squeezed and clip their text); the list scrolls instead. */
.rj-select__option,
.rj-select__group {
flex: 0 0 auto;
}
.rj-select__option {
padding: 7px 10px;
border-radius: var(--rj-radius-sm, 6px);
font-size: 0.875rem;
color: var(--rj-text, inherit);
cursor: pointer;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.rj-select__option:hover,
.rj-select__option.is-active {
background: var(--rj-bg-hover, rgba(127, 127, 127, 0.12));
}
.rj-select__option.is-selected {
font-weight: 600;
}
.rj-select__option[aria-disabled="true"] {
opacity: 0.5;
cursor: default;
}
.rj-select__group {
padding: 8px 10px 2px;
font-size: 0.7rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--rj-text-muted, #888);
}
/* Mirrored field classes must not impose a minimum width on the hidden native control. */
.rj-select .rj-select__native { min-width: 0 !important; max-width: 1px !important; }
/* Shared caret spacing for enhanced controls and intentional native selects.
data-native-select opts out of the custom listbox, not the field styling.
Keep the browser's keyboard/touch picker; draw only its closed-state caret. */
.rj-select .rj-select__button {
padding-inline-end: var(--rj-select-caret-inset, 14px);
gap: 10px;
}
select[data-native-select]:not([multiple]):not([size]) {
-webkit-appearance: none !important;
appearance: none !important;
padding-inline-end: calc(var(--rj-select-caret-inset, 14px) + 26px) !important;
background-image: var(--rj-select-caret-image, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2378889c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")) !important;
background-repeat: no-repeat !important;
background-position: right var(--rj-select-caret-inset, 14px) center !important;
background-size: 14px 14px !important;
}
select[data-native-select]:not([multiple]):not([size]):dir(rtl) {
background-position: left var(--rj-select-caret-inset, 14px) center !important;
}
@media (forced-colors: active) {
select[data-native-select]:not([multiple]):not([size]) {
-webkit-appearance: auto !important;
appearance: auto !important;
background-image: none !important;
padding-inline-end: var(--rj-select-caret-inset, 14px) !important;
}
}