Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/demos/attachments/custom-file-type.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,5 @@ const handleFileChange = (event: Event) => {
.demo-section h4 {
margin-top: 0;
margin-bottom: 16px;
color: #333;
}
</style>
93 changes: 58 additions & 35 deletions packages/components/src/attachments/components/FileCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,13 @@ const cardClasses = computed(() => {
border-radius: 8px;
margin-right: 8px;
margin-bottom: 8px;
transition: all 0.3s ease;
transition:
background-color 0.3s ease,
border-color 0.3s ease,
box-shadow 0.3s ease;
box-sizing: border-box;
background: rgb(255, 255, 255);
border: 1px solid rgb(240, 240, 240);
background: var(--tr-attachments-card-bg);
border: 1px solid var(--tr-attachments-card-border-color);
}

// 默认卡片样式
Expand All @@ -208,8 +211,9 @@ const cardClasses = computed(() => {
padding: 8px 12px 8px 8px;

&:hover {
background: rgb(255, 255, 255);
box-shadow: 0px 4px 16px 0px rgba(0, 0, 0, 0.08);
background: var(--tr-attachments-card-hover-bg);
border-color: var(--tr-attachments-card-hover-border-color);
box-shadow: var(--tr-attachments-card-hover-shadow);
}
}

Expand All @@ -223,7 +227,7 @@ const cardClasses = computed(() => {

&--uploading {
.tr-file-card__status {
color: #808080;
color: var(--tr-attachments-meta-color);
}
}

Expand All @@ -234,10 +238,21 @@ const cardClasses = computed(() => {
z-index: 20;
border: none;
background: transparent;
color: var(--tr-attachments-close-icon-color);
cursor: pointer;
border-radius: 50%;
transition: opacity 0.2s;
transition:
opacity 0.2s ease,
color 0.2s ease;
opacity: 0;
display: flex;
align-items: center;
justify-content: center;
padding: 0;

&:hover {
color: var(--tr-attachments-close-icon-hover-color);
}

// 悬浮时显示
.tr-file-card:hover &,
Expand Down Expand Up @@ -273,8 +288,8 @@ const cardClasses = computed(() => {
width: 100%;
height: 100%;
border-radius: inherit;
background-color: rgba(0, 0, 0, 0.4);
color: white;
background-color: var(--tr-attachments-status-overlay-bg);
color: var(--tr-attachments-picture-overlay-color);
display: flex;
align-items: center;
justify-content: center;
Expand Down Expand Up @@ -351,12 +366,12 @@ const cardClasses = computed(() => {

// 卡片模式
&--icon {
background-color: rgba(0, 0, 0, 0.4);
background-color: var(--tr-attachments-status-overlay-bg);
}

// 图片模式
&--picture {
background-color: rgba(0, 0, 0, 0.4);
background-color: var(--tr-attachments-status-overlay-bg);
z-index: 2;
}
}
Expand All @@ -375,12 +390,12 @@ const cardClasses = computed(() => {
height: 17px;
text-align: center;
font-size: 12px;
color: #fff;
color: var(--tr-attachments-loading-text-color);
}
}

&--error {
color: #ffffff;
color: #fff;
}
}

Expand All @@ -407,7 +422,7 @@ const cardClasses = computed(() => {
font-size: 12px;
font-weight: 400;
line-height: 18px;
color: rgb(25, 25, 25);
color: var(--tr-attachments-title-color);

white-space: nowrap;
text-overflow: ellipsis;
Expand All @@ -421,7 +436,7 @@ const cardClasses = computed(() => {
font-size: 12px;
font-weight: 400;
line-height: 18px;
color: rgb(128, 128, 128);
color: var(--tr-attachments-meta-color);

// 成功状态容器
&-success {
Expand Down Expand Up @@ -483,60 +498,68 @@ const cardClasses = computed(() => {
}

&__file-type {
color: rgb(128, 128, 128);
color: var(--tr-attachments-meta-color);
}

&__file-size {
color: rgb(128, 128, 128);
color: var(--tr-attachments-meta-color);
}

// 上传中文本
&__uploading-text {
color: rgb(128, 128, 128);
color: var(--tr-attachments-meta-color);
font-size: 12px;
}

// 错误文本
&__error-text {
color: #f23030;
color: var(--tr-attachments-error-color);
font-size: 12px;
}

// 重试按钮
&__retry-btn {
background: transparent;
border: none;
color: #1476ff;
color: var(--tr-attachments-retry-color);
cursor: pointer;
font-size: 12px;
padding: 2px 6px;
border-radius: 4px;
transition: all 0.2s ease;

&:hover {
background-color: rgba(20, 118, 255, 0.05);
background-color: var(--tr-attachments-retry-hover-bg);
}
}

&__action-btn {
height: 18px;
border: none;
background: transparent;
color: #616161;
cursor: pointer;
border-radius: 4px;
transition: all 0.2s ease;
white-space: nowrap;
font-size: 12px;
display: flex;
align-items: center;

&--preview,
&--download {
color: rgb(20, 118, 255);
> a,
> button {
height: 18px;
padding: 0;
border: none;
background: transparent;
color: var(--tr-attachments-action-color);
cursor: pointer;
border-radius: 4px;
transition:
color 0.2s ease,
background-color 0.2s ease;
white-space: nowrap;
font-size: 12px;
line-height: 18px;
text-decoration: none;
}

&--preview,
&--download {
&:hover {
color: #1476ff;
background-color: rgba(0, 0, 0, 0.04);
color: var(--tr-attachments-action-hover-color);
background-color: var(--tr-attachments-action-hover-bg);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/attachments/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ watch(
.tr-attachments {
position: relative;
border-radius: 8px;
color: rgb(25, 25, 25);
color: var(--tr-attachments-title-color);

// 文件列表容器
&__file-list {
Expand Down
40 changes: 40 additions & 0 deletions packages/components/src/styles/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,26 @@
--tr-container-bg-active: rgba(0, 0, 0, 0.15);
--tr-container-bg-disabled: rgba(0, 0, 0, 0.04);

/* ===== Attachments ===== */
--tr-attachments-card-bg: #ffffff;
--tr-attachments-card-border-color: #f0f0f0;
--tr-attachments-card-hover-bg: #ffffff;
--tr-attachments-card-hover-border-color: #f0f0f0;
--tr-attachments-card-hover-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
--tr-attachments-title-color: var(--tr-text-primary);
--tr-attachments-meta-color: var(--tr-text-tertiary);
--tr-attachments-action-color: var(--tr-color-primary);
--tr-attachments-action-hover-color: var(--tr-color-primary);
--tr-attachments-action-hover-bg: transparent;
--tr-attachments-retry-color: var(--tr-color-primary);
--tr-attachments-retry-hover-bg: rgba(20, 118, 255, 0.05);
--tr-attachments-close-icon-color: #c2c2c2;
--tr-attachments-close-icon-hover-color: var(--tr-text-primary);
--tr-attachments-status-overlay-bg: rgba(0, 0, 0, 0.4);
--tr-attachments-picture-overlay-color: #ffffff;
--tr-attachments-error-color: var(--tr-color-error);
--tr-attachments-loading-text-color: #ffffff;

/* ===== MCP Server Picker ===== */
--tr-mcp-server-picker-bg-default: #ffffff;
--tr-mcp-server-picker-bg-default-2: #ffffff;
Expand Down Expand Up @@ -234,6 +254,26 @@
--tr-container-bg-active: rgba(255, 255, 255, 0.15);
--tr-container-bg-disabled: rgba(255, 255, 255, 0.06);

/* ===== Attachments ===== */
--tr-attachments-card-bg: transparent;
--tr-attachments-card-border-color: rgba(255, 255, 255, 0.15);
--tr-attachments-card-hover-bg: rgba(255, 255, 255, 0.05);
--tr-attachments-card-hover-border-color: transparent;
--tr-attachments-card-hover-shadow: none;
--tr-attachments-title-color: var(--tr-text-primary);
--tr-attachments-meta-color: var(--tr-text-tertiary);
--tr-attachments-action-color: var(--tr-color-primary);
--tr-attachments-action-hover-color: var(--tr-color-primary);
--tr-attachments-action-hover-bg: transparent;
--tr-attachments-retry-color: var(--tr-color-primary);
--tr-attachments-retry-hover-bg: rgba(82, 145, 255, 0.12);
--tr-attachments-close-icon-color: #4d4d4d;
--tr-attachments-close-icon-hover-color: var(--tr-text-primary);
--tr-attachments-status-overlay-bg: rgba(0, 0, 0, 0.4);
--tr-attachments-picture-overlay-color: #ffffff;
--tr-attachments-error-color: var(--tr-color-error);
--tr-attachments-loading-text-color: #ffffff;

/* ===== 阴影系统 ===== */
--tr-shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.48);
--tr-shadow-md: 0 4px 12px 0 rgba(0, 0, 0, 0.02);
Expand Down
2 changes: 1 addition & 1 deletion packages/svgs/src/assets/file-remove.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading