@apexhub/apex-ui-react-source 1.3.3 → 1.3.4

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.
Files changed (87) hide show
  1. package/dist/files/AGENTS.md +1 -1
  2. package/dist/files/alert/llm.txt +1 -1
  3. package/dist/files/alert/tokens.txt +1 -1
  4. package/dist/files/apex-provider/llm.txt +1 -1
  5. package/dist/files/auto-complete/llm.txt +1 -1
  6. package/dist/files/auto-complete/tokens.txt +1 -1
  7. package/dist/files/avatar/llm.txt +1 -1
  8. package/dist/files/avatar/tokens.txt +1 -1
  9. package/dist/files/breadcrumb/llm.txt +1 -1
  10. package/dist/files/breadcrumb/tokens.txt +1 -1
  11. package/dist/files/button/llm.txt +1 -1
  12. package/dist/files/button/tokens.txt +1 -1
  13. package/dist/files/card/llm.txt +1 -1
  14. package/dist/files/card/tokens.txt +1 -1
  15. package/dist/files/cascader/llm.txt +1 -1
  16. package/dist/files/cascader/tokens.txt +1 -1
  17. package/dist/files/checkbox/llm.txt +1 -1
  18. package/dist/files/checkbox/tokens.txt +1 -1
  19. package/dist/files/collapse/llm.txt +1 -1
  20. package/dist/files/collapse/tokens.txt +1 -1
  21. package/dist/files/date-picker/llm.txt +1 -1
  22. package/dist/files/date-picker/tokens.txt +1 -1
  23. package/dist/files/divider/llm.txt +1 -1
  24. package/dist/files/divider/tokens.txt +1 -1
  25. package/dist/files/drawer/Drawer.tsx +81 -48
  26. package/dist/files/drawer/interface.ts +6 -1
  27. package/dist/files/drawer/llm.txt +3 -2
  28. package/dist/files/drawer/tokens.txt +1 -1
  29. package/dist/files/dropdown/llm.txt +1 -1
  30. package/dist/files/dropdown/tokens.txt +1 -1
  31. package/dist/files/form/llm.txt +1 -1
  32. package/dist/files/form/tokens.txt +1 -1
  33. package/dist/files/grid/llm.txt +1 -1
  34. package/dist/files/image/llm.txt +1 -1
  35. package/dist/files/image/tokens.txt +1 -1
  36. package/dist/files/input/llm.txt +1 -1
  37. package/dist/files/input/tokens.txt +1 -1
  38. package/dist/files/input-number/llm.txt +1 -1
  39. package/dist/files/input-number/tokens.txt +1 -1
  40. package/dist/files/layout/llm.txt +1 -1
  41. package/dist/files/layout/tokens.txt +1 -1
  42. package/dist/files/menu/llm.txt +1 -1
  43. package/dist/files/menu/tokens.txt +1 -1
  44. package/dist/files/message/llm.txt +1 -1
  45. package/dist/files/message/tokens.txt +1 -1
  46. package/dist/files/modal/llm.txt +1 -1
  47. package/dist/files/modal/tokens.txt +1 -1
  48. package/dist/files/notification/llm.txt +1 -1
  49. package/dist/files/notification/tokens.txt +1 -1
  50. package/dist/files/pagination/llm.txt +1 -1
  51. package/dist/files/pagination/tokens.txt +1 -1
  52. package/dist/files/popover/llm.txt +1 -1
  53. package/dist/files/popover/tokens.txt +1 -1
  54. package/dist/files/progress/llm.txt +1 -1
  55. package/dist/files/progress/tokens.txt +1 -1
  56. package/dist/files/radio/llm.txt +1 -1
  57. package/dist/files/radio/tokens.txt +1 -1
  58. package/dist/files/rate/llm.txt +1 -1
  59. package/dist/files/rate/tokens.txt +1 -1
  60. package/dist/files/select/llm.txt +1 -1
  61. package/dist/files/select/tokens.txt +1 -1
  62. package/dist/files/skeleton/llm.txt +1 -1
  63. package/dist/files/skeleton/tokens.txt +1 -1
  64. package/dist/files/spin/llm.txt +1 -1
  65. package/dist/files/spin/tokens.txt +1 -1
  66. package/dist/files/steps/llm.txt +1 -1
  67. package/dist/files/steps/tokens.txt +1 -1
  68. package/dist/files/switch/llm.txt +1 -1
  69. package/dist/files/switch/tokens.txt +1 -1
  70. package/dist/files/table/llm.txt +1 -1
  71. package/dist/files/table/tokens.txt +1 -1
  72. package/dist/files/tabs/llm.txt +1 -1
  73. package/dist/files/tabs/tokens.txt +1 -1
  74. package/dist/files/tag/llm.txt +1 -1
  75. package/dist/files/tag/tokens.txt +1 -1
  76. package/dist/files/tooltip/llm.txt +1 -1
  77. package/dist/files/tooltip/tokens.txt +1 -1
  78. package/dist/files/tree/llm.txt +1 -1
  79. package/dist/files/tree/tokens.txt +1 -1
  80. package/dist/files/tree-select/llm.txt +1 -1
  81. package/dist/files/tree-select/tokens.txt +1 -1
  82. package/dist/files/typography/llm.txt +1 -1
  83. package/dist/files/typography/tokens.txt +1 -1
  84. package/dist/files/upload/llm.txt +1 -1
  85. package/dist/files/upload/tokens.txt +1 -1
  86. package/dist/manifest.json +86 -86
  87. package/package.json +3 -3
