Files
michaelschiemer/resources/css/components/admin/admin-asset-picker.css
2025-11-24 21:28:25 +01:00

504 lines
13 KiB
CSS

/**
* Admin Asset Picker Component
*
* Modern modal design with backdrop, improved search with filter sidebar,
* grid/list view options, and drag & drop support.
* Uses BEM naming convention and design system tokens.
*/
.livecomponent-admin-asset-picker {
position: relative;
}
/* Picker Button */
.livecomponent-admin-asset-picker__button {
padding: var(--space-sm, 0.75rem) var(--space-md, 1rem);
border: 1px solid var(--border-light, oklch(75% 0.02 280));
border-radius: 6px;
background: var(--bg-secondary, oklch(95% 0.01 280));
color: var(--text, oklch(20% 0.02 280));
cursor: pointer;
font-size: 0.875rem;
font-weight: 500;
transition: all 0.2s ease;
display: inline-flex;
align-items: center;
gap: var(--space-xs, 0.5rem);
}
.livecomponent-admin-asset-picker__button:hover {
background: var(--bg-tertiary, oklch(92% 0.01 280));
border-color: var(--accent-primary, oklch(60% 0.2 280));
transform: translateY(-1px);
box-shadow: 0 2px 4px oklch(0% 0 0 / 0.1);
}
/* Modal Backdrop */
.livecomponent-admin-asset-picker__backdrop {
position: fixed;
inset: 0;
background: oklch(0% 0 0 / 0.5);
backdrop-filter: blur(4px);
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
padding: var(--space-lg, 1.5rem);
opacity: 0;
pointer-events: none;
transition: opacity 0.3s ease;
}
.livecomponent-admin-asset-picker__backdrop--visible {
opacity: 1;
pointer-events: auto;
}
/* Modal Content */
.livecomponent-admin-asset-picker__modal {
background: var(--bg, oklch(100% 0 0));
border-radius: 12px;
padding: var(--space-xl, 2rem);
max-width: 90vw;
max-height: 90vh;
overflow: hidden;
display: flex;
flex-direction: column;
box-shadow: 0 8px 32px oklch(0% 0 0 / 0.3);
transform: scale(0.95);
transition: transform 0.3s ease;
width: 100%;
max-width: 1200px;
}
.livecomponent-admin-asset-picker__backdrop--visible .livecomponent-admin-asset-picker__modal {
transform: scale(1);
}
/* Modal Header */
.livecomponent-admin-asset-picker__header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: var(--space-lg, 1.5rem);
padding-bottom: var(--space-md, 1rem);
border-bottom: 2px solid var(--border-light, oklch(75% 0.02 280));
}
.livecomponent-admin-asset-picker__title {
font-size: 1.5rem;
font-weight: 700;
color: var(--text, oklch(20% 0.02 280));
margin: 0;
}
.livecomponent-admin-asset-picker__close {
padding: var(--space-xs, 0.5rem);
border: none;
background: transparent;
color: var(--muted, oklch(50% 0.01 280));
cursor: pointer;
border-radius: 4px;
transition: all 0.2s ease;
display: flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
}
.livecomponent-admin-asset-picker__close:hover {
background: var(--bg-secondary, oklch(95% 0.01 280));
color: var(--text, oklch(20% 0.02 280));
}
/* Search and Filters */
.livecomponent-admin-asset-picker__search-container {
display: flex;
gap: var(--space-md, 1rem);
margin-bottom: var(--space-lg, 1.5rem);
}
.livecomponent-admin-asset-picker__search {
flex: 1;
position: relative;
}
.livecomponent-admin-asset-picker__search-input {
width: 100%;
padding: var(--space-sm, 0.75rem) var(--space-md, 1rem);
padding-left: 2.5rem;
border: 1px solid var(--border-light, oklch(75% 0.02 280));
border-radius: 6px;
background: var(--bg, oklch(100% 0 0));
color: var(--text, oklch(20% 0.02 280));
font-size: 0.875rem;
transition: all 0.2s ease;
}
.livecomponent-admin-asset-picker__search-input:focus {
outline: none;
border-color: var(--accent-primary, oklch(60% 0.2 280));
box-shadow: 0 0 0 3px oklch(60% 0.2 280 / 0.1);
}
.livecomponent-admin-asset-picker__search-icon {
position: absolute;
left: var(--space-sm, 0.75rem);
top: 50%;
transform: translateY(-50%);
color: var(--muted, oklch(50% 0.01 280));
width: 16px;
height: 16px;
}
/* View Toggle */
.livecomponent-admin-asset-picker__view-toggle {
display: flex;
gap: var(--space-xs, 0.5rem);
background: var(--bg-secondary, oklch(95% 0.01 280));
border: 1px solid var(--border-light, oklch(75% 0.02 280));
border-radius: 6px;
padding: 2px;
}
.livecomponent-admin-asset-picker__view-toggle-button {
padding: var(--space-xs, 0.5rem) var(--space-sm, 0.75rem);
border: none;
background: transparent;
color: var(--muted, oklch(50% 0.01 280));
cursor: pointer;
border-radius: 4px;
transition: all 0.2s ease;
font-size: 0.875rem;
}
.livecomponent-admin-asset-picker__view-toggle-button:hover {
background: var(--bg, oklch(100% 0 0));
color: var(--text, oklch(20% 0.02 280));
}
.livecomponent-admin-asset-picker__view-toggle-button--active {
background: var(--accent-primary, oklch(60% 0.2 280));
color: var(--bg, oklch(100% 0 0));
}
/* Main Content Area */
.livecomponent-admin-asset-picker__content {
display: flex;
gap: var(--space-lg, 1.5rem);
flex: 1;
overflow: hidden;
}
/* Filters Sidebar */
.livecomponent-admin-asset-picker__filters {
min-width: 250px;
background: var(--bg-secondary, oklch(95% 0.01 280));
border: 1px solid var(--border-light, oklch(75% 0.02 280));
border-radius: 8px;
padding: var(--space-md, 1rem);
overflow-y: auto;
max-height: calc(90vh - 200px);
}
.livecomponent-admin-asset-picker__filters-title {
font-size: 1rem;
font-weight: 600;
color: var(--text, oklch(20% 0.02 280));
margin: 0 0 var(--space-md, 1rem) 0;
padding-bottom: var(--space-sm, 0.75rem);
border-bottom: 1px solid var(--border-light, oklch(75% 0.02 280));
}
.livecomponent-admin-asset-picker__filter-group {
margin-bottom: var(--space-md, 1rem);
}
.livecomponent-admin-asset-picker__filter-label {
display: block;
font-size: 0.875rem;
font-weight: 500;
color: var(--text, oklch(20% 0.02 280));
margin-bottom: var(--space-xs, 0.5rem);
}
.livecomponent-admin-asset-picker__filter-select,
.livecomponent-admin-asset-picker__filter-input {
width: 100%;
padding: var(--space-xs, 0.5rem) var(--space-sm, 0.75rem);
border: 1px solid var(--border-light, oklch(75% 0.02 280));
border-radius: 4px;
background: var(--bg, oklch(100% 0 0));
color: var(--text, oklch(20% 0.02 280));
font-size: 0.875rem;
}
/* Assets Grid */
.livecomponent-admin-asset-picker__assets {
flex: 1;
overflow-y: auto;
max-height: calc(90vh - 200px);
padding-right: var(--space-xs, 0.5rem);
}
.livecomponent-admin-asset-picker__grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
gap: var(--space-md, 1rem);
}
.livecomponent-admin-asset-picker__list {
display: flex;
flex-direction: column;
gap: var(--space-sm, 0.75rem);
}
/* Asset Item */
.livecomponent-admin-asset-picker__item {
border: 2px solid var(--border-light, oklch(75% 0.02 280));
border-radius: 8px;
padding: var(--space-sm, 0.75rem);
cursor: pointer;
transition: all 0.2s ease;
background: var(--bg, oklch(100% 0 0));
position: relative;
overflow: hidden;
}
.livecomponent-admin-asset-picker__item:hover {
border-color: var(--accent-primary, oklch(60% 0.2 280));
transform: translateY(-2px);
box-shadow: 0 4px 8px oklch(0% 0 0 / 0.1);
}
.livecomponent-admin-asset-picker__item--selected {
border-color: var(--accent-primary, oklch(60% 0.2 280));
border-width: 3px;
box-shadow: 0 0 0 3px oklch(60% 0.2 280 / 0.1);
}
.livecomponent-admin-asset-picker__item--dragging {
opacity: 0.5;
transform: scale(0.95);
}
/* Asset Preview */
.livecomponent-admin-asset-picker__preview {
position: relative;
width: 100%;
height: 120px;
border-radius: 4px;
overflow: hidden;
background: var(--bg-secondary, oklch(95% 0.01 280));
margin-bottom: var(--space-xs, 0.5rem);
}
.livecomponent-admin-asset-picker__preview-image {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.3s ease;
}
.livecomponent-admin-asset-picker__item:hover .livecomponent-admin-asset-picker__preview-image {
transform: scale(1.05);
}
.livecomponent-admin-asset-picker__preview-icon {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
background: var(--bg-secondary, oklch(95% 0.01 280));
color: var(--muted, oklch(50% 0.01 280));
font-size: 0.75rem;
text-align: center;
padding: var(--space-xs, 0.5rem);
}
/* Asset Info */
.livecomponent-admin-asset-picker__info {
font-size: 0.75rem;
color: var(--muted, oklch(50% 0.01 280));
word-break: break-all;
line-height: 1.4;
}
.livecomponent-admin-asset-picker__info-id {
font-family: monospace;
font-size: 0.7rem;
}
/* List View */
.livecomponent-admin-asset-picker__list {
display: none;
}
.livecomponent-admin-asset-picker__list[data-view="list"] {
display: flex;
}
/* List View Item */
.livecomponent-admin-asset-picker__list-item {
display: flex;
align-items: center;
gap: var(--space-md, 1rem);
padding: var(--space-sm, 0.75rem);
border: 1px solid var(--border-light, oklch(75% 0.02 280));
border-radius: 6px;
background: var(--bg, oklch(100% 0 0));
cursor: pointer;
transition: all 0.2s ease;
}
.livecomponent-admin-asset-picker__list-item:hover {
background: var(--bg-secondary, oklch(95% 0.01 280));
border-color: var(--accent-primary, oklch(60% 0.2 280));
}
.livecomponent-admin-asset-picker__list-item--selected {
background: oklch(60% 0.2 280 / 0.1);
border-color: var(--accent-primary, oklch(60% 0.2 280));
}
.livecomponent-admin-asset-picker__list-preview {
width: 60px;
height: 60px;
border-radius: 4px;
object-fit: cover;
flex-shrink: 0;
}
.livecomponent-admin-asset-picker__list-info {
flex: 1;
min-width: 0;
}
.livecomponent-admin-asset-picker__list-id {
font-family: monospace;
font-size: 0.75rem;
color: var(--text, oklch(20% 0.02 280));
word-break: break-all;
}
.livecomponent-admin-asset-picker__list-mime {
font-size: 0.7rem;
color: var(--muted, oklch(50% 0.01 280));
margin-top: var(--space-xs, 0.5rem);
}
/* Empty State */
.livecomponent-admin-asset-picker__empty {
text-align: center;
padding: var(--space-xl, 3rem);
color: var(--muted, oklch(50% 0.01 280));
}
.livecomponent-admin-asset-picker__empty-text {
font-size: 1rem;
margin-bottom: var(--space-md, 1rem);
}
/* Selected Asset Display */
.livecomponent-admin-asset-picker__selected {
margin-top: var(--space-md, 1rem);
padding: var(--space-md, 1rem);
background: var(--bg-secondary, oklch(95% 0.01 280));
border-radius: 8px;
border: 1px solid var(--border-light, oklch(75% 0.02 280));
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--space-md, 1rem);
}
.livecomponent-admin-asset-picker__selected-label {
font-weight: 600;
color: var(--text, oklch(20% 0.02 280));
font-size: 0.875rem;
}
.livecomponent-admin-asset-picker__selected-value {
font-family: monospace;
font-size: 0.875rem;
color: var(--muted, oklch(50% 0.01 280));
word-break: break-all;
flex: 1;
text-align: right;
}
.livecomponent-admin-asset-picker__clear {
padding: var(--space-xs, 0.5rem) var(--space-sm, 0.75rem);
border: 1px solid var(--border-light, oklch(75% 0.02 280));
border-radius: 4px;
background: var(--bg, oklch(100% 0 0));
color: var(--text, oklch(20% 0.02 280));
cursor: pointer;
font-size: 0.875rem;
transition: all 0.2s ease;
flex-shrink: 0;
}
.livecomponent-admin-asset-picker__clear:hover {
background: var(--bg-tertiary, oklch(92% 0.01 280));
border-color: var(--accent-error, oklch(60% 0.25 25));
color: var(--accent-error, oklch(60% 0.25 25));
}
/* Responsive Design */
@media (max-width: 1024px) {
.livecomponent-admin-asset-picker__content {
flex-direction: column;
}
.livecomponent-admin-asset-picker__filters {
min-width: 100%;
max-height: 200px;
}
}
@media (max-width: 768px) {
.livecomponent-admin-asset-picker__modal {
padding: var(--space-md, 1rem);
max-width: 100vw;
max-height: 100vh;
border-radius: 0;
}
.livecomponent-admin-asset-picker__grid {
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
gap: var(--space-sm, 0.75rem);
}
.livecomponent-admin-asset-picker__search-container {
flex-direction: column;
}
}
/* Loading State */
.livecomponent-admin-asset-picker__loading {
display: flex;
align-items: center;
justify-content: center;
padding: var(--space-xl, 3rem);
color: var(--muted, oklch(50% 0.01 280));
}
.livecomponent-admin-asset-picker__loading-spinner {
width: 40px;
height: 40px;
border: 3px solid var(--border-light, oklch(75% 0.02 280));
border-top-color: var(--accent-primary, oklch(60% 0.2 280));
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}