@versini/ui-modal 3.1.0 → 3.2.0
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/index.d.ts +7 -0
- package/dist/index.js +10 -7
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,13 @@ declare namespace ModalTypes {
|
|
|
21
21
|
initialOpen?: boolean;
|
|
22
22
|
onOpenChange?: (open: boolean) => void;
|
|
23
23
|
open?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Which element to initially focus when the modal opens.
|
|
26
|
+
* Can be a number (tabbable index, 0 = first), a ref to an element,
|
|
27
|
+
* or -1 to disable initial focus.
|
|
28
|
+
* @default 0
|
|
29
|
+
*/
|
|
30
|
+
initialFocus?: number | React.RefObject<HTMLElement | null>;
|
|
24
31
|
};
|
|
25
32
|
|
|
26
33
|
type Context =
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-modal v3.
|
|
2
|
+
@versini/ui-modal v3.2.0
|
|
3
3
|
© 2025 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
try {
|
|
6
6
|
if (!window.__VERSINI_UI_MODAL__) {
|
|
7
7
|
window.__VERSINI_UI_MODAL__ = {
|
|
8
|
-
version: "3.
|
|
9
|
-
buildTime: "
|
|
10
|
-
homepage: "https://
|
|
8
|
+
version: "3.2.0",
|
|
9
|
+
buildTime: "12/10/2025 08:21 AM EST",
|
|
10
|
+
homepage: "https://www.npmjs.com/package/@versini/ui-modal",
|
|
11
11
|
license: "MIT",
|
|
12
12
|
};
|
|
13
13
|
}
|
|
@@ -36,7 +36,7 @@ const ModalContext = /*#__PURE__*/ createContext(null);
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
function useModal({ initialOpen = false, open: controlledOpen, onOpenChange: setControlledOpen } = {}) {
|
|
39
|
+
function useModal({ initialOpen = false, open: controlledOpen, onOpenChange: setControlledOpen, initialFocus } = {}) {
|
|
40
40
|
const [uncontrolledOpen, setUncontrolledOpen] = useState(initialOpen);
|
|
41
41
|
const [labelId, setLabelId] = useState();
|
|
42
42
|
const [descriptionId, setDescriptionId] = useState();
|
|
@@ -68,14 +68,16 @@ function useModal({ initialOpen = false, open: controlledOpen, onOpenChange: set
|
|
|
68
68
|
labelId,
|
|
69
69
|
descriptionId,
|
|
70
70
|
setLabelId,
|
|
71
|
-
setDescriptionId
|
|
71
|
+
setDescriptionId,
|
|
72
|
+
initialFocus
|
|
72
73
|
}), [
|
|
73
74
|
open,
|
|
74
75
|
setOpen,
|
|
75
76
|
interactions,
|
|
76
77
|
data,
|
|
77
78
|
labelId,
|
|
78
|
-
descriptionId
|
|
79
|
+
descriptionId,
|
|
80
|
+
initialFocus
|
|
79
81
|
]);
|
|
80
82
|
}
|
|
81
83
|
const useModalContext = ()=>{
|
|
@@ -121,6 +123,7 @@ const Modal_ModalContent = /*#__PURE__*/ forwardRef(function ModalContent(props,
|
|
|
121
123
|
lockScroll: true,
|
|
122
124
|
children: /*#__PURE__*/ jsx(FloatingFocusManager, {
|
|
123
125
|
context: floatingContext,
|
|
126
|
+
initialFocus: context.initialFocus,
|
|
124
127
|
children: /*#__PURE__*/ jsx("div", {
|
|
125
128
|
ref: ref,
|
|
126
129
|
"aria-labelledby": context.labelId,
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/ui-modal",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
|
-
"homepage": "https://
|
|
9
|
+
"homepage": "https://www.npmjs.com/package/@versini/ui-modal",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
12
|
"url": "git@github.com:aversini/ui-components.git"
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"start": "static-server dist --port 5173"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@versini/ui-types": "
|
|
36
|
+
"@versini/ui-types": "7.1.0"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@floating-ui/react": "0.27.16",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"sideEffects": [
|
|
43
43
|
"**/*.css"
|
|
44
44
|
],
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "85fd31156888edce83b4b0ecf195ad613b7db699"
|
|
46
46
|
}
|