@elvora/core 1.0.0-rc.1
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/LICENSE +21 -0
- package/README.md +24 -0
- package/dist/chunk-VFHCOPTO.js +127 -0
- package/dist/chunk-VFHCOPTO.js.map +1 -0
- package/dist/focusTrap-Bko1L5FG.d.cts +18 -0
- package/dist/focusTrap-Bko1L5FG.d.ts +18 -0
- package/dist/index.cjs +749 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +346 -0
- package/dist/index.d.ts +346 -0
- package/dist/index.js +603 -0
- package/dist/index.js.map +1 -0
- package/dist/react/index.cjs +245 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.cts +73 -0
- package/dist/react/index.d.ts +73 -0
- package/dist/react/index.js +109 -0
- package/dist/react/index.js.map +1 -0
- package/package.json +75 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { generateId, createFocusTrap } from '../chunk-VFHCOPTO.js';
|
|
2
|
+
import { useLayoutEffect, useEffect, useRef, useCallback, useId as useId$1, useMemo, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" && typeof window.document !== "undefined" ? useLayoutEffect : useEffect;
|
|
5
|
+
function useEventCallback(fn) {
|
|
6
|
+
const ref = useRef(fn);
|
|
7
|
+
useIsomorphicLayoutEffect(() => {
|
|
8
|
+
ref.current = fn;
|
|
9
|
+
});
|
|
10
|
+
return useCallback((...args) => ref.current?.(...args), []);
|
|
11
|
+
}
|
|
12
|
+
function useId(providedId, prefix = "elvora") {
|
|
13
|
+
const reactId = typeof useId$1 === "function" ? useId$1() : void 0;
|
|
14
|
+
const fallback = useMemo(() => generateId(prefix), [prefix]);
|
|
15
|
+
if (providedId) return providedId;
|
|
16
|
+
return reactId ? `${prefix}-${reactId.replace(/:/g, "")}` : fallback;
|
|
17
|
+
}
|
|
18
|
+
function useControllableState({
|
|
19
|
+
value,
|
|
20
|
+
defaultValue,
|
|
21
|
+
onChange
|
|
22
|
+
}) {
|
|
23
|
+
const isControlled = value !== void 0;
|
|
24
|
+
const [uncontrolled, setUncontrolled] = useState(defaultValue);
|
|
25
|
+
const onChangeStable = useEventCallback(onChange);
|
|
26
|
+
const currentRef = useRef(isControlled ? value : uncontrolled);
|
|
27
|
+
currentRef.current = isControlled ? value : uncontrolled;
|
|
28
|
+
const setValue = useCallback(
|
|
29
|
+
(next) => {
|
|
30
|
+
const resolved = typeof next === "function" ? next(currentRef.current) : next;
|
|
31
|
+
if (!isControlled) {
|
|
32
|
+
setUncontrolled(resolved);
|
|
33
|
+
}
|
|
34
|
+
onChangeStable(resolved);
|
|
35
|
+
},
|
|
36
|
+
[isControlled, onChangeStable]
|
|
37
|
+
);
|
|
38
|
+
return [isControlled ? value : uncontrolled, setValue];
|
|
39
|
+
}
|
|
40
|
+
function usePortal(id = "elvora-portal-root") {
|
|
41
|
+
const [container, setContainer] = useState(null);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (typeof document === "undefined") return;
|
|
44
|
+
let node = document.getElementById(id);
|
|
45
|
+
let created = false;
|
|
46
|
+
if (!node) {
|
|
47
|
+
node = document.createElement("div");
|
|
48
|
+
node.id = id;
|
|
49
|
+
node.setAttribute("data-elvora-portal", "");
|
|
50
|
+
document.body.appendChild(node);
|
|
51
|
+
created = true;
|
|
52
|
+
}
|
|
53
|
+
setContainer(node);
|
|
54
|
+
return () => {
|
|
55
|
+
if (created && node && node.parentElement && node.childNodes.length === 0) {
|
|
56
|
+
node.parentElement.removeChild(node);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}, [id]);
|
|
60
|
+
return container;
|
|
61
|
+
}
|
|
62
|
+
function useFocusTrap(ref, options) {
|
|
63
|
+
const trapRef = useRef(null);
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
const node = ref.current;
|
|
66
|
+
if (!node || !options.enabled) {
|
|
67
|
+
trapRef.current?.deactivate();
|
|
68
|
+
trapRef.current = null;
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const trap = createFocusTrap(node, options);
|
|
72
|
+
trap.activate();
|
|
73
|
+
trapRef.current = trap;
|
|
74
|
+
return () => {
|
|
75
|
+
trap.deactivate();
|
|
76
|
+
trapRef.current = null;
|
|
77
|
+
};
|
|
78
|
+
}, [ref, options.enabled]);
|
|
79
|
+
}
|
|
80
|
+
function useDismissable(ref, {
|
|
81
|
+
enabled,
|
|
82
|
+
onDismiss,
|
|
83
|
+
closeOnEscape = true,
|
|
84
|
+
closeOnOutsideClick = true
|
|
85
|
+
}) {
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if (!enabled) return;
|
|
88
|
+
function handleKey(e) {
|
|
89
|
+
if (closeOnEscape && e.key === "Escape") onDismiss(e);
|
|
90
|
+
}
|
|
91
|
+
function handlePointer(e) {
|
|
92
|
+
if (!closeOnOutsideClick) return;
|
|
93
|
+
const target = e.target;
|
|
94
|
+
if (target && ref.current && !ref.current.contains(target)) onDismiss(e);
|
|
95
|
+
}
|
|
96
|
+
document.addEventListener("keydown", handleKey, true);
|
|
97
|
+
document.addEventListener("mousedown", handlePointer, true);
|
|
98
|
+
document.addEventListener("touchstart", handlePointer, true);
|
|
99
|
+
return () => {
|
|
100
|
+
document.removeEventListener("keydown", handleKey, true);
|
|
101
|
+
document.removeEventListener("mousedown", handlePointer, true);
|
|
102
|
+
document.removeEventListener("touchstart", handlePointer, true);
|
|
103
|
+
};
|
|
104
|
+
}, [enabled, onDismiss, closeOnEscape, closeOnOutsideClick, ref]);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export { useControllableState, useDismissable, useEventCallback, useFocusTrap, useId, useIsomorphicLayoutEffect, usePortal };
|
|
108
|
+
//# sourceMappingURL=index.js.map
|
|
109
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/react/useIsomorphicLayoutEffect.ts","../../src/react/useEventCallback.ts","../../src/react/useId.ts","../../src/react/useControllableState.ts","../../src/react/usePortal.ts","../../src/react/useFocusTrap.ts","../../src/react/useDismissable.ts"],"names":["useReactId","useRef","useCallback","useState","useEffect"],"mappings":";;;AAMO,IAAM,yBAAA,GACX,OAAO,MAAA,KAAW,WAAA,IAAe,OAAO,MAAA,CAAO,QAAA,KAAa,cACxD,eAAA,GACA;ACDC,SAAS,iBACd,EAAA,EACkC;AAClC,EAAA,MAAM,GAAA,GAAM,OAAO,EAAE,CAAA;AAErB,EAAA,yBAAA,CAA0B,MAAM;AAC9B,IAAA,GAAA,CAAI,OAAA,GAAU,EAAA;AAAA,EAChB,CAAC,CAAA;AAED,EAAA,OAAO,WAAA,CAAY,IAAI,IAAA,KAAe,GAAA,CAAI,UAAU,GAAG,IAAI,CAAA,EAAG,EAAE,CAAA;AAClE;ACVO,SAAS,KAAA,CAAM,UAAA,EAAqB,MAAA,GAAS,QAAA,EAAkB;AACpE,EAAA,MAAM,OAAA,GAAU,OAAOA,OAAA,KAAe,UAAA,GAAaA,SAAW,GAAI,MAAA;AAClE,EAAA,MAAM,QAAA,GAAW,QAAQ,MAAM,UAAA,CAAW,MAAM,CAAA,EAAG,CAAC,MAAM,CAAC,CAAA;AAC3D,EAAA,IAAI,YAAY,OAAO,UAAA;AACvB,EAAA,OAAO,OAAA,GAAU,GAAG,MAAM,CAAA,CAAA,EAAI,QAAQ,OAAA,CAAQ,IAAA,EAAM,EAAE,CAAC,CAAA,CAAA,GAAK,QAAA;AAC9D;ACOO,SAAS,oBAAA,CAAwB;AAAA,EACtC,KAAA;AAAA,EACA,YAAA;AAAA,EACA;AACF,CAAA,EAAsG;AACpG,EAAA,MAAM,eAAe,KAAA,KAAU,MAAA;AAC/B,EAAA,MAAM,CAAC,YAAA,EAAc,eAAe,CAAA,GAAI,SAAwB,YAAY,CAAA;AAC5E,EAAA,MAAM,cAAA,GAAiB,iBAAiB,QAAQ,CAAA;AAGhD,EAAA,MAAM,UAAA,GA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A,SAAS,cAAc,CAAA,EAAkC;AACvD,MAAA,IAAI,CAAC,mBAAA,EAAqB;AAC1B,MAAA,MAAM,SAAS,CAAA,CAAE,MAAA;AACjB,MAAA,IAAI,MAAA,IAAU,GAAA,CAAI,OAAA,IAAW,CAAC,GAAA,CAAI,QAAQ,QAAA,CAAS,MAAM,CAAA,EAAG,SAAA,CAAU,CAAC,CAAA;AAAA,IACzE;AAEA,IAAA,QAAA,CAAS,gBAAA,CAAiB,SAAA,EAAW,SAAA,EAAW,IAAI,CAAA;AACpD,IAAA,QAAA,CAAS,gBAAA,CAAiB,WAAA,EAAa,aAAA,EAAe,IAAI,CAAA;AAC1D,IAAA,QAAA,CAAS,gBAAA,CAAiB,YAAA,EAAc,aAAA,EAAe,IAAI,CAAA;AAE3D,IAAA,OAAO,MAAM;AACX,MAAA,QAAA,CAAS,mBAAA,CAAoB,SAAA,EAAW,SAAA,EAAW,IAAI,CAAA;AACvD,MAAA,QAAA,CAAS,mBAAA,CAAoB,WAAA,EAAa,aAAA,EAAe,IAAI,CAAA;AAC7D,MAAA,QAAA,CAAS,mBAAA,CAAoB,YAAA,EAAc,aAAA,EAAe,IAAI,CAAA;AAAA,IAChE,CAAA;AAAA,EACF,GAAG,CAAC,OAAA,EAAS,WAAW,aAAA,EAAe,mBAAA,EAAqB,GAAG,CAAC,CAAA;AAClE","file":"index.js","sourcesContent":["import { useEffect, useLayoutEffect } from 'react';\r\n\r\n/**\r\n * `useLayoutEffect` warns when used during SSR; this swaps in `useEffect` on\r\n * the server so components stay isomorphic.\r\n */\r\nexport const useIsomorphicLayoutEffect =\r\n typeof window !== 'undefined' && typeof window.document !== 'undefined'\r\n ? useLayoutEffect\r\n : useEffect;\r\n","import { useCallback, useRef } from 'react';\r\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';\r\n\r\n/**\r\n * Returns a stable callback identity whose body reads the latest props/state.\r\n * Lets a component pass the same handler down across renders without making\r\n * dependents re-render, while still calling the latest closure.\r\n */\r\nexport function useEventCallback<Args extends unknown[], R>(\r\n fn: ((...args: Args) => R) | undefined,\r\n): (...args: Args) => R | undefined {\r\n const ref = useRef(fn);\r\n\r\n useIsomorphicLayoutEffect(() => {\r\n ref.current = fn;\r\n });\r\n\r\n return useCallback((...args: Args) => ref.current?.(...args), []);\r\n}\r\n","import { useId as useReactId, useMemo } from 'react';\r\nimport { generateId } from '../id';\r\n\r\n/**\r\n * SSR-safe id hook. Prefers React 18's built-in `useId`; falls back to a\r\n * memoized id when consumers pin an older React, or when they explicitly\r\n * provide an id via props (passed through).\r\n */\r\nexport function useId(providedId?: string, prefix = 'elvora'): string {\r\n const reactId = typeof useReactId === 'function' ? useReactId() : undefined;\r\n const fallback = useMemo(() => generateId(prefix), [prefix]);\r\n if (providedId) return providedId;\r\n return reactId ? `${prefix}-${reactId.replace(/:/g, '')}` : fallback;\r\n}\r\n","import { useCallback, useRef, useState } from 'react';\r\nimport { useEventCallback } from './useEventCallback';\r\n\r\nexport interface UseControllableStateOptions<T> {\r\n /** Controlled value. When defined the hook reports it directly. */\r\n value?: T;\r\n /** Default value for uncontrolled mode. */\r\n defaultValue?: T | (() => T);\r\n /** Called whenever the value changes (controlled or uncontrolled). */\r\n onChange?: (value: T) => void;\r\n}\r\n\r\n/**\r\n * Bridges controlled and uncontrolled component patterns. Returns\r\n * `[value, setValue]`: in controlled mode `value` mirrors the prop and\r\n * `setValue` only fires `onChange`; in uncontrolled mode `setValue` also\r\n * updates internal state.\r\n *\r\n * Mirrors the pattern used by Radix UI, Aria, and Reach UI.\r\n */\r\nexport function useControllableState<T>({\r\n value,\r\n defaultValue,\r\n onChange,\r\n}: UseControllableStateOptions<T>): [T | undefined, (next: T | ((prev: T | undefined) => T)) => void] {\r\n const isControlled = value !== undefined;\r\n const [uncontrolled, setUncontrolled] = useState<T | undefined>(defaultValue);\r\n const onChangeStable = useEventCallback(onChange);\r\n\r\n // Track latest internal value for functional updates in controlled mode.\r\n const currentRef = useRef(isControlled ? value : uncontrolled);\r\n currentRef.current = isControlled ? value : uncontrolled;\r\n\r\n const setValue = useCallback(\r\n (next: T | ((prev: T | undefined) => T)) => {\r\n const resolved =\r\n typeof next === 'function' ? (next as (prev: T | undefined) => T)(currentRef.current) : next;\r\n\r\n if (!isControlled) {\r\n setUncontrolled(resolved);\r\n }\r\n onChangeStable(resolved);\r\n },\r\n [isControlled, onChangeStable],\r\n );\r\n\r\n return [isControlled ? value : uncontrolled, setValue];\r\n}\r\n","import { useEffect, useState } from 'react';\r\n\r\n/**\r\n * Returns a DOM container suitable for `ReactDOM.createPortal`. Lazily creates\r\n * one on first render under `document.body` so consumers don't need to set\r\n * up portal roots themselves. SSR-safe (returns null until mount).\r\n */\r\nexport function usePortal(id = 'elvora-portal-root'): HTMLElement | null {\r\n const [container, setContainer] = useState<HTMLElement | null>(null);\r\n\r\n useEffect(() => {\r\n if (typeof document === 'undefined') return;\r\n\r\n let node = document.getElementById(id);\r\n let created = false;\r\n if (!node) {\r\n node = document.createElement('div');\r\n node.id = id;\r\n node.setAttribute('data-elvora-portal', '');\r\n document.body.appendChild(node);\r\n created = true;\r\n }\r\n setContainer(node);\r\n\r\n return () => {\r\n // Only remove the node if this hook created it AND it has no other\r\n // portal children mounted into it.\r\n if (created && node && node.parentElement && node.childNodes.length === 0) {\r\n node.parentElement.removeChild(node);\r\n }\r\n };\r\n }, [id]);\r\n\r\n return container;\r\n}\r\n","import { useEffect, useRef, type RefObject } from 'react';\r\nimport { createFocusTrap, type FocusTrapOptions } from '../focus/focusTrap';\r\n\r\nexport interface UseFocusTrapOptions extends FocusTrapOptions {\r\n /** Whether the trap is active. Toggle this when the modal/menu opens/closes. */\r\n enabled: boolean;\r\n}\r\n\r\n/**\r\n * Activates a focus trap on the provided ref while `enabled` is true. Cleans\r\n * up on unmount and disables on `enabled === false`.\r\n */\r\nexport function useFocusTrap<T extends HTMLElement>(\r\n ref: RefObject<T | null>,\r\n options: UseFocusTrapOptions,\r\n): void {\r\n const trapRef = useRef<ReturnType<typeof createFocusTrap> | null>(null);\r\n\r\n useEffect(() => {\r\n const node = ref.current;\r\n if (!node || !options.enabled) {\r\n trapRef.current?.deactivate();\r\n trapRef.current = null;\r\n return;\r\n }\r\n\r\n const trap = createFocusTrap(node, options);\r\n trap.activate();\r\n trapRef.current = trap;\r\n\r\n return () => {\r\n trap.deactivate();\r\n trapRef.current = null;\r\n };\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [ref, options.enabled]);\r\n}\r\n","import { useEffect, type RefObject } from 'react';\r\n\r\nexport interface UseDismissableOptions {\r\n enabled: boolean;\r\n onDismiss: (event: Event) => void;\r\n /** When true, Escape triggers dismiss. Default true. */\r\n closeOnEscape?: boolean;\r\n /** When true, outside pointerdown triggers dismiss. Default true. */\r\n closeOnOutsideClick?: boolean;\r\n}\r\n\r\n/**\r\n * Listens for Escape and/or outside-click and calls `onDismiss`. Designed for\r\n * popovers, dropdowns, drawers, and toasts.\r\n */\r\nexport function useDismissable<T extends HTMLElement>(\r\n ref: RefObject<T | null>,\r\n {\r\n enabled,\r\n onDismiss,\r\n closeOnEscape = true,\r\n closeOnOutsideClick = true,\r\n }: UseDismissableOptions,\r\n): void {\r\n useEffect(() => {\r\n if (!enabled) return;\r\n\r\n function handleKey(e: KeyboardEvent): void {\r\n if (closeOnEscape && e.key === 'Escape') onDismiss(e);\r\n }\r\n function handlePointer(e: MouseEvent | TouchEvent): void {\r\n if (!closeOnOutsideClick) return;\r\n const target = e.target as Node | null;\r\n if (target && ref.current && !ref.current.contains(target)) onDismiss(e);\r\n }\r\n\r\n document.addEventListener('keydown', handleKey, true);\r\n document.addEventListener('mousedown', handlePointer, true);\r\n document.addEventListener('touchstart', handlePointer, true);\r\n\r\n return () => {\r\n document.removeEventListener('keydown', handleKey, true);\r\n document.removeEventListener('mousedown', handlePointer, true);\r\n document.removeEventListener('touchstart', handlePointer, true);\r\n };\r\n }, [enabled, onDismiss, closeOnEscape, closeOnOutsideClick, ref]);\r\n}\r\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@elvora/core",
|
|
3
|
+
"version": "1.0.0-rc.1",
|
|
4
|
+
"description": "Framework-agnostic primitives, state machines, accessibility logic, and shared types powering Elvora UI's React, RN, Angular, Vue, and Svelte adapters.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Elvora UI Contributors",
|
|
7
|
+
"homepage": "https://github.com/elvora-ui/elvora/tree/main/packages/core#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/elvora-ui/elvora.git",
|
|
11
|
+
"directory": "packages/core"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/elvora-ui/elvora/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"ui",
|
|
18
|
+
"headless",
|
|
19
|
+
"primitives",
|
|
20
|
+
"state-machine",
|
|
21
|
+
"accessibility",
|
|
22
|
+
"elvora"
|
|
23
|
+
],
|
|
24
|
+
"type": "module",
|
|
25
|
+
"main": "./dist/index.cjs",
|
|
26
|
+
"module": "./dist/index.js",
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"import": "./dist/index.js",
|
|
32
|
+
"require": "./dist/index.cjs"
|
|
33
|
+
},
|
|
34
|
+
"./react": {
|
|
35
|
+
"types": "./dist/react/index.d.ts",
|
|
36
|
+
"import": "./dist/react/index.js",
|
|
37
|
+
"require": "./dist/react/index.cjs"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist"
|
|
42
|
+
],
|
|
43
|
+
"sideEffects": false,
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"react": ">=18.0.0"
|
|
46
|
+
},
|
|
47
|
+
"peerDependenciesMeta": {
|
|
48
|
+
"react": {
|
|
49
|
+
"optional": true
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@elvora/tokens": "1.0.0-rc.1"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@types/react": "^18.3.18",
|
|
57
|
+
"react": "^18.3.1",
|
|
58
|
+
"rimraf": "^6.0.1",
|
|
59
|
+
"tsup": "^8.3.5",
|
|
60
|
+
"typescript": "^5.7.2",
|
|
61
|
+
"vitest": "^2.1.8"
|
|
62
|
+
},
|
|
63
|
+
"publishConfig": {
|
|
64
|
+
"access": "public"
|
|
65
|
+
},
|
|
66
|
+
"scripts": {
|
|
67
|
+
"build": "tsup",
|
|
68
|
+
"dev": "tsup --watch",
|
|
69
|
+
"typecheck": "tsc --noEmit",
|
|
70
|
+
"lint": "echo 'no lint configured'",
|
|
71
|
+
"test": "vitest run",
|
|
72
|
+
"test:watch": "vitest",
|
|
73
|
+
"clean": "rimraf dist"
|
|
74
|
+
}
|
|
75
|
+
}
|