@apexhub/apex-ui-react-source 1.3.1 → 1.3.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/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/llm.txt +1 -1
- package/dist/files/breadcrumb/tokens.txt +1 -1
- package/dist/files/button/llm.txt +1 -1
- 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 +1 -1
- package/dist/files/checkbox/tokens.txt +1 -1
- package/dist/files/collapse/llm.txt +1 -1
- package/dist/files/collapse/tokens.txt +1 -1
- package/dist/files/date-picker/llm.txt +1 -1
- package/dist/files/date-picker/tokens.txt +1 -1
- package/dist/files/divider/llm.txt +1 -1
- package/dist/files/divider/tokens.txt +1 -1
- package/dist/files/drawer/llm.txt +1 -1
- package/dist/files/drawer/tokens.txt +1 -1
- package/dist/files/dropdown/llm.txt +1 -1
- package/dist/files/dropdown/tokens.txt +1 -1
- package/dist/files/form/form.css +0 -10
- package/dist/files/form/llm.txt +12 -1
- package/dist/files/form/tokens.txt +1 -3
- package/dist/files/grid/llm.txt +1 -1
- 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/llm.txt +1 -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/menu/Menu.tsx +27 -11
- package/dist/files/menu/icons.tsx +4 -4
- package/dist/files/menu/interface.ts +7 -7
- package/dist/files/menu/lib.ts +11 -6
- package/dist/files/menu/llm.txt +25 -10
- package/dist/files/menu/menu.css +73 -32
- package/dist/files/menu/tokens.txt +14 -13
- package/dist/files/message/llm.txt +1 -1
- package/dist/files/message/tokens.txt +1 -1
- package/dist/files/modal/llm.txt +1 -1
- 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/Pagination.tsx +20 -2
- package/dist/files/pagination/interface.ts +1 -1
- package/dist/files/pagination/llm.txt +4 -6
- 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 +1 -1
- 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/tokens.txt +1 -1
- package/dist/files/switch/llm.txt +1 -1
- package/dist/files/switch/tokens.txt +1 -1
- package/dist/files/table/llm.txt +1 -1
- package/dist/files/table/tokens.txt +1 -1
- package/dist/files/tabs/llm.txt +1 -1
- package/dist/files/tabs/tokens.txt +1 -1
- package/dist/files/tag/llm.txt +1 -1
- package/dist/files/tag/tokens.txt +1 -1
- package/dist/files/theme/aliases.css +1 -1
- package/dist/files/theme/component-tokens.css +5 -5
- package/dist/files/theme/primitives.css +1 -1
- package/dist/files/tooltip/Tooltip.tsx +60 -24
- package/dist/files/tooltip/llm.txt +1 -1
- package/dist/files/tooltip/tokens.txt +1 -1
- 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 +26 -1
- package/dist/files/upload/tokens.txt +1 -1
- package/dist/manifest.json +96 -96
- package/package.json +3 -3
- package/template/index.html +5 -0
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.
|
|
3
|
+
This folder is Apex UI 1.3.2, 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
package/dist/files/card/llm.txt
CHANGED
package/dist/files/form/form.css
CHANGED
|
@@ -222,16 +222,6 @@
|
|
|
222
222
|
color: var(--form-text-caption-default);
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
/* Figma form1/form2:caption 从控件底边下方 4px 开始。 */
|
|
226
|
-
.apex-form__item--vertical .apex-form__item-caption {
|
|
227
|
-
margin-top: var(--form-spacing-gap);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.apex-form__item--horizontal .apex-form__item-caption,
|
|
231
|
-
.apex-form__item--inline .apex-form__item-caption {
|
|
232
|
-
margin-top: var(--form-spacing-gap-y);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
225
|
/* caption 预留态:保证最小高度防止布局跳动 */
|
|
236
226
|
.apex-form__item-caption[data-reserve] {
|
|
237
227
|
min-height: 16px;
|
package/dist/files/form/llm.txt
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Form:需要收集、校验并提交一组结构化字段数据时。
|
|
4
4
|
|
|
5
|
-
版本:`1.3.
|
|
5
|
+
版本:`1.3.2`。组件源码在本目录,属于当前项目。
|
|
6
6
|
|
|
7
7
|
公开导出:`Form`、`FormItem`、`useForm`。
|
|
8
8
|
|
|
@@ -280,6 +280,8 @@ export default () => (
|
|
|
280
280
|
|
|
281
281
|
在 `Form.Item` 的 `rules` 中声明同步或异步校验;失败时触发提交失败事件。
|
|
282
282
|
|
|
283
|
+
提示和校验文字紧贴输入框;字段之间仍保留表单布局间距。
|
|
284
|
+
|
|
283
285
|
```tsx
|
|
284
286
|
import { Button } from '@/components/apex/button'
|
|
285
287
|
import { Form } from '@/components/apex/form'
|
|
@@ -344,3 +346,12 @@ export default () => (
|
|
|
344
346
|
### `Form.Item` 的 `name` 支持 `user.name` 这种路径吗?
|
|
345
347
|
|
|
346
348
|
v1 不支持点号或方括号嵌套路径,`name` 须为单层字符串字段名。
|
|
349
|
+
|
|
350
|
+
### `valuePropName` 和 `getValueFromEvent` 什么时候用?
|
|
351
|
+
|
|
352
|
+
`Form.Item` 默认把字段值通过子组件的 `value` 传入,并把 `onChange` 的参数当作新值(参数是事件时取 `event.target.value`,勾选框取 `checked`)。子组件不符合这个约定时用这两个属性:
|
|
353
|
+
|
|
354
|
+
- `valuePropName`:值要传给哪个属性,例如 Switch 用 `checked`,Upload 用 `fileList`。
|
|
355
|
+
- `getValueFromEvent`:从 `onChange` 的参数里取出要存的值,例如 Upload 的 `(info) => info.fileList`。
|
|
356
|
+
|
|
357
|
+
Upload 的完整写法见 [Upload](/components/upload) 页 FAQ 的“在 `Form` 里怎么用 Upload?”。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Form Token 明细
|
|
2
2
|
|
|
3
|
-
包:`@apexhub/apex-ui-react`;版本:`1.3.
|
|
3
|
+
包:`@apexhub/apex-ui-react`;版本:`1.3.2`(当前源码快照)。
|
|
4
4
|
|
|
5
5
|
按需读取:[组件用法](./llm.txt) · [主题与覆盖规则](../../llms-theme.txt)。
|
|
6
6
|
|
|
@@ -10,12 +10,10 @@
|
|
|
10
10
|
|
|
11
11
|
| Token | 用途(CSS 属性) | 定义值 | 定义作用域 |
|
|
12
12
|
| --- | --- | --- | --- |
|
|
13
|
-
| `--form-spacing-gap` | `margin-top` | `var(--apex-spacing-4)` | `.apex-form.apex-vertical-form` |
|
|
14
13
|
| `--form-spacing-gap-caption` | `gap` | `var(--apex-spacing-0)` | `.apex-form.apex-horizontal-form` |
|
|
15
14
|
| `--form-spacing-gap-caption` | `gap` | `var(--apex-spacing-0)` | `.apex-form.apex-vertical-form` |
|
|
16
15
|
| `--form-spacing-gap-title` | `column-gap`、`gap` | `var(--apex-spacing-8)` | `.apex-form.apex-horizontal-form` |
|
|
17
16
|
| `--form-spacing-gap-title` | `column-gap`、`gap` | `var(--apex-spacing-4)` | `.apex-form.apex-vertical-form` |
|
|
18
|
-
| `--form-spacing-gap-y` | `margin-top` | `var(--apex-spacing-4)` | `.apex-form.apex-horizontal-form` |
|
|
19
17
|
| `--form-text-caption-default` | `color` | `var(--apex-text-neutral-secondary)` | `.apex-form.apex-default-form` |
|
|
20
18
|
| `--form-text-caption-disabled` | `color` | `var(--apex-text-neutral-disabled)` | `.apex-form.apex-default-form` |
|
|
21
19
|
| `--form-text-caption-error` | `color` | `var(--apex-text-error-primary)` | `.apex-form.apex-default-form` |
|
package/dist/files/grid/llm.txt
CHANGED
package/dist/files/image/llm.txt
CHANGED
package/dist/files/input/llm.txt
CHANGED
package/dist/files/menu/Menu.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import { Dropdown } from '../dropdown'
|
|
|
6
6
|
import { Tooltip } from '../tooltip'
|
|
7
7
|
import { Typography } from '../typography'
|
|
8
8
|
import { cn } from '../utils/cn'
|
|
9
|
-
import {
|
|
9
|
+
import { CaretDownIcon } from './icons'
|
|
10
10
|
import type {
|
|
11
11
|
MenuChildRenderInfo,
|
|
12
12
|
MenuClickInfo,
|
|
@@ -32,10 +32,12 @@ const prefix = 'apex-menu'
|
|
|
32
32
|
function menuButtonScopeClasses(options: { iconOnly?: boolean; secondary?: boolean }) {
|
|
33
33
|
return cn(
|
|
34
34
|
'apex-menu-button',
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
// Rail buttons inherit primary colors from their list item so icon sizing wins locally.
|
|
36
|
+
options.iconOnly
|
|
37
|
+
? 'apex-icon-menu-button'
|
|
38
|
+
: options.secondary
|
|
39
|
+
? 'apex-secondary-menu-button'
|
|
40
|
+
: 'apex-primary-menu-button',
|
|
39
41
|
)
|
|
40
42
|
}
|
|
41
43
|
|
|
@@ -196,7 +198,7 @@ function renderDefaultMenuRow({
|
|
|
196
198
|
</Typography.Text>
|
|
197
199
|
{hasChildren ? (
|
|
198
200
|
<span className={`${prefix}__caret`} aria-hidden>
|
|
199
|
-
<
|
|
201
|
+
<CaretDownIcon />
|
|
200
202
|
</span>
|
|
201
203
|
) : null}
|
|
202
204
|
</button>
|
|
@@ -269,6 +271,7 @@ function MenuRail({
|
|
|
269
271
|
selectable,
|
|
270
272
|
selectedKeys,
|
|
271
273
|
selectedKeyPath,
|
|
274
|
+
openKeys,
|
|
272
275
|
onOpenKeysChange,
|
|
273
276
|
onItemClick,
|
|
274
277
|
onItemSelect,
|
|
@@ -316,6 +319,12 @@ function MenuRail({
|
|
|
316
319
|
return
|
|
317
320
|
}
|
|
318
321
|
|
|
322
|
+
if (hasChildren) {
|
|
323
|
+
if (!openKeys.includes(item.key)) onOpenKeysChange([...openKeys, item.key])
|
|
324
|
+
onExpand()
|
|
325
|
+
return
|
|
326
|
+
}
|
|
327
|
+
|
|
319
328
|
const info: MenuClickInfo = { key: item.key, keyPath, domEvent: event }
|
|
320
329
|
item.onClick?.(info)
|
|
321
330
|
onItemClick(info, item)
|
|
@@ -371,7 +380,11 @@ function MenuRail({
|
|
|
371
380
|
)
|
|
372
381
|
|
|
373
382
|
return (
|
|
374
|
-
<li
|
|
383
|
+
<li
|
|
384
|
+
key={item.key}
|
|
385
|
+
className={`${prefix}__rail-item apex-menu-button apex-primary-menu-button`}
|
|
386
|
+
data-slot="menu-item"
|
|
387
|
+
>
|
|
375
388
|
{railTrigger}
|
|
376
389
|
</li>
|
|
377
390
|
)
|
|
@@ -408,9 +421,9 @@ function MenuList({
|
|
|
408
421
|
const isOpen = openKeys.includes(item.key)
|
|
409
422
|
const isPrimarySelected = isPrimarySelectedInPath(item.key, selectedKeyPath)
|
|
410
423
|
const isSecondarySelected = isSecondarySelectedInPath(item.key, selectedKeyPath)
|
|
411
|
-
const isActive = selectedKeys.includes(item.key)
|
|
424
|
+
const isActive = !item.children?.length && selectedKeys.includes(item.key)
|
|
412
425
|
const hasChildren = Boolean(item.children?.length)
|
|
413
|
-
const isDisabled = Boolean(item.disabled)
|
|
426
|
+
const isDisabled = Boolean(item.disabled || item.loading)
|
|
414
427
|
|
|
415
428
|
if (item.type === 'divider') {
|
|
416
429
|
return (
|
|
@@ -475,12 +488,15 @@ function MenuList({
|
|
|
475
488
|
return
|
|
476
489
|
}
|
|
477
490
|
|
|
491
|
+
if (hasChildren) {
|
|
492
|
+
onOpenKeysChange(toggleKey(openKeys, item.key))
|
|
493
|
+
return
|
|
494
|
+
}
|
|
495
|
+
|
|
478
496
|
const info: MenuClickInfo = { key: item.key, keyPath, domEvent: event }
|
|
479
497
|
item.onClick?.(info)
|
|
480
498
|
onItemClick(info, item)
|
|
481
499
|
|
|
482
|
-
if (hasChildren) onOpenKeysChange(toggleKey(openKeys, item.key))
|
|
483
|
-
|
|
484
500
|
if (selectable) onItemSelect({ ...info, selectedKeys: [item.key] }, item)
|
|
485
501
|
}
|
|
486
502
|
|
|
@@ -15,19 +15,19 @@ export function AppGridIcon({ className }: MenuIconProps) {
|
|
|
15
15
|
|
|
16
16
|
export { DoubleCaretLeftIcon }
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
export function
|
|
18
|
+
/** 24×24 rounded chevron; the wrapper rotates when the directory opens. */
|
|
19
|
+
export function CaretDownIcon({ className }: MenuIconProps) {
|
|
20
20
|
return (
|
|
21
21
|
<svg
|
|
22
22
|
className={className}
|
|
23
|
-
viewBox="0 0
|
|
23
|
+
viewBox="0 0 24 24"
|
|
24
24
|
fill="none"
|
|
25
25
|
xmlns="http://www.w3.org/2000/svg"
|
|
26
26
|
aria-hidden
|
|
27
27
|
preserveAspectRatio="xMidYMid meet"
|
|
28
28
|
>
|
|
29
29
|
<path
|
|
30
|
-
d="
|
|
30
|
+
d="M6 9.5L12 15.5L18 9.5"
|
|
31
31
|
stroke="currentColor"
|
|
32
32
|
strokeWidth="1.5"
|
|
33
33
|
strokeLinecap="round"
|
|
@@ -34,9 +34,9 @@ export interface MenuItemType {
|
|
|
34
34
|
danger?: boolean
|
|
35
35
|
/** 分组标题或分割线 */
|
|
36
36
|
type?: MenuItemKind
|
|
37
|
-
/**
|
|
37
|
+
/** 非空子级表示目录:只展开/收起,不触发点击或选中;可嵌套 */
|
|
38
38
|
children?: MenuItemType[]
|
|
39
|
-
/**
|
|
39
|
+
/** 仅页面项点击;目录不触发 */
|
|
40
40
|
onClick?: (info: MenuClickInfo) => void
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -110,18 +110,18 @@ export interface MenuProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onCl
|
|
|
110
110
|
items: MenuItemType[]
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
|
-
*
|
|
113
|
+
* 页面项是否可选中(目录始终不可选中)
|
|
114
114
|
* @default true
|
|
115
115
|
*/
|
|
116
116
|
selectable?: boolean
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
|
-
*
|
|
119
|
+
* 受控:当前页面项(单选,length ≤ 1;不传目录 key)
|
|
120
120
|
*/
|
|
121
121
|
selectedKeys?: string[]
|
|
122
122
|
|
|
123
123
|
/**
|
|
124
|
-
*
|
|
124
|
+
* 默认选中的页面项(不传目录 key)
|
|
125
125
|
*/
|
|
126
126
|
defaultSelectedKeys?: string[]
|
|
127
127
|
|
|
@@ -179,12 +179,12 @@ export interface MenuProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onCl
|
|
|
179
179
|
styles?: MenuStyles
|
|
180
180
|
|
|
181
181
|
/**
|
|
182
|
-
*
|
|
182
|
+
* 页面项选中变化;目录展开/收起不触发
|
|
183
183
|
*/
|
|
184
184
|
onSelect?: (info: MenuSelectInfo) => void
|
|
185
185
|
|
|
186
186
|
/**
|
|
187
|
-
*
|
|
187
|
+
* 页面项点击;目录不触发
|
|
188
188
|
*/
|
|
189
189
|
onClick?: (info: MenuClickInfo) => void
|
|
190
190
|
|
package/dist/files/menu/lib.ts
CHANGED
|
@@ -28,15 +28,15 @@ export function wrapRailDropdownItems(
|
|
|
28
28
|
return {
|
|
29
29
|
...item,
|
|
30
30
|
onClick: (info) => {
|
|
31
|
-
const fullInfo: MenuClickInfo = { ...info, keyPath }
|
|
32
|
-
item.onClick?.(fullInfo)
|
|
33
|
-
handlers.onItemClick(fullInfo, item)
|
|
34
|
-
|
|
35
31
|
// Submenu parents are opened by Dropdown Sub; only leaves select + expand menu-maximized.
|
|
36
32
|
if (hasChildren || item.type === 'divider' || item.type === 'group') {
|
|
37
33
|
return
|
|
38
34
|
}
|
|
39
35
|
|
|
36
|
+
const fullInfo: MenuClickInfo = { ...info, keyPath }
|
|
37
|
+
item.onClick?.(fullInfo)
|
|
38
|
+
handlers.onItemClick(fullInfo, item)
|
|
39
|
+
|
|
40
40
|
if (handlers.selectable) {
|
|
41
41
|
handlers.onItemSelect({ ...fullInfo, selectedKeys: [item.key] }, item)
|
|
42
42
|
}
|
|
@@ -109,10 +109,15 @@ function findSelectedKeyPath(
|
|
|
109
109
|
path: string[] = [],
|
|
110
110
|
): string[] | null {
|
|
111
111
|
for (const item of items) {
|
|
112
|
-
if (item.type === 'divider'
|
|
112
|
+
if (item.type === 'divider') continue
|
|
113
|
+
if (item.type === 'group') {
|
|
114
|
+
const found = findSelectedKeyPath(item.children ?? [], selectedKey, path)
|
|
115
|
+
if (found) return found
|
|
116
|
+
continue
|
|
117
|
+
}
|
|
113
118
|
|
|
114
119
|
const keyPath = [...path, item.key]
|
|
115
|
-
if (item.key === selectedKey) return keyPath
|
|
120
|
+
if (item.key === selectedKey && !item.children?.length) return keyPath
|
|
116
121
|
|
|
117
122
|
if (item.children?.length) {
|
|
118
123
|
const found = findSelectedKeyPath(item.children, selectedKey, keyPath)
|