@apexhub/apex-ui-react-source 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -4
- package/bin/apex-ui-react-source.mjs +208 -24
- package/dist/files/AGENTS.md +2 -2
- package/dist/files/_assets/table-empty.url.ts +1 -1
- package/dist/files/alert/Alert.tsx +2 -2
- package/dist/files/alert/alert.css +1 -0
- package/dist/files/alert/llm.txt +3 -3
- package/dist/files/alert/tokens.txt +1 -1
- package/dist/files/apex-provider/llm.txt +3 -2
- package/dist/files/auto-complete/llm.txt +1 -1
- package/dist/files/auto-complete/tokens.txt +1 -1
- package/dist/files/avatar/Avatar.tsx +1 -1
- package/dist/files/avatar/avatar.css +12 -1
- package/dist/files/avatar/llm.txt +1 -1
- package/dist/files/avatar/tokens.txt +1 -1
- package/dist/files/breadcrumb/Breadcrumb.tsx +17 -10
- package/dist/files/breadcrumb/breadcrumb.css +20 -10
- package/dist/files/breadcrumb/interface.ts +4 -4
- package/dist/files/breadcrumb/llm.txt +8 -8
- package/dist/files/breadcrumb/tokens.txt +46 -96
- package/dist/files/breadcrumb/variants.ts +6 -0
- package/dist/files/button/Button.tsx +25 -8
- package/dist/files/button/button.css +20 -2
- package/dist/files/button/interface.ts +7 -4
- package/dist/files/button/llm.txt +16 -8
- package/dist/files/button/tokens.txt +1 -1
- package/dist/files/button/variants.ts +8 -0
- package/dist/files/card/Card.tsx +8 -1
- package/dist/files/card/card-states.stories.css +42 -0
- package/dist/files/card/card.css +6 -1
- package/dist/files/card/interface.ts +3 -0
- package/dist/files/card/llm.txt +24 -1
- package/dist/files/card/tokens.txt +3 -1
- package/dist/files/cascader/cascader-data.ts +29 -8
- package/dist/files/cascader/cascader.css +45 -11
- package/dist/files/cascader/llm.txt +25 -6
- package/dist/files/cascader/tokens.txt +15 -7
- package/dist/files/cascader/variants.ts +1 -1
- package/dist/files/checkbox/Checkbox.tsx +26 -10
- package/dist/files/checkbox/checkbox.css +64 -22
- package/dist/files/checkbox/llm.txt +24 -13
- package/dist/files/checkbox/tokens.txt +10 -2
- package/dist/files/clear/clear.css +5 -2
- package/dist/files/collapse/llm.txt +1 -1
- package/dist/files/collapse/tokens.txt +1 -1
- package/dist/files/date-picker/RangePicker.tsx +5 -5
- package/dist/files/date-picker/Trigger.tsx +5 -5
- package/dist/files/date-picker/date-picker.css +53 -23
- package/dist/files/date-picker/llm.txt +7 -3
- package/dist/files/date-picker/tokens.txt +10 -10
- package/dist/files/divider/llm.txt +1 -1
- package/dist/files/divider/tokens.txt +1 -1
- package/dist/files/drawer/drawer.css +1 -0
- package/dist/files/drawer/llm.txt +2 -2
- package/dist/files/drawer/tokens.txt +2 -2
- package/dist/files/dropdown/llm.txt +1 -1
- package/dist/files/dropdown/tokens.txt +1 -1
- package/dist/files/form/form.css +10 -0
- package/dist/files/form/llm.txt +1 -1
- package/dist/files/form/tokens.txt +3 -1
- package/dist/files/grid/llm.txt +9 -9
- package/dist/files/image/ImagePreview.tsx +7 -6
- package/dist/files/image/image.css +0 -10
- package/dist/files/image/llm.txt +2 -2
- package/dist/files/image/tokens.txt +1 -1
- package/dist/files/input/input.css +14 -14
- package/dist/files/input/llm.txt +4 -2
- package/dist/files/input/tokens.txt +4 -4
- package/dist/files/input-number/InputNumber.tsx +2 -0
- package/dist/files/input-number/input-number.css +13 -1
- package/dist/files/input-number/llm.txt +8 -3
- package/dist/files/input-number/tokens.txt +4 -4
- package/dist/files/layout/llm.txt +1 -1
- package/dist/files/layout/tokens.txt +1 -1
- package/dist/files/llms.txt +18 -11
- package/dist/files/menu/Menu.tsx +5 -1
- package/dist/files/menu/llm.txt +19 -12
- package/dist/files/menu/menu.css +41 -15
- package/dist/files/menu/menu.figma.stories.css +39 -0
- package/dist/files/menu/tokens.txt +21 -8
- package/dist/files/message/llm.txt +1 -1
- package/dist/files/message/tokens.txt +1 -1
- package/dist/files/modal/Modal.tsx +1 -2
- package/dist/files/modal/interface.ts +1 -1
- package/dist/files/modal/llm.txt +9 -9
- package/dist/files/modal/tokens.txt +1 -1
- package/dist/files/notification/llm.txt +1 -1
- package/dist/files/notification/tokens.txt +1 -1
- package/dist/files/pagination/PageButton.tsx +2 -0
- package/dist/files/pagination/Pagination.tsx +149 -170
- package/dist/files/pagination/interface.ts +2 -2
- package/dist/files/pagination/llm.txt +18 -9
- package/dist/files/pagination/pagination.css +56 -17
- package/dist/files/pagination/tokens.txt +6 -4
- package/dist/files/popover/Popover.tsx +11 -3
- package/dist/files/popover/llm.txt +3 -3
- package/dist/files/popover/popover.css +30 -18
- package/dist/files/popover/popover.stories.css +6 -0
- package/dist/files/popover/tokens.txt +4 -14
- package/dist/files/progress/llm.txt +4 -4
- package/dist/files/progress/tokens.txt +1 -1
- package/dist/files/radio/llm.txt +38 -1
- package/dist/files/radio/radio.css +51 -14
- package/dist/files/radio/tokens.txt +11 -6
- package/dist/files/rate/llm.txt +1 -1
- package/dist/files/rate/tokens.txt +1 -1
- package/dist/files/select/llm.txt +8 -7
- package/dist/files/select/select.css +30 -16
- package/dist/files/select/tokens.txt +4 -4
- package/dist/files/skeleton/llm.txt +1 -1
- package/dist/files/skeleton/tokens.txt +1 -1
- package/dist/files/spin/llm.txt +1 -1
- package/dist/files/spin/tokens.txt +1 -1
- package/dist/files/steps/llm.txt +1 -1
- package/dist/files/steps/tokens.txt +1 -1
- package/dist/files/switch/llm.txt +1 -1
- package/dist/files/switch/tokens.txt +1 -1
- package/dist/files/table/constants.ts +2 -2
- package/dist/files/table/hooks/useRowSelection.tsx +3 -3
- package/dist/files/table/interface.ts +7 -7
- package/dist/files/table/llm.txt +16 -13
- package/dist/files/table/parts/TablePagination.tsx +8 -0
- package/dist/files/table/table.css +27 -10
- package/dist/files/table/tokenScopes.ts +2 -2
- package/dist/files/table/tokens.txt +2 -2
- package/dist/files/tabs/Tabs.tsx +1 -2
- package/dist/files/tabs/llm.txt +1 -1
- package/dist/files/tabs/tabs.css +3 -3
- package/dist/files/tabs/tokens.txt +1 -1
- package/dist/files/tag/interface.ts +2 -2
- package/dist/files/tag/llm.txt +7 -8
- package/dist/files/tag/tag.css +1 -1
- package/dist/files/tag/tokens.txt +1 -2
- package/dist/files/tag/variants.ts +12 -2
- package/dist/files/theme/aliases.css +1 -1
- package/dist/files/theme/component-tokens.css +7 -7
- package/dist/files/theme/primitives.css +1 -1
- package/dist/files/tooltip/Tooltip.tsx +2 -2
- package/dist/files/tooltip/llm.txt +1 -1
- package/dist/files/tooltip/tokens.txt +1 -1
- package/dist/files/tooltip/tooltip.css +2 -3
- package/dist/files/tree/Tree.tsx +8 -38
- package/dist/files/tree/llm.txt +11 -15
- package/dist/files/tree/tokens.txt +1 -3
- package/dist/files/tree/tree-data.ts +30 -2
- package/dist/files/tree/tree.css +17 -3
- package/dist/files/tree/variants.ts +4 -2
- package/dist/files/tree-select/llm.txt +32 -22
- package/dist/files/tree-select/tokens.txt +7 -6
- package/dist/files/tree-select/tree-select-data.ts +2 -1
- package/dist/files/tree-select/tree-select.css +61 -8
- package/dist/files/typography/llm.txt +1 -1
- package/dist/files/typography/tokens.txt +1 -1
- package/dist/files/upload/llm.txt +4 -2
- package/dist/files/upload/tokens.txt +5 -1
- package/dist/files/upload/upload.css +54 -11
- package/dist/manifest.json +155 -153
- package/package.json +6 -5
- package/template/_gitignore +5 -0
- package/template/index.html +12 -0
- package/template/src/App.tsx +25 -0
- package/template/src/main.tsx +14 -0
- package/template/tsconfig.app.json +22 -0
- package/template/tsconfig.json +4 -0
- package/template/tsconfig.node.json +16 -0
- package/template/vite.config.ts +8 -0
|
@@ -9,7 +9,7 @@ import { isDevelopment } from '../utils/env'
|
|
|
9
9
|
import { BreadcrumbLink } from './BreadcrumbLink'
|
|
10
10
|
import type { BreadcrumbItemType, BreadcrumbProps, BreadcrumbRouteItem } from './interface'
|
|
11
11
|
import { isBreadcrumbSeparatorItem } from './interface'
|
|
12
|
-
import { breadcrumbItemClassName } from './variants'
|
|
12
|
+
import { breadcrumbCurrentClassName, breadcrumbItemClassName } from './variants'
|
|
13
13
|
|
|
14
14
|
const prefixCls = 'apex-breadcrumb'
|
|
15
15
|
|
|
@@ -161,11 +161,19 @@ const BreadcrumbRoot: React.FC<BreadcrumbProps> = ({
|
|
|
161
161
|
const isSection = route.type === 'section'
|
|
162
162
|
const isLastRoute = routeIndex === routeItems.length - 1
|
|
163
163
|
const resolvedHref = route.href ?? (route.path ? paths[routeIndex] : undefined)
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
164
|
+
const hasResolvedHref = Boolean(resolvedHref && !/:([A-Za-z0-9_]+)/.test(resolvedHref))
|
|
165
|
+
const content = isLastRoute
|
|
166
|
+
? route.title
|
|
167
|
+
: (itemRender?.(route, params, items, paths) ?? route.title)
|
|
168
|
+
const customLinkTarget =
|
|
169
|
+
React.isValidElement(content) &&
|
|
170
|
+
content.props != null &&
|
|
171
|
+
typeof content.props === 'object' &&
|
|
172
|
+
(('href' in content.props && Boolean(content.props.href)) ||
|
|
173
|
+
('to' in content.props && Boolean(content.props.to)))
|
|
167
174
|
const hasCustomLink =
|
|
168
|
-
|
|
175
|
+
!isLastRoute && React.isValidElement(content) && (content.type === 'a' || customLinkTarget)
|
|
176
|
+
const showLink = !isLastRoute && (hasResolvedHref || customLinkTarget)
|
|
169
177
|
|
|
170
178
|
nodes.push(
|
|
171
179
|
<li
|
|
@@ -174,20 +182,19 @@ const BreadcrumbRoot: React.FC<BreadcrumbProps> = ({
|
|
|
174
182
|
data-slot="breadcrumb-item"
|
|
175
183
|
data-type={isSection ? 'section' : undefined}
|
|
176
184
|
>
|
|
177
|
-
{showLink
|
|
185
|
+
{showLink ? (
|
|
178
186
|
<BreadcrumbLink
|
|
179
187
|
asChild={hasCustomLink}
|
|
180
|
-
href={resolvedHref}
|
|
188
|
+
href={hasResolvedHref ? resolvedHref : undefined}
|
|
181
189
|
onClick={route.onClick}
|
|
182
190
|
className={isSection ? getTextFontClass(localeKind, 'heading-3') : undefined}
|
|
183
|
-
aria-current={isLastRoute ? 'page' : undefined}
|
|
184
191
|
>
|
|
185
192
|
{content}
|
|
186
193
|
</BreadcrumbLink>
|
|
187
194
|
) : (
|
|
188
195
|
<span
|
|
189
196
|
className={cn(
|
|
190
|
-
|
|
197
|
+
breadcrumbCurrentClassName,
|
|
191
198
|
`${prefixCls}__text`,
|
|
192
199
|
'apex-font',
|
|
193
200
|
getTextFontClass(localeKind, isSection ? 'heading-3' : 'body'),
|
|
@@ -195,7 +202,7 @@ const BreadcrumbRoot: React.FC<BreadcrumbProps> = ({
|
|
|
195
202
|
data-slot="breadcrumb-text"
|
|
196
203
|
{...(isLastRoute ? { 'aria-current': 'page' as const } : {})}
|
|
197
204
|
>
|
|
198
|
-
{
|
|
205
|
+
{route.title}
|
|
199
206
|
</span>
|
|
200
207
|
)}
|
|
201
208
|
</li>,
|
|
@@ -36,38 +36,48 @@
|
|
|
36
36
|
flex-shrink: 0;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
.apex-breadcrumb__link {
|
|
40
|
+
color: var(--button-text-selected);
|
|
41
|
+
}
|
|
42
|
+
|
|
39
43
|
.apex-breadcrumb__link:hover,
|
|
44
|
+
.apex-breadcrumb__link:focus-visible {
|
|
45
|
+
color: var(--button-text-hover);
|
|
46
|
+
}
|
|
47
|
+
|
|
40
48
|
.apex-breadcrumb__link:active {
|
|
41
|
-
color: var(--button-text-
|
|
49
|
+
color: var(--button-text-active);
|
|
42
50
|
}
|
|
43
51
|
|
|
44
52
|
.apex-breadcrumb__link:focus-visible {
|
|
45
|
-
outline
|
|
53
|
+
outline: 2px solid var(--button-text-hover);
|
|
54
|
+
outline-offset: 2px;
|
|
46
55
|
}
|
|
47
56
|
|
|
48
57
|
.apex-breadcrumb__link[data-state='active'],
|
|
49
58
|
.apex-breadcrumb__text[data-state='active'] {
|
|
50
59
|
color: var(--button-text-selected);
|
|
51
|
-
background-color:
|
|
52
|
-
border-color:
|
|
60
|
+
background-color: transparent;
|
|
61
|
+
border-color: transparent;
|
|
53
62
|
}
|
|
54
63
|
|
|
55
64
|
.apex-breadcrumb__text {
|
|
56
|
-
|
|
65
|
+
color: var(--button-text-default);
|
|
66
|
+
cursor: default;
|
|
57
67
|
}
|
|
58
68
|
|
|
59
69
|
.apex-breadcrumb__text:hover,
|
|
60
70
|
.apex-breadcrumb__text:active {
|
|
61
71
|
color: var(--button-text-default);
|
|
62
|
-
background-color:
|
|
63
|
-
border-color:
|
|
72
|
+
background-color: transparent;
|
|
73
|
+
border-color: transparent;
|
|
64
74
|
}
|
|
65
75
|
|
|
66
76
|
.apex-breadcrumb__text[data-state='active']:hover,
|
|
67
77
|
.apex-breadcrumb__text[data-state='active']:active {
|
|
68
78
|
color: var(--button-text-selected);
|
|
69
|
-
background-color:
|
|
70
|
-
border-color:
|
|
79
|
+
background-color: transparent;
|
|
80
|
+
border-color: transparent;
|
|
71
81
|
}
|
|
72
82
|
|
|
73
83
|
.apex-breadcrumb__separator-item,
|
|
@@ -76,7 +86,7 @@
|
|
|
76
86
|
padding: 0;
|
|
77
87
|
border: 0;
|
|
78
88
|
border-radius: 0;
|
|
79
|
-
color: var(--button-icon-
|
|
89
|
+
color: var(--button-icon-disabled);
|
|
80
90
|
background: transparent;
|
|
81
91
|
cursor: inherit;
|
|
82
92
|
}
|
|
@@ -6,13 +6,13 @@ export interface BreadcrumbRouteItem {
|
|
|
6
6
|
type?: 'section'
|
|
7
7
|
/** 展示名称(可内嵌图标) */
|
|
8
8
|
title?: React.ReactNode
|
|
9
|
-
/**
|
|
9
|
+
/** 上级项链接;末项作为当前页始终不可点击。与 `path` 共存时优先 `href` */
|
|
10
10
|
href?: string
|
|
11
11
|
/** 相对路径段;累加并支持 `:key` + `Breadcrumb.params` */
|
|
12
12
|
path?: string
|
|
13
13
|
/** 该项最外层 DOM 的类名(`li` 或链接/文案壳层,非 `Breadcrumb` 根) */
|
|
14
14
|
className?: string
|
|
15
|
-
/**
|
|
15
|
+
/** 上级链接单击事件;末项不会绑定 */
|
|
16
16
|
onClick?: React.MouseEventHandler<HTMLAnchorElement | HTMLElement>
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -33,7 +33,7 @@ export function isBreadcrumbSeparatorItem(
|
|
|
33
33
|
return 'type' in item && item.type === 'separator'
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
/**
|
|
36
|
+
/** 自定义上级项渲染(当前页始终使用 `title`,避免生成可点击节点) */
|
|
37
37
|
export type BreadcrumbItemRender = (
|
|
38
38
|
route: BreadcrumbRouteItem,
|
|
39
39
|
params: Record<string, string | number>,
|
|
@@ -65,7 +65,7 @@ export interface BreadcrumbProps extends React.ComponentProps<'nav'> {
|
|
|
65
65
|
/**
|
|
66
66
|
* 单项链接(T2:`Slot` / `asChild`)
|
|
67
67
|
*
|
|
68
|
-
* -
|
|
68
|
+
* - 默认类名使用 Button `text`(Figma subtle-text)的 medium 尺寸,上级链接有 Hover / Focus 反馈
|
|
69
69
|
* - `className` / `style` 仅挂在最外层 `<a>` 或 `asChild` 合并后的子元素
|
|
70
70
|
*/
|
|
71
71
|
export interface BreadcrumbLinkProps extends React.ComponentProps<'a'> {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Breadcrumb:页面层级较深,用户需要知道「当前在哪」并快速返回上级时。
|
|
4
4
|
|
|
5
|
-
版本:`1.2.
|
|
5
|
+
版本:`1.2.2`。组件源码在本目录,属于当前项目。
|
|
6
6
|
|
|
7
7
|
公开导出:`Breadcrumb`、`BreadcrumbLink`、`BreadcrumbSeparatorIcon`、`isBreadcrumbSeparatorItem`。
|
|
8
8
|
|
|
@@ -16,9 +16,9 @@ import type { BreadcrumbItemType } from '@/components/apex/breadcrumb'
|
|
|
16
16
|
import { Breadcrumb, BreadcrumbSeparatorIcon } from '@/components/apex/breadcrumb'
|
|
17
17
|
|
|
18
18
|
const items: BreadcrumbItemType[] = [
|
|
19
|
-
{ type: 'section', title: '
|
|
20
|
-
{ title: '
|
|
21
|
-
{ title: '
|
|
19
|
+
{ type: 'section', title: '首页', href: '/' },
|
|
20
|
+
{ title: 'Button', href: '/components/button' },
|
|
21
|
+
{ title: 'Breadcrumb' },
|
|
22
22
|
]
|
|
23
23
|
|
|
24
24
|
export default () => <Breadcrumb items={items} separator={<BreadcrumbSeparatorIcon />} />
|
|
@@ -53,10 +53,10 @@ export default () => <Breadcrumb items={items} separator={<BreadcrumbSeparatorIc
|
|
|
53
53
|
| --- | --- | --- | --- | --- |
|
|
54
54
|
| type | 栏目标题项;使用 heading-3 字阶与默认字色,其后自动渲染竖向 Divider | `"section"` | 否 | — |
|
|
55
55
|
| title | 展示名称(可内嵌图标) | `React.ReactNode` | 否 | — |
|
|
56
|
-
| href |
|
|
56
|
+
| href | 上级项链接;末项作为当前页始终不可点击。与 `path` 共存时优先 `href` | `string` | 否 | — |
|
|
57
57
|
| path | 相对路径段;累加并支持 `:key` + `Breadcrumb.params` | `string` | 否 | — |
|
|
58
58
|
| className | 该项最外层 DOM 的类名(`li` 或链接/文案壳层,非 `Breadcrumb` 根) | `string` | 否 | — |
|
|
59
|
-
| onClick |
|
|
59
|
+
| onClick | 上级链接单击事件;末项不会绑定 | `React.MouseEventHandler<HTMLAnchorElement \| HTMLElement>` | 否 | — |
|
|
60
60
|
|
|
61
61
|
### BreadcrumbSeparatorItem
|
|
62
62
|
|
|
@@ -77,7 +77,7 @@ type BreadcrumbItemType = BreadcrumbRouteItem | BreadcrumbSeparatorItem
|
|
|
77
77
|
|
|
78
78
|
### BreadcrumbItemRender
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
自定义上级项渲染(当前页始终使用 `title`,避免生成可点击节点)
|
|
81
81
|
|
|
82
82
|
```typescript
|
|
83
83
|
type BreadcrumbItemRender = (
|
|
@@ -154,7 +154,7 @@ export default () => <Breadcrumb separator={<BreadcrumbSeparatorIcon />} items={
|
|
|
154
154
|
|
|
155
155
|
### 路径参数与自定义渲染
|
|
156
156
|
|
|
157
|
-
通过 `path` 与 `params` 拼接路径,也可以用 `itemRender`
|
|
157
|
+
通过 `path` 与 `params` 拼接路径,也可以用 `itemRender` 自定义上级项展示。未解析的路径参数不会生成链接;当前项始终使用 `title`,避免自定义渲染产生可点击节点。
|
|
158
158
|
|
|
159
159
|
```tsx
|
|
160
160
|
import type { BreadcrumbItemRender, BreadcrumbItemType } from '@/components/apex/breadcrumb'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Breadcrumb Token 明细
|
|
2
2
|
|
|
3
|
-
包:`@apexhub/apex-ui-react`;版本:`1.2.
|
|
3
|
+
包:`@apexhub/apex-ui-react`;版本:`1.2.2`(当前源码快照)。
|
|
4
4
|
|
|
5
5
|
按需读取:[组件用法](./llm.txt) · [主题与覆盖规则](../../llms-theme.txt)。
|
|
6
6
|
|
|
@@ -12,63 +12,25 @@
|
|
|
12
12
|
| --- | --- | --- | --- |
|
|
13
13
|
| `--breadcrumb-spacing-gap-md` | `margin-inline` | `var(--apex-spacing-24)` | `.apex-breadcrumb.apex-default-breadcrumb` |
|
|
14
14
|
| `--breadcrumb-spacing-gap-sm` | `gap`、`margin-inline` | `var(--apex-spacing-12)` | `.apex-breadcrumb.apex-default-breadcrumb` |
|
|
15
|
-
| `--button-
|
|
16
|
-
| `--button-
|
|
17
|
-
| `--button-
|
|
18
|
-
| `--button-
|
|
19
|
-
| `--button-
|
|
20
|
-
| `--button-
|
|
21
|
-
| `--button-
|
|
22
|
-
| `--button-
|
|
23
|
-
| `--button-
|
|
24
|
-
| `--button-
|
|
25
|
-
| `--button-
|
|
26
|
-
| `--button-
|
|
27
|
-
| `--button-
|
|
28
|
-
| `--button-
|
|
29
|
-
| `--button-
|
|
30
|
-
| `--button-
|
|
31
|
-
| `--button-
|
|
32
|
-
| `--button-
|
|
33
|
-
| `--button-
|
|
34
|
-
| `--button-fill-selected` | `background-color` | `var(--apex-fill-neutral-transparent)` | `.apex-button.apex-icon-error-button` |
|
|
35
|
-
| `--button-fill-selected` | `background-color` | `var(--apex-fill-neutral-secondary)` | `.apex-button.apex-icon-primary-button` |
|
|
36
|
-
| `--button-fill-selected` | `background-color` | `var(--apex-fill-neutral-transparent)` | `.apex-button.apex-icon-secondary-button` |
|
|
37
|
-
| `--button-fill-selected` | `background-color` | `var(--apex-fill-neutral-transparent)` | `.apex-button.apex-icon-success-button` |
|
|
38
|
-
| `--button-fill-selected` | `background-color` | `var(--apex-fill-neutral-transparent)` | `.apex-button.apex-icon-transparent-button` |
|
|
39
|
-
| `--button-fill-selected` | `background-color` | `var(--apex-fill-neutral-transparent)` | `.apex-button.apex-icon-warning-button` |
|
|
40
|
-
| `--button-fill-selected` | `background-color` | `var(--apex-fill-neutral-transparent)` | `.apex-button.apex-link-default-button` |
|
|
41
|
-
| `--button-fill-selected` | `background-color` | `var(--apex-fill-brand-primary)` | `.apex-button.apex-main-default-button` |
|
|
42
|
-
| `--button-fill-selected` | `background-color` | `var(--apex-fill-error-primary)` | `.apex-button.apex-main-error-button` |
|
|
43
|
-
| `--button-fill-selected` | `background-color` | `var(--apex-fill-success-primary)` | `.apex-button.apex-main-success-button` |
|
|
44
|
-
| `--button-fill-selected` | `background-color` | `var(--apex-fill-warning-primary)` | `.apex-button.apex-main-warning-button` |
|
|
45
|
-
| `--button-fill-selected` | `background-color` | `var(--apex-fill-brand-alpha-secondary)` | `.apex-button.apex-outline-brand-button` |
|
|
46
|
-
| `--button-fill-selected` | `background-color` | `var(--apex-fill-neutral-secondary)` | `.apex-button.apex-outline-default-button` |
|
|
47
|
-
| `--button-fill-selected` | `background-color` | `var(--apex-fill-error-alpha-secondary)` | `.apex-button.apex-outline-error-button` |
|
|
48
|
-
| `--button-fill-selected` | `background-color` | `var(--apex-fill-success-alpha-secondary)` | `.apex-button.apex-outline-success-button` |
|
|
49
|
-
| `--button-fill-selected` | `background-color` | `var(--apex-fill-warning-alpha-secondary)` | `.apex-button.apex-outline-warning-button` |
|
|
50
|
-
| `--button-fill-selected` | `background-color` | `var(--apex-fill-brand-primary)` | `.apex-button.apex-secondary-default-button` |
|
|
51
|
-
| `--button-fill-selected` | `background-color` | `var(--apex-fill-neutral-transparent)` | `.apex-button.apex-text-default-button` |
|
|
52
|
-
| `--button-fill-selected` | `background-color` | `var(--apex-fill-neutral-transparent)` | `.apex-button.apex-text-secondary-button` |
|
|
53
|
-
| `--button-icon-default` | `color` | `var(--apex-icon-error-primary)` | `.apex-button.apex-icon-error-button` |
|
|
54
|
-
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-secondary)` | `.apex-button.apex-icon-primary-button` |
|
|
55
|
-
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-secondary)` | `.apex-button.apex-icon-secondary-button` |
|
|
56
|
-
| `--button-icon-default` | `color` | `var(--apex-icon-success-primary)` | `.apex-button.apex-icon-success-button` |
|
|
57
|
-
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-secondary)` | `.apex-button.apex-icon-transparent-button` |
|
|
58
|
-
| `--button-icon-default` | `color` | `var(--apex-icon-warning-primary)` | `.apex-button.apex-icon-warning-button` |
|
|
59
|
-
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-primary)` | `.apex-button.apex-link-default-button` |
|
|
60
|
-
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-inverse)` | `.apex-button.apex-main-default-button` |
|
|
61
|
-
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-inverse)` | `.apex-button.apex-main-error-button` |
|
|
62
|
-
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-inverse)` | `.apex-button.apex-main-success-button` |
|
|
63
|
-
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-inverse)` | `.apex-button.apex-main-warning-button` |
|
|
64
|
-
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-primary)` | `.apex-button.apex-outline-brand-button` |
|
|
65
|
-
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-primary)` | `.apex-button.apex-outline-default-button` |
|
|
66
|
-
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-primary)` | `.apex-button.apex-outline-error-button` |
|
|
67
|
-
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-primary)` | `.apex-button.apex-outline-success-button` |
|
|
68
|
-
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-primary)` | `.apex-button.apex-outline-warning-button` |
|
|
69
|
-
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-primary)` | `.apex-button.apex-secondary-default-button` |
|
|
70
|
-
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-primary)` | `.apex-button.apex-text-default-button` |
|
|
71
|
-
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-primary)` | `.apex-button.apex-text-secondary-button` |
|
|
15
|
+
| `--button-icon-disabled` | `color` | `var(--apex-icon-error-disabled)` | `.apex-button.apex-icon-error-button` |
|
|
16
|
+
| `--button-icon-disabled` | `color` | `var(--apex-icon-neutral-disabled)` | `.apex-button.apex-icon-primary-button` |
|
|
17
|
+
| `--button-icon-disabled` | `color` | `var(--apex-icon-neutral-disabled)` | `.apex-button.apex-icon-secondary-button` |
|
|
18
|
+
| `--button-icon-disabled` | `color` | `var(--apex-icon-success-disabled)` | `.apex-button.apex-icon-success-button` |
|
|
19
|
+
| `--button-icon-disabled` | `color` | `var(--apex-icon-neutral-disabled)` | `.apex-button.apex-icon-transparent-button` |
|
|
20
|
+
| `--button-icon-disabled` | `color` | `var(--apex-icon-warning-disabled)` | `.apex-button.apex-icon-warning-button` |
|
|
21
|
+
| `--button-icon-disabled` | `color` | `var(--apex-icon-neutral-disabled)` | `.apex-button.apex-link-default-button` |
|
|
22
|
+
| `--button-icon-disabled` | `color` | `var(--apex-icon-neutral-disabled)` | `.apex-button.apex-main-default-button` |
|
|
23
|
+
| `--button-icon-disabled` | `color` | `var(--apex-icon-neutral-disabled)` | `.apex-button.apex-main-error-button` |
|
|
24
|
+
| `--button-icon-disabled` | `color` | `var(--apex-icon-neutral-disabled)` | `.apex-button.apex-main-success-button` |
|
|
25
|
+
| `--button-icon-disabled` | `color` | `var(--apex-icon-neutral-disabled)` | `.apex-button.apex-main-warning-button` |
|
|
26
|
+
| `--button-icon-disabled` | `color` | `var(--apex-icon-neutral-disabled)` | `.apex-button.apex-outline-brand-button` |
|
|
27
|
+
| `--button-icon-disabled` | `color` | `var(--apex-icon-neutral-disabled)` | `.apex-button.apex-outline-default-button` |
|
|
28
|
+
| `--button-icon-disabled` | `color` | `var(--apex-icon-neutral-disabled)` | `.apex-button.apex-outline-error-button` |
|
|
29
|
+
| `--button-icon-disabled` | `color` | `var(--apex-icon-neutral-disabled)` | `.apex-button.apex-outline-success-button` |
|
|
30
|
+
| `--button-icon-disabled` | `color` | `var(--apex-icon-neutral-disabled)` | `.apex-button.apex-outline-warning-button` |
|
|
31
|
+
| `--button-icon-disabled` | `color` | `var(--apex-icon-neutral-disabled)` | `.apex-button.apex-secondary-default-button` |
|
|
32
|
+
| `--button-icon-disabled` | `color` | `var(--apex-icon-neutral-disabled)` | `.apex-button.apex-text-default-button` |
|
|
33
|
+
| `--button-icon-disabled` | `color` | `var(--apex-icon-neutral-disabled)` | `.apex-button.apex-text-secondary-button` |
|
|
72
34
|
| `--button-icon-icon` | `height`、`width` | `var(--apex-icon-20)` | `.apex-button.apex-icon-md-button` |
|
|
73
35
|
| `--button-icon-icon` | `height`、`width` | `var(--apex-icon-16)` | `.apex-button.apex-icon-sm-button` |
|
|
74
36
|
| `--button-icon-icon` | `height`、`width` | `var(--apex-icon-16)` | `.apex-button.apex-link-md-button` |
|
|
@@ -91,44 +53,19 @@
|
|
|
91
53
|
| `--button-spacing-gap` | `height` | `var(--apex-spacing-4)` | `.apex-button.apex-main-sm-button` |
|
|
92
54
|
| `--button-spacing-gap` | `height` | `var(--apex-spacing-4)` | `.apex-button.apex-text-md-button` |
|
|
93
55
|
| `--button-spacing-gap` | `height` | `var(--apex-spacing-4)` | `.apex-button.apex-text-sm-button` |
|
|
94
|
-
| `--button-
|
|
95
|
-
| `--button-
|
|
96
|
-
| `--button-
|
|
97
|
-
| `--button-
|
|
98
|
-
| `--button-
|
|
99
|
-
| `--button-
|
|
100
|
-
| `--button-
|
|
101
|
-
| `--button-
|
|
102
|
-
| `--button-
|
|
103
|
-
| `--button-
|
|
104
|
-
| `--button-
|
|
105
|
-
| `--button-
|
|
106
|
-
| `--button-
|
|
107
|
-
| `--button-stroke-default` | `border-color` | `var(--apex-stroke-error-primary)` | `.apex-button.apex-outline-error-button` |
|
|
108
|
-
| `--button-stroke-default` | `border-color` | `var(--apex-stroke-success-primary)` | `.apex-button.apex-outline-success-button` |
|
|
109
|
-
| `--button-stroke-default` | `border-color` | `var(--apex-stroke-warning-primary)` | `.apex-button.apex-outline-warning-button` |
|
|
110
|
-
| `--button-stroke-default` | `border-color` | `var(--apex-stroke-neutral-secondary)` | `.apex-button.apex-secondary-default-button` |
|
|
111
|
-
| `--button-stroke-default` | `border-color` | `var(--apex-stroke-neutral-transparent)` | `.apex-button.apex-text-default-button` |
|
|
112
|
-
| `--button-stroke-default` | `border-color` | `var(--apex-stroke-neutral-transparent)` | `.apex-button.apex-text-secondary-button` |
|
|
113
|
-
| `--button-stroke-selected` | `border-color` | `var(--apex-stroke-neutral-transparent)` | `.apex-button.apex-icon-error-button` |
|
|
114
|
-
| `--button-stroke-selected` | `border-color` | `var(--apex-stroke-brand-primary)` | `.apex-button.apex-icon-primary-button` |
|
|
115
|
-
| `--button-stroke-selected` | `border-color` | `var(--apex-stroke-neutral-transparent)` | `.apex-button.apex-icon-secondary-button` |
|
|
116
|
-
| `--button-stroke-selected` | `border-color` | `var(--apex-stroke-neutral-transparent)` | `.apex-button.apex-icon-success-button` |
|
|
117
|
-
| `--button-stroke-selected` | `border-color` | `var(--apex-stroke-neutral-transparent)` | `.apex-button.apex-icon-transparent-button` |
|
|
118
|
-
| `--button-stroke-selected` | `border-color` | `var(--apex-stroke-neutral-transparent)` | `.apex-button.apex-icon-warning-button` |
|
|
119
|
-
| `--button-stroke-selected` | `border-color` | `var(--apex-stroke-neutral-transparent)` | `.apex-button.apex-link-default-button` |
|
|
120
|
-
| `--button-stroke-selected` | `border-color` | `var(--apex-stroke-brand-primary)` | `.apex-button.apex-main-default-button` |
|
|
121
|
-
| `--button-stroke-selected` | `border-color` | `var(--apex-stroke-error-primary)` | `.apex-button.apex-main-error-button` |
|
|
122
|
-
| `--button-stroke-selected` | `border-color` | `var(--apex-stroke-success-primary)` | `.apex-button.apex-main-success-button` |
|
|
123
|
-
| `--button-stroke-selected` | `border-color` | `var(--apex-stroke-warning-primary)` | `.apex-button.apex-main-warning-button` |
|
|
124
|
-
| `--button-stroke-selected` | `border-color` | `var(--apex-stroke-brand-primary)` | `.apex-button.apex-outline-brand-button` |
|
|
125
|
-
| `--button-stroke-selected` | `border-color` | `var(--apex-stroke-neutral-quaternary)` | `.apex-button.apex-outline-default-button` |
|
|
126
|
-
| `--button-stroke-selected` | `border-color` | `var(--apex-stroke-error-primary)` | `.apex-button.apex-outline-error-button` |
|
|
127
|
-
| `--button-stroke-selected` | `border-color` | `var(--apex-stroke-success-primary)` | `.apex-button.apex-outline-success-button` |
|
|
128
|
-
| `--button-stroke-selected` | `border-color` | `var(--apex-stroke-warning-primary)` | `.apex-button.apex-outline-warning-button` |
|
|
129
|
-
| `--button-stroke-selected` | `border-color` | `var(--apex-stroke-brand-primary)` | `.apex-button.apex-secondary-default-button` |
|
|
130
|
-
| `--button-stroke-selected` | `border-color` | `var(--apex-stroke-neutral-transparent)` | `.apex-button.apex-text-default-button` |
|
|
131
|
-
| `--button-stroke-selected` | `border-color` | `var(--apex-stroke-neutral-transparent)` | `.apex-button.apex-text-secondary-button` |
|
|
56
|
+
| `--button-text-active` | `color` | `var(--apex-text-brand-primary)` | `.apex-button.apex-link-default-button` |
|
|
57
|
+
| `--button-text-active` | `color` | `var(--apex-text-neutral-inverse)` | `.apex-button.apex-main-default-button` |
|
|
58
|
+
| `--button-text-active` | `color` | `var(--apex-text-neutral-inverse)` | `.apex-button.apex-main-error-button` |
|
|
59
|
+
| `--button-text-active` | `color` | `var(--apex-text-neutral-inverse)` | `.apex-button.apex-main-success-button` |
|
|
60
|
+
| `--button-text-active` | `color` | `var(--apex-text-neutral-inverse)` | `.apex-button.apex-main-warning-button` |
|
|
61
|
+
| `--button-text-active` | `color` | `var(--apex-text-neutral-primary)` | `.apex-button.apex-outline-brand-button` |
|
|
62
|
+
| `--button-text-active` | `color` | `var(--apex-text-neutral-primary)` | `.apex-button.apex-outline-default-button` |
|
|
63
|
+
| `--button-text-active` | `color` | `var(--apex-text-neutral-primary)` | `.apex-button.apex-outline-error-button` |
|
|
64
|
+
| `--button-text-active` | `color` | `var(--apex-text-neutral-primary)` | `.apex-button.apex-outline-success-button` |
|
|
65
|
+
| `--button-text-active` | `color` | `var(--apex-text-neutral-primary)` | `.apex-button.apex-outline-warning-button` |
|
|
66
|
+
| `--button-text-active` | `color` | `var(--apex-text-neutral-inverse)` | `.apex-button.apex-secondary-default-button` |
|
|
67
|
+
| `--button-text-active` | `color` | `var(--apex-text-brand-primary)` | `.apex-button.apex-text-default-button` |
|
|
68
|
+
| `--button-text-active` | `color` | `var(--apex-text-brand-tertiary)` | `.apex-button.apex-text-secondary-button` |
|
|
132
69
|
| `--button-text-default` | `color` | `var(--apex-text-neutral-secondary)` | `.apex-button.apex-link-default-button` |
|
|
133
70
|
| `--button-text-default` | `color` | `var(--apex-text-neutral-inverse)` | `.apex-button.apex-main-default-button` |
|
|
134
71
|
| `--button-text-default` | `color` | `var(--apex-text-neutral-inverse)` | `.apex-button.apex-main-error-button` |
|
|
@@ -142,6 +79,19 @@
|
|
|
142
79
|
| `--button-text-default` | `color` | `var(--apex-text-neutral-primary)` | `.apex-button.apex-secondary-default-button` |
|
|
143
80
|
| `--button-text-default` | `color` | `var(--apex-text-neutral-primary)` | `.apex-button.apex-text-default-button` |
|
|
144
81
|
| `--button-text-default` | `color` | `var(--apex-text-neutral-primary)` | `.apex-button.apex-text-secondary-button` |
|
|
82
|
+
| `--button-text-hover` | `color`、`outline` | `var(--apex-text-brand-secondary)` | `.apex-button.apex-link-default-button` |
|
|
83
|
+
| `--button-text-hover` | `color`、`outline` | `var(--apex-text-neutral-inverse)` | `.apex-button.apex-main-default-button` |
|
|
84
|
+
| `--button-text-hover` | `color`、`outline` | `var(--apex-text-neutral-inverse)` | `.apex-button.apex-main-error-button` |
|
|
85
|
+
| `--button-text-hover` | `color`、`outline` | `var(--apex-text-neutral-inverse)` | `.apex-button.apex-main-success-button` |
|
|
86
|
+
| `--button-text-hover` | `color`、`outline` | `var(--apex-text-neutral-inverse)` | `.apex-button.apex-main-warning-button` |
|
|
87
|
+
| `--button-text-hover` | `color`、`outline` | `var(--apex-text-neutral-primary)` | `.apex-button.apex-outline-brand-button` |
|
|
88
|
+
| `--button-text-hover` | `color`、`outline` | `var(--apex-text-neutral-primary)` | `.apex-button.apex-outline-default-button` |
|
|
89
|
+
| `--button-text-hover` | `color`、`outline` | `var(--apex-text-neutral-primary)` | `.apex-button.apex-outline-error-button` |
|
|
90
|
+
| `--button-text-hover` | `color`、`outline` | `var(--apex-text-neutral-primary)` | `.apex-button.apex-outline-success-button` |
|
|
91
|
+
| `--button-text-hover` | `color`、`outline` | `var(--apex-text-neutral-primary)` | `.apex-button.apex-outline-warning-button` |
|
|
92
|
+
| `--button-text-hover` | `color`、`outline` | `var(--apex-text-neutral-primary)` | `.apex-button.apex-secondary-default-button` |
|
|
93
|
+
| `--button-text-hover` | `color`、`outline` | `var(--apex-text-neutral-secondary)` | `.apex-button.apex-text-default-button` |
|
|
94
|
+
| `--button-text-hover` | `color`、`outline` | `var(--apex-text-brand-secondary)` | `.apex-button.apex-text-secondary-button` |
|
|
145
95
|
| `--button-text-selected` | `color` | `var(--apex-text-brand-primary)` | `.apex-button.apex-link-default-button` |
|
|
146
96
|
| `--button-text-selected` | `color` | `var(--apex-text-neutral-inverse)` | `.apex-button.apex-main-default-button` |
|
|
147
97
|
| `--button-text-selected` | `color` | `var(--apex-text-neutral-inverse)` | `.apex-button.apex-main-error-button` |
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import './button.css'
|
|
4
4
|
import { Slot as SlotPrimitive } from 'radix-ui'
|
|
5
5
|
import * as React from 'react'
|
|
6
|
-
import { Typography } from '../typography'
|
|
7
6
|
import { cn } from '../utils/cn'
|
|
8
7
|
import { isDevelopment } from '../utils/env'
|
|
9
8
|
import type { ButtonProps } from './interface'
|
|
@@ -71,7 +70,7 @@ function resolveButtonAppearance(
|
|
|
71
70
|
* 旋转动画由 button.css 中的 @keyframes apex-button-spin 驱动
|
|
72
71
|
*/
|
|
73
72
|
const LoadingIcon = React.memo(() => (
|
|
74
|
-
<span className={`${prefixCls}__loading-icon`} aria-hidden="true">
|
|
73
|
+
<span className={`${prefixCls}__loading-icon`} data-slot="button-loading-icon" aria-hidden="true">
|
|
75
74
|
<svg
|
|
76
75
|
viewBox="0 0 24 24"
|
|
77
76
|
fill="none"
|
|
@@ -104,6 +103,7 @@ export function Button({
|
|
|
104
103
|
target,
|
|
105
104
|
asChild = false,
|
|
106
105
|
icon,
|
|
106
|
+
suffixIcon,
|
|
107
107
|
block = false,
|
|
108
108
|
onClick,
|
|
109
109
|
children,
|
|
@@ -124,8 +124,8 @@ export function Button({
|
|
|
124
124
|
const appearance = resolveButtonAppearance(variantType, variant, tone)
|
|
125
125
|
|
|
126
126
|
const isDisabled = disabled || loading
|
|
127
|
-
const hasIcon = icon !== undefined || loading
|
|
128
|
-
const isIconOnly = hasIcon && children == null
|
|
127
|
+
const hasIcon = icon !== undefined || suffixIcon !== undefined || loading
|
|
128
|
+
const isIconOnly = hasIcon && children == null && !(icon != null && suffixIcon != null)
|
|
129
129
|
|
|
130
130
|
const classes = cn(
|
|
131
131
|
buttonVariants({
|
|
@@ -151,7 +151,11 @@ export function Button({
|
|
|
151
151
|
|
|
152
152
|
const loadingNode =
|
|
153
153
|
loadingIcon != null ? (
|
|
154
|
-
<span
|
|
154
|
+
<span
|
|
155
|
+
className={`${prefixCls}__loading-icon`}
|
|
156
|
+
data-slot="button-loading-icon"
|
|
157
|
+
aria-hidden="true"
|
|
158
|
+
>
|
|
155
159
|
{loadingIcon}
|
|
156
160
|
</span>
|
|
157
161
|
) : (
|
|
@@ -161,13 +165,23 @@ export function Button({
|
|
|
161
165
|
const iconNode = loading ? (
|
|
162
166
|
loadingNode
|
|
163
167
|
) : icon ? (
|
|
164
|
-
<span className={`${prefixCls}__icon`} aria-hidden="true">
|
|
168
|
+
<span className={`${prefixCls}__icon`} data-slot="button-icon" aria-hidden="true">
|
|
165
169
|
{icon}
|
|
166
170
|
</span>
|
|
167
171
|
) : null
|
|
168
172
|
|
|
173
|
+
const suffixIconNode = suffixIcon ? (
|
|
174
|
+
<span className={`${prefixCls}__icon`} data-slot="button-suffix-icon" aria-hidden="true">
|
|
175
|
+
{suffixIcon}
|
|
176
|
+
</span>
|
|
177
|
+
) : null
|
|
178
|
+
|
|
169
179
|
const contentNode =
|
|
170
|
-
children != null ?
|
|
180
|
+
children != null ? (
|
|
181
|
+
<span className={`${prefixCls}__content`} data-slot="button-content">
|
|
182
|
+
{children}
|
|
183
|
+
</span>
|
|
184
|
+
) : null
|
|
171
185
|
|
|
172
186
|
const sharedProps = {
|
|
173
187
|
'data-slot': dataSlot,
|
|
@@ -190,6 +204,7 @@ export function Button({
|
|
|
190
204
|
>
|
|
191
205
|
{iconNode}
|
|
192
206
|
<Slottable>{children}</Slottable>
|
|
207
|
+
{suffixIconNode}
|
|
193
208
|
</Slot>
|
|
194
209
|
)
|
|
195
210
|
}
|
|
@@ -209,7 +224,8 @@ export function Button({
|
|
|
209
224
|
tabIndex={isDisabled ? -1 : anchorTabIndex}
|
|
210
225
|
>
|
|
211
226
|
{iconNode}
|
|
212
|
-
|
|
227
|
+
{contentNode}
|
|
228
|
+
{suffixIconNode}
|
|
213
229
|
</a>
|
|
214
230
|
)
|
|
215
231
|
}
|
|
@@ -226,6 +242,7 @@ export function Button({
|
|
|
226
242
|
>
|
|
227
243
|
{iconNode}
|
|
228
244
|
{contentNode}
|
|
245
|
+
{suffixIconNode}
|
|
229
246
|
</button>
|
|
230
247
|
)
|
|
231
248
|
}
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
cursor: pointer;
|
|
25
25
|
user-select: none;
|
|
26
26
|
outline: none;
|
|
27
|
+
font-size: 14px;
|
|
28
|
+
line-height: 20px;
|
|
27
29
|
|
|
28
30
|
height: var(--button-size-height);
|
|
29
31
|
padding: 0 var(--button-spacing-padding-x);
|
|
@@ -153,6 +155,8 @@
|
|
|
153
155
|
|
|
154
156
|
.apex-button--small {
|
|
155
157
|
height: var(--button-size-height);
|
|
158
|
+
font-size: 12px;
|
|
159
|
+
line-height: 16px;
|
|
156
160
|
}
|
|
157
161
|
|
|
158
162
|
/* ── Block / Loading / Disabled 交互 ─────────────────────────────────────── */
|
|
@@ -164,7 +168,6 @@
|
|
|
164
168
|
|
|
165
169
|
.apex-button--loading {
|
|
166
170
|
cursor: default;
|
|
167
|
-
opacity: 0.85;
|
|
168
171
|
}
|
|
169
172
|
|
|
170
173
|
.apex-button:disabled,
|
|
@@ -195,10 +198,25 @@ a.apex-button[aria-disabled='true'] {
|
|
|
195
198
|
align-items: center;
|
|
196
199
|
justify-content: center;
|
|
197
200
|
flex-shrink: 0;
|
|
198
|
-
|
|
201
|
+
width: 20px;
|
|
202
|
+
height: 20px;
|
|
203
|
+
font-size: 20px;
|
|
199
204
|
line-height: 1;
|
|
200
205
|
}
|
|
201
206
|
|
|
207
|
+
.apex-button--small .apex-button__icon,
|
|
208
|
+
.apex-button--small .apex-button__loading-icon {
|
|
209
|
+
width: 16px;
|
|
210
|
+
height: 16px;
|
|
211
|
+
font-size: 16px;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.apex-icon-primary-button .apex-button__icon {
|
|
215
|
+
width: 16px;
|
|
216
|
+
height: 16px;
|
|
217
|
+
font-size: 16px;
|
|
218
|
+
}
|
|
219
|
+
|
|
202
220
|
.apex-button__icon {
|
|
203
221
|
color: var(--button-icon-default, currentColor);
|
|
204
222
|
}
|
|
@@ -31,8 +31,8 @@ export interface ButtonProps
|
|
|
31
31
|
* - `main`: solid emphasis
|
|
32
32
|
* - `outline`: bordered emphasis
|
|
33
33
|
* - `secondary`: neutral filled action
|
|
34
|
-
* - `text` / `link`: low-emphasis actions
|
|
35
|
-
* - `icon`: icon-only
|
|
34
|
+
* - `text` / `text-secondary` / `link`: low-emphasis actions
|
|
35
|
+
* - `icon` / `icon-primary`: icon-only actions with hover fill
|
|
36
36
|
* - `icon-transparent`: icon-only action, fully transparent background
|
|
37
37
|
* @since 0.1.0
|
|
38
38
|
*/
|
|
@@ -40,8 +40,8 @@ export interface ButtonProps
|
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* Visual intent. `main`, `outline`, and `icon` support every tone;
|
|
43
|
-
* `icon-transparent`, `secondary`, `text`,
|
|
44
|
-
* `secondary`,
|
|
43
|
+
* `icon-primary`, `icon-transparent`, `secondary`, `text`,
|
|
44
|
+
* `text-secondary`, and `link` use `default`.
|
|
45
45
|
* When omitted, the legacy `danger` type resolves to `error`; other types
|
|
46
46
|
* resolve to `default`.
|
|
47
47
|
* @since 0.1.0
|
|
@@ -112,6 +112,9 @@ export interface ButtonProps
|
|
|
112
112
|
*/
|
|
113
113
|
icon?: React.ReactNode
|
|
114
114
|
|
|
115
|
+
/** 尾部图标;loading 时仍保留在文案后方。 */
|
|
116
|
+
suffixIcon?: React.ReactNode
|
|
117
|
+
|
|
115
118
|
/**
|
|
116
119
|
* 是否撑满父容器宽度(`display: flex; width: 100%`)
|
|
117
120
|
* @default false
|