@@ -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, installed as source code by `@apexhub/apex-ui-react-source`.
3
+ This folder is Apex UI 1.3.4, 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
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Alert:需要在当前页面内展示操作结果、风险提示或补充说明,且信息应持续可见时。
4
4
 
5
- 版本:`1.3.3`。组件源码在本目录,属于当前项目。
5
+ 版本:`1.3.4`。组件源码在本目录,属于当前项目。
6
6
 
7
7
  公开导出:`Alert`。
8
8
 
@@ -1,6 +1,6 @@
1
1
  # Alert Token 明细
2
2
 
3
- 包:`@apexhub/apex-ui-react`;版本:`1.3.3`(当前源码快照)。
3
+ 包:`@apexhub/apex-ui-react`;版本:`1.3.4`(当前源码快照)。
4
4
 
5
5
  按需读取:[组件用法](./llm.txt) · [主题与覆盖规则](../../llms-theme.txt)。
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > ApexProvider:在应用或微前端子应用最外层包裹,确保组件库 Token、主题、滚动条样式在整个组件树生效。
4
4
 
5
- 版本:`1.3.3`。组件源码在本目录,属于当前项目。
5
+ 版本:`1.3.4`。组件源码在本目录,属于当前项目。
6
6
 
7
7
  公开导出:`ApexProvider`、`useConfig`。
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > AutoComplete:为自由文本输入提供历史记录、关键词或搜索建议。没有匹配建议时,输入内容仍会保留。
4
4
 
5
- 版本:`1.3.3`。组件源码在本目录,属于当前项目。
5
+ 版本:`1.3.4`。组件源码在本目录,属于当前项目。
6
6
 
7
7
  公开导出:`AutoComplete`。
8
8
 
@@ -1,6 +1,6 @@
1
1
  # AutoComplete Token 明细
2
2
 
3
- 包:`@apexhub/apex-ui-react`;版本:`1.3.3`(当前源码快照)。
3
+ 包:`@apexhub/apex-ui-react`;版本:`1.3.4`(当前源码快照)。
4
4
 
5
5
  按需读取:[组件用法](./llm.txt) · [主题与覆盖规则](../../llms-theme.txt)。
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Avatar:需要展示用户、团队或业务实体的缩略标识,且空间有限时。
4
4
 
5
- 版本:`1.3.3`。组件源码在本目录,属于当前项目。
5
+ 版本:`1.3.4`。组件源码在本目录,属于当前项目。
6
6
 
7
7
  公开导出:`Avatar`、`AvatarGroup`。
8
8
 
@@ -1,6 +1,6 @@
1
1
  # Avatar Token 明细
2
2
 
3
- 包:`@apexhub/apex-ui-react`;版本:`1.3.3`(当前源码快照)。
3
+ 包:`@apexhub/apex-ui-react`;版本:`1.3.4`(当前源码快照)。
4
4
 
5
5
  按需读取:[组件用法](./llm.txt) · [主题与覆盖规则](../../llms-theme.txt)。
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Breadcrumb:页面层级较深,用户需要知道「当前在哪」并快速返回上级时。
4
4
 
