From 95854ea21019914a28d453975bd2dfa38c2afebc Mon Sep 17 00:00:00 2001
From: ajaxzheng <894103554@qq.com>
Date: Wed, 16 Oct 2024 14:27:20 +0800
Subject: [PATCH] refactor(theme): [button-group] refactor button-group theme
vars (#2276)
---
examples/sites/demos/apis/button-group.js | 34 ---
.../pc/app/button-group/basic-usage.spec.ts | 3 +-
.../button-group-multiple.spec.ts | 2 +-
.../button-group/disabled-composition-api.vue | 3 -
.../pc/app/button-group/disabled.spec.ts | 31 +-
.../demos/pc/app/button-group/disabled.vue | 3 -
.../show-edit-composition-api.vue | 29 --
.../pc/app/button-group/show-edit.spec.ts | 32 --
.../demos/pc/app/button-group/show-edit.vue | 38 ---
.../app/button-group/size-composition-api.vue | 1 +
.../demos/pc/app/button-group/size.spec.ts | 10 +-
.../sites/demos/pc/app/button-group/size.vue | 1 +
.../pc/app/button-group/slot-default.spec.ts | 4 +-
.../pc/app/button-group/slot-empty.spec.ts | 2 +-
.../app/button-group/webdoc/button-group.js | 14 -
packages/theme/src/base/vars.less | 4 +-
packages/theme/src/button-group/index.less | 287 +++++-------------
packages/theme/src/button-group/vars.less | 141 +++------
packages/theme/src/carousel/vars.less | 2 +-
packages/vue/src/button-group/src/pc.vue | 2 +-
20 files changed, 144 insertions(+), 499 deletions(-)
delete mode 100644 examples/sites/demos/pc/app/button-group/show-edit-composition-api.vue
delete mode 100644 examples/sites/demos/pc/app/button-group/show-edit.spec.ts
delete mode 100644 examples/sites/demos/pc/app/button-group/show-edit.vue
diff --git a/examples/sites/demos/apis/button-group.js b/examples/sites/demos/apis/button-group.js
index ba5e629fbe..aaaafa4c6f 100644
--- a/examples/sites/demos/apis/button-group.js
+++ b/examples/sites/demos/apis/button-group.js
@@ -5,17 +5,6 @@ export default {
name: 'button-group',
type: 'component',
props: [
- {
- name: 'border',
- type: 'boolean',
- defaultValue: 'true',
- desc: {
- 'zh-CN': '是否显示边框线',
- 'en-US': 'Remove button border.'
- },
- mode: ['pc'],
- pcDemo: 'border'
- },
{
name: 'data',
typeAnchorName: 'IButtonGroupData',
@@ -64,18 +53,6 @@ export default {
pcDemo: 'plain',
mfDemo: ''
},
- {
- name: 'show-edit',
- type: 'boolean',
- defaultValue: 'false',
- desc: {
- 'zh-CN': '是否显示编辑按钮,只有在显示更多的情况下生效',
- 'en-US':
- 'Whether to display the edit button. This parameter takes effect only when more buttons are displayed'
- },
- mode: ['pc'],
- pcDemo: 'show-edit'
- },
{
name: 'show-more',
type: 'number',
@@ -146,17 +123,6 @@ export default {
},
mode: ['pc'],
pcDemo: 'change-event'
- },
- {
- name: 'edit',
- type: '() => void',
- defaultValue: '',
- desc: {
- 'zh-CN': '当编辑按钮被点击时触发',
- 'en-US': 'Set the callback function triggered when the edit button is clicked'
- },
- mode: ['pc'],
- pcDemo: 'show-edit'
}
],
methods: [],
diff --git a/examples/sites/demos/pc/app/button-group/basic-usage.spec.ts b/examples/sites/demos/pc/app/button-group/basic-usage.spec.ts
index f96f40e674..85bf58f821 100644
--- a/examples/sites/demos/pc/app/button-group/basic-usage.spec.ts
+++ b/examples/sites/demos/pc/app/button-group/basic-usage.spec.ts
@@ -12,8 +12,7 @@ test('按钮组基本示例', async ({ page }) => {
await button3.click()
await demo.getByRole('button', { name: 'Button2' }).hover()
await expect(buttonGroup.locator('li').nth(2)).toHaveClass('active')
- await expect(button3).toHaveCSS('background-color', 'rgb(94, 124, 224)')
- await expect(button3).toHaveCSS('border-bottom-color', 'rgb(94, 124, 224)')
+ await expect(button3).toHaveCSS('background-color', 'rgb(20, 118, 255)')
await expect(button3).toHaveCSS('color', 'rgb(255, 255, 255)')
await demo.getByRole('button', { name: 'Button2' }).click()
await expect(buttonGroup.locator('li').nth(1)).toHaveClass('active')
diff --git a/examples/sites/demos/pc/app/button-group/button-group-multiple.spec.ts b/examples/sites/demos/pc/app/button-group/button-group-multiple.spec.ts
index 55338066f3..3e5bd4328a 100644
--- a/examples/sites/demos/pc/app/button-group/button-group-multiple.spec.ts
+++ b/examples/sites/demos/pc/app/button-group/button-group-multiple.spec.ts
@@ -13,7 +13,7 @@ test('测试按钮是否换行', async ({ page }) => {
const demo = page.locator('#button-group-multiple')
const buttonGroup = demo.locator('.tiny-button-group')
const button = buttonGroup.locator('button').first()
- const bottomSpace = 4
+ const bottomSpace = 2
let groupBox = await buttonGroup.boundingBox()
let buttonBox = await button.boundingBox()
expect(groupBox?.height).toBe(((buttonBox?.height || 0) + bottomSpace) * 2)
diff --git a/examples/sites/demos/pc/app/button-group/disabled-composition-api.vue b/examples/sites/demos/pc/app/button-group/disabled-composition-api.vue
index 734c3193cc..1d857b5bb0 100644
--- a/examples/sites/demos/pc/app/button-group/disabled-composition-api.vue
+++ b/examples/sites/demos/pc/app/button-group/disabled-composition-api.vue
@@ -3,9 +3,6 @@
-
-
-
diff --git a/examples/sites/demos/pc/app/button-group/disabled.spec.ts b/examples/sites/demos/pc/app/button-group/disabled.spec.ts
index 4a2e360cdd..683782a450 100644
--- a/examples/sites/demos/pc/app/button-group/disabled.spec.ts
+++ b/examples/sites/demos/pc/app/button-group/disabled.spec.ts
@@ -6,38 +6,23 @@ test('测试按钮是否禁用', async ({ page }) => {
const demo = page.locator('#disabled')
const buttonGroup1 = demo.locator('.tiny-button-group').first()
- const buttonGroup2 = demo.locator('.tiny-button-group').nth(1)
- const buttonGroup3 = demo.locator('.tiny-button-group').nth(2)
+ const buttonGroup3 = demo.locator('.tiny-button-group').nth(1)
// 普通按钮组禁用
await expect(buttonGroup1.locator('button').first()).toHaveClass(/disabled/)
- await expect(buttonGroup1.locator('button').first()).toHaveCSS('background-color', 'rgb(223, 225, 230)')
- await expect(buttonGroup1.locator('button').first()).toHaveCSS('border-bottom-color', 'rgb(173, 176, 184)')
- await expect(buttonGroup1.locator('button').first()).toHaveCSS('color', 'rgb(173, 176, 184)')
+ await expect(buttonGroup1.locator('button').first()).toHaveCSS('background-color', 'rgb(219, 219, 219)')
+ await expect(buttonGroup1.locator('button').first()).toHaveCSS('color', 'rgb(194, 194, 194)')
await expect(buttonGroup1.locator('button').nth(1)).toHaveClass(/disabled/)
- await expect(buttonGroup1.locator('button').nth(1)).toHaveCSS('background-color', 'rgb(245, 245, 246)')
- await expect(buttonGroup1.locator('button').nth(1)).toHaveCSS('border-bottom-color', 'rgb(173, 176, 184)')
- await expect(buttonGroup1.locator('button').nth(1)).toHaveCSS('color', 'rgb(173, 176, 184)')
-
- // 无边框按钮组禁用
- await expect(buttonGroup2.locator('button').first()).toHaveClass(/disabled/)
- await expect(buttonGroup2.locator('button').first()).toHaveCSS('background-color', 'rgb(255, 255, 255)')
- await expect(buttonGroup2.locator('button').first()).toHaveCSS('border-bottom-color', 'rgba(0, 0, 0, 0)')
- await expect(buttonGroup2.locator('button').first()).toHaveCSS('color', 'rgb(173, 176, 184)')
- await expect(buttonGroup2.locator('button').nth(1)).toHaveClass(/disabled/)
- await expect(buttonGroup2.locator('button').nth(1)).toHaveCSS('background-color', 'rgb(255, 255, 255)')
- await expect(buttonGroup2.locator('button').nth(1)).toHaveCSS('border-bottom-color', 'rgba(0, 0, 0, 0)')
- await expect(buttonGroup2.locator('button').nth(1)).toHaveCSS('color', 'rgb(173, 176, 184)')
+ await expect(buttonGroup1.locator('button').nth(1)).toHaveCSS('background-color', 'rgb(240, 240, 240)')
+ await expect(buttonGroup1.locator('button').nth(1)).toHaveCSS('color', 'rgb(194, 194, 194)')
// 单个按钮禁用
await expect(buttonGroup3.locator('button').first()).not.toHaveClass(/disabled/)
- await expect(buttonGroup3.locator('button').first()).toHaveCSS('background-color', 'rgb(94, 124, 224)')
- await expect(buttonGroup3.locator('button').first()).toHaveCSS('border-bottom-color', 'rgb(94, 124, 224)')
+ await expect(buttonGroup3.locator('button').first()).toHaveCSS('background-color', 'rgb(20, 118, 255)')
await expect(buttonGroup3.locator('button').first()).toHaveCSS('color', 'rgb(255, 255, 255)')
await expect(buttonGroup3.locator('button').nth(1)).toHaveClass(/disabled/)
- await expect(buttonGroup3.locator('button').nth(1)).toHaveCSS('background-color', 'rgb(245, 245, 246)')
- await expect(buttonGroup3.locator('button').nth(1)).toHaveCSS('border-bottom-color', 'rgb(173, 176, 184)')
- await expect(buttonGroup3.locator('button').nth(1)).toHaveCSS('color', 'rgb(173, 176, 184)')
+ await expect(buttonGroup3.locator('button').nth(1)).toHaveCSS('background-color', 'rgb(240, 240, 240)')
+ await expect(buttonGroup3.locator('button').nth(1)).toHaveCSS('color', 'rgb(194, 194, 194)')
// 按钮悬浮提示
await buttonGroup3.locator('button').nth(1).hover()
diff --git a/examples/sites/demos/pc/app/button-group/disabled.vue b/examples/sites/demos/pc/app/button-group/disabled.vue
index 33c16a5f41..df07f5c9b4 100644
--- a/examples/sites/demos/pc/app/button-group/disabled.vue
+++ b/examples/sites/demos/pc/app/button-group/disabled.vue
@@ -3,9 +3,6 @@
-
-
-
diff --git a/examples/sites/demos/pc/app/button-group/show-edit-composition-api.vue b/examples/sites/demos/pc/app/button-group/show-edit-composition-api.vue
deleted file mode 100644
index db92f03079..0000000000
--- a/examples/sites/demos/pc/app/button-group/show-edit-composition-api.vue
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
diff --git a/examples/sites/demos/pc/app/button-group/show-edit.spec.ts b/examples/sites/demos/pc/app/button-group/show-edit.spec.ts
deleted file mode 100644
index 2eac4c6670..0000000000
--- a/examples/sites/demos/pc/app/button-group/show-edit.spec.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import { test, expect } from '@playwright/test'
-
-test('测试是否显示编辑按钮', async ({ page }) => {
- page.on('pageerror', (exception) => expect(exception).toBeNull())
- await page.goto('button-group#show-edit')
-
- const demo = page.locator('#show-edit')
- const buttonGroup = demo.locator('.tiny-button-group')
-
- // 判断点击事件是否正常
- await demo.getByRole('button', { name: 'Button3' }).click()
- await expect(buttonGroup.locator('li').nth(2)).toHaveClass('active')
- await demo.getByRole('button', { name: 'Button2' }).click()
- await expect(buttonGroup.locator('li').nth(1)).toHaveClass('active')
- await demo.getByRole('button', { name: 'Button1' }).click()
- await expect(buttonGroup.locator('li').nth(0)).toHaveClass('active')
- await expect(buttonGroup.locator('button').nth(2)).toHaveText('Button3')
- await demo.getByRole('button').nth(3).click()
- await page.locator('.tiny-popover').getByText('Button5').click()
- await expect(buttonGroup.locator('button').nth(2)).toHaveText('Button5')
-
- // 判断图标是否正确
- const moreButton = buttonGroup.getByRole('button').nth(3)
- const editButton = buttonGroup.getByRole('button').nth(4)
- const moreButtonSvg = moreButton.locator('svg path').first()
- const editButtonSvg = editButton.locator('svg path').first()
- const moreSvgPathReg = /^M292\.768 449\.694c2\.491\.515.+002-12.555-\.002z$/
- const editSvgPath =
- 'm14.6 6.6-7.5 7.6c-.3.3-.3.7 0 1 .1.1.4.2.5.2.1 0 .4-.1.5-.2l7.5-7.5c.3-.3.3-.7 0-1-.3-.3-.7-.3-1-.1z'
- await expect(moreButtonSvg).toHaveAttribute('d', moreSvgPathReg)
- await expect(editButtonSvg).toHaveAttribute('d', editSvgPath)
-})
diff --git a/examples/sites/demos/pc/app/button-group/show-edit.vue b/examples/sites/demos/pc/app/button-group/show-edit.vue
deleted file mode 100644
index bcf68cf97d..0000000000
--- a/examples/sites/demos/pc/app/button-group/show-edit.vue
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
-
diff --git a/examples/sites/demos/pc/app/button-group/size-composition-api.vue b/examples/sites/demos/pc/app/button-group/size-composition-api.vue
index 1db5eea169..74404e14dc 100644
--- a/examples/sites/demos/pc/app/button-group/size-composition-api.vue
+++ b/examples/sites/demos/pc/app/button-group/size-composition-api.vue
@@ -1,6 +1,7 @@
+
diff --git a/examples/sites/demos/pc/app/button-group/size.spec.ts b/examples/sites/demos/pc/app/button-group/size.spec.ts
index 8cefdc17ee..546b7d4f5a 100644
--- a/examples/sites/demos/pc/app/button-group/size.spec.ts
+++ b/examples/sites/demos/pc/app/button-group/size.spec.ts
@@ -4,8 +4,9 @@ test('测试按钮尺寸', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('button-group#size')
- const mediumHeight = '42px'
- const smallHeight = '32px'
+ const mediumHeight = '40px'
+ const defaultHeight = '32px'
+ const smallHeight = '28px'
const miniHeight = '24px'
const demo = page.locator('#size')
const buttonGroup = demo.locator('.tiny-button-group').first()
@@ -17,6 +18,7 @@ test('测试按钮尺寸', async ({ page }) => {
await expect(buttonGroup.locator('li').nth(0)).toHaveClass('active')
await expect(demo.getByRole('button', { name: 'Button1' }).first()).toHaveCSS('height', mediumHeight)
- await expect(demo.getByRole('button', { name: 'Button1' }).nth(1)).toHaveCSS('height', smallHeight)
- await expect(demo.getByRole('button', { name: 'Button1' }).nth(2)).toHaveCSS('height', miniHeight)
+ await expect(demo.getByRole('button', { name: 'Button1' }).nth(1)).toHaveCSS('height', defaultHeight)
+ await expect(demo.getByRole('button', { name: 'Button1' }).nth(2)).toHaveCSS('height', smallHeight)
+ await expect(demo.getByRole('button', { name: 'Button1' }).nth(3)).toHaveCSS('height', miniHeight)
})
diff --git a/examples/sites/demos/pc/app/button-group/size.vue b/examples/sites/demos/pc/app/button-group/size.vue
index e016860bf6..88b91c4be8 100644
--- a/examples/sites/demos/pc/app/button-group/size.vue
+++ b/examples/sites/demos/pc/app/button-group/size.vue
@@ -1,6 +1,7 @@
+
diff --git a/examples/sites/demos/pc/app/button-group/slot-default.spec.ts b/examples/sites/demos/pc/app/button-group/slot-default.spec.ts
index b7d59140e7..9f1b04bb4b 100644
--- a/examples/sites/demos/pc/app/button-group/slot-default.spec.ts
+++ b/examples/sites/demos/pc/app/button-group/slot-default.spec.ts
@@ -5,7 +5,7 @@ test('测试按钮默认插槽', async ({ page }) => {
await page.goto('button-group#slot-default')
const demo = page.locator('#slot-default')
const buttonGroup = demo.locator('.tiny-button-group').first()
- await expect(buttonGroup.getByRole('button', { name: 'Button1' })).toHaveCSS('background-color', 'rgb(94, 124, 224)')
- await expect(buttonGroup.getByRole('button', { name: 'Button2' })).toHaveCSS('background-color', 'rgb(80, 212, 171)')
+ await expect(buttonGroup.getByRole('button', { name: 'Button1' })).toHaveCSS('background-color', 'rgb(25, 25, 25)')
+ await expect(buttonGroup.getByRole('button', { name: 'Button2' })).toHaveCSS('background-color', 'rgb(92, 179, 0)')
await expect(buttonGroup.getByRole('button', { name: 'Button3' })).toHaveClass(/is-disabled/)
})
diff --git a/examples/sites/demos/pc/app/button-group/slot-empty.spec.ts b/examples/sites/demos/pc/app/button-group/slot-empty.spec.ts
index 40203af6af..fff4ff1687 100644
--- a/examples/sites/demos/pc/app/button-group/slot-empty.spec.ts
+++ b/examples/sites/demos/pc/app/button-group/slot-empty.spec.ts
@@ -6,6 +6,6 @@ test('空数据插槽', async ({ page }) => {
const demo = page.locator('#slot-empty')
const emptySlot = demo.locator('.tiny-button-group .tiny-button-group--empty')
- await expect(emptySlot.first()).toHaveCSS('color', 'rgb(173, 176, 184)')
+ await expect(emptySlot.first()).toHaveCSS('color', 'rgb(128, 128, 128)')
await expect(demo.locator('.tiny-button-group .custom-empty')).toHaveCSS('color', 'rgb(250, 194, 10)')
})
diff --git a/examples/sites/demos/pc/app/button-group/webdoc/button-group.js b/examples/sites/demos/pc/app/button-group/webdoc/button-group.js
index 1a657cc6fe..859ff4d7bf 100644
--- a/examples/sites/demos/pc/app/button-group/webdoc/button-group.js
+++ b/examples/sites/demos/pc/app/button-group/webdoc/button-group.js
@@ -82,20 +82,6 @@ export default {
},
codeFiles: ['show-more.vue']
},
- {
- demoId: 'show-edit',
- name: {
- 'zh-CN': '编辑按钮',
- 'en-US': 'Display Edit Button'
- },
- desc: {
- 'zh-CN':
- '设置了显示更多按钮后,可以通过 show-edit
设置是否显示编辑按钮。点击编辑按钮后触发 edit
事件。
',
- 'en-US':
- 'After setting up to display more buttons, You can set whether to display the edit button through show edit
. After clicking the edit button, the edit
event is triggered.
'
- },
- codeFiles: ['show-edit.vue']
- },
{
demoId: 'slot-default',
name: {
diff --git a/packages/theme/src/base/vars.less b/packages/theme/src/base/vars.less
index 1030983bef..f6f177b715 100644
--- a/packages/theme/src/base/vars.less
+++ b/packages/theme/src/base/vars.less
@@ -324,8 +324,8 @@
--tv-color-bg-hover-primary: var(--tv-base-color-common-9); // #595959 一级tab页签背景-悬浮色 /分页hover背景颜色 /灰色悬浮背景色:表格悬浮、下拉悬浮、左侧导航悬浮
--tv-color-bg-hover-secondary: var(--tv-base-color-common-1); // #fff 次要背景色悬浮色 / 穿梭框头部/折叠面板背景色
--tv-color-bg-hover-1: var(--tv-base-color-brand-2); // #deecff 浅蓝色场景:悬浮背景色-日期悬浮 /选块悬浮态背景色
- --tv-color-bg-hover-3: var(--tv-base-color-common-5); // #e6e6e6 轮播箭头背景悬浮色
- --tv-color-bg-hover-4: var(--tv-base-color-brand-1); // #f0f7ff 悬浮背景色
+ --tv-color-bg-hover-2: var(--tv-base-color-common-5); // #e6e6e6 轮播箭头背景悬浮色
+ --tv-color-bg-hover-3: var(--tv-base-color-brand-1); // #f0f7ff 悬浮背景色
/* 2.6.4 active/选中 */
--tv-color-bg-active: var(--tv-base-color-common-3); // #f5f5f5 分页选中背景色/左侧导航选中背景色
diff --git a/packages/theme/src/button-group/index.less b/packages/theme/src/button-group/index.less
index 500245a4a9..9e6a121c14 100644
--- a/packages/theme/src/button-group/index.less
+++ b/packages/theme/src/button-group/index.less
@@ -17,325 +17,186 @@
@button-group-prefix-cls: ~'@{css-prefix}button-group';
@group-item-prefix-cls: ~'@{css-prefix}group-item';
-@button-prefix-cls: ~'@{css-prefix}button';
-@dropdown-prefix-cls: ~'@{css-prefix}dropdown';
+@button-group-popover-prefix-cls: ~'@{css-prefix}group-item__more-popover';
.@{button-group-prefix-cls} {
- .component-css-vars-button-group();
+ .inject-ButtonGroup-vars();
display: inline-block;
vertical-align: middle;
- margin-top: var(--ti-button-group-margin-top);
.clearfix();
&--empty {
- color: var(--ti-common-color-placeholder);
+ color: var(--tv-ButtonGroup-empty-text-color);
}
.@{group-item-prefix-cls} {
display: inline-block;
vertical-align: middle;
- & li.active {
- button.disabled,
- &[disabled] {
- color: var(--ti-button-group-item-active-disabled-text-color);
- }
- }
-
& li {
- line-height: 28px;
+ line-height: var(--tv-ButtonGroup-line-height-number);
float: left;
position: relative;
- margin-top: var(--ti-button-group-item-margin-top);
button {
- border: var(--ti-button-group-border-weight) solid var(--ti-button-group-border-color);
+ border: none;
display: block;
text-align: center;
- color: var(--ti-button-group-item-btn-text-color);
- background: var(--ti-button-group-item-bg-color);
- min-width: var(--ti-button-group-item-btn-width);
- height: var(--ti-button-group-item-btn-height);
- padding: 0 var(--ti-button-group-btn-padding-horizontal);
+ color: var(--tv-ButtonGroup-item-btn-text-color);
+ background: var(--tv-ButtonGroup-item-bg-color);
+ min-width: auto;
+ height: var(--tv-ButtonGroup-item-btn-height);
+ padding: 0 var(--tv-ButtonGroup-btn-padding-x);
text-decoration: none;
- font-size: var(--ti-button-group-item-btn-font-size);
+ font-size: var(--tv-ButtonGroup-item-btn-font-size);
cursor: pointer;
transition:
background ease-in 0.3s,
border ease-in 0.3s;
- border-radius: var(--ti-button-group-middle-border-radius);
+ border-radius: var(--tv-ButtonGroup-border-radius);
&:focus-visible {
- outline: 2px solid var(--ti-button-group-item-active-bg-color);
+ outline: 2px solid var(--tv-ButtonGroup-item-active-bg-color);
}
&.disabled,
&[disabled] {
- background: var(--ti-button-group-item-btn-disabled-bg-color);
- border-color: var(--ti-button-group-item-btn-disabled-border-color);
+ background: var(--tv-ButtonGroup-item-btn-disabled-bg-color);
+ border-color: var(--tv-ButtonGroup-item-btn-disabled-border-color);
+ color: var(--tv-ButtonGroup-item-disabled-text-color);
cursor: not-allowed;
- color: var(--ti-button-group-item-disabled-text-color);
outline: none;
}
- &.plain,
- &[plain] {
- background: none;
+ &.plain {
+ border: 1px solid var(--tv-ButtonGroup-plain-border-color);
}
}
&:hover {
- z-index: 1;
-
button:not(.disabled) {
- background: var(--ti-button-group-item-btn-hover-bg-color);
- color: var(--ti-button-group-item-btn-hover-text-color);
- border-color: var(--ti-button-group-item-btn-hover-border-color);
+ background: var(--tv-ButtonGroup-item-btn-hover-bg-color);
+ color: var(--tv-ButtonGroup-item-btn-hover-text-color);
- &.plain,
- &[plain] {
- color: var(--ti-button-group-item-btn-plain-text-color);
- background-color: var(--ti-button-group-item-btn-plain-bg-color);
- border-color: var(--ti-button-group-item-btn-plain-border-color);
+ &.plain {
+ color: var(--tv-ButtonGroup-item-btn-plain-text-color);
+ background-color: var(--tv-ButtonGroup-item-btn-plain-bg-color);
+ border-color: var(--tv-ButtonGroup-item-btn-plain-border-color);
}
}
}
&.active {
- z-index: 1;
-
&:hover {
button:not(.disabled) {
- background: var(--ti-button-group-item-btn-active-hover-bg-color);
- border-color: var(--ti-button-group-active-hover-border-color);
-
- &.plain,
- &[plain] {
- background-color: var(--ti-button-group-item-btn-plain-bg-color);
+ &.plain {
+ color: var(--tv-ButtonGroup-item-btn-plain-text-color);
+ background-color: var(--tv-ButtonGroup-item-btn-plain-bg-color);
+ border-color: var(--tv-ButtonGroup-item-btn-plain-border-color);
}
}
}
button {
&.disabled {
- background: var(--ti-button-group-item-active-disabled-bg-color);
+ background: var(--tv-ButtonGroup-item-active-disabled-bg-color);
}
+
&:not(.disabled) {
- background: var(--ti-button-group-item-active-bg-color);
- color: var(--ti-button-group-item-active-text-color);
- border-color: var(--ti-button-group-item-active-border-color);
+ background: var(--tv-ButtonGroup-item-active-bg-color);
+ color: var(--tv-ButtonGroup-item-active-text-color);
- &.plain,
- &[plain] {
- color: var(--ti-button-group-plain-active-text-color);
- background: none;
+ &.plain {
+ color: var(--tv-ButtonGroup-item-btn-plain-text-color);
+ background-color: var(--tv-ButtonGroup-item-btn-plain-bg-color);
+ border-color: var(--tv-ButtonGroup-item-btn-plain-border-color);
}
}
}
}
- &:first-child {
- button {
- border-radius: var(--ti-button-group-border-radius) var(--ti-button-group-right-border-radius)
- var(--ti-button-group-right-border-radius) var(--ti-button-group-border-radius);
- }
- }
-
- &:last-child {
- button {
- border-radius: var(--ti-button-group-left-border-radius) var(--ti-button-group-border-radius)
- var(--ti-button-group-border-radius) var(--ti-button-group-left-border-radius);
- }
- }
-
&:not(:last-child) {
- margin-right: var(--ti-button-group-item-li-margin-right);
- margin-bottom: var(--ti-button-group-item-li-margin-bottom);
+ margin-right: 2px;
+ margin-bottom: 2px;
}
}
+ // 角标相关样式
&__sup {
position: absolute;
- min-width: var(--ti-button-group-item-sup-height);
- height: var(--ti-button-group-item-sup-height);
- top: var(--ti-button-group-item-sup-position-top);
- color: var(--ti-button-group-item-sup-font-color);
+ min-width: var(--tv-ButtonGroup-item-sup-height);
+ height: var(--tv-ButtonGroup-item-sup-height);
+ top: 0;
+ color: var(--tv-ButtonGroup-item-sup-font-color);
right: 0;
- font-size: var(--ti-button-group-item-btn-font-size);
- line-height: var(--ti-button-group-item-sup-height);
+ font-size: var(--tv-ButtonGroup-item-btn-font-size);
+ line-height: var(--tv-ButtonGroup-item-sup-height);
text-align: center;
background-color: #fa9841;
+
.tiny-svg {
vertical-align: unset;
}
}
+
&__sup-icon {
background-color: #fa9841;
border-radius: 2px;
fill: #fff;
- line-height: var(--ti-button-group-sup-icon-line-height);
}
+
&__sup-text {
background-color: #fa9841;
padding: 0 4px;
border-top-left-radius: 4px;
border-bottom-right-radius: 4px;
-
}
+
.sup-tag {
background-color: unset;
}
}
- & > .@{button-prefix-cls} {
- float: left;
- position: relative;
-
- & + .@{button-prefix-cls} {
- margin-left: 0;
- }
-
- &:first-child {
- border-top-right-radius: 0;
- border-bottom-right-radius: 0;
- border-right-color: var(--ti-button-group-info-border-color);
-
- &.@{button-prefix-cls}--default {
- border-right-color: var(--ti-button-group-border-color);
-
- &:hover,
- &:active,
- &:focus {
- border-right-color: var(--ti-button-group-hover-border-color);
- z-index: 1;
- }
- }
- }
-
- &:last-child {
- border-top-left-radius: 0;
- border-bottom-left-radius: 0;
- border-left-color: var(--ti-button-group-info-border-color);
-
- &.@{button-prefix-cls}--default {
- border-left-color: var(--ti-button-group-border-color);
-
- &:hover,
- &:active,
- &:focus {
- border-left-color: var(--ti-button-group-hover-border-color);
- z-index: 1;
- }
- }
- }
-
- &:first-child:last-child {
- border-radius: var(--ti-button-group-border-radius);
-
- &.is-round {
- border-radius: calc(var(--ti-button-size-normal-height, 30px) / 2);
- }
-
- &.is-circle {
- border-radius: 50%;
- }
- }
-
- &:not(:first-child):not(:last-child) {
- border-radius: 0;
- border-left-color: var(--ti-button-group-info-border-color);
- border-right-color: var(--ti-button-group-info-border-color);
-
- &.@{button-prefix-cls}--default {
- border-left-color: var(--ti-button-group-border-color);
- border-right-color: var(--ti-button-group-border-color);
-
- &:hover,
- &:active,
- &:focus {
- border-left-color: var(--ti-button-group-hover-border-color);
- border-right-color: var(--ti-button-group-hover-border-color);
- z-index: 1;
- }
- }
- }
-
- &:not(:last-child) {
- margin-right: -1px;
+ // 大中小尺寸
+ &&--medium {
+ ul li button {
+ height: var(--tv-ButtonGroup-medium-size);
}
+ }
- & > .@{dropdown-prefix-cls} > .@{button-prefix-cls} {
- border-top-left-radius: 0;
- border-bottom-left-radius: 0;
- border-left-color: var(--ti-button-group-info-border-color);
+ &&--small {
+ ul li button {
+ height: var(--tv-ButtonGroup-small-size);
}
}
&&--mini {
- & li:first-child {
- button {
- border-radius: var(--ti-button-group-mini-side-border-radius) var(--ti-button-group-mini-right-border-radius)
- var(--ti-button-group-mini-right-border-radius) var(--ti-button-group-mini-side-border-radius);
- }
- }
-
- & li:last-child {
- button {
- border-radius: var(--ti-button-group-mini-left-border-radius) var(--ti-button-group-mini-side-border-radius)
- var(--ti-button-group-mini-side-border-radius) var(--ti-button-group-mini-left-border-radius);
- }
- }
-
- & li:not(:last-child) {
- margin-right: var(--ti-button-group-mini-margin-right);
- }
-
& li button {
- font-size: var(--ti-button-group-mini-font-size);
- padding: 0 var(--ti-button-group-mini-padding-horizontal);
- border-radius: var(--ti-button-group-mini-border-radius);
+ font-size: var(--tv-ButtonGroup-mini-font-size);
+ padding: 0 var(--tv-ButtonGroup-mini-padding-x);
+ height: var(--tv-ButtonGroup-mini-size);
+ border-radius: var(--tv-ButtonGroup-mini-border-radius);
}
}
+}
- &&--borderless {
- .@{group-item-prefix-cls} li button {
- border: 1px solid transparent;
- background: transparent;
- }
-
- .@{group-item-prefix-cls} li:hover button:not(.disabled) {
- background-color: var(--ti-button-group-no-border-hover-bg-color);
- border-color: var(--ti-button-group-no-border-hover-border-color);
- }
-
- .@{group-item-prefix-cls} li.active:hover button:not(.disabled) {
- background-color: var(--ti-button-group-no-border-active-hover-bg-color);
- border-color: var(--ti-button-group-no-border-border-color);
- }
+.@{button-group-popover-prefix-cls} {
+ .inject-ButtonGroup-vars();
- .@{group-item-prefix-cls} li button.disabled {
- background-color: var(--ti-button-group-no-border-disabled-bg-color);
- }
+ &.tiny-popper {
+ padding: 6px 0;
}
- &&--medium {
- ul li button {
- height: var(--ti-button-group-medium-size);
- line-height: var(--ti-button-group-medium-line-height);
- }
- }
- &&--small {
- ul li button {
- height: var(--ti-button-group-small-size);
- line-height: var(--ti-button-group-small-line-height);
- }
- }
- &&--mini {
- ul li button {
- height: var(--ti-button-group-mini-size);
- line-height: var(--ti-button-group-mini-line-height);
+ .more-list {
+ .more-item {
+ padding: 6px 16px;
+ cursor: pointer;
+
+ &:hover {
+ background: var(--tv-ButtonGroup-more-item-bg-color-hover);
+ }
}
}
}
diff --git a/packages/theme/src/button-group/vars.less b/packages/theme/src/button-group/vars.less
index 7c070fa8c1..d6cc1246d5 100644
--- a/packages/theme/src/button-group/vars.less
+++ b/packages/theme/src/button-group/vars.less
@@ -10,118 +10,67 @@
*
*/
-.component-css-vars-button-group() {
- // 按钮组边框色
- --ti-button-group-border-color: var(--ti-common-color-line-normal, #c2c2c2);
- // 按钮组边框厚度
- --ti-button-group-border-weight: var(--ti-common-size-0, 0px);
+.inject-ButtonGroup-vars() {
// 按钮组圆角
- --ti-button-group-border-radius: var(--ti-common-border-radius-normal, 6px);
- // 小尺寸按钮组左右端侧圆角
- --ti-button-group-mini-side-border-radius: var(--ti-button-group-mini-border-radius);
- // 按钮组第一个按钮右侧圆角
- --ti-button-group-right-border-radius: var(--ti-common-border-radius-normal, 6px);
- // 小尺寸按钮组第一个按钮右侧圆角
- --ti-button-group-mini-right-border-radius: var(--ti-button-group-mini-border-radius, 0px);
- // 按钮组中间按钮圆角
- --ti-button-group-middle-border-radius: var(--ti-common-border-radius-normal, 6px);
- // 按钮组最后一个按钮左侧圆角
- --ti-button-group-left-border-radius: var(--ti-common-border-radius-normal, 6px);
- // 小尺寸按钮组最后一个按钮左侧圆角
- --ti-button-group-mini-left-border-radius: var(--ti-button-group-mini-border-radius, 0px);
- // 默认插槽尾部按钮的左边框色
- --ti-button-group-hover-border-color: var(--ti-common-color-line-active, #191919);
- // 默认插槽按钮间分割线颜色
- --ti-button-group-info-border-color: var(--ti-common-color-light, #ffffff);
- // 禁用色(没有使用)
- --ti-button-group-disabled-text-color: var(--ti-common-color-text-disabled, #c2c2c2);
+ --tv-ButtonGroup-border-radius: var(--tv-border-radius-md);
+ // 按钮组字体行高
+ --tv-ButtonGroup-line-height-number: var(--tv-line-height-number);
// 默认按钮未选中项背景色
- --ti-button-group-item-bg-color: var(--ti-common-color-bg-normal, #f5f5f5);
+ --tv-ButtonGroup-item-bg-color: var(--tv-color-bg);
// 按钮非选中项文本色
- --ti-button-group-item-btn-text-color: var(--ti-common-color-text-secondary, #595959);
- // 按钮项宽度
- --ti-button-group-item-btn-width: var(--ti-common-size-auto, auto);
+ --tv-ButtonGroup-item-btn-text-color: var(--tv-color-text-secondary);
+ // 空数据文本色
+ --tv-ButtonGroup-empty-text-color: var(--tv-color-text-weaken);
// 未指定尺寸的按钮项高度
- --ti-button-group-item-btn-height: var(--ti-common-size-height-normal, 32px);
+ --tv-ButtonGroup-item-btn-height: var(--tv-size-height-md);
// 按钮组默认字号
- --ti-button-group-item-btn-font-size: var(--ti-common-font-size-base, 14px);
+ --tv-ButtonGroup-item-btn-font-size: var(--tv-font-size-md);
// 按钮项禁用背景色
- --ti-button-group-item-btn-disabled-bg-color: #F0F0F0;
- // 按钮项禁用边框色
- --ti-button-group-item-btn-disabled-border-color: var(--ti-common-color-border, #999999);
+ --tv-ButtonGroup-item-btn-disabled-bg-color: var(--tv-color-bg-disabled);
// 按钮项禁用文本色
- --ti-button-group-item-disabled-text-color: var(--ti-common-color-text-disabled, #c2c2c2);
- // 按钮选中项禁用文本色(new)
- --ti-button-group-item-active-disabled-text-color: var(--ti-common-color-text-weaken, #808080);
+ --tv-ButtonGroup-item-disabled-text-color: var(--tv-color-text-disabled);
// 默认按钮项悬浮背景色
- --ti-button-group-item-btn-hover-bg-color: #DEECFF;
- // 按钮项悬浮边框色
- --ti-button-group-item-btn-hover-border-color: var(--ti-common-color-primary-hover, #595959);
+ --tv-ButtonGroup-item-btn-hover-bg-color: var(--tv-color-bg-hover-1);
// 默认按钮非选中项悬浮文本色
- --ti-button-group-item-btn-hover-text-color: var(--ti-common-color-text-primary, #191919);
- // 朴素按钮非选中项悬浮文本色
- --ti-button-group-item-btn-plain-text-color: var(--ti-common-color-text-link-hover, #1476ff);
+ --tv-ButtonGroup-item-btn-hover-text-color: var(--tv-color-text);
+
+ // 朴素按钮非选中项悬浮/选中文本色
+ --tv-ButtonGroup-item-btn-plain-text-color: var(--tv-color-text-active);
+ // 按钮组圆角
+ --tv-ButtonGroup-plain-border-color: var(--tv-color-border);
// 朴素按钮项悬浮背景色
- --ti-button-group-item-btn-plain-bg-color: var(--ti-common-color-prompt-bg, #deecff);
+ --tv-ButtonGroup-item-btn-plain-bg-color: var(--tv-color-bg-hover-1);
// 朴素按钮非选中项悬浮边框色
- --ti-button-group-item-btn-plain-border-color: var(--ti-common-color-bg-emphasize, #191919);
+ --tv-ButtonGroup-item-btn-plain-border-color: var(--tv-color-border-active-control);
+
// 默认按钮选中项背景色
- --ti-button-group-item-active-bg-color: var(--ti-common-color-prompt, #1476ff);
- // 默认按钮选中项悬浮背景色
- --ti-button-group-item-btn-active-hover-bg-color: var(--ti-common-color-prompt, #1476ff);
- // 朴素按钮选中项文本颜色
- --ti-button-group-plain-active-text-color: var(--ti-common-color-bg-emphasize, #191919);
+ --tv-ButtonGroup-item-active-bg-color: var(--tv-color-bg-active-control);
// 默认按钮选中项禁用时背景色
- --ti-button-group-item-active-disabled-bg-color: var(--ti-common-color-bg-dark-disabled, #dbdbdb);
+ --tv-ButtonGroup-item-active-disabled-bg-color: var(--tv-color-bg-disabled-control-checked);
// 默认按钮选中项文本色
- --ti-button-group-item-active-text-color: var(--ti-common-color-light, #ffffff);
- // 默认按钮右侧外边距
- --ti-button-group-item-li-margin-right: calc(var(--ti-common-space-base, 4px) / 2);
- // 默认按钮下侧外边距
- --ti-button-group-item-li-margin-bottom: var(--ti-common-space-2, 2px);
- // 默认按钮选中边框色
- --ti-button-group-item-active-border-color: var(--ti-common-color-bg-emphasize, #191919);
- // 默认按钮选中边框色
- --ti-button-group-active-hover-border-color: var(--ti-common-color-primary-hover, #595959);
+ --tv-ButtonGroup-item-active-text-color: var(--tv-color-text-white);
// 默认按钮内间距
- --ti-button-group-btn-padding-horizontal: var(--ti-common-space-6x, 24px);
- // 按钮组按钮上间距
- --ti-button-group-margin-top: var(--ti-common-space-0, 0px);
- // 按钮组各个按钮的上间距
- --ti-button-group-item-margin-top: var(--ti-common-space-0, 0px);
- // 小尺寸按钮组按钮右间距
- --ti-button-group-mini-margin-right: calc(var(--ti-common-space-base, 4px) / 2);
- // 小尺寸按钮组按钮字号
- --ti-button-group-mini-font-size: calc(var(--ti-common-font-size-1, 14px) - 2px);
- // 无边框按钮悬浮按钮组背景色
- --ti-button-group-no-border-hover-bg-color: var(--ti-common-color-bg-light-emphasize, #b3d6ff);
- // 无边框按钮组按钮选中态悬浮背景色
- --ti-button-group-no-border-active-hover-bg-color: var(--ti-common-color-primary-hover, #595959);
- // 无边框按钮组按钮禁用状态下背景色
- --ti-button-group-no-border-disabled-bg-color: var(--ti-common-color-light, #ffffff);
- // 小尺寸按钮内间距
- --ti-button-group-mini-padding-horizontal: var(--ti-common-space-4x, 16px);
- // 小尺寸按钮圆角
- --ti-button-group-mini-border-radius: calc(var(--ti-common-border-radius-normal, 6px) - 2px);
- // 无边框按钮悬浮边框色
- --ti-button-group-no-border-hover-border-color: var(--ti-common-color-transparent, transparent);
- // 选中按钮组按钮悬浮边框色
- --ti-button-group-no-border-border-color: var(--ti-common-color-transparent, transparent);
+ --tv-ButtonGroup-btn-padding-x: 24px;
// 按钮角标高度
- --ti-button-group-item-sup-height: var(--ti-common-line-height-base, 18px);
- // 按钮角标上边距(hide)
- --ti-button-group-item-sup-position-top: var(--ti-common-space-0, 0px);
+ --tv-ButtonGroup-item-sup-height: 18px;
+ // 小尺寸按钮圆角
+ --tv-ButtonGroup-mini-border-radius: var(--tv-border-radius-sm);
// 按钮角标字体颜色
- --ti-button-group-item-sup-font-color: var(--ti-common-color-text-white, #fff);
+ --tv-ButtonGroup-item-sup-font-color: var(--tv-color-text-white);
// 按钮角标字体大小
- --ti-button-group-item-sup-font-size: var(--ti-common-font-size-base, 14px);
- // icon角标
- --ti-button-group-sup-icon-line-height: 22px;
- // 尺寸大小
- --ti-button-group-medium-size: 32px;
- --ti-button-group-medium-line-height: 30px;
- --ti-button-group-small-size: 28px;
- --ti-button-group-small-line-height: 26px;
- --ti-button-group-mini-size: 24px;
- --ti-button-group-mini-line-height: 22px;
+ --tv-ButtonGroup-item-sup-font-size: var(--tv-font-size-md);
+
+ // medium尺寸
+ --tv-ButtonGroup-medium-size: var(--tv-size-height-lg);
+ // small尺寸
+ --tv-ButtonGroup-small-size: var(--tv-size-height-sm);
+ // mini 尺寸
+ --tv-ButtonGroup-mini-size: var(--tv-size-height-xs);
+ // mini 尺寸按钮组按钮字号
+ --tv-ButtonGroup-mini-font-size: var(--tv-font-size-sm);
+ // mini 尺寸按钮内间距
+ --tv-ButtonGroup-mini-padding-x: 16px;
+
+ // 更多下拉框选项悬浮背景色
+ --tv-ButtonGroup-more-item-bg-color-hover: var(--tv-color-bg-hover);
}
diff --git a/packages/theme/src/carousel/vars.less b/packages/theme/src/carousel/vars.less
index 3563c5fbbe..0eeea109b1 100644
--- a/packages/theme/src/carousel/vars.less
+++ b/packages/theme/src/carousel/vars.less
@@ -18,7 +18,7 @@
// 左右箭头的字号
--tv-Carousel-arrow-font-size: var(--tv-font-size-lg);
// 左右箭头按钮悬浮背景色
- --tv-Carousel-arrow-hover-bg-color: var(--tv-color-bg-hover-3);
+ --tv-Carousel-arrow-hover-bg-color: var(--tv-color-bg-hover-2);
// 左右箭头按钮背景色
--tv-Carousel-arrow-bg-color: var(--tv-color-bg-header);
// 箭头正常颜色
diff --git a/packages/vue/src/button-group/src/pc.vue b/packages/vue/src/button-group/src/pc.vue
index f93a137b6a..dd2fd1860a 100644
--- a/packages/vue/src/button-group/src/pc.vue
+++ b/packages/vue/src/button-group/src/pc.vue
@@ -76,7 +76,7 @@
-
+