@apexhub/apex-ui-react-source 1.2.1 → 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/bin/apex-ui-react-source.mjs +0 -0
- package/dist/files/AGENTS.md +1 -1
- 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 +24 -10
|
@@ -2,7 +2,7 @@ import type * as React from 'react'
|
|
|
2
2
|
|
|
3
3
|
export type TagVariant = 'filled' | 'solid' | 'outlined'
|
|
4
4
|
|
|
5
|
-
export type TagPresetColor = 'default' | 'brand' | 'success' | 'warning' | 'error'
|
|
5
|
+
export type TagPresetColor = 'default' | 'brand' | 'success' | 'warning' | 'error' | 'grey'
|
|
6
6
|
|
|
7
7
|
export type TagColor = TagPresetColor | string
|
|
8
8
|
|
|
@@ -25,7 +25,7 @@ export interface TagProps extends Omit<React.HTMLAttributes<HTMLElement>, 'color
|
|
|
25
25
|
* 标签色(支持预设值与自定义色字符串)。
|
|
26
26
|
* 自定义字符串会作为 `backgroundColor` / `borderColor` 注入 inline style;
|
|
27
27
|
* `data-color` 同步输出原始值,便于消费方覆盖。
|
|
28
|
-
* @default '
|
|
28
|
+
* @default 'grey'
|
|
29
29
|
*/
|
|
30
30
|
color?: TagColor
|
|
31
31
|
/**
|
package/dist/files/tag/llm.txt
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Tag:需要标记状态、分类、属性等短文本信息时(如「进行中」「VIP」)。
|
|
4
4
|
|
|
5
|
-
版本:`1.2.
|
|
5
|
+
版本:`1.2.2`。组件源码在本目录,属于当前项目。
|
|
6
6
|
|
|
7
7
|
公开导出:`Tag`。
|
|
8
8
|
|
|
@@ -31,7 +31,7 @@ export default () => <Tag>默认标签</Tag>
|
|
|
31
31
|
| 属性 | 说明 | 类型 | 必填 | 默认值 |
|
|
32
32
|
| --- | --- | --- | --- | --- |
|
|
33
33
|
| closeIcon | 自定义关闭按钮。`false`/`null` 隐藏,`true` 使用默认图标,传入 ReactNode 自定义。 | `React.ReactNode` | 否 | `false` |
|
|
34
|
-
| color | 标签色(支持预设值与自定义色字符串)。<br>自定义字符串会作为 `backgroundColor` / `borderColor` 注入 inline style;<br>`data-color` 同步输出原始值,便于消费方覆盖。 | `TagColor` | 否 | `'
|
|
34
|
+
| color | 标签色(支持预设值与自定义色字符串)。<br>自定义字符串会作为 `backgroundColor` / `borderColor` 注入 inline style;<br>`data-color` 同步输出原始值,便于消费方覆盖。 | `TagColor` | 否 | `'grey'` |
|
|
35
35
|
| disabled | 是否禁用标签交互。 | `boolean` | 否 | `false` |
|
|
36
36
|
| href | 点击跳转地址,存在时渲染为 a 标签。 | `string` | 否 | — |
|
|
37
37
|
| target | a 标签 target,href 存在时生效。 | `string` | 否 | — |
|
|
@@ -50,7 +50,7 @@ type TagVariant = 'filled' | 'solid' | 'outlined'
|
|
|
50
50
|
### TagPresetColor
|
|
51
51
|
|
|
52
52
|
```typescript
|
|
53
|
-
type TagPresetColor = 'default' | 'brand' | 'success' | 'warning' | 'error'
|
|
53
|
+
type TagPresetColor = 'default' | 'brand' | 'success' | 'warning' | 'error' | 'grey'
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
### TagColor
|
|
@@ -73,7 +73,7 @@ type TagSize = 'lg' | 'md' | 'sm'
|
|
|
73
73
|
|
|
74
74
|
### 样式变体
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
当前设计 Token 支持浅底 `filled` 和中性描边 `outlined` 两种预设视觉样式。
|
|
77
77
|
|
|
78
78
|
```tsx
|
|
79
79
|
import { Tag } from '@/components/apex/tag'
|
|
@@ -81,7 +81,6 @@ import { Tag } from '@/components/apex/tag'
|
|
|
81
81
|
export default () => (
|
|
82
82
|
<div style={{ display: 'flex', gap: 8, flexWrap: 'wrap' }}>
|
|
83
83
|
<Tag variant="filled">Filled</Tag>
|
|
84
|
-
<Tag variant="solid">Solid</Tag>
|
|
85
84
|
<Tag variant="outlined">Outlined</Tag>
|
|
86
85
|
</div>
|
|
87
86
|
)
|
|
@@ -89,7 +88,7 @@ export default () => (
|
|
|
89
88
|
|
|
90
89
|
### 多彩标签
|
|
91
90
|
|
|
92
|
-
使用 `color` 表示语义色,也可以传入具体色值满足临时标记场景。
|
|
91
|
+
使用 `color` 表示语义色,也可以传入具体色值满足临时标记场景。React 版提供 `grey` 预设。`solid` 暂无预设色 Token,不用于预设色示例。
|
|
93
92
|
|
|
94
93
|
```tsx
|
|
95
94
|
import type { TagPresetColor, TagVariant } from '@/components/apex/tag'
|
|
@@ -97,9 +96,9 @@ import type { TagPresetColor, TagVariant } from '@/components/apex/tag'
|
|
|
97
96
|
import { Divider } from '@/components/apex/divider'
|
|
98
97
|
import { Tag } from '@/components/apex/tag'
|
|
99
98
|
|
|
100
|
-
const variants: TagVariant[] = ['filled', '
|
|
99
|
+
const variants: TagVariant[] = ['filled', 'outlined']
|
|
101
100
|
|
|
102
|
-
const presets: TagPresetColor[] = ['
|
|
101
|
+
const presets: TagPresetColor[] = ['grey', 'brand', 'success', 'warning', 'error']
|
|
103
102
|
|
|
104
103
|
const customs = ['#f50', '#2db7f5', '#87d068', '#108ee9']
|
|
105
104
|
|
package/dist/files/tag/tag.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Tag 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
|
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
| `--font-fontheight` | `line-height` | `var(--apex-fontheight-24)` | `.apex-font.apex-text-en-heading-3-font` |
|
|
24
24
|
| `--font-fontheight` | `line-height` | `var(--apex-fontheight-24)` | `.apex-font.apex-text-en-heading-4-font` |
|
|
25
25
|
| `--tag-active` | `color` | `var(--apex-icon-neutral-tertiary)` | `.apex-tag.apex-close-tag` |
|
|
26
|
-
| `--tag-default` | `color` | `var(--apex-icon-neutral-primary)` | `.apex-tag.apex-close-tag` |
|
|
27
26
|
| `--tag-fill-default` | `background-color` | `var(--apex-fill-brand-alpha-secondary)` | `.apex-tag.apex-filled-default-brand-tag` |
|
|
28
27
|
| `--tag-fill-default` | `background-color` | `var(--apex-fill-neutral-secondary)` | `.apex-tag.apex-filled-default-default-tag` |
|
|
29
28
|
| `--tag-fill-default` | `background-color` | `var(--apex-fill-error-alpha-secondary)` | `.apex-tag.apex-filled-default-error-tag` |
|
|
@@ -2,7 +2,14 @@ import type { CSSProperties } from 'react'
|
|
|
2
2
|
import { cn } from '../utils/cn'
|
|
3
3
|
import type { TagColor, TagPresetColor, TagSize, TagVariant } from './interface'
|
|
4
4
|
|
|
5
|
-
const PRESET_COLORS = new Set<TagPresetColor>([
|
|
5
|
+
const PRESET_COLORS = new Set<TagPresetColor>([
|
|
6
|
+
'default',
|
|
7
|
+
'brand',
|
|
8
|
+
'success',
|
|
9
|
+
'warning',
|
|
10
|
+
'error',
|
|
11
|
+
'grey',
|
|
12
|
+
])
|
|
6
13
|
|
|
7
14
|
const SIZE_SCOPE: Record<TagSize, string> = {
|
|
8
15
|
sm: 'apex-sm-tag',
|
|
@@ -15,7 +22,7 @@ export function isPresetColor(color: TagColor | undefined): color is TagPresetCo
|
|
|
15
22
|
}
|
|
16
23
|
|
|
17
24
|
export function resolveTagColor(color: TagColor | undefined): TagColor {
|
|
18
|
-
return color ?? '
|
|
25
|
+
return color ?? 'grey'
|
|
19
26
|
}
|
|
20
27
|
|
|
21
28
|
/** filled → filled-default-*(filled-status-* 预留给后续 status 形态 API) */
|
|
@@ -23,6 +30,9 @@ function colorScopeClass(variant: TagVariant, preset: TagPresetColor): string {
|
|
|
23
30
|
if (variant === 'filled') {
|
|
24
31
|
return `apex-filled-default-${preset}-tag`
|
|
25
32
|
}
|
|
33
|
+
if (variant === 'outlined') {
|
|
34
|
+
return 'apex-outlined-default-tag'
|
|
35
|
+
}
|
|
26
36
|
return `apex-${variant}-${preset}-tag`
|
|
27
37
|
}
|
|
28
38
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* ==========================================================================
|
|
2
2
|
Apex UI Design Tokens — Auto-generated
|
|
3
|
-
Generated at 2026-11-
|
|
3
|
+
Generated at 2026-11-19 04:41:15 from tokens — aliases layer (foundation, 卡片 Demo / 单选状态)
|
|
4
4
|
DO NOT EDIT MANUALLY. Run `apex-ui theme` / `apex-ui build` to regenerate.
|
|
5
5
|
========================================================================== */
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* ==========================================================================
|
|
2
2
|
Apex UI Component Tokens — Auto-generated (scoped)
|
|
3
|
-
Generated at 2026-11-
|
|
3
|
+
Generated at 2026-11-19 04:41:15 from tokens — component layer (component, component usage)
|
|
4
4
|
DO NOT EDIT MANUALLY. Run `apex-ui theme` / `apex-ui build` to regenerate.
|
|
5
5
|
========================================================================== */
|
|
6
6
|
|
|
@@ -1082,8 +1082,8 @@
|
|
|
1082
1082
|
--input-stroke-focused: var(--apex-stroke-brand-primary);
|
|
1083
1083
|
--input-stroke-hover: var(--apex-stroke-neutral-quinary);
|
|
1084
1084
|
--input-text-filled-default: var(--apex-text-neutral-primary);
|
|
1085
|
-
--input-text-filled-disabled: var(--apex-text-neutral-
|
|
1086
|
-
--input-text-filled-error: var(--apex-text-neutral-
|
|
1085
|
+
--input-text-filled-disabled: var(--apex-text-neutral-disabled);
|
|
1086
|
+
--input-text-filled-error: var(--apex-text-neutral-primary);
|
|
1087
1087
|
--input-text-filled-focused: var(--apex-text-neutral-primary);
|
|
1088
1088
|
--input-text-filled-hover: var(--apex-text-neutral-primary);
|
|
1089
1089
|
--input-text-placeholder-default: var(--apex-text-neutral-tertiary);
|
|
@@ -1110,7 +1110,7 @@
|
|
|
1110
1110
|
--input-stroke-hover: var(--apex-stroke-neutral-quinary);
|
|
1111
1111
|
--input-text-filled-default: var(--apex-text-neutral-primary);
|
|
1112
1112
|
--input-text-filled-disabled: var(--apex-text-neutral-disabled);
|
|
1113
|
-
--input-text-filled-error: var(--apex-text-neutral-
|
|
1113
|
+
--input-text-filled-error: var(--apex-text-neutral-primary);
|
|
1114
1114
|
--input-text-filled-focused: var(--apex-text-neutral-primary);
|
|
1115
1115
|
--input-text-filled-hover: var(--apex-text-neutral-primary);
|
|
1116
1116
|
--input-text-placeholder-default: var(--apex-text-neutral-tertiary);
|
|
@@ -1514,13 +1514,13 @@
|
|
|
1514
1514
|
--radio-icon-icon: var(--apex-size-20);
|
|
1515
1515
|
--radio-spacing-gap: var(--apex-spacing-4);
|
|
1516
1516
|
--radio-stoke-stroke: var(--apex-border-1);
|
|
1517
|
-
--radio-stroke-active: var(--apex-stroke-neutral-
|
|
1517
|
+
--radio-stroke-active: var(--apex-stroke-neutral-septenary);
|
|
1518
1518
|
--radio-stroke-check-active: var(--apex-stroke-brand-tertiary);
|
|
1519
1519
|
--radio-stroke-check-hover: var(--apex-stroke-brand-secondary);
|
|
1520
1520
|
--radio-stroke-default: var(--apex-stroke-neutral-denary);
|
|
1521
1521
|
--radio-stroke-disabled: var(--apex-stroke-neutral-quinary);
|
|
1522
1522
|
--radio-stroke-error: var(--apex-stroke-error-primary);
|
|
1523
|
-
--radio-stroke-hover: var(--apex-stroke-neutral-
|
|
1523
|
+
--radio-stroke-hover: var(--apex-stroke-neutral-octonary);
|
|
1524
1524
|
--radio-stroke-selected: var(--apex-stroke-brand-primary);
|
|
1525
1525
|
--radio-text-active: var(--apex-text-neutral-tertiary);
|
|
1526
1526
|
--radio-text-default: var(--apex-text-neutral-primary);
|
|
@@ -1851,7 +1851,7 @@
|
|
|
1851
1851
|
--table-fill-content-color-2: var(--apex-green-alpha-6);
|
|
1852
1852
|
--table-fill-content-default: var(--apex-fill-neutral-secondary);
|
|
1853
1853
|
--table-fill-content-disabled: var(--apex-fill-neutral-primary);
|
|
1854
|
-
--table-fill-content-hover:
|
|
1854
|
+
--table-fill-content-hover: color-mix(in srgb, var(--apex-fill-neutral-tertiary) 80%, transparent);
|
|
1855
1855
|
--table-fill-content-loading: var(--apex-fill-neutral-tertiary);
|
|
1856
1856
|
--table-fill-content-selected: var(--apex-fill-neutral-quaternary);
|
|
1857
1857
|
--table-fill-header-default: var(--apex-fill-neutral-tertiary);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* ==========================================================================
|
|
2
2
|
Apex UI Design Tokens — Auto-generated
|
|
3
|
-
Generated at 2026-11-
|
|
3
|
+
Generated at 2026-11-19 04:41:15 from tokens — primitives layer (palette, base value)
|
|
4
4
|
DO NOT EDIT MANUALLY. Run `apex-ui theme` / `apex-ui build` to regenerate.
|
|
5
5
|
========================================================================== */
|
|
6
6
|
|
|
@@ -328,8 +328,8 @@ export const Tooltip: React.FC<TooltipProps> = ({
|
|
|
328
328
|
<svg
|
|
329
329
|
data-slot="tooltip-arrow"
|
|
330
330
|
className="apex-tooltip__arrow"
|
|
331
|
-
width={
|
|
332
|
-
height={
|
|
331
|
+
width={14}
|
|
332
|
+
height={7}
|
|
333
333
|
viewBox="0 0 30 10"
|
|
334
334
|
preserveAspectRatio="none"
|
|
335
335
|
aria-hidden
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Tooltip — 消费 component-tokens.css 局部变量(--tooltip-*)
|
|
3
3
|
========================================================================== */
|
|
4
4
|
|
|
5
|
-
:where(.apex-tooltip.apex-default-tooltip) {
|
|
5
|
+
:where(.apex-tooltip.apex-default-tooltip:not(.apex-popover)) {
|
|
6
6
|
display:flex;
|
|
7
7
|
justify-content: center;
|
|
8
8
|
align-items: center;
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
background-color: var(--tooltip-fill-default);
|
|
20
20
|
/* fill-image removed in token 8.4 */
|
|
21
21
|
color: var(--tooltip-text-default);
|
|
22
|
-
box-shadow: none;
|
|
23
22
|
overflow: visible;
|
|
24
23
|
}
|
|
25
24
|
|
|
@@ -69,7 +68,7 @@
|
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
.apex-tooltip[data-side='bottom'] .apex-tooltip__arrow {
|
|
72
|
-
margin-top:
|
|
71
|
+
margin-top: var(--tooltip-stroke-stroke);
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
.apex-tooltip[data-side='left'] .apex-tooltip__arrow,
|
package/dist/files/tree/Tree.tsx
CHANGED
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
deriveCascadeCheckedState,
|
|
40
40
|
expandParentIds,
|
|
41
41
|
findNodesByIds,
|
|
42
|
+
getCheckableDescendantKeyIds,
|
|
42
43
|
getDescendantKeyIds,
|
|
43
44
|
type InternalTreeItem,
|
|
44
45
|
keyToId,
|
|
@@ -565,28 +566,17 @@ export function Tree({
|
|
|
565
566
|
[checkStrictly, checkedKeys, onCheck],
|
|
566
567
|
)
|
|
567
568
|
|
|
568
|
-
/**
|
|
569
|
+
/** 级联勾选时计算下一 checked 集合,跳过禁用子树。 */
|
|
569
570
|
const predictNextCascadeCheckedIds = React.useCallback(
|
|
570
571
|
(checked: boolean, itemId: string): string[] => {
|
|
571
572
|
const current = checkedState.checked
|
|
572
573
|
const childIds = dataIndex.childrenByParent.get(itemId) ?? []
|
|
573
574
|
|
|
574
575
|
const collectLeafDescendantIds = (id: string): string[] => {
|
|
575
|
-
const leaves
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
if (currentId === undefined) break
|
|
580
|
-
const children = dataIndex.childrenByParent.get(currentId) ?? []
|
|
581
|
-
if (children.length === 0) {
|
|
582
|
-
leaves.push(currentId)
|
|
583
|
-
continue
|
|
584
|
-
}
|
|
585
|
-
for (let index = children.length - 1; index >= 0; index -= 1) {
|
|
586
|
-
pending.push(children[index])
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
return leaves
|
|
576
|
+
const leaves = getCheckableDescendantKeyIds(id, dataIndex).filter(
|
|
577
|
+
(childId) => (dataIndex.childrenByParent.get(childId)?.length ?? 0) === 0,
|
|
578
|
+
)
|
|
579
|
+
return leaves.length > 0 ? leaves : [id]
|
|
590
580
|
}
|
|
591
581
|
|
|
592
582
|
if (checked) {
|
|
@@ -598,7 +588,7 @@ export function Tree({
|
|
|
598
588
|
}
|
|
599
589
|
|
|
600
590
|
if (childIds.length > 0) {
|
|
601
|
-
const descendants = new Set(
|
|
591
|
+
const descendants = new Set(getCheckableDescendantKeyIds(itemId, dataIndex))
|
|
602
592
|
descendants.add(itemId)
|
|
603
593
|
return current.filter((id) => !descendants.has(id))
|
|
604
594
|
}
|
|
@@ -700,28 +690,8 @@ export function Tree({
|
|
|
700
690
|
},
|
|
701
691
|
halfCheckedKeys: [],
|
|
702
692
|
})
|
|
703
|
-
|
|
704
|
-
// 受控 Tree 会由 checkedKeys 在父层同步回填;再次调用 headless-tree 的
|
|
705
|
-
// 递归级联只会重复遍历整棵子树。非受控模式仍保留其状态更新能力。
|
|
706
|
-
if (checkedKeys === undefined) {
|
|
707
|
-
void (async () => {
|
|
708
|
-
if (checked) {
|
|
709
|
-
await item.setChecked()
|
|
710
|
-
} else {
|
|
711
|
-
await item.setUnchecked()
|
|
712
|
-
}
|
|
713
|
-
})()
|
|
714
|
-
}
|
|
715
693
|
},
|
|
716
|
-
[
|
|
717
|
-
checkStrictly,
|
|
718
|
-
checkedKeys,
|
|
719
|
-
checkedState,
|
|
720
|
-
dataIndex,
|
|
721
|
-
fireCheck,
|
|
722
|
-
predictNextCascadeCheckedIds,
|
|
723
|
-
tree,
|
|
724
|
-
],
|
|
694
|
+
[checkStrictly, checkedState, dataIndex, fireCheck, predictNextCascadeCheckedIds, tree],
|
|
725
695
|
)
|
|
726
696
|
|
|
727
697
|
const handleCheckboxChange = React.useCallback(
|
package/dist/files/tree/llm.txt
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Tree:需要展示具有父子层级关系的数据(目录、组织架构、权限树等)时。
|
|
4
4
|
|
|
5
|
-
版本:`1.2.
|
|
5
|
+
版本:`1.2.2`。组件源码在本目录,属于当前项目。
|
|
6
6
|
|
|
7
7
|
公开导出:`Tree`。
|
|
8
8
|
|
|
@@ -296,31 +296,27 @@ Tree 实例方法(通过 `ref` 获取)
|
|
|
296
296
|
|
|
297
297
|
### 勾选
|
|
298
298
|
|
|
299
|
-
设置 `checkable` 显示勾选框,配合 `checkedKeys` / 勾选变化事件
|
|
299
|
+
设置 `checkable` 显示勾选框,配合 `checkedKeys` / 勾选变化事件 管理勾选状态。示例预选一个子节点,父节点显示半选;点击父节点可勾选其余可用子节点,禁用子节点保持未选。
|
|
300
300
|
|
|
301
301
|
```tsx
|
|
302
|
-
import { Tree } from '@/components/apex/tree'
|
|
303
|
-
|
|
304
302
|
import type { TreeDataNode } from '@/components/apex/tree'
|
|
305
303
|
|
|
306
|
-
|
|
304
|
+
import { Tree } from '@/components/apex/tree'
|
|
305
|
+
|
|
306
|
+
const treeData: TreeDataNode[] = [
|
|
307
307
|
{
|
|
308
|
-
key: '
|
|
309
|
-
title: '
|
|
308
|
+
key: 'team',
|
|
309
|
+
title: '项目组',
|
|
310
310
|
children: [
|
|
311
|
-
{ key: '
|
|
312
|
-
{ key: '
|
|
311
|
+
{ key: 'design', title: '设计' },
|
|
312
|
+
{ key: 'engineering', title: '研发' },
|
|
313
|
+
{ key: 'archived', title: '已归档', disabled: true },
|
|
313
314
|
],
|
|
314
315
|
},
|
|
315
|
-
{
|
|
316
|
-
key: '0-1',
|
|
317
|
-
title: '父节点 1',
|
|
318
|
-
children: [{ key: '0-1-0', title: '叶子 0-1-0' }],
|
|
319
|
-
},
|
|
320
316
|
]
|
|
321
317
|
|
|
322
318
|
export default () => (
|
|
323
|
-
<Tree treeData={
|
|
319
|
+
<Tree treeData={treeData} checkable defaultExpandAll defaultCheckedKeys={['design']} />
|
|
324
320
|
)
|
|
325
321
|
```
|
|
326
322
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Tree 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
|
|
|
@@ -30,7 +30,5 @@
|
|
|
30
30
|
| `--tree-icon-icon-navigation-content` | `font-size`、`height`、`width` | `var(--apex-icon-20)` | `.apex-tree.apex-sm-tree` |
|
|
31
31
|
| `--tree-spacing-gap-container` | `gap`、`padding-bottom` | `var(--apex-spacing-8)` | `.apex-tree.apex-md-tree` |
|
|
32
32
|
| `--tree-spacing-gap-container` | `gap`、`padding-bottom` | `var(--apex-spacing-4)` | `.apex-tree.apex-sm-tree` |
|
|
33
|
-
| `--tree-spacing-gap-content` | `gap` | `var(--apex-spacing-4)` | `.apex-tree.apex-md-tree` |
|
|
34
|
-
| `--tree-spacing-gap-content` | `gap` | `var(--apex-spacing-4)` | `.apex-tree.apex-sm-tree` |
|
|
35
33
|
| `--tree-spacing-padding-x-left-container` | `flex`、`padding-left`、`width` | `var(--apex-spacing-24)` | `.apex-tree.apex-md-tree` |
|
|
36
34
|
| `--tree-spacing-padding-x-left-container` | `flex`、`padding-left`、`width` | `var(--apex-spacing-24)` | `.apex-tree.apex-sm-tree` |
|
|
@@ -141,6 +141,23 @@ export function getDescendantKeyIds(keyId: string, index: TreeDataIndex): string
|
|
|
141
141
|
return result
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
export function getCheckableDescendantKeyIds(keyId: string, index: TreeDataIndex): string[] {
|
|
145
|
+
const result: string[] = []
|
|
146
|
+
const pending = [...(index.childrenByParent.get(keyId) ?? [])].reverse()
|
|
147
|
+
while (pending.length > 0) {
|
|
148
|
+
const id = pending.pop()
|
|
149
|
+
if (id === undefined) break
|
|
150
|
+
const node = index.items.get(id)?.node
|
|
151
|
+
if (node?.disabled || node?.disableCheckbox) continue
|
|
152
|
+
result.push(id)
|
|
153
|
+
const children = index.childrenByParent.get(id) ?? []
|
|
154
|
+
for (let position = children.length - 1; position >= 0; position -= 1) {
|
|
155
|
+
pending.push(children[position])
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return result
|
|
159
|
+
}
|
|
160
|
+
|
|
144
161
|
export function findNodesByIds(index: TreeDataIndex, ids: string[]): TreeDataNode[] {
|
|
145
162
|
return ids
|
|
146
163
|
.map((id) => index.items.get(id)?.node)
|
|
@@ -164,14 +181,25 @@ export function deriveCascadeCheckedState(
|
|
|
164
181
|
|
|
165
182
|
for (let indexPosition = itemIds.length - 1; indexPosition >= 0; indexPosition -= 1) {
|
|
166
183
|
const itemId = itemIds[indexPosition]
|
|
167
|
-
|
|
184
|
+
const node = index.items.get(itemId)?.node
|
|
185
|
+
if (
|
|
186
|
+
itemId === APEX_TREE_ROOT_ID ||
|
|
187
|
+
checked.has(itemId) ||
|
|
188
|
+
node?.disabled ||
|
|
189
|
+
node?.disableCheckbox
|
|
190
|
+
)
|
|
191
|
+
continue
|
|
168
192
|
|
|
169
193
|
const childIds = index.childrenByParent.get(itemId) ?? []
|
|
170
194
|
if (childIds.length === 0) continue
|
|
171
195
|
|
|
172
196
|
let hasCheckedChild = false
|
|
173
197
|
let allChildrenChecked = true
|
|
198
|
+
let hasCheckableChild = false
|
|
174
199
|
for (const childId of childIds) {
|
|
200
|
+
const child = index.items.get(childId)?.node
|
|
201
|
+
if (child?.disabled || child?.disableCheckbox) continue
|
|
202
|
+
hasCheckableChild = true
|
|
175
203
|
if (checked.has(childId)) {
|
|
176
204
|
hasCheckedChild = true
|
|
177
205
|
continue
|
|
@@ -180,7 +208,7 @@ export function deriveCascadeCheckedState(
|
|
|
180
208
|
if (halfChecked.has(childId)) hasCheckedChild = true
|
|
181
209
|
}
|
|
182
210
|
|
|
183
|
-
if (allChildrenChecked) checked.add(itemId)
|
|
211
|
+
if (hasCheckableChild && allChildrenChecked) checked.add(itemId)
|
|
184
212
|
else if (hasCheckedChild) halfChecked.add(itemId)
|
|
185
213
|
}
|
|
186
214
|
|
package/dist/files/tree/tree.css
CHANGED
|
@@ -88,11 +88,16 @@
|
|
|
88
88
|
flex: 1 1 auto;
|
|
89
89
|
flex-direction: row;
|
|
90
90
|
align-items: center;
|
|
91
|
-
gap: var(--
|
|
91
|
+
gap: var(--apex-spacing-4);
|
|
92
92
|
min-width: 0;
|
|
93
93
|
box-sizing: border-box;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
.apex-tree__content:has(> .apex-tree__title-zone[data-highlighted]:not([data-selected])) {
|
|
97
|
+
border-radius: var(--dropdown-radius-item);
|
|
98
|
+
background-color: var(--dropdown-fill-hover);
|
|
99
|
+
}
|
|
100
|
+
|
|
96
101
|
/* ── 分区交互(对齐 dropdown.css 项态,但限定在 .apex-tree 内)──────────── */
|
|
97
102
|
|
|
98
103
|
.apex-tree .apex-tree__zone {
|
|
@@ -148,6 +153,13 @@
|
|
|
148
153
|
color: var(--dropdown-text-hover);
|
|
149
154
|
}
|
|
150
155
|
|
|
156
|
+
.apex-tree
|
|
157
|
+
.apex-tree__title-zone.apex-tree__zone[data-highlighted]:not([data-disabled]):not(
|
|
158
|
+
[data-selected]
|
|
159
|
+
) {
|
|
160
|
+
background-color: var(--dropdown-fill-default);
|
|
161
|
+
}
|
|
162
|
+
|
|
151
163
|
.apex-tree .apex-tree__zone:active:not([data-disabled]):not([data-selected]) {
|
|
152
164
|
background-color: var(--dropdown-fill-active);
|
|
153
165
|
color: var(--dropdown-text-active);
|
|
@@ -189,8 +201,10 @@
|
|
|
189
201
|
min-width: 0;
|
|
190
202
|
max-width: none;
|
|
191
203
|
justify-content: flex-start;
|
|
192
|
-
gap: var(--
|
|
193
|
-
|
|
204
|
+
gap: var(--apex-spacing-4);
|
|
205
|
+
/* The row already supplies the design-system content gap. Keep the title's
|
|
206
|
+
hit area padded on the trailing side without widening checkbox-to-text. */
|
|
207
|
+
padding: 0 var(--dropdown-spacing-item-padding-x-item) 0 0;
|
|
194
208
|
}
|
|
195
209
|
|
|
196
210
|
.apex-tree[data-block-node='true'] .apex-tree__title-zone {
|
|
@@ -4,8 +4,10 @@ const prefixCls = 'apex-tree'
|
|
|
4
4
|
|
|
5
5
|
export const treeVariants = cva(`${prefixCls} apex-md-tree`)
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
export const treeNodeRowVariants = cva(
|
|
7
|
+
/** 节点行承载标题 hover 底色,需要 dropdown token 作用域。 */
|
|
8
|
+
export const treeNodeRowVariants = cva(
|
|
9
|
+
`${prefixCls}__content apex-dropdown apex-default-dropdown apex-sm-dropdown`,
|
|
10
|
+
)
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* 节点内可独立 hover / selected 的区块。
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> TreeSelect:表单中需要从层级数据里选取一个或多个节点时(部门、分类、地区等)。
|
|
4
4
|
|
|
5
|
-
版本:`1.2.
|
|
5
|
+
版本:`1.2.2`。组件源码在本目录,属于当前项目。
|
|
6
6
|
|
|
7
7
|
公开导出:`TreeSelect`。
|
|
8
8
|
|
|
@@ -425,27 +425,23 @@ export default () => (
|
|
|
425
425
|
|
|
426
426
|
### 勾选
|
|
427
427
|
|
|
428
|
-
`treeCheckable` 与 `multiple`
|
|
428
|
+
`treeCheckable` 与 `multiple` 配合,通过复选框选择多个节点。示例预选一个子节点,可观察父节点半选;悬停一行时,行背景与该行复选框共同显示悬停态。点击父节点只勾选可用子节点,禁用子节点保持未选。
|
|
429
429
|
|
|
430
430
|
```tsx
|
|
431
|
-
import { TreeSelect } from '@/components/apex/tree-select'
|
|
432
|
-
|
|
433
431
|
import type { TreeSelectDataNode } from '@/components/apex/tree-select'
|
|
434
432
|
|
|
435
|
-
|
|
433
|
+
import { TreeSelect } from '@/components/apex/tree-select'
|
|
434
|
+
|
|
435
|
+
const treeData: TreeSelectDataNode[] = [
|
|
436
436
|
{
|
|
437
|
-
value: '
|
|
438
|
-
title: '
|
|
437
|
+
value: 'team',
|
|
438
|
+
title: '项目组',
|
|
439
439
|
children: [
|
|
440
|
-
{ value: '
|
|
441
|
-
{ value: '
|
|
440
|
+
{ value: 'design', title: '设计' },
|
|
441
|
+
{ value: 'engineering', title: '研发' },
|
|
442
|
+
{ value: 'archived', title: '已归档', disabled: true },
|
|
442
443
|
],
|
|
443
444
|
},
|
|
444
|
-
{
|
|
445
|
-
value: '0-1',
|
|
446
|
-
title: '父节点 1',
|
|
447
|
-
children: [{ value: '0-1-0', title: '叶子 0-1-0' }],
|
|
448
|
-
},
|
|
449
445
|
]
|
|
450
446
|
|
|
451
447
|
export default () => (
|
|
@@ -453,10 +449,10 @@ export default () => (
|
|
|
453
449
|
style={{ width: '250px' }}
|
|
454
450
|
treeCheckable
|
|
455
451
|
multiple
|
|
456
|
-
treeData={
|
|
452
|
+
treeData={treeData}
|
|
457
453
|
treeDefaultExpandAll
|
|
458
|
-
defaultValue={['
|
|
459
|
-
placeholder="
|
|
454
|
+
defaultValue={['design']}
|
|
455
|
+
placeholder="选择团队"
|
|
460
456
|
/>
|
|
461
457
|
)
|
|
462
458
|
```
|
|
@@ -493,7 +489,7 @@ export default () => (
|
|
|
493
489
|
|
|
494
490
|
### 尺寸
|
|
495
491
|
|
|
496
|
-
支持 `large`、`medium`(默认)、`small`
|
|
492
|
+
支持 `large`、`medium`(默认)、`small` 三种触发器尺寸;弹层选项高度随尺寸档位对齐。示例选中值并开启清除,以便对照 large/medium 的 16px 箭头、small 的 14px 箭头与各档 14px 清除按钮。
|
|
497
493
|
|
|
498
494
|
```tsx
|
|
499
495
|
import { TreeSelect } from '@/components/apex/tree-select'
|
|
@@ -518,14 +514,27 @@ const TREE_SELECT_DATA: TreeSelectDataNode[] = [
|
|
|
518
514
|
|
|
519
515
|
export default () => (
|
|
520
516
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
|
|
521
|
-
<TreeSelect
|
|
517
|
+
<TreeSelect
|
|
518
|
+
size="large"
|
|
519
|
+
treeData={TREE_SELECT_DATA}
|
|
520
|
+
defaultValue="0-0-0"
|
|
521
|
+
allowClear
|
|
522
|
+
treeDefaultExpandAll
|
|
523
|
+
/>
|
|
522
524
|
<TreeSelect
|
|
523
525
|
size="medium"
|
|
524
526
|
treeData={TREE_SELECT_DATA}
|
|
527
|
+
defaultValue="0-0-0"
|
|
528
|
+
allowClear
|
|
529
|
+
treeDefaultExpandAll
|
|
530
|
+
/>
|
|
531
|
+
<TreeSelect
|
|
532
|
+
size="small"
|
|
533
|
+
treeData={TREE_SELECT_DATA}
|
|
534
|
+
defaultValue="0-0-0"
|
|
535
|
+
allowClear
|
|
525
536
|
treeDefaultExpandAll
|
|
526
|
-
placeholder="medium"
|
|
527
537
|
/>
|
|
528
|
-
<TreeSelect size="small" treeData={TREE_SELECT_DATA} treeDefaultExpandAll placeholder="small" />
|
|
529
538
|
</div>
|
|
530
539
|
)
|
|
531
540
|
```
|
|
@@ -562,7 +571,7 @@ export default () => (
|
|
|
562
571
|
|
|
563
572
|
### 只读
|
|
564
573
|
|
|
565
|
-
`readOnly` 为 true
|
|
574
|
+
`readOnly` 为 true 时不可打开下拉、不可清除或修改;视觉使用禁用配色,但仍可聚焦。示例对照空值、单选和多选。
|
|
566
575
|
|
|
567
576
|
```tsx
|
|
568
577
|
import { TreeSelect } from '@/components/apex/tree-select'
|
|
@@ -588,6 +597,7 @@ const TREE_SELECT_DATA: TreeSelectDataNode[] = [
|
|
|
588
597
|
export default () => (
|
|
589
598
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 16, maxWidth: 320 }}>
|
|
590
599
|
<TreeSelect treeData={TREE_SELECT_DATA} defaultValue="0-0-0" placeholder="可编辑" allowClear />
|
|
600
|
+
<TreeSelect treeData={TREE_SELECT_DATA} readOnly placeholder="只读空值" />
|
|
591
601
|
<TreeSelect treeData={TREE_SELECT_DATA} defaultValue="0-0-0" readOnly placeholder="只读" />
|
|
592
602
|
<TreeSelect
|
|
593
603
|
treeData={TREE_SELECT_DATA}
|