@bonprix-ds/react-modal 1.1.3 → 1.1.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/index.js +1 -2
- package/dist/src/Modal.d.ts +2 -2
- package/dist/src/Modal.js +1 -2
- package/dist/src/Modal.js.map +1 -1
- package/dist/src/useAnimation.js +1 -2
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { e as default };
|
|
1
|
+
export { default } from "./src/Modal.js";
|
package/dist/src/Modal.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
2
|
/** @deprecated [modal-component] Use Dialog, SideSheet or BottomSheet instead. */
|
|
3
3
|
export interface Props {
|
|
4
4
|
/** Toggles the visibility of the modal. Should be used in conjunction with the `onClose` property. */
|
|
5
5
|
isOpen: boolean;
|
|
6
6
|
/** The content to be displayed inside the modal. */
|
|
7
|
-
children?:
|
|
7
|
+
children?: ReactNode;
|
|
8
8
|
/** Callback function to be called when the modal is closed. Should be used in conjunction with the `isOpen` property. */
|
|
9
9
|
onClose?: () => void;
|
|
10
10
|
/** The z-index of the modal. */
|
package/dist/src/Modal.js
CHANGED
|
@@ -7,7 +7,7 @@ import { backdrop as r, fadeAnimation as i } from "@bonprix-ds/internal-componen
|
|
|
7
7
|
import { useIsClient as a, usePrefersReducedMotion as o } from "@bonprix-ds/utils";
|
|
8
8
|
import { warnDeprecated as s } from "@bonprix-ds/utils/deprecation";
|
|
9
9
|
import { Fragment as c, jsx as l } from "react/jsx-runtime";
|
|
10
|
-
|
|
10
|
+
// src/Modal.tsx
|
|
11
11
|
var u = n({
|
|
12
12
|
slots: { backdrop: r() },
|
|
13
13
|
variants: { prefersReducedMotion: { false: { backdrop: i() } } }
|
|
@@ -24,7 +24,6 @@ var u = n({
|
|
|
24
24
|
children: n
|
|
25
25
|
}) : null, document.body) }) : null;
|
|
26
26
|
};
|
|
27
|
-
//#endregion
|
|
28
27
|
export { d as default };
|
|
29
28
|
|
|
30
29
|
//# sourceMappingURL=Modal.js.map
|
package/dist/src/Modal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","names":["_Fragment","useAnimation","generateClasses","tv","backdrop","fadeAnimation","Modal","usePrefersReducedMotion","isOpen","useIsClient","Fragment","createPortal","shouldRender","onClose","handleAnimationEnd"],"sources":["../../src/Modal.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { tv } from \"tailwind-variants\";\n\nimport { backdrop, fadeAnimation } from \"@bonprix-ds/internal-components\";\nimport { useIsClient, usePrefersReducedMotion } from \"@bonprix-ds/utils\";\nimport { warnDeprecated } from \"@bonprix-ds/utils/deprecation\";\n\nimport useAnimation from \"./useAnimation\";\n\nconst generateClasses = tv({\n slots: {\n backdrop: backdrop(),\n },\n variants: {\n prefersReducedMotion: {\n false: {\n backdrop: fadeAnimation(),\n },\n },\n },\n});\n\n/** @deprecated [modal-component] Use Dialog, SideSheet or BottomSheet instead. */\nexport interface Props {\n /** Toggles the visibility of the modal. Should be used in conjunction with the `onClose` property. */\n isOpen: boolean;\n /** The content to be displayed inside the modal. */\n children?:
|
|
1
|
+
{"version":3,"file":"Modal.js","names":["_Fragment","useAnimation","generateClasses","tv","backdrop","fadeAnimation","Modal","usePrefersReducedMotion","isOpen","useIsClient","Fragment","createPortal","shouldRender","onClose","handleAnimationEnd"],"sources":["../../src/Modal.tsx"],"sourcesContent":["\"use client\";\n\nimport React, { ReactNode } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { tv } from \"tailwind-variants\";\n\nimport { backdrop, fadeAnimation } from \"@bonprix-ds/internal-components\";\nimport { useIsClient, usePrefersReducedMotion } from \"@bonprix-ds/utils\";\nimport { warnDeprecated } from \"@bonprix-ds/utils/deprecation\";\n\nimport useAnimation from \"./useAnimation\";\n\nconst generateClasses = tv({\n slots: {\n backdrop: backdrop(),\n },\n variants: {\n prefersReducedMotion: {\n false: {\n backdrop: fadeAnimation(),\n },\n },\n },\n});\n\n/** @deprecated [modal-component] Use Dialog, SideSheet or BottomSheet instead. */\nexport interface Props {\n /** Toggles the visibility of the modal. Should be used in conjunction with the `onClose` property. */\n isOpen: boolean;\n /** The content to be displayed inside the modal. */\n children?: ReactNode;\n /** Callback function to be called when the modal is closed. Should be used in conjunction with the `isOpen` property. */\n onClose?: () => void;\n /** The z-index of the modal. */\n zIndex?: number;\n}\n\n/** @deprecated [modal-component] Use Dialog, SideSheet or BottomSheet instead. */\nconst Modal = ({ children, isOpen, onClose = () => null, zIndex = 1 }: Props) => {\n warnDeprecated(\"modal-component\");\n\n const prefersReducedMotion = usePrefersReducedMotion();\n const { backdrop } = generateClasses({ prefersReducedMotion });\n const { shouldRender, handleAnimationEnd } = useAnimation(isOpen);\n\n const isClient = useIsClient();\n if (!isClient) return null;\n\n return (\n <>\n {createPortal(\n shouldRender ? (\n <div\n className={backdrop()}\n onClick={onClose}\n data-state={isOpen ? \"open\" : \"closed\"}\n onAnimationEnd={handleAnimationEnd}\n style={{ zIndex }}\n data-bpds=\"modal\"\n >\n {children}\n </div>\n ) : null,\n document.body,\n )}\n </>\n );\n};\n\nexport default Modal;\n"],"mappings":";;;;;;;;;;AAYA,IAAME,IAAkBC,EAAG;CACzB,OAAO,EACL,UAAUC,EAAS,EACrB;CACA,UAAU,EACR,sBAAsB,EACpB,OAAO,EACL,UAAUC,EAAc,EAC1B,EACF,EACF;AACF,CAAC,GAeKC,KAAS,EAAE,aAAU,WAAQ,mBAAgB,MAAM,YAAS,QAAe;CAC/E,EAAe,iBAAiB;CAGhC,IAAM,EAAE,gBAAaJ,EAAgB,EAAE,sBADVK,EACU,EAAqB,CAAC,GACvD,EAAE,iBAAc,0BAAuBN,EAAaO,CAAM;CAKhE,OAHiBC,EACZ,IAGH,kBAAAT,GAAA,EAAA,UACGW,EACCC,IACE,kBAAC,OAAD;EACE,WAAWR,EAAS;EACpB,SAASS;EACT,cAAYL,IAAS,SAAS;EAC9B,gBAAgBM;EAChB,OAAO,EAAE,UAAO;EAChB,aAAU;EAET;CACE,CAAA,IACH,MACJ,SAAS,IACX,EACA,CAAA,IAnBkB;AAqBxB"}
|
package/dist/src/useAnimation.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect as e, useState as t } from "react";
|
|
2
|
-
|
|
2
|
+
// src/useAnimation.ts
|
|
3
3
|
var n = (n) => {
|
|
4
4
|
let [r, i] = t(n);
|
|
5
5
|
return e(() => {
|
|
@@ -11,7 +11,6 @@ var n = (n) => {
|
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
-
//#endregion
|
|
15
14
|
export { n as default };
|
|
16
15
|
|
|
17
16
|
//# sourceMappingURL=useAnimation.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bonprix-ds/react-modal",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "Modal component, implemented in React, for the Bonprix Design System.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -32,17 +32,17 @@
|
|
|
32
32
|
"provenance": true
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@bonprix-ds/internal-components": "0.2.
|
|
36
|
-
"@bonprix-ds/utils": "0.
|
|
35
|
+
"@bonprix-ds/internal-components": "0.2.7",
|
|
36
|
+
"@bonprix-ds/utils": "0.6.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
+
"@bonprix-ds/vite-config": "0.0.0",
|
|
39
40
|
"@testing-library/dom": "10.4.2",
|
|
40
41
|
"@testing-library/react": "16.3.3",
|
|
41
42
|
"@types/react": "19.3.0",
|
|
42
43
|
"@types/react-dom": "19.3.0",
|
|
43
|
-
"vite": "8.3.
|
|
44
|
-
"vitest": "5.0
|
|
45
|
-
"@bonprix-ds/vite-config": "0.0.0"
|
|
44
|
+
"vite": "8.3.8",
|
|
45
|
+
"vitest": "5.1.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"react": "^19",
|