@apexhub/apex-ui-react-source 1.2.2 → 1.3.0
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/dist/files/AGENTS.md +1 -1
- package/dist/files/alert/llm.txt +1 -1
- package/dist/files/alert/tokens.txt +1 -1
- package/dist/files/apex-provider/llm.txt +1 -1
- package/dist/files/auto-complete/llm.txt +1 -1
- package/dist/files/auto-complete/tokens.txt +1 -1
- package/dist/files/avatar/llm.txt +1 -1
- package/dist/files/avatar/tokens.txt +1 -1
- package/dist/files/breadcrumb/Breadcrumb.stories.css +8 -0
- package/dist/files/breadcrumb/Breadcrumb.tsx +15 -14
- package/dist/files/breadcrumb/breadcrumb.css +6 -19
- package/dist/files/breadcrumb/interface.ts +6 -6
- package/dist/files/breadcrumb/llm.txt +24 -40
- package/dist/files/breadcrumb/tokens.txt +20 -20
- package/dist/files/breadcrumb/variants.ts +4 -9
- package/dist/files/button/llm.txt +14 -2
- package/dist/files/button/tokens.txt +1 -1
- package/dist/files/card/llm.txt +1 -1
- package/dist/files/card/tokens.txt +1 -1
- package/dist/files/cascader/llm.txt +1 -1
- package/dist/files/cascader/tokens.txt +1 -1
- package/dist/files/checkbox/llm.txt +6 -4
- package/dist/files/checkbox/tokens.txt +1 -1
- package/dist/files/collapse/llm.txt +4 -3
- package/dist/files/collapse/tokens.txt +1 -1
- package/dist/files/date-picker/RangePicker.tsx +6 -4
- package/dist/files/date-picker/date-picker-hover.stories.css +21 -0
- package/dist/files/date-picker/date-picker.css +30 -18
- package/dist/files/date-picker/interface.ts +3 -0
- package/dist/files/date-picker/llm.txt +2 -2
- 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 +14 -1
- package/dist/files/drawer/llm.txt +1 -1
- package/dist/files/drawer/tokens.txt +3 -2
- package/dist/files/dropdown/llm.txt +1 -1
- package/dist/files/dropdown/tokens.txt +1 -1
- package/dist/files/form/llm.txt +1 -1
- package/dist/files/form/tokens.txt +1 -1
- package/dist/files/grid/llm.txt +2 -2
- package/dist/files/image/llm.txt +1 -1
- package/dist/files/image/tokens.txt +1 -1
- package/dist/files/input/llm.txt +1 -1
- package/dist/files/input/tokens.txt +1 -1
- package/dist/files/input-number/lib.ts +2 -2
- package/dist/files/input-number/llm.txt +9 -1
- package/dist/files/input-number/tokens.txt +1 -1
- package/dist/files/layout/llm.txt +1 -1
- package/dist/files/layout/tokens.txt +1 -1
- package/dist/files/llms.txt +20 -4
- package/dist/files/menu/llm.txt +1 -3
- package/dist/files/menu/menu.css +2 -1
- package/dist/files/menu/tokens.txt +1 -1
- package/dist/files/message/llm.txt +1 -1
- package/dist/files/message/tokens.txt +1 -1
- package/dist/files/modal/lib/useModal.tsx +2 -1
- package/dist/files/modal/llm.txt +5 -1
- package/dist/files/modal/modal.css +1 -0
- 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/llm.txt +1 -1
- package/dist/files/pagination/tokens.txt +1 -1
- package/dist/files/popover/llm.txt +1 -1
- package/dist/files/popover/tokens.txt +1 -1
- package/dist/files/progress/llm.txt +2 -6
- package/dist/files/progress/tokens.txt +1 -1
- package/dist/files/radio/llm.txt +1 -1
- package/dist/files/radio/tokens.txt +1 -1
- package/dist/files/rate/llm.txt +1 -1
- package/dist/files/rate/tokens.txt +1 -1
- package/dist/files/select/llm.txt +1 -1
- package/dist/files/select/tokens.txt +1 -1
- 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/steps.css +2 -2
- package/dist/files/steps/tokens.txt +2 -2
- package/dist/files/switch/llm.txt +1 -1
- package/dist/files/switch/tokens.txt +1 -1
- package/dist/files/table/Table.stories.css +4 -0
- package/dist/files/table/index.ts +1 -0
- package/dist/files/table/interface.ts +44 -7
- package/dist/files/table/llm.txt +73 -9
- package/dist/files/table/parts/TableHeader.tsx +66 -4
- package/dist/files/table/table.css +91 -7
- package/dist/files/table/tokens.txt +3 -1
- package/dist/files/tabs/Tabs.tsx +69 -9
- package/dist/files/tabs/TabsOverflow.tsx +138 -0
- package/dist/files/tabs/interface.ts +14 -0
- package/dist/files/tabs/llm.txt +4 -2
- package/dist/files/tabs/overflow-layout.ts +50 -0
- package/dist/files/tabs/tabs-overflow.stories.css +25 -0
- package/dist/files/tabs/tabs.css +114 -17
- package/dist/files/tabs/tokens.txt +5 -1
- package/dist/files/tabs/useTabOverflow.ts +101 -0
- package/dist/files/tag/llm.txt +2 -15
- package/dist/files/tag/tokens.txt +1 -1
- package/dist/files/tooltip/llm.txt +1 -1
- package/dist/files/tooltip/tokens.txt +3 -1
- package/dist/files/tooltip/tooltip.css +11 -0
- package/dist/files/tree/llm.txt +1 -1
- package/dist/files/tree/tokens.txt +1 -1
- package/dist/files/tree-select/llm.txt +1 -1
- package/dist/files/tree-select/tokens.txt +1 -1
- package/dist/files/typography/llm.txt +1 -1
- package/dist/files/typography/tokens.txt +1 -1
- package/dist/files/upload/llm.txt +1 -1
- package/dist/files/upload/tokens.txt +1 -1
- package/dist/manifest.json +113 -108
- package/package.json +3 -3
package/dist/files/AGENTS.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Apex UI source (React) — rules for AI assistants
|
|
2
2
|
|
|
3
|
-
This folder is Apex UI 1.
|
|
3
|
+
This folder is Apex UI 1.3.0, installed as source code by `@apexhub/apex-ui-react-source`.
|
|
4
4
|
The code now belongs to this project: you may edit it.
|
|
5
5
|
|
|
6
6
|
## Using components
|
package/dist/files/alert/llm.txt
CHANGED
|
@@ -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 {
|
|
12
|
+
import { breadcrumbItemClassName } from './variants'
|
|
13
13
|
|
|
14
14
|
const prefixCls = 'apex-breadcrumb'
|
|
15
15
|
|
|
@@ -162,18 +162,20 @@ const BreadcrumbRoot: React.FC<BreadcrumbProps> = ({
|
|
|
162
162
|
const isLastRoute = routeIndex === routeItems.length - 1
|
|
163
163
|
const resolvedHref = route.href ?? (route.path ? paths[routeIndex] : undefined)
|
|
164
164
|
const hasResolvedHref = Boolean(resolvedHref && !/:([A-Za-z0-9_]+)/.test(resolvedHref))
|
|
165
|
-
const
|
|
165
|
+
const isStatic = isSection || isLastRoute
|
|
166
|
+
// 栏目与当前页直接展示 title,避免自定义路由渲染器重新引入可点击节点。
|
|
167
|
+
const content = isStatic
|
|
166
168
|
? route.title
|
|
167
169
|
: (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)))
|
|
174
170
|
const hasCustomLink =
|
|
175
|
-
!
|
|
176
|
-
|
|
171
|
+
!isStatic &&
|
|
172
|
+
itemRender != null &&
|
|
173
|
+
React.isValidElement<{ href?: string; to?: unknown }>(content) &&
|
|
174
|
+
(content.type === 'a' ||
|
|
175
|
+
content.type === BreadcrumbLink ||
|
|
176
|
+
Boolean(content.props.href) ||
|
|
177
|
+
content.props.to != null)
|
|
178
|
+
const showLink = !isStatic && hasResolvedHref
|
|
177
179
|
|
|
178
180
|
nodes.push(
|
|
179
181
|
<li
|
|
@@ -182,19 +184,18 @@ const BreadcrumbRoot: React.FC<BreadcrumbProps> = ({
|
|
|
182
184
|
data-slot="breadcrumb-item"
|
|
183
185
|
data-type={isSection ? 'section' : undefined}
|
|
184
186
|
>
|
|
185
|
-
{showLink ? (
|
|
187
|
+
{showLink || hasCustomLink ? (
|
|
186
188
|
<BreadcrumbLink
|
|
187
189
|
asChild={hasCustomLink}
|
|
188
190
|
href={hasResolvedHref ? resolvedHref : undefined}
|
|
189
191
|
onClick={route.onClick}
|
|
190
|
-
className={isSection ? getTextFontClass(localeKind, 'heading-3') : undefined}
|
|
191
192
|
>
|
|
192
193
|
{content}
|
|
193
194
|
</BreadcrumbLink>
|
|
194
195
|
) : (
|
|
195
196
|
<span
|
|
196
197
|
className={cn(
|
|
197
|
-
|
|
198
|
+
breadcrumbItemClassName,
|
|
198
199
|
`${prefixCls}__text`,
|
|
199
200
|
'apex-font',
|
|
200
201
|
getTextFontClass(localeKind, isSection ? 'heading-3' : 'body'),
|
|
@@ -202,7 +203,7 @@ const BreadcrumbRoot: React.FC<BreadcrumbProps> = ({
|
|
|
202
203
|
data-slot="breadcrumb-text"
|
|
203
204
|
{...(isLastRoute ? { 'aria-current': 'page' as const } : {})}
|
|
204
205
|
>
|
|
205
|
-
{
|
|
206
|
+
{content}
|
|
206
207
|
</span>
|
|
207
208
|
)}
|
|
208
209
|
</li>,
|
|
@@ -30,18 +30,14 @@
|
|
|
30
30
|
font-weight: var(--font-fontweight);
|
|
31
31
|
line-height: var(--font-fontheight);
|
|
32
32
|
letter-spacing: 0;
|
|
33
|
+
color: var(--button-text-default);
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
.apex-breadcrumb__item {
|
|
36
37
|
flex-shrink: 0;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
.apex-breadcrumb__link {
|
|
40
|
-
color: var(--button-text-selected);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.apex-breadcrumb__link:hover,
|
|
44
|
-
.apex-breadcrumb__link:focus-visible {
|
|
40
|
+
.apex-breadcrumb__link:hover {
|
|
45
41
|
color: var(--button-text-hover);
|
|
46
42
|
}
|
|
47
43
|
|
|
@@ -51,19 +47,17 @@
|
|
|
51
47
|
|
|
52
48
|
.apex-breadcrumb__link:focus-visible {
|
|
53
49
|
outline: 2px solid var(--button-text-hover);
|
|
54
|
-
outline-offset: 2px;
|
|
50
|
+
outline-offset: -2px;
|
|
55
51
|
}
|
|
56
52
|
|
|
57
|
-
.apex-breadcrumb__link[data-state='active']
|
|
58
|
-
.apex-breadcrumb__text[data-state='active'] {
|
|
53
|
+
.apex-breadcrumb__link[data-state='active'] {
|
|
59
54
|
color: var(--button-text-selected);
|
|
60
55
|
background-color: transparent;
|
|
61
56
|
border-color: transparent;
|
|
62
57
|
}
|
|
63
58
|
|
|
64
59
|
.apex-breadcrumb__text {
|
|
65
|
-
|
|
66
|
-
cursor: default;
|
|
60
|
+
cursor: inherit;
|
|
67
61
|
}
|
|
68
62
|
|
|
69
63
|
.apex-breadcrumb__text:hover,
|
|
@@ -73,20 +67,13 @@
|
|
|
73
67
|
border-color: transparent;
|
|
74
68
|
}
|
|
75
69
|
|
|
76
|
-
.apex-breadcrumb__text[data-state='active']:hover,
|
|
77
|
-
.apex-breadcrumb__text[data-state='active']:active {
|
|
78
|
-
color: var(--button-text-selected);
|
|
79
|
-
background-color: transparent;
|
|
80
|
-
border-color: transparent;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
70
|
.apex-breadcrumb__separator-item,
|
|
84
71
|
.apex-breadcrumb__separator-icon {
|
|
85
72
|
flex-shrink: 0;
|
|
86
73
|
padding: 0;
|
|
87
74
|
border: 0;
|
|
88
75
|
border-radius: 0;
|
|
89
|
-
color: var(--button-icon-
|
|
76
|
+
color: var(--button-icon-default);
|
|
90
77
|
background: transparent;
|
|
91
78
|
cursor: inherit;
|
|
92
79
|
}
|
|
@@ -2,17 +2,17 @@ import type * as React from 'react'
|
|
|
2
2
|
|
|
3
3
|
/** 可导航的路由项 */
|
|
4
4
|
export interface BreadcrumbRouteItem {
|
|
5
|
-
/**
|
|
5
|
+
/** 栏目标题项;仅展示 title,不可点击;使用 heading-3 字阶与默认字色,其后自动渲染竖向 Divider */
|
|
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
|
+
/** 自定义项渲染(对齐 antd) */
|
|
37
37
|
export type BreadcrumbItemRender = (
|
|
38
38
|
route: BreadcrumbRouteItem,
|
|
39
39
|
params: Record<string, string | number>,
|
|
@@ -54,7 +54,7 @@ export interface BreadcrumbProps extends React.ComponentProps<'nav'> {
|
|
|
54
54
|
style?: React.CSSProperties
|
|
55
55
|
/** 面包屑栈 */
|
|
56
56
|
items?: BreadcrumbItemType[]
|
|
57
|
-
/**
|
|
57
|
+
/** 自定义上级路径项渲染;栏目标题和末项始终直接展示 title */
|
|
58
58
|
itemRender?: BreadcrumbItemRender
|
|
59
59
|
/** `path` 占位符 `:key` 的替换表 */
|
|
60
60
|
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 `type="text"` 的 medium 尺寸,消费 `--button-text-default`
|
|
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.
|
|
5
|
+
版本:`1.3.0`。组件源码在本目录,属于当前项目。
|
|
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: '
|
|
19
|
+
{ type: 'section', title: '项目管理' },
|
|
20
20
|
{ title: 'Button', href: '/components/button' },
|
|
21
|
-
{ title: 'Breadcrumb' },
|
|
21
|
+
{ title: 'Breadcrumb', href: '/components/breadcrumb' },
|
|
22
22
|
]
|
|
23
23
|
|
|
24
24
|
export default () => <Breadcrumb items={items} separator={<BreadcrumbSeparatorIcon />} />
|
|
@@ -41,7 +41,7 @@ export default () => <Breadcrumb items={items} separator={<BreadcrumbSeparatorIc
|
|
|
41
41
|
| className | 根节点类名(最外层 `<nav>`) | `string` | 否 | — |
|
|
42
42
|
| style | 根节点内联样式(最外层 `<nav>`) | `React.CSSProperties` | 否 | — |
|
|
43
43
|
| items | 面包屑栈 | `BreadcrumbItemType[]` | 否 | — |
|
|
44
|
-
| itemRender |
|
|
44
|
+
| itemRender | 自定义上级路径项渲染;栏目标题和末项始终直接展示 title | `BreadcrumbItemRender` | 否 | — |
|
|
45
45
|
| params | `path` 占位符 `:key` 的替换表 | `Record<string, string \| number>` | 否 | — |
|
|
46
46
|
| separator | 项间分隔符;未传则渲染内置竖向 Divider | `React.ReactNode` | 否 | — |
|
|
47
47
|
|
|
@@ -51,12 +51,12 @@ export default () => <Breadcrumb items={items} separator={<BreadcrumbSeparatorIc
|
|
|
51
51
|
|
|
52
52
|
| 属性 | 说明 | 类型 | 必填 | 默认值 |
|
|
53
53
|
| --- | --- | --- | --- | --- |
|
|
54
|
-
| type |
|
|
54
|
+
| type | 栏目标题项;仅展示 title,不可点击;使用 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
|
+
自定义项渲染
|
|
81
81
|
|
|
82
82
|
```typescript
|
|
83
83
|
type BreadcrumbItemRender = (
|
|
@@ -117,11 +117,10 @@ import { Breadcrumb, BreadcrumbSeparatorIcon } from '@/components/apex/breadcrum
|
|
|
117
117
|
|
|
118
118
|
const link = (title: string): BreadcrumbItemType => ({
|
|
119
119
|
title,
|
|
120
|
-
href: '
|
|
121
|
-
onClick: (e) => e.preventDefault(),
|
|
120
|
+
href: title === '首页' ? '/' : '/components/button',
|
|
122
121
|
})
|
|
123
122
|
|
|
124
|
-
const items: BreadcrumbItemType[] = [link('首页'), link('
|
|
123
|
+
const items: BreadcrumbItemType[] = [link('首页'), link('Button'), { title: 'Breadcrumb' }]
|
|
125
124
|
|
|
126
125
|
export default () => (
|
|
127
126
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 24 }}>
|
|
@@ -143,10 +142,10 @@ import type { BreadcrumbItemType } from '@/components/apex/breadcrumb'
|
|
|
143
142
|
import { Breadcrumb, BreadcrumbSeparatorIcon } from '@/components/apex/breadcrumb'
|
|
144
143
|
|
|
145
144
|
const items: BreadcrumbItemType[] = [
|
|
146
|
-
{ title: '首页', href: '
|
|
145
|
+
{ title: '首页', href: '/' },
|
|
147
146
|
{ type: 'separator' },
|
|
148
|
-
{ title: '
|
|
149
|
-
{ title: '
|
|
147
|
+
{ title: 'Button', href: '/components/button' },
|
|
148
|
+
{ title: 'Breadcrumb' },
|
|
150
149
|
]
|
|
151
150
|
|
|
152
151
|
export default () => <Breadcrumb separator={<BreadcrumbSeparatorIcon />} items={items} />
|
|
@@ -154,7 +153,7 @@ export default () => <Breadcrumb separator={<BreadcrumbSeparatorIcon />} items={
|
|
|
154
153
|
|
|
155
154
|
### 路径参数与自定义渲染
|
|
156
155
|
|
|
157
|
-
通过 `path` 与 `params` 拼接路径,也可以用 `itemRender`
|
|
156
|
+
通过 `path` 与 `params` 拼接路径,也可以用 `itemRender` 自定义上级路径项。栏目标题和当前页始终直接展示 `title`,不调用 `itemRender`,避免自定义链接让当前页重复跳转。
|
|
158
157
|
|
|
159
158
|
```tsx
|
|
160
159
|
import type { BreadcrumbItemRender, BreadcrumbItemType } from '@/components/apex/breadcrumb'
|
|
@@ -162,47 +161,33 @@ import type { BreadcrumbItemRender, BreadcrumbItemType } from '@/components/apex
|
|
|
162
161
|
import { Breadcrumb } from '@/components/apex/breadcrumb'
|
|
163
162
|
|
|
164
163
|
const items: BreadcrumbItemType[] = [
|
|
165
|
-
{ title: '
|
|
166
|
-
{ title: '
|
|
167
|
-
{ title: '
|
|
164
|
+
{ title: '首页', href: '/' },
|
|
165
|
+
{ title: 'Button', path: 'components/:slug' },
|
|
166
|
+
{ title: 'Breadcrumb' },
|
|
168
167
|
]
|
|
169
168
|
|
|
170
169
|
const itemRender: BreadcrumbItemRender = (route, _params, _routes, paths) => {
|
|
171
170
|
const routeItems = _routes.filter((item) => !('type' in item && item.type === 'separator'))
|
|
172
171
|
const href = paths[routeItems.indexOf(route)]
|
|
173
172
|
if (!href) return route.title
|
|
174
|
-
return
|
|
175
|
-
<a href={href} onClick={(event) => event.preventDefault()}>
|
|
176
|
-
{route.title}
|
|
177
|
-
</a>
|
|
178
|
-
)
|
|
173
|
+
return <a href={href}>{route.title}</a>
|
|
179
174
|
}
|
|
180
175
|
|
|
181
|
-
export default () =>
|
|
176
|
+
export default () => (
|
|
177
|
+
<Breadcrumb items={items} params={{ slug: 'button' }} itemRender={itemRender} />
|
|
178
|
+
)
|
|
182
179
|
```
|
|
183
180
|
|
|
184
181
|
### 自定义链接
|
|
185
182
|
|
|
186
|
-
`Breadcrumb.Link` 支持 `asChild
|
|
183
|
+
`Breadcrumb.Link` 支持 `asChild`,可将链接属性合并到路由组件或自定义链接上。示例链接到真实的 Button 文档;在产品中可以把子元素替换为已有路由库的 Link。
|
|
187
184
|
|
|
188
185
|
```tsx
|
|
189
186
|
import { Breadcrumb } from '@/components/apex/breadcrumb'
|
|
190
187
|
|
|
191
|
-
import type * as React from 'react'
|
|
192
|
-
|
|
193
|
-
const RouterLink = ({
|
|
194
|
-
href,
|
|
195
|
-
children,
|
|
196
|
-
...props
|
|
197
|
-
}: React.AnchorHTMLAttributes<HTMLAnchorElement>) => (
|
|
198
|
-
<a href={href} onClick={(event) => event.preventDefault()} {...props}>
|
|
199
|
-
{children}
|
|
200
|
-
</a>
|
|
201
|
-
)
|
|
202
|
-
|
|
203
188
|
export default () => (
|
|
204
189
|
<Breadcrumb.Link asChild>
|
|
205
|
-
<
|
|
190
|
+
<a href="/components/button">查看 Button 文档</a>
|
|
206
191
|
</Breadcrumb.Link>
|
|
207
192
|
)
|
|
208
193
|
```
|
|
@@ -229,8 +214,7 @@ const items: BreadcrumbItemType[] = [
|
|
|
229
214
|
<HomeIcon /> 首页
|
|
230
215
|
</>
|
|
231
216
|
),
|
|
232
|
-
href: '
|
|
233
|
-
onClick: (e) => e.preventDefault(),
|
|
217
|
+
href: '/',
|
|
234
218
|
},
|
|
235
219
|
{ title: '文档' },
|
|
236
220
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Breadcrumb Token 明细
|
|
2
2
|
|
|
3
|
-
包:`@apexhub/apex-ui-react`;版本:`1.
|
|
3
|
+
包:`@apexhub/apex-ui-react`;版本:`1.3.0`(当前源码快照)。
|
|
4
4
|
|
|
5
5
|
按需读取:[组件用法](./llm.txt) · [主题与覆盖规则](../../llms-theme.txt)。
|
|
6
6
|
|
|
@@ -12,25 +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-icon-
|
|
16
|
-
| `--button-icon-
|
|
17
|
-
| `--button-icon-
|
|
18
|
-
| `--button-icon-
|
|
19
|
-
| `--button-icon-
|
|
20
|
-
| `--button-icon-
|
|
21
|
-
| `--button-icon-
|
|
22
|
-
| `--button-icon-
|
|
23
|
-
| `--button-icon-
|
|
24
|
-
| `--button-icon-
|
|
25
|
-
| `--button-icon-
|
|
26
|
-
| `--button-icon-
|
|
27
|
-
| `--button-icon-
|
|
28
|
-
| `--button-icon-
|
|
29
|
-
| `--button-icon-
|
|
30
|
-
| `--button-icon-
|
|
31
|
-
| `--button-icon-
|
|
32
|
-
| `--button-icon-
|
|
33
|
-
| `--button-icon-
|
|
15
|
+
| `--button-icon-default` | `color` | `var(--apex-icon-error-primary)` | `.apex-button.apex-icon-error-button` |
|
|
16
|
+
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-secondary)` | `.apex-button.apex-icon-primary-button` |
|
|
17
|
+
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-secondary)` | `.apex-button.apex-icon-secondary-button` |
|
|
18
|
+
| `--button-icon-default` | `color` | `var(--apex-icon-success-primary)` | `.apex-button.apex-icon-success-button` |
|
|
19
|
+
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-secondary)` | `.apex-button.apex-icon-transparent-button` |
|
|
20
|
+
| `--button-icon-default` | `color` | `var(--apex-icon-warning-primary)` | `.apex-button.apex-icon-warning-button` |
|
|
21
|
+
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-primary)` | `.apex-button.apex-link-default-button` |
|
|
22
|
+
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-inverse)` | `.apex-button.apex-main-default-button` |
|
|
23
|
+
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-inverse)` | `.apex-button.apex-main-error-button` |
|
|
24
|
+
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-inverse)` | `.apex-button.apex-main-success-button` |
|
|
25
|
+
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-inverse)` | `.apex-button.apex-main-warning-button` |
|
|
26
|
+
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-primary)` | `.apex-button.apex-outline-brand-button` |
|
|
27
|
+
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-primary)` | `.apex-button.apex-outline-default-button` |
|
|
28
|
+
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-primary)` | `.apex-button.apex-outline-error-button` |
|
|
29
|
+
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-primary)` | `.apex-button.apex-outline-success-button` |
|
|
30
|
+
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-primary)` | `.apex-button.apex-outline-warning-button` |
|
|
31
|
+
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-primary)` | `.apex-button.apex-secondary-default-button` |
|
|
32
|
+
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-primary)` | `.apex-button.apex-text-default-button` |
|
|
33
|
+
| `--button-icon-default` | `color` | `var(--apex-icon-neutral-primary)` | `.apex-button.apex-text-secondary-button` |
|
|
34
34
|
| `--button-icon-icon` | `height`、`width` | `var(--apex-icon-20)` | `.apex-button.apex-icon-md-button` |
|
|
35
35
|
| `--button-icon-icon` | `height`、`width` | `var(--apex-icon-16)` | `.apex-button.apex-icon-sm-button` |
|
|
36
36
|
| `--button-icon-icon` | `height`、`width` | `var(--apex-icon-16)` | `.apex-button.apex-link-md-button` |
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import '../button/button.css'
|
|
2
2
|
import { buttonVariants } from '../button/variants'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// Figma text button transparent uses the existing text-secondary palette.
|
|
5
|
+
export const breadcrumbItemClassName = `${buttonVariants({
|
|
5
6
|
variant: 'text',
|
|
6
|
-
tone:
|
|
7
|
+
tone: null,
|
|
7
8
|
size: 'medium',
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
export const breadcrumbCurrentClassName = buttonVariants({
|
|
11
|
-
variant: 'text',
|
|
12
|
-
tone: 'default',
|
|
13
|
-
size: 'medium',
|
|
14
|
-
})
|
|
9
|
+
})} apex-text-secondary-button`
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Button:标记一个或多个操作(提交、确认、跳转等)时。
|
|
4
4
|
|
|
5
|
-
版本:`1.
|
|
5
|
+
版本:`1.3.0`。组件源码在本目录,属于当前项目。
|
|
6
6
|
|
|
7
7
|
公开导出:`Button`。
|
|
8
8
|
|
|
@@ -151,11 +151,20 @@ export default () => (
|
|
|
151
151
|
|
|
152
152
|
### 图标
|
|
153
153
|
|
|
154
|
-
通过 `icon` 在文案前插入图标,`suffixIcon` 在文案后插入图标;`loading` 时前置 icon 会被 loading
|
|
154
|
+
通过 `icon` 在文案前插入图标,`suffixIcon` 在文案后插入图标;`loading` 时前置 icon 会被 loading 指示器替换。新增操作的加号采用 Figma [Broken / Arrows / add](https://www.figma.com/design/S7j3qBSUvilwYoGe4vO876/Hero-icons?node-id=347-554&m=dev) 的图形,下面的 `AddIcon` 示例保留其路径和画板比例,颜色跟随按钮文字。
|
|
155
155
|
|
|
156
156
|
```tsx
|
|
157
157
|
import { Button } from '@/components/apex/button'
|
|
158
158
|
|
|
159
|
+
const AddIcon = () => (
|
|
160
|
+
<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" aria-hidden="true">
|
|
161
|
+
<path
|
|
162
|
+
d="M11.25 19V12.75H5C4.58579 12.75 4.25 12.4142 4.25 12C4.25003 11.5858 4.58581 11.25 5 11.25H11.25V5C11.25 4.58579 11.5858 4.25 12 4.25C12.4142 4.25 12.75 4.58579 12.75 5V11.25H19C19.4142 11.25 19.75 11.5858 19.75 12C19.75 12.4142 19.4142 12.75 19 12.75H12.75V19C12.75 19.4142 12.4142 19.75 12 19.75C11.5858 19.75 11.25 19.4142 11.25 19Z"
|
|
163
|
+
fill="currentColor"
|
|
164
|
+
/>
|
|
165
|
+
</svg>
|
|
166
|
+
)
|
|
167
|
+
|
|
159
168
|
const StarIcon = () => (
|
|
160
169
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor" aria-hidden>
|
|
161
170
|
<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z" />
|
|
@@ -164,6 +173,9 @@ const StarIcon = () => (
|
|
|
164
173
|
|
|
165
174
|
export default () => (
|
|
166
175
|
<div style={{ display: 'flex', gap: 12, alignItems: 'center', flexWrap: 'wrap' }}>
|
|
176
|
+
<Button type="primary" icon={<AddIcon />}>
|
|
177
|
+
新增供应商
|
|
178
|
+
</Button>
|
|
167
179
|
<Button icon={<StarIcon />}>带图标</Button>
|
|
168
180
|
<Button type="primary" icon={<StarIcon />}>
|
|
169
181
|
主要带图标
|
package/dist/files/card/llm.txt
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Checkbox:用户可从多个选项中任选零个、一个或多个时(与 Radio 互斥单选相对)。
|
|
4
4
|
|
|
5
|
-
版本:`1.
|
|
5
|
+
版本:`1.3.0`。组件源码在本目录,属于当前项目。
|
|
6
6
|
|
|
7
7
|
公开导出:`Checkbox`、`CheckboxGroup`。
|
|
8
8
|
|
|
@@ -174,6 +174,7 @@ export default () => (
|
|
|
174
174
|
|
|
175
175
|
```tsx
|
|
176
176
|
import { Checkbox } from '@/components/apex/checkbox'
|
|
177
|
+
import { Typography } from '@/components/apex/typography'
|
|
177
178
|
|
|
178
179
|
import { useState } from 'react'
|
|
179
180
|
|
|
@@ -184,7 +185,7 @@ export default () => {
|
|
|
184
185
|
<Checkbox checked={checked} onChange={(e) => setChecked(e.target.checked)}>
|
|
185
186
|
受控复选框
|
|
186
187
|
</Checkbox>
|
|
187
|
-
<
|
|
188
|
+
<Typography.Text variant="caption">状态:{checked ? '已选中' : '未选中'}</Typography.Text>
|
|
188
189
|
</div>
|
|
189
190
|
)
|
|
190
191
|
}
|
|
@@ -214,6 +215,7 @@ export default () => (
|
|
|
214
215
|
import type { CheckboxOption } from '@/components/apex/checkbox'
|
|
215
216
|
|
|
216
217
|
import { Checkbox } from '@/components/apex/checkbox'
|
|
218
|
+
import { Typography } from '@/components/apex/typography'
|
|
217
219
|
|
|
218
220
|
import { useState } from 'react'
|
|
219
221
|
|
|
@@ -228,9 +230,9 @@ export default () => {
|
|
|
228
230
|
return (
|
|
229
231
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
|
230
232
|
<Checkbox.Group options={options} value={value} onChange={setValue} />
|
|
231
|
-
<
|
|
233
|
+
<Typography.Text variant="caption">
|
|
232
234
|
已选:{value.length === 0 ? '(空)' : value.map(String).join(', ')}
|
|
233
|
-
</
|
|
235
|
+
</Typography.Text>
|
|
234
236
|
</div>
|
|
235
237
|
)
|
|
236
238
|
}
|