@kadoui/react 1.6.4 → 1.6.6
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/Sheet/SheetBody.d.ts +1 -1
- package/dist/components/Sheet/SheetBody.d.ts.map +1 -1
- package/dist/components/Sheet/SheetBody.js +9 -4
- package/dist/components/Sheet/SheetContent.d.ts +1 -1
- package/dist/components/Sheet/SheetContent.d.ts.map +1 -1
- package/dist/components/Sheet/SheetContent.js +13 -2
- package/dist/components/Sheet/SheetContext.d.ts +1 -2
- package/dist/components/Sheet/SheetContext.d.ts.map +1 -1
- package/dist/components/Sheet/SheetHeader.d.ts +1 -1
- package/dist/components/Sheet/SheetHeader.d.ts.map +1 -1
- package/dist/components/Sheet/SheetHeader.js +2 -8
- package/dist/components/Sheet/SheetRoot.d.ts.map +1 -1
- package/dist/components/Sheet/SheetRoot.js +2 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { HTMLMotionProps } from "framer-motion";
|
|
2
2
|
export type SheetBodyPropsT = HTMLMotionProps<"div">;
|
|
3
|
-
export declare function SheetBody(p: SheetBodyPropsT): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function SheetBody({ onPointerDown, ...p }: SheetBodyPropsT): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
//# sourceMappingURL=SheetBody.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetBody.d.ts","sourceRoot":"","sources":["../../../src/components/Sheet/SheetBody.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"SheetBody.d.ts","sourceRoot":"","sources":["../../../src/components/Sheet/SheetBody.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAA2B,MAAM,eAAe,CAAC;AAIzE,MAAM,MAAM,eAAe,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;AAErD,wBAAgB,SAAS,CAAC,EAAE,aAAa,EAAE,GAAG,CAAC,EAAE,EAAE,eAAe,2CAuCjE"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { use } from "react";
|
|
4
|
-
import { motion } from "framer-motion";
|
|
4
|
+
import { motion, useDragControls } from "framer-motion";
|
|
5
5
|
import { SheetContext } from "./SheetContext";
|
|
6
|
-
export function SheetBody(p) {
|
|
7
|
-
const {
|
|
8
|
-
|
|
6
|
+
export function SheetBody({ onPointerDown, ...p }) {
|
|
7
|
+
const { y, closeHandler: handleClose } = use(SheetContext);
|
|
8
|
+
const controls = useDragControls();
|
|
9
|
+
return (_jsx(motion.div, { id: "sheet", onClick: (ev) => ev.stopPropagation(), initial: { y: "100%" }, animate: { y: "0%" }, exit: { y: "100%" }, style: { y }, drag: "y", dragListener: false, dragControls: controls, onPointerDown: (ev) => {
|
|
10
|
+
ev.stopPropagation();
|
|
11
|
+
controls?.start(ev);
|
|
12
|
+
onPointerDown?.(ev);
|
|
13
|
+
}, transition: {
|
|
9
14
|
ease: "easeInOut",
|
|
10
15
|
}, onDragEnd: () => {
|
|
11
16
|
if ((y?.get() || 0) >= 100) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { HTMLAttributes } from "react";
|
|
2
2
|
export type SheetContentPropsT = HTMLAttributes<HTMLDivElement>;
|
|
3
|
-
export declare function SheetContent(p: SheetContentPropsT): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function SheetContent({ style, onScroll, ...p }: SheetContentPropsT): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
//# sourceMappingURL=SheetContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetContent.d.ts","sourceRoot":"","sources":["../../../src/components/Sheet/SheetContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEhE,wBAAgB,YAAY,CAAC,CAAC,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"SheetContent.d.ts","sourceRoot":"","sources":["../../../src/components/Sheet/SheetContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEhE,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,EAAE,kBAAkB,2CAmBzE"}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
export function SheetContent(p) {
|
|
3
|
-
return _jsx("div", {
|
|
2
|
+
export function SheetContent({ style, onScroll, ...p }) {
|
|
3
|
+
return (_jsx("div", { style: {
|
|
4
|
+
touchAction: "pan-down",
|
|
5
|
+
...style,
|
|
6
|
+
}, onScroll: (ev) => {
|
|
7
|
+
if (ev.currentTarget.scrollTop > 0) {
|
|
8
|
+
ev.currentTarget.style.touchAction = "pan-y";
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
ev.currentTarget.style.touchAction = "pan-down";
|
|
12
|
+
}
|
|
13
|
+
onScroll?.(ev);
|
|
14
|
+
}, ...p }));
|
|
4
15
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
import { AnimationScope, MotionValue } from "framer-motion";
|
|
1
2
|
import { Dispatch, SetStateAction } from "react";
|
|
2
|
-
import { AnimationScope, DragControls, MotionValue } from "framer-motion";
|
|
3
3
|
export type SheetContextT = {
|
|
4
4
|
isOpen: boolean;
|
|
5
5
|
setOpen: Dispatch<SetStateAction<boolean>>;
|
|
6
6
|
closeHandler: () => void;
|
|
7
7
|
scope?: AnimationScope<any>;
|
|
8
|
-
controls?: DragControls;
|
|
9
8
|
y?: MotionValue<number>;
|
|
10
9
|
};
|
|
11
10
|
export declare const SheetContext: import("react").Context<SheetContextT>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetContext.d.ts","sourceRoot":"","sources":["../../../src/components/Sheet/SheetContext.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"SheetContext.d.ts","sourceRoot":"","sources":["../../../src/components/Sheet/SheetContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5D,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;IAC3C,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,KAAK,CAAC,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACzB,CAAA;AAED,eAAO,MAAM,YAAY,wCAAoD,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { HTMLAttributes } from "react";
|
|
2
2
|
export type SheetHeaderPropsT = HTMLAttributes<HTMLDivElement>;
|
|
3
|
-
export declare function SheetHeader({
|
|
3
|
+
export declare function SheetHeader({ ...p }: SheetHeaderPropsT): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
//# sourceMappingURL=SheetHeader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetHeader.d.ts","sourceRoot":"","sources":["../../../src/components/Sheet/SheetHeader.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"SheetHeader.d.ts","sourceRoot":"","sources":["../../../src/components/Sheet/SheetHeader.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAE/D,wBAAgB,WAAW,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,iBAAiB,2CAEtD"}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export function SheetHeader({ onPointerDown, ...p }) {
|
|
6
|
-
const { controls } = use(SheetContext);
|
|
7
|
-
return (_jsx("div", { onPointerDown: (ev) => {
|
|
8
|
-
controls?.start(ev);
|
|
9
|
-
onPointerDown?.(ev);
|
|
10
|
-
}, ...p }));
|
|
3
|
+
export function SheetHeader({ ...p }) {
|
|
4
|
+
return _jsx("div", { ...p });
|
|
11
5
|
}
|
|
@@ -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":"AAIA,OAAO,EAAE,iBAAiB,EAAuB,MAAM,OAAO,CAAC;AAI/D,MAAM,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAEhD,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,EAAE,eAAe,2CA8CtD"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { usePathname } from "next/navigation";
|
|
4
|
+
import { useMotionValue, useAnimate } from "framer-motion";
|
|
4
5
|
import { useEffect, useState } from "react";
|
|
5
|
-
import { useDragControls, useMotionValue, useAnimate } from "framer-motion";
|
|
6
6
|
import { SheetContext } from "./SheetContext";
|
|
7
7
|
export function SheetRoot({ children }) {
|
|
8
8
|
const pathname = usePathname();
|
|
9
9
|
const y = useMotionValue(0);
|
|
10
|
-
const controls = useDragControls();
|
|
11
10
|
const [scope, animate] = useAnimate();
|
|
12
11
|
const [isOpen, setOpen] = useState(false);
|
|
13
12
|
useEffect(() => {
|
|
@@ -36,5 +35,5 @@ export function SheetRoot({ children }) {
|
|
|
36
35
|
});
|
|
37
36
|
setOpen(false);
|
|
38
37
|
};
|
|
39
|
-
return (_jsx(SheetContext, { value: { isOpen, setOpen, closeHandler, scope,
|
|
38
|
+
return (_jsx(SheetContext, { value: { isOpen, setOpen, closeHandler, scope, y }, children: children }));
|
|
40
39
|
}
|