@kadoui/react 1.6.2 → 1.6.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.
- package/dist/components/Drawer/DrawerRoot.d.ts.map +1 -1
- package/dist/components/Drawer/DrawerRoot.js +7 -4
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/Modal/ModalContent.d.ts.map +1 -1
- package/dist/components/Modal/ModalContent.js +1 -0
- package/dist/components/Modal/ModalContext.d.ts.map +1 -1
- package/dist/components/Modal/ModalHeader.d.ts.map +1 -1
- package/dist/components/Modal/ModalHeader.js +1 -0
- package/dist/components/Modal/ModalPortal.js +1 -1
- package/dist/components/Modal/ModalRoot.d.ts.map +1 -1
- package/dist/components/Modal/ModalRoot.js +7 -4
- package/dist/components/Modal/ModalTrigger.js +1 -1
- package/dist/components/Popover/PopoverRoot.d.ts.map +1 -1
- package/dist/components/Popover/PopoverRoot.js +9 -4
- package/dist/components/Sheet/SheetRoot.d.ts.map +1 -1
- package/dist/components/Sheet/SheetRoot.js +6 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DrawerRoot.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer/DrawerRoot.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAuB,iBAAiB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DrawerRoot.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer/DrawerRoot.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAuB,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAK/D,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAEjD,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE,gBAAgB,2CAqCxD"}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { usePathname } from "next/navigation";
|
|
4
4
|
import { useState, useEffect } from "react";
|
|
5
5
|
import { DrawerContext } from "./DrawerContext";
|
|
6
|
+
import { getBrowserScrollbarWith } from "../../utils";
|
|
6
7
|
export function DrawerRoot({ children }) {
|
|
8
|
+
const pathname = usePathname();
|
|
7
9
|
const [isOpen, setOpen] = useState(false);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
setOpen(false);
|
|
12
|
+
}, [pathname]);
|
|
8
13
|
useEffect(() => {
|
|
9
14
|
const handleEscape = (ev) => {
|
|
10
15
|
if (ev.key === "Escape") {
|
|
11
16
|
setOpen(false);
|
|
12
17
|
}
|
|
13
|
-
;
|
|
14
18
|
};
|
|
15
19
|
document.addEventListener("keydown", handleEscape);
|
|
16
20
|
return () => {
|
|
@@ -28,7 +32,6 @@ export function DrawerRoot({ children }) {
|
|
|
28
32
|
document.body.style.overflow = "unset";
|
|
29
33
|
document.body.style.paddingRight = "0px";
|
|
30
34
|
}
|
|
31
|
-
;
|
|
32
35
|
}, [isOpen]);
|
|
33
|
-
return
|
|
36
|
+
return _jsx(DrawerContext, { value: { isOpen, setOpen }, children: children });
|
|
34
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalContent.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/ModalContent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ModalContent.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/ModalContent.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEhE,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,EAAE,kBAAkB,2CAUjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalContext.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/ModalContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEhE,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;CAC5C,
|
|
1
|
+
{"version":3,"file":"ModalContext.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/ModalContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEhE,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;CAC5C,CAAC;AAEF,eAAO,MAAM,YAAY,wCAAoD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalHeader.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/ModalHeader.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ModalHeader.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/ModalHeader.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAE/D,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,EAAE,iBAAiB,2CAU/D"}
|
|
@@ -7,7 +7,7 @@ import { ModalContext } from "./ModalContext";
|
|
|
7
7
|
import { ClientOnly } from "../ClientOnly/ClientOnly";
|
|
8
8
|
export function ModalPortal({ onClick, ...p }) {
|
|
9
9
|
const { isOpen, setOpen } = use(ModalContext);
|
|
10
|
-
return (_jsx(ClientOnly, { children: _jsx(Portal, { children: _jsx(AnimatePresence, { children: isOpen ? (_jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, onClick: ev => {
|
|
10
|
+
return (_jsx(ClientOnly, { children: _jsx(Portal, { children: _jsx(AnimatePresence, { children: isOpen ? (_jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, onClick: (ev) => {
|
|
11
11
|
onClick?.(ev);
|
|
12
12
|
setOpen(false);
|
|
13
13
|
}, ...p })) : null }) }) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalRoot.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/ModalRoot.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ModalRoot.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/ModalRoot.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAuB,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAK/D,MAAM,MAAM,eAAe,GAAG,iBAAiB,GAAG;IAChD,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,WAAmB,EAAE,EAAE,eAAe,2CAoC3E"}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { usePathname } from "next/navigation";
|
|
3
4
|
import { useState, useEffect } from "react";
|
|
4
|
-
import { getBrowserScrollbarWith } from "../../utils";
|
|
5
5
|
import { ModalContext } from "./ModalContext";
|
|
6
|
+
import { getBrowserScrollbarWith } from "../../utils";
|
|
6
7
|
export function ModalRoot({ children, defaultOpen = false }) {
|
|
8
|
+
const pathname = usePathname();
|
|
7
9
|
const [isOpen, setOpen] = useState(defaultOpen);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
setOpen(false);
|
|
12
|
+
}, [pathname]);
|
|
8
13
|
useEffect(() => {
|
|
9
14
|
const handleEscape = (e) => {
|
|
10
15
|
if (e.key === "Escape") {
|
|
11
16
|
setOpen(false);
|
|
12
17
|
}
|
|
13
|
-
;
|
|
14
18
|
};
|
|
15
19
|
document.addEventListener("keydown", handleEscape);
|
|
16
20
|
return () => {
|
|
@@ -28,7 +32,6 @@ export function ModalRoot({ children, defaultOpen = false }) {
|
|
|
28
32
|
document.body.style.overflow = "unset";
|
|
29
33
|
document.body.style.paddingRight = "0px";
|
|
30
34
|
}
|
|
31
|
-
;
|
|
32
35
|
}, [isOpen]);
|
|
33
|
-
return
|
|
36
|
+
return _jsx(ModalContext, { value: { isOpen, setOpen }, children: children });
|
|
34
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopoverRoot.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/PopoverRoot.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PopoverRoot.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/PopoverRoot.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAA8C,MAAM,OAAO,CAAC;AAGnF,OAAO,EAAkB,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnE,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAC/D,IAAI,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAC/B,sBAAsB,CAAC,EAAE,YAAY,GAAG,WAAW,CAAC;CACrD,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAC1B,IAAc,EACd,sBAAsB,EACtB,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,GAAG,CAAC,EACL,EAAE,iBAAiB,2CA+FnB"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { usePathname } from "next/navigation";
|
|
3
4
|
import { useEffect, useRef, useState } from "react";
|
|
4
|
-
import { PopoverContext } from "./PopoverContext";
|
|
5
5
|
import { selectAccessibleChildren } from "../../utils";
|
|
6
|
+
import { PopoverContext } from "./PopoverContext";
|
|
6
7
|
export function PopoverRoot({ mode = "click", accessHorizontalArrows, onKeyDown, onMouseEnter, onMouseLeave, ...p }) {
|
|
8
|
+
const pathname = usePathname();
|
|
7
9
|
const [isOpen, setOpen] = useState(false);
|
|
8
10
|
const toggleRef = useRef(null);
|
|
9
11
|
const bodyRef = useRef(null);
|
|
@@ -14,6 +16,9 @@ export function PopoverRoot({ mode = "click", accessHorizontalArrows, onKeyDown,
|
|
|
14
16
|
window.addEventListener("click", closeHandler);
|
|
15
17
|
return () => window.removeEventListener("click", closeHandler);
|
|
16
18
|
}, []);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
setOpen(false);
|
|
21
|
+
}, [pathname]);
|
|
17
22
|
useEffect(() => {
|
|
18
23
|
if (isOpen) {
|
|
19
24
|
selectFirstMenuChild();
|
|
@@ -55,16 +60,16 @@ export function PopoverRoot({ mode = "click", accessHorizontalArrows, onKeyDown,
|
|
|
55
60
|
}
|
|
56
61
|
}
|
|
57
62
|
};
|
|
58
|
-
return (_jsx(PopoverContext, { value: { isOpen, setOpen, toggleRef, bodyRef, mode }, children: _jsx("div", { "data-state": isOpen ? "active" : "inactive", onKeyDown: ev => {
|
|
63
|
+
return (_jsx(PopoverContext, { value: { isOpen, setOpen, toggleRef, bodyRef, mode }, children: _jsx("div", { "data-state": isOpen ? "active" : "inactive", onKeyDown: (ev) => {
|
|
59
64
|
onKeyDown?.(ev);
|
|
60
65
|
handleKeyDown(ev);
|
|
61
|
-
}, onMouseEnter: ev => {
|
|
66
|
+
}, onMouseEnter: (ev) => {
|
|
62
67
|
onMouseEnter?.(ev);
|
|
63
68
|
if (["hover", "both"].includes(mode)) {
|
|
64
69
|
ev.stopPropagation();
|
|
65
70
|
setOpen(true);
|
|
66
71
|
}
|
|
67
|
-
}, onMouseLeave: ev => {
|
|
72
|
+
}, onMouseLeave: (ev) => {
|
|
68
73
|
onMouseLeave?.(ev);
|
|
69
74
|
if (["hover", "both"].includes(mode)) {
|
|
70
75
|
ev.stopPropagation();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetRoot.d.ts","sourceRoot":"","sources":["../../../src/components/Sheet/SheetRoot.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SheetRoot.d.ts","sourceRoot":"","sources":["../../../src/components/Sheet/SheetRoot.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAuB,MAAM,OAAO,CAAC;AAK/D,MAAM,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAEhD,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,EAAE,eAAe,2CA+CtD"}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { usePathname } from "next/navigation";
|
|
3
4
|
import { useEffect, useState } from "react";
|
|
4
|
-
import { useDragControls, useMotionValue, useAnimate
|
|
5
|
+
import { useDragControls, useMotionValue, useAnimate } from "framer-motion";
|
|
5
6
|
import { SheetContext } from "./SheetContext";
|
|
6
7
|
export function SheetRoot({ children }) {
|
|
8
|
+
const pathname = usePathname();
|
|
7
9
|
const y = useMotionValue(0);
|
|
8
10
|
const controls = useDragControls();
|
|
9
11
|
const [scope, animate] = useAnimate();
|
|
10
12
|
const [isOpen, setOpen] = useState(false);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
setOpen(false);
|
|
15
|
+
}, [pathname]);
|
|
11
16
|
useEffect(() => {
|
|
12
17
|
const bodyElem = document.body;
|
|
13
18
|
const removeOverflow = () => {
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kadoui/react",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.4",
|
|
4
4
|
"description": "Kadoui primitive components for React",
|
|
5
5
|
"author": "ArrowUp",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "tsc",
|
|
10
|
-
"push": "npm run build && npm publish"
|
|
10
|
+
"push": "npm run build && git push && npm publish"
|
|
11
11
|
},
|
|
12
12
|
"exports": {
|
|
13
13
|
".": "./dist/index.js",
|
|
@@ -42,4 +42,4 @@
|
|
|
42
42
|
"@types/react-dom": "^19",
|
|
43
43
|
"@types/qrcode": "^1.5.5"
|
|
44
44
|
}
|
|
45
|
-
}
|
|
45
|
+
}
|