5
- 版本:`1.3.3`。组件源码在本目录,属于当前项目。
5
+ 版本:`1.3.4`。组件源码在本目录,属于当前项目。
6
6
 
7
7
  公开导出:`Breadcrumb`、`BreadcrumbLink`、`BreadcrumbSeparatorIcon`、`isBreadcrumbSeparatorItem`。
8
8
 
@@ -1,6 +1,6 @@
1
1
  # Breadcrumb Token 明细
2
2
 
3
- 包:`@apexhub/apex-ui-react`;版本:`1.3.3`(当前源码快照)。
3
+ 包:`@apexhub/apex-ui-react`;版本:`1.3.4`(当前源码快照)。
4
4
 
5
5
  按需读取:[组件用法](./llm.txt) · [主题与覆盖规则](../../llms-theme.txt)。
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Button:标记一个或多个操作(提交、确认、跳转等)时。
4
4
 
5
- 版本:`1.3.3`。组件源码在本目录,属于当前项目。
5
+ 版本:`1.3.4`。组件源码在本目录,属于当前项目。
6
6
 
7
7
  公开导出:`Button`。
8
8
 
@@ -1,6 +1,6 @@
1
1
  # Button Token 明细
2
2
 
3
- 包:`@apexhub/apex-ui-react`;版本:`1.3.3`(当前源码快照)。
3
+ 包:`@apexhub/apex-ui-react`;版本:`1.3.4`(当前源码快照)。
4
4
 
5
5
  按需读取:[组件用法](./llm.txt) · [主题与覆盖规则](../../llms-theme.txt)。
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Card:需要将一组相关信息收纳在带边框的容器内,与页面背景区分时。
4
4
 
5
- 版本:`1.3.3`。组件源码在本目录,属于当前项目。
5
+ 版本:`1.3.4`。组件源码在本目录,属于当前项目。
6
6
 
7
7
  公开导出:`Card`。
8
8
 
@@ -1,6 +1,6 @@
1
1
  # Card Token 明细
2
2
 
3
- 包:`@apexhub/apex-ui-react`;版本:`1.3.3`(当前源码快照)。
3
+ 包:`@apexhub/apex-ui-react`;版本:`1.3.4`(当前源码快照)。
4
4
 
5
5
  按需读取:[组件用法](./llm.txt) · [主题与覆盖规则](../../llms-theme.txt)。
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Cascader:选项具有清晰的层级关系(省市区、分类目录等),需要从根到叶逐级选择时。
4
4
 
5
- 版本:`1.3.3`。组件源码在本目录,属于当前项目。
5
+ 版本:`1.3.4`。组件源码在本目录,属于当前项目。
6
6
 
7
7
  公开导出:`Cascader`。
8
8
 
@@ -1,6 +1,6 @@
1
1
  # Cascader Token 明细
2
2
 
3
- 包:`@apexhub/apex-ui-react`;版本:`1.3.3`(当前源码快照)。
3
+ 包:`@apexhub/apex-ui-react`;版本:`1.3.4`(当前源码快照)。
4
4
 
5
5
  按需读取:[组件用法](./llm.txt) · [主题与覆盖规则](../../llms-theme.txt)。
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Checkbox:用户可从多个选项中任选零个、一个或多个时(与 Radio 互斥单选相对)。
4
4
 
5
- 版本:`1.3.3`。组件源码在本目录,属于当前项目。
5
+ 版本:`1.3.4`。组件源码在本目录,属于当前项目。
6
6
 
7
7
  公开导出:`Checkbox`、`CheckboxGroup`。
8
8
 
@@ -1,6 +1,6 @@
1
1
  # Checkbox Token 明细
2
2
 
3
- 包:`@apexhub/apex-ui-react`;版本:`1.3.3`(当前源码快照)。
3
+ 包:`@apexhub/apex-ui-react`;版本:`1.3.4`(当前源码快照)。
4
4
 
5
5
  按需读取:[组件用法](./llm.txt) · [主题与覆盖规则](../../llms-theme.txt)。
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Collapse:页面信息量大,需要将次要内容默认折叠、按需展开时。
4
4
 
5
- 版本:`1.3.3`。组件源码在本目录,属于当前项目。
5
+ 版本:`1.3.4`。组件源码在本目录,属于当前项目。
6
6
 
