@apexhub/apex-ui-react-source 1.3.4 → 1.3.5
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/Drawer.tsx +45 -3
- package/dist/files/drawer/drawer.css +8 -0
- 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/llm.txt +1 -1
- package/dist/files/form/tokens.txt +1 -1
- 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/llm.txt +1 -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/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/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 +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/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 +1 -1
- package/dist/files/upload/tokens.txt +1 -1
- package/dist/manifest.json +86 -86
- package/package.json +2 -2
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.5, 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
|
@@ -25,6 +25,17 @@ import { drawerScopeVariants } from './variants'
|
|
|
25
25
|
|
|
26
26
|
const OVERLAY_LAYER_SELECTOR = '[data-slot="message-root"],[data-slot="notification-root"]'
|
|
27
27
|
|
|
28
|
+
const RESTORED_FOCUS_ATTRIBUTE = 'data-apex-drawer-restored-focus'
|
|
29
|
+
|
|
30
|
+
type OpeningInput = 'pointer' | 'keyboard'
|
|
31
|
+
|
|
32
|
+
function markRestoredFocus(target: HTMLElement, input: OpeningInput) {
|
|
33
|
+
target.setAttribute(RESTORED_FOCUS_ATTRIBUTE, input)
|
|
34
|
+
target.addEventListener('blur', () => target.removeAttribute(RESTORED_FOCUS_ATTRIBUTE), {
|
|
35
|
+
once: true,
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
|
|
28
39
|
function isInsideOverlayLayer(target: EventTarget | null): boolean {
|
|
29
40
|
const el =
|
|
30
41
|
target instanceof Element ? target : target instanceof Node ? target.parentElement : null
|
|
@@ -174,29 +185,48 @@ export const Drawer: React.FC<DrawerProps> = ({
|
|
|
174
185
|
const panelRef = React.useRef<HTMLElement | null>(null)
|
|
175
186
|
const focusableRef = React.useRef(focusable)
|
|
176
187
|
focusableRef.current = focusable
|
|
188
|
+
const openingInputRef = React.useRef<OpeningInput | undefined>(undefined)
|
|
177
189
|
const focusSessionRef = React.useRef<{
|
|
178
190
|
ownerDocument: Document
|
|
179
191
|
trigger: HTMLElement | null
|
|
180
192
|
triggerIsTabPanel: boolean
|
|
193
|
+
openingInput: OpeningInput
|
|
181
194
|
} | null>(null)
|
|
182
195
|
|
|
183
196
|
React.useLayoutEffect(() => {
|
|
184
|
-
if (!open) return
|
|
185
197
|
const ownerDocument = panelRef.current?.ownerDocument ?? document
|
|
198
|
+
if (!open) {
|
|
199
|
+
const onPointerDown = () => {
|
|
200
|
+
openingInputRef.current = 'pointer'
|
|
201
|
+
}
|
|
202
|
+
const onKeyDown = () => {
|
|
203
|
+
openingInputRef.current = 'keyboard'
|
|
204
|
+
}
|
|
205
|
+
ownerDocument.addEventListener('pointerdown', onPointerDown, true)
|
|
206
|
+
ownerDocument.addEventListener('keydown', onKeyDown, true)
|
|
207
|
+
return () => {
|
|
208
|
+
ownerDocument.removeEventListener('pointerdown', onPointerDown, true)
|
|
209
|
+
ownerDocument.removeEventListener('keydown', onKeyDown, true)
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
186
213
|
const active = ownerDocument.activeElement
|
|
187
214
|
const trigger = active instanceof HTMLElement && active !== ownerDocument.body ? active : null
|
|
188
215
|
focusSessionRef.current = {
|
|
189
216
|
ownerDocument,
|
|
190
217
|
trigger,
|
|
191
218
|
triggerIsTabPanel: trigger?.matches('[role="tabpanel"]') ?? false,
|
|
219
|
+
openingInput:
|
|
220
|
+
openingInputRef.current ?? (trigger?.matches(':focus-visible') ? 'keyboard' : 'pointer'),
|
|
192
221
|
}
|
|
222
|
+
openingInputRef.current = undefined
|
|
193
223
|
}, [open])
|
|
194
224
|
|
|
195
225
|
const handleFocusExit = React.useCallback(
|
|
196
226
|
(activeRef: React.RefObject<boolean>) => {
|
|
197
227
|
const session = focusSessionRef.current
|
|
198
228
|
if (!session) return
|
|
199
|
-
const { ownerDocument, trigger, triggerIsTabPanel } = session
|
|
229
|
+
const { ownerDocument, trigger, triggerIsTabPanel, openingInput } = session
|
|
200
230
|
const focusedBeforeRestore = ownerDocument.activeElement
|
|
201
231
|
queueMicrotask(() => {
|
|
202
232
|
if (
|
|
@@ -210,13 +240,25 @@ export const Drawer: React.FC<DrawerProps> = ({
|
|
|
210
240
|
const resolveTarget = options?.getReturnFocus
|
|
211
241
|
if (enabled && !resolveTarget && !triggerIsTabPanel) {
|
|
212
242
|
if (!trapFocus && trigger?.isConnected) trigger.focus({ preventScroll: true })
|
|
243
|
+
|
|
244
|
+
const restored = ownerDocument.activeElement
|
|
245
|
+
if (
|
|
246
|
+
restored instanceof HTMLElement &&
|
|
247
|
+
restored !== ownerDocument.body &&
|
|
248
|
+
(restored === trigger || (trapFocus && restored !== focusedBeforeRestore))
|
|
249
|
+
) {
|
|
250
|
+
markRestoredFocus(restored, openingInput)
|
|
251
|
+
}
|
|
213
252
|
return
|
|
214
253
|
}
|
|
215
254
|
|
|
216
255
|
const target = enabled ? resolveTarget?.() : null
|
|
217
256
|
if (target?.isConnected && target.ownerDocument === ownerDocument) {
|
|
218
257
|
target.focus({ preventScroll: true })
|
|
219
|
-
if (ownerDocument.activeElement === target)
|
|
258
|
+
if (ownerDocument.activeElement === target) {
|
|
259
|
+
markRestoredFocus(target, openingInput)
|
|
260
|
+
return
|
|
261
|
+
}
|
|
220
262
|
}
|
|
221
263
|
|
|
222
264
|
// Undo automatic restoration while preserving focus the consumer placed during close.
|
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
pointer-events: none;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
:root [data-apex-drawer-restored-focus='pointer']:focus {
|
|
14
|
+
outline: none;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
[data-apex-drawer-restored-focus='keyboard']:focus:not(:focus-visible) {
|
|
18
|
+
outline: auto;
|
|
19
|
+
}
|
|
20
|
+
|
|
13
21
|
.apex-drawer__mask {
|
|
14
22
|
position: fixed;
|
|
15
23
|
inset: 0;
|
package/dist/files/form/llm.txt
CHANGED
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/llm.txt
CHANGED
package/dist/files/modal/llm.txt
CHANGED