290 lines
6.3 KiB
TypeScript
290 lines
6.3 KiB
TypeScript
import { css, cssManager } from '@design.estate/dees-element';
|
|
import { DeesInputBase } from '../dees-input-base/dees-input-base.js';
|
|
import { themeDefaultStyles } from '../../00theme.js';
|
|
|
|
export const fileuploadStyles = [
|
|
themeDefaultStyles,
|
|
...DeesInputBase.baseStyles,
|
|
cssManager.defaultStyles,
|
|
css`
|
|
:host {
|
|
position: relative;
|
|
display: block;
|
|
}
|
|
|
|
.input-wrapper {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 12px;
|
|
}
|
|
|
|
/* ── Tile integration ── */
|
|
dees-tile {
|
|
cursor: default;
|
|
}
|
|
|
|
dees-tile:hover::part(outer) {
|
|
border-color: var(--dees-color-border-strong);
|
|
}
|
|
|
|
dees-tile.dragover::part(outer) {
|
|
border-color: var(--dees-color-accent-primary);
|
|
box-shadow: 0 0 0 2px ${cssManager.bdTheme('hsl(217 91% 60% / 0.15)', 'hsl(213 93% 68% / 0.15)')};
|
|
}
|
|
|
|
:host([disabled]) dees-tile {
|
|
opacity: 0.6;
|
|
cursor: not-allowed;
|
|
pointer-events: none;
|
|
}
|
|
|
|
/* ── Header slot: sleek toolbar ── */
|
|
.dropzone-header {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
height: 32px;
|
|
padding: 0 12px;
|
|
}
|
|
|
|
.dropzone-header dees-icon {
|
|
width: 14px;
|
|
height: 14px;
|
|
color: var(--dees-color-text-muted);
|
|
}
|
|
|
|
.dropzone-loader {
|
|
width: 14px;
|
|
height: 14px;
|
|
border-radius: var(--dees-radius-full);
|
|
border: 2px solid ${cssManager.bdTheme('rgba(15, 23, 42, 0.15)', 'rgba(255, 255, 255, 0.15)')};
|
|
border-top-color: var(--dees-color-accent-primary);
|
|
animation: loader-spin 0.6s linear infinite;
|
|
}
|
|
|
|
.dropzone-title {
|
|
font-size: 13px;
|
|
color: var(--dees-color-text-muted);
|
|
}
|
|
|
|
.dropzone-browse {
|
|
appearance: none;
|
|
border: none;
|
|
background: none;
|
|
padding: 0;
|
|
font-size: 13px;
|
|
font-family: inherit;
|
|
font-weight: 600;
|
|
color: var(--dees-color-accent-primary);
|
|
cursor: pointer;
|
|
}
|
|
|
|
.dropzone-browse:hover {
|
|
text-decoration: underline;
|
|
}
|
|
|
|
.dropzone-browse:disabled {
|
|
cursor: not-allowed;
|
|
opacity: 0.5;
|
|
}
|
|
|
|
/* ── Content slot: file list in rounded inset ── */
|
|
.file-list-empty {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 8px;
|
|
padding: 24px 16px;
|
|
color: var(--dees-color-text-muted);
|
|
font-size: 13px;
|
|
}
|
|
|
|
.file-list-empty dees-icon {
|
|
font-size: 24px;
|
|
opacity: 0.4;
|
|
}
|
|
|
|
.file-list {
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.file-list-header {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 8px 12px;
|
|
font-size: 12px;
|
|
font-weight: 500;
|
|
color: var(--dees-color-text-muted);
|
|
}
|
|
|
|
.file-list-clear {
|
|
appearance: none;
|
|
border: none;
|
|
background: none;
|
|
color: var(--dees-color-accent-primary);
|
|
cursor: pointer;
|
|
font-weight: 500;
|
|
font-size: 12px;
|
|
padding: 0;
|
|
font-family: inherit;
|
|
}
|
|
|
|
.file-list-clear:hover {
|
|
text-decoration: underline;
|
|
}
|
|
|
|
.file-row {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 12px;
|
|
padding: 6px 12px;
|
|
transition: background var(--dees-transition-fast) ease;
|
|
}
|
|
|
|
.file-row:hover {
|
|
background: var(--dees-color-row-hover);
|
|
}
|
|
|
|
.file-thumb {
|
|
width: 32px;
|
|
height: 32px;
|
|
border-radius: var(--dees-radius-sm);
|
|
background: var(--dees-color-bg-tertiary);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
overflow: hidden;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.file-thumb dees-icon {
|
|
font-size: 16px;
|
|
color: var(--dees-color-text-muted);
|
|
display: block;
|
|
width: 16px;
|
|
height: 16px;
|
|
line-height: 1;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.thumb-image {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
}
|
|
|
|
.file-meta {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 2px;
|
|
min-width: 0;
|
|
}
|
|
|
|
.file-name {
|
|
font-weight: 500;
|
|
font-size: 13px;
|
|
color: var(--dees-color-text-primary);
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
.file-details {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
flex-wrap: wrap;
|
|
font-size: 11px;
|
|
color: var(--dees-color-text-muted);
|
|
}
|
|
|
|
.file-size {
|
|
font-variant-numeric: tabular-nums;
|
|
}
|
|
|
|
.file-type {
|
|
padding: 1px 6px;
|
|
border-radius: var(--dees-radius-full);
|
|
border: 1px solid var(--dees-color-border-default);
|
|
color: var(--dees-color-text-muted);
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.08em;
|
|
line-height: 1;
|
|
font-size: 10px;
|
|
}
|
|
|
|
.file-actions {
|
|
display: flex;
|
|
align-items: center;
|
|
margin-left: auto;
|
|
}
|
|
|
|
.remove-button {
|
|
width: 24px;
|
|
height: 24px;
|
|
border-radius: var(--dees-radius-xs);
|
|
background: transparent;
|
|
border: none;
|
|
cursor: pointer;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
transition: background var(--dees-transition-fast) ease,
|
|
color var(--dees-transition-fast) ease;
|
|
color: var(--dees-color-text-muted);
|
|
}
|
|
|
|
.remove-button:hover {
|
|
background: ${cssManager.bdTheme('hsl(0 72% 50% / 0.08)', 'hsl(0 62% 32% / 0.15)')};
|
|
color: var(--dees-color-accent-error);
|
|
}
|
|
|
|
.remove-button:active {
|
|
transform: scale(0.96);
|
|
}
|
|
|
|
.remove-button dees-icon {
|
|
display: block;
|
|
width: 14px;
|
|
height: 14px;
|
|
font-size: 14px;
|
|
line-height: 1;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
/* ── Footer slot: meta chips ── */
|
|
.dropzone-footer {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 6px;
|
|
padding: 6px 12px;
|
|
align-items: center;
|
|
}
|
|
|
|
.meta-chip {
|
|
font-size: 11px;
|
|
padding: 2px 8px;
|
|
border-radius: var(--dees-radius-full);
|
|
color: var(--dees-color-text-muted);
|
|
background: var(--dees-color-bg-tertiary);
|
|
border: 1px solid var(--dees-color-border-subtle);
|
|
}
|
|
|
|
/* ── Validation ── */
|
|
.validation-message {
|
|
font-size: 13px;
|
|
color: var(--dees-color-accent-error);
|
|
line-height: 1.5;
|
|
}
|
|
|
|
@keyframes loader-spin {
|
|
to {
|
|
transform: rotate(360deg);
|
|
}
|
|
}
|
|
`,
|
|
];
|