7
7
  公开导出:`Collapse`。
8
8
 
@@ -1,6 +1,6 @@
1
1
  # Collapse Token 明细
2
2
 
3
- 包:`@apexhub/apex-ui-react`;版本:`1.3.3`(当前源码快照)。
3
+ 包:`@apexhub/apex-ui-react`;版本:`1.3.4`(当前源码快照)。
4
4
 
5
5
  按需读取:[组件用法](./llm.txt) · [主题与覆盖规则](../../llms-theme.txt)。
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > DatePicker:用户需要选择单个日期或日期范围,且精确到日、周、月、季、年等不同粒度时。
4
4
 
5
- 版本:`1.3.3`。组件源码在本目录,属于当前项目。
5
+ 版本:`1.3.4`。组件源码在本目录,属于当前项目。
6
6
 
7
7
  公开导出:`DatePicker`、`RangePicker`。
8
8
 
@@ -1,6 +1,6 @@
1
1
  # DatePicker Token 明细
2
2
 
3
- 包:`@apexhub/apex-ui-react`;版本:`1.3.3`(当前源码快照)。
3
+ 包:`@apexhub/apex-ui-react`;版本:`1.3.4`(当前源码快照)。
4
4
 
5
5
  按需读取:[组件用法](./llm.txt) · [主题与覆盖规则](../../llms-theme.txt)。
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Divider:需要在区块之间做视觉分隔、区分内容层次时。
4
4
 
5
- 版本:`1.3.3`。组件源码在本目录,属于当前项目。
5
+ 版本:`1.3.4`。组件源码在本目录,属于当前项目。
6
6
 
7
7
  公开导出:`Divider`。
8
8
 
@@ -1,6 +1,6 @@
1
1
  # Divider Token 明细
2
2
 
3
- 包:`@apexhub/apex-ui-react`;版本:`1.3.3`(当前源码快照)。
3
+ 包:`@apexhub/apex-ui-react`;版本:`1.3.4`(当前源码快照)。
4
4
 
5
5
  按需读取:[组件用法](./llm.txt) · [主题与覆盖规则](../../llms-theme.txt)。
6
6
 
@@ -69,7 +69,6 @@ function buildPanelSizeStyle(size: DrawerSize | undefined): React.CSSProperties
69
69
  type NonModalDrawerRootProps = {
70
70
  open: boolean
71
71
  keyboard: boolean
72
- focusTriggerAfterClose: boolean
73
72
  labelledBy: string
74
73
  placement: DrawerProps['placement']
75
74
  onEscape: (event: KeyboardEvent) => void
@@ -79,7 +78,6 @@ type NonModalDrawerRootProps = {
79
78
  function NonModalDrawerRoot({
80
79
  open,
81
80
  keyboard,
82
- focusTriggerAfterClose,
83
81
  labelledBy,
84
82
  placement,
85
83
  onEscape,
@@ -87,28 +85,7 @@ function NonModalDrawerRoot({
87
85
  }: NonModalDrawerRootProps) {
88
86
  const rootRef = React.useRef<HTMLDivElement | null>(null)
89
87
  const onEscapeRef = React.useRef(onEscape)
90
- const focusTriggerAfterCloseRef = React.useRef(focusTriggerAfterClose)
91
88
  onEscapeRef.current = onEscape
92
- focusTriggerAfterCloseRef.current = focusTriggerAfterClose
93
-
94
- React.useEffect(() => {
95
- if (!open) return
96
-
97
- const ownerDocument = rootRef.current?.ownerDocument
98
- const HTMLElementConstructor = ownerDocument?.defaultView?.HTMLElement
99
- const previouslyFocused = ownerDocument?.activeElement
100
-
101
- return () => {
102
- if (!focusTriggerAfterCloseRef.current || !HTMLElementConstructor) return
103
- if (
104
- !(previouslyFocused instanceof HTMLElementConstructor) ||
105
- !previouslyFocused.isConnected
106
- ) {
107
- return
108
- }
109
- previouslyFocused.focus({ preventScroll: true })
110
- }
111
- }, [open])
112
89
 
113
90
  React.useEffect(() => {
114
91
  if (!open || !keyboard) return
@@ -140,6 +117,23 @@ function NonModalDrawerRoot({
140
117
  )
141
118
  }
142
119
 
120
+ // Mount with the dialog content so the cleanup runs after Headless UI queues its restoration.
121
+ function DrawerFocusLifecycle({
122
+ onExit,
123
+ }: {
124
+ onExit: (activeRef: React.RefObject<boolean>) => void
125
+ }) {
126
+ const activeRef = React.useRef(false)
127
+ React.useEffect(() => {
128
+ activeRef.current = true
129
+ return () => {
130
+ activeRef.current = false
131
+ onExit(activeRef)
132
+ }
133
+ }, [onExit])
134
+ return null
135
+ }
136
+
143
137
  /**
144
138
  * Drawer — antd 风格侧滑面板(默认 Headless UI Dialog,支持 Apex 非模态分支)
145
139
  */
@@ -170,7 +164,6 @@ export const Drawer: React.FC<DrawerProps> = ({
170
164
  const titleFontClass = getTextFontClass(localeKind, 'heading-3')
171
165
  const maskConfig = normalizeMask(mask)
172
166
  const trapFocus = focusable?.trap !== false
173
- const focusTriggerAfterClose = focusable?.focusTriggerAfterClose !== false
174
167
  const drawerTitleId = React.useId()
175
168
  const afterOpenChangeRef = React.useRef(afterOpenChange)
176
169
  afterOpenChangeRef.current = afterOpenChange
@@ -178,8 +171,67 @@ export const Drawer: React.FC<DrawerProps> = ({
178
171
  const onCloseRef = React.useRef(onClose)
179
172
  onCloseRef.current = onClose
180
173
 
181
- const closeViaButtonRef = React.useRef(false)
182
174
  const panelRef = React.useRef<HTMLElement | null>(null)
175
+ const focusableRef = React.useRef(focusable)
176
+ focusableRef.current = focusable
177
+ const focusSessionRef = React.useRef<{
178
+ ownerDocument: Document
179
+ trigger: HTMLElement | null
180
+ triggerIsTabPanel: boolean
181
+ } | null>(null)
182
+
183
+ React.useLayoutEffect(() => {
184
+ if (!open) return
185
+ const ownerDocument = panelRef.current?.ownerDocument ?? document
186
+ const active = ownerDocument.activeElement
187
+ const trigger = active instanceof HTMLElement && active !== ownerDocument.body ? active : null
188
+ focusSessionRef.current = {
189
+ ownerDocument,
190
+ trigger,
191
+ triggerIsTabPanel: trigger?.matches('[role="tabpanel"]') ?? false,
192
+ }
193
+ }, [open])
194
+
195
+ const handleFocusExit = React.useCallback(
196
+ (activeRef: React.RefObject<boolean>) => {
197
+ const session = focusSessionRef.current
198
+ if (!session) return
199
+ const { ownerDocument, trigger, triggerIsTabPanel } = session
200
+ const focusedBeforeRestore = ownerDocument.activeElement
201
+ queueMicrotask(() => {
202
+ if (
203
+ activeRef.current ||
204
+ focusSessionRef.current !== session ||
205
+ panelRef.current?.dataset.state === 'open'
206
+ )
207
+ return
208
+ const options = focusableRef.current
209
+ const enabled = options?.focusTriggerAfterClose !== false
210
+ const resolveTarget = options?.getReturnFocus
211
+ if (enabled && !resolveTarget && !triggerIsTabPanel) {
212
+ if (!trapFocus && trigger?.isConnected) trigger.focus({ preventScroll: true })
213
+ return
214
+ }
215
+
216
+ const target = enabled ? resolveTarget?.() : null
217
+ if (target?.isConnected && target.ownerDocument === ownerDocument) {
218
+ target.focus({ preventScroll: true })
219
+ if (ownerDocument.activeElement === target) return
220
+ }
221
+
222
+ // Undo automatic restoration while preserving focus the consumer placed during close.
223
+ const restored = ownerDocument.activeElement
224
+ if (restored !== focusedBeforeRestore && restored instanceof HTMLElement) {
225
+ if (focusedBeforeRestore instanceof HTMLElement && focusedBeforeRestore.isConnected) {
226
+ focusedBeforeRestore.focus({ preventScroll: true })
227
+ }
228
+ if (ownerDocument.activeElement === restored) restored.blur()
229
+ }
230
+ })
231
+ },
232
+ [trapFocus],
233
+ )
234
+
183
235
  const dismissIntentRef = useDismissIntent(panelRef, open && trapFocus)
184
236
 
185
237
  useEmbeddedScrollLockGuard(open && trapFocus)
@@ -249,11 +301,6 @@ export const Drawer: React.FC<DrawerProps> = ({
249
301
  }, [])
250
302
 
251
303
  const handleDialogClose = React.useCallback(() => {
252
- if (closeViaButtonRef.current) {
253
- closeViaButtonRef.current = false
254
- return
255
- }
256
-
257
304
  const intent = consumeDismissIntent(dismissIntentRef)
258
305
 
259
306
  if (intent?.source === 'escape' && !keyboard) return
@@ -282,13 +329,9 @@ export const Drawer: React.FC<DrawerProps> = ({
282
329
  onCloseRef.current?.(syntheticEvent as unknown as React.KeyboardEvent<HTMLElement>)
283
330
  }, [dismissIntentRef, keyboard, maskConfig.closable, open])
284
331
 
285
- const handleCloseButtonClick = React.useCallback(
286
- (event: React.MouseEvent<HTMLElement>) => {
287
- if (trapFocus) closeViaButtonRef.current = true
288
- onCloseRef.current?.(event)
289
- },
290
- [trapFocus],
291
- )
332
+ const handleCloseButtonClick = React.useCallback((event: React.MouseEvent<HTMLElement>) => {
333
+ onCloseRef.current?.(event)
334
+ }, [])
292
335
 
293
336
  const handleNonModalEscape = React.useCallback(
294
337
  (event: KeyboardEvent) => {
@@ -400,15 +443,6 @@ export const Drawer: React.FC<DrawerProps> = ({
400
443
  </>
401
444
  )
402
445
 
403
- const handlePanelFocusCapture = React.useCallback(
404
- (event: React.FocusEvent<HTMLDivElement>) => {
405
- if (trapFocus && !focusTriggerAfterClose) {
406
- event.stopPropagation()
407
- }
408
- },
409
- [focusTriggerAfterClose, trapFocus],
410
- )
411
-
412
446
  const panelProps = {
413
447
  className: cn(scopeClass, className, classNames?.content),
414
448
  style: { ...panelSizeStyle, ...style, ...styles?.content },
@@ -416,7 +450,6 @@ export const Drawer: React.FC<DrawerProps> = ({
416
450
  'data-placement': placement,
417
451
  'data-state': open ? 'open' : 'closed',
418
452
  onAnimationEnd: handlePanelAnimationEnd,
419
- onFocusCapture: handlePanelFocusCapture,
420
453
  }
421
454
 
422
455
  const panel = trapFocus ? (
@@ -440,6 +473,7 @@ export const Drawer: React.FC<DrawerProps> = ({
440
473
  style={{ ...rootStyle, ...styles?.wrapper, zIndex: overlayZIndex.drawer }}
441
474
  data-slot="drawer-wrapper"
442
475
  >
476
+ {trapFocus || open ? <DrawerFocusLifecycle onExit={handleFocusExit} /> : null}
443
477
  {maskConfig.enabled ? (
444
478
  <div
445
479
  className={cn(
@@ -471,7 +505,6 @@ export const Drawer: React.FC<DrawerProps> = ({
471
505
  <NonModalDrawerRoot
472
506
  open={open}
473
507
  keyboard={keyboard}
474
- focusTriggerAfterClose={focusTriggerAfterClose}
475
508
  labelledBy={drawerTitleId}
476
509
  placement={placement}
477
510
  onEscape={handleNonModalEscape}
@@ -31,10 +31,15 @@ export type DrawerFocusable = {
31
31
  */
32
32
  trap?: boolean
33
33
  /**
34
- * 关闭后是否将焦点还原到触发器
34
+ * 是否在关闭后自动回焦,模态和非模态均生效
35
35
  * @default true
36
36
  */
37
37
  focusTriggerAfterClose?: boolean
38
+ /**
39
+ * 在关闭时解析回焦元素,可通过 ref 为已移除的入口提供备用控件。
40
+ * 返回 null 跳过自动回焦。仅在 focusTriggerAfterClose 启用时调用。
41
+ */
42
+ getReturnFocus?: () => HTMLElement | null
38
43
  }
39
44
 
40
45
  /** Portal 挂载目标 */
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Drawer:需要从屏幕边缘滑出面板展示详情、表单或临时任务,且保留原页面上下文时。
4
4
 
5
- 版本:`1.3.3`。组件源码在本目录,属于当前项目。
5
+ 版本:`1.3.4`。组件源码在本目录,属于当前项目。
6
6
 
7
7
  公开导出:`Drawer`。
8
8
 
@@ -122,7 +122,8 @@ type DrawerSize = number
122
122
  | 属性 | 说明 | 类型 | 必填 | 默认值 |
123
123
  | --- | --- | --- | --- | --- |
124
124
  | trap | 是否启用模态焦点管理。`false` 时允许与 Drawer 外页面继续交互 | `boolean` | 否 | `true` |
125
- | focusTriggerAfterClose | 关闭后是否将焦点还原到触发器 | `boolean` | 否 | `true` |
125
+ | focusTriggerAfterClose | 是否在关闭后自动回焦,模态和非模态均生效 | `boolean` | 否 | `true` |
126
+ | getReturnFocus | 在关闭时解析回焦元素,可通过 ref 为已移除的入口提供备用控件。<br>返回 null 跳过自动回焦。仅在 focusTriggerAfterClose 启用时调用。 | `() => HTMLElement \| null` | 否 | — |
126
127
 
127
128
  ### DrawerContainer
128
129
 
@@ -1,6 +1,6 @@
1
1
  # Drawer Token 明细
2
2
 
3
- 包:`@apexhub/apex-ui-react`;版本:`1.3.3`(当前源码快照)。
3
+ 包:`@apexhub/apex-ui-react`;版本:`1.3.4`(当前源码快照)。
4
4
 
5
5
  按需读取:[组件用法](./llm.txt) · [主题与覆盖规则](../../llms-theme.txt)。
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Dropdown:在触发器附近展示一组快捷操作或菜单项时。
4
4
 
5
- 版本:`1.3.3`。组件源码在本目录,属于当前项目。
5
+ 版本:`1.3.4`。组件源码在本目录,属于当前项目。
6
6
 
7
7
  公开导出:`Dropdown`。
8
8
 
@@ -1,6 +1,6 @@
1
1
  # Dropdown Token 明细
2
2
 
3
- 包:`@apexhub/apex-ui-react`;版本:`1.3.3`(当前源码快照)。
3
+ 包:`@apexhub/apex-ui-react`;版本:`1.3.4`(当前源码快照)。
4
4
 
5
5
  按需读取:[组件用法](./llm.txt) · [主题与覆盖规则](../../llms-theme.txt)。
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Form:需要收集、校验并提交一组结构化字段数据时。
4
4
 
5
- 版本:`1.3.3`。组件源码在本目录,属于当前项目。
5
+ 版本:`1.3.4`。组件源码在本目录,属于当前项目。
6
6
 
7
7
  公开导出:`Form`、`FormItem`、`useForm`。
8
8
 
@@ -1,6 +1,6 @@
1
1
  # Form Token 明细
2
2
 
3
- 包:`@apexhub/apex-ui-react`;版本:`1.3.3`(当前源码快照)。
3
+ 包:`@apexhub/apex-ui-react`;版本:`1.3.4`(当前源码快照)。
4
4
 
5
5
  按需读取:[组件用法](./llm.txt) · [主题与覆盖规则](../../llms-theme.txt)。
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Grid:页面区块需要按 24 栅格划分宽度与响应式列数时。
4
4
 
5
- 版本:`1.3.3`。组件源码在本目录,属于当前项目。
5
+ 版本:`1.3.4`。组件源码在本目录,属于当前项目。
6
6
 
7
7
  公开导出:`Col`、`Row`、`useBreakpoint`。
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Image:需要以缩略图形式展示图片,并支持点击放大预览时。
4
4
 
5
- 版本:`1.3.3`。组件源码在本目录,属于当前项目。
5
+ 版本:`1.3.4`。组件源码在本目录,属于当前项目。
6
6
 
7
7
  公开导出:`Image`。
8
8
 
@@ -1,6 +1,6 @@
1
1
  # Image Token 明细
2
2
 
3
- 包:`@apexhub/apex-ui-react`;版本:`1.3.3`(当前源码快照)。
3
+ 包:`@apexhub/apex-ui-react`;版本:`1.3.4`(当前源码快照)。
4
4
 
5
5
  按需读取:[组件用法](./llm.txt) · [主题与覆盖规则](../../llms-theme.txt)。
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Input:需要通过键盘录入单行或多行文本内容时。
4
4
 
5
- 版本:`1.3.3`。组件源码在本目录,属于当前项目。
5
+ 版本:`1.3.4`。组件源码在本目录,属于当前项目。
6
6
 
7
7
  公开导出:`Input`。
8
8
 
@@ -1,6 +1,6 @@
1
1
  # Input Token 明细
2
2
 
3
- 包:`@apexhub/apex-ui-react`;版本:`1.3.3`(当前源码快照)。
3
+ 包:`@apexhub/apex-ui-react`;版本:`1.3.4`(当前源码快照)。
4
4
 
5
5
  按需读取:[组件用法](./llm.txt) · [主题与覆盖规则](../../llms-theme.txt)。
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > InputNumber:需要录入有上下界的数值,并支持步进增减时。
4
4
 
5
- 版本:`1.3.3`。组件源码在本目录,属于当前项目。
5
+ 版本:`1.3.4`。组件源码在本目录,属于当前项目。
6
6
 
7
7
  公开导出:`InputNumber`。
8
8
 
@@ -1,6 +1,6 @@
1
1
  # InputNumber Token 明细
2
2
 
3
- 包:`@apexhub/apex-ui-react`;版本:`1.3.3`(当前源码快照)。
3
+ 包:`@apexhub/apex-ui-react`;版本:`1.3.4`(当前源码快照)。
4
4
 
5
5
  按需读取:[组件用法](./llm.txt) · [主题与覆盖规则](../../llms-theme.txt)。
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Layout:搭建后台页面的 Header、侧栏、内容区与 Footer 等整体结构时。
4
4
 
5
- 版本:`1.3.3`。组件源码在本目录,属于当前项目。
5
+ 版本:`1.3.4`。组件源码在本目录,属于当前项目。
6
6
 
7
7
  公开导出:`Layout`、`LayoutSiderDrawerBody`、`LayoutSiderDrawerHeader`、`LayoutSiderMenuCollapsed`、`LayoutSiderMenuMaximized`。
8
8
 
@@ -1,6 +1,6 @@
1
1
  # Layout Token 明细
2
2
 
3
- 包:`@apexhub/apex-ui-react`;版本:`1.3.3`(当前源码快照)。
3
+ 包:`@apexhub/apex-ui-react`;版本:`1.3.4`(当前源码快照)。
4
4
 
5
5
  按需读取:[组件用法](./llm.txt) · [主题与覆盖规则](../../llms-theme.txt)。
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Menu:侧栏持久导航,需要在图标 rail 与展开列表之间切换时。
4
4
 
5
- 版本:`1.3.3`。组件源码在本目录,属于当前项目。
5
+ 版本:`1.3.4`。组件源码在本目录,属于当前项目。
6
6
 
7
7
  公开导出:`isKeySelected`、`Menu`。
8
8
 
@@ -1,6 +1,6 @@
1
1
  # Menu Token 明细
2
2
 
3
- 包:`@apexhub/apex-ui-react`;版本:`1.3.3`(当前源码快照)。
3
+ 包:`@apexhub/apex-ui-react`;版本:`1.3.4`(当前源码快照)。
4
4
 
5
5
  按需读取:[组件用法](./llm.txt) · [主题与覆盖规则](../../llms-theme.txt)。
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Message:操作结果的轻量全局反馈(成功、失败、警告、进行中等)时。
4
4
 
5
- 版本:`1.3.3`。组件源码在本目录,属于当前项目。
5
+ 版本:`1.3.4`。组件源码在本目录,属于当前项目。
6
6
 
7
7
  公开导出:`message`。
8
8
 
@@ -1,6 +1,6 @@
1
1
  # Message Token 明细
2
2
 
3
- 包:`@apexhub/apex-ui-react`;版本:`1.3.3`(当前源码快照)。
3
+ 包:`@apexhub/apex-ui-react`;版本:`1.3.4`(当前源码快照)。
4
4
 
5
5
  按需读取:[组件用法](./llm.txt) · [主题与覆盖规则](../../llms-theme.txt)。
6
6