@progress/kendo-react-common 7.2.4-develop.2 → 7.2.4-develop.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/Draggable.js +8 -0
- package/Draggable.mjs +79 -0
- package/Droppable.js +8 -0
- package/Droppable.mjs +64 -0
- package/FormComponent.js +8 -0
- package/FormComponent.mjs +13 -0
- package/browser-support.service.js +8 -0
- package/browser-support.service.mjs +25 -0
- package/canUseDOM.js +8 -0
- package/canUseDOM.mjs +13 -0
- package/canUseRef.js +8 -0
- package/canUseRef.mjs +15 -0
- package/classNames.js +8 -0
- package/classNames.mjs +17 -0
- package/clone.js +8 -0
- package/clone.mjs +44 -0
- package/constants/index.js +8 -0
- package/constants/index.mjs +12 -0
- package/contexts/ZIndexContext.js +8 -0
- package/contexts/ZIndexContext.mjs +15 -0
- package/dist/cdn/js/kendo-react-common.js +8 -5
- package/drag-n-drop/context/index.js +8 -0
- package/drag-n-drop/context/index.mjs +23 -0
- package/drag-n-drop/index.js +8 -0
- package/drag-n-drop/index.mjs +46 -0
- package/events/dispatchEvent.js +8 -0
- package/events/dispatchEvent.mjs +21 -0
- package/fieldList.js +8 -0
- package/fieldList.mjs +18 -0
- package/getActiveElement.js +8 -0
- package/getActiveElement.mjs +19 -0
- package/getTabIndex.js +8 -0
- package/getTabIndex.mjs +16 -0
- package/getter.js +8 -0
- package/getter.mjs +26 -0
- package/guid.js +8 -0
- package/guid.mjs +17 -0
- package/hasRelativeStackingContext.js +8 -0
- package/hasRelativeStackingContext.mjs +25 -0
- package/hocs/AsyncFocusBlur.js +8 -0
- package/hocs/AsyncFocusBlur.mjs +23 -0
- package/hocs/use-id-hoc.js +8 -0
- package/hocs/use-id-hoc.mjs +17 -0
- package/hocs/withPropsContext.js +8 -0
- package/hocs/withPropsContext.mjs +18 -0
- package/hooks/use-id.js +8 -0
- package/hooks/use-id.mjs +35 -0
- package/hooks/use-isomorphic-layout-effect.js +8 -0
- package/hooks/use-isomorphic-layout-effect.mjs +13 -0
- package/hooks/useAsyncFocusBlur.js +8 -0
- package/hooks/useAsyncFocusBlur.mjs +38 -0
- package/hooks/useCollection.js +8 -0
- package/hooks/useCollection.mjs +32 -0
- package/hooks/useControlledState.js +8 -0
- package/hooks/useControlledState.mjs +21 -0
- package/hooks/useCustomComponent.js +8 -0
- package/hooks/useCustomComponent.mjs +22 -0
- package/hooks/useDir.js +8 -0
- package/hooks/useDir.mjs +24 -0
- package/hooks/useDocument.js +8 -0
- package/hooks/useDocument.mjs +22 -0
- package/hooks/useDraggable.js +8 -0
- package/hooks/useDraggable.mjs +308 -0
- package/hooks/useDroppable.js +8 -0
- package/hooks/useDroppable.mjs +67 -0
- package/hooks/useInheritedState.js +8 -0
- package/hooks/useInheritedState.mjs +21 -0
- package/hooks/useMouse.js +8 -0
- package/hooks/useMouse.mjs +98 -0
- package/hooks/usePropsContext.js +8 -0
- package/hooks/usePropsContext.mjs +13 -0
- package/hooks/useRtl.js +8 -0
- package/hooks/useRtl.mjs +24 -0
- package/hooks/useWindow.js +8 -0
- package/hooks/useWindow.mjs +20 -0
- package/icons/Icon.js +8 -0
- package/icons/Icon.mjs +92 -0
- package/icons/IconWrap.js +8 -0
- package/icons/IconWrap.mjs +24 -0
- package/icons/IconsContext.js +8 -0
- package/icons/IconsContext.mjs +14 -0
- package/icons/SvgIcon.js +8 -0
- package/icons/SvgIcon.mjs +124 -0
- package/icons/constants.js +8 -0
- package/icons/constants.mjs +21 -0
- package/icons/utils.js +8 -0
- package/icons/utils.mjs +19 -0
- package/index.d.mts +1771 -5
- package/index.d.ts +1771 -65
- package/index.js +8 -5
- package/index.mjs +147 -1812
- package/keys.js +8 -0
- package/keys.mjs +28 -0
- package/memoize.js +8 -0
- package/memoize.mjs +38 -0
- package/navigation.js +8 -0
- package/navigation.mjs +97 -0
- package/noop.js +8 -0
- package/noop.mjs +13 -0
- package/package.json +1 -1
- package/scrollbarWidth.js +8 -0
- package/scrollbarWidth.mjs +20 -0
- package/setter.js +8 -0
- package/setter.mjs +27 -0
- package/theme.js +8 -0
- package/theme.mjs +27 -0
- package/trappedFocus.js +8 -0
- package/trappedFocus.mjs +58 -0
- package/tree-utils/FieldsService.js +8 -0
- package/tree-utils/FieldsService.mjs +48 -0
- package/tree-utils/SortedPublicItemIds.js +8 -0
- package/tree-utils/SortedPublicItemIds.mjs +24 -0
- package/tree-utils/itemIdUtils.js +8 -0
- package/tree-utils/itemIdUtils.mjs +87 -0
- package/tree-utils/itemUtils.js +8 -0
- package/tree-utils/itemUtils.mjs +118 -0
- package/tree-utils/misc.js +8 -0
- package/tree-utils/misc.mjs +22 -0
- package/treeDataOperations.js +8 -0
- package/treeDataOperations.mjs +45 -0
- package/typography/Typography.js +8 -0
- package/typography/Typography.mjs +110 -0
- package/typography/constants.js +8 -0
- package/typography/constants.mjs +71 -0
- package/validate-package.js +8 -0
- package/validate-package.mjs +20 -0
- package/watermark/WatermarkOverlay.js +8 -0
- package/watermark/WatermarkOverlay.mjs +93 -0
- package/Draggable.d.ts +0 -90
- package/Droppable.d.ts +0 -81
- package/FormComponent.d.ts +0 -167
- package/browser-support.service.d.ts +0 -11
- package/canUseDOM.d.ts +0 -8
- package/canUseRef.d.ts +0 -9
- package/classNames.d.ts +0 -8
- package/clone.d.ts +0 -24
- package/constants/index.d.ts +0 -8
- package/contexts/ZIndexContext.d.ts +0 -11
- package/drag-n-drop/context/index.d.ts +0 -23
- package/drag-n-drop/index.d.ts +0 -25
- package/events/BaseEvent.d.ts +0 -22
- package/events/dispatchEvent.d.ts +0 -18
- package/fieldList.d.ts +0 -8
- package/focus.d.ts +0 -8
- package/getActiveElement.d.ts +0 -12
- package/getTabIndex.d.ts +0 -8
- package/getter.d.ts +0 -18
- package/guid.d.ts +0 -8
- package/hasRelativeStackingContext.d.ts +0 -6
- package/hocs/AsyncFocusBlur.d.ts +0 -17
- package/hocs/use-id-hoc.d.ts +0 -7
- package/hocs/withPropsContext.d.ts +0 -9
- package/hooks/index.d.ts +0 -16
- package/hooks/use-id.d.ts +0 -6
- package/hooks/use-isomorphic-layout-effect.d.ts +0 -7
- package/hooks/useAsyncFocusBlur.d.ts +0 -29
- package/hooks/useCollection.d.ts +0 -18
- package/hooks/useControlledState.d.ts +0 -11
- package/hooks/useCustomComponent.d.ts +0 -15
- package/hooks/useDir.d.ts +0 -9
- package/hooks/useDocument.d.ts +0 -11
- package/hooks/useDraggable.d.ts +0 -67
- package/hooks/useDroppable.d.ts +0 -32
- package/hooks/useInheritedState.d.ts +0 -17
- package/hooks/useMouse.d.ts +0 -24
- package/hooks/usePropsContext.d.ts +0 -7
- package/hooks/useRtl.d.ts +0 -9
- package/hooks/useWindow.d.ts +0 -11
- package/icons/BaseIconProps.d.ts +0 -76
- package/icons/Icon.d.ts +0 -39
- package/icons/IconWrap.d.ts +0 -11
- package/icons/IconsContext.d.ts +0 -25
- package/icons/SvgIcon.d.ts +0 -75
- package/icons/constants.d.ts +0 -17
- package/icons/models/flip.d.ts +0 -15
- package/icons/models/size.d.ts +0 -19
- package/icons/models/theme-color.d.ts +0 -25
- package/icons/utils.d.ts +0 -21
- package/keys.d.ts +0 -24
- package/memoize.d.ts +0 -14
- package/models/auto-scroll-options.d.ts +0 -26
- package/models/index.d.ts +0 -9
- package/models/kendoReactComponentBaseProps.d.ts +0 -27
- package/models/mouse.d.ts +0 -20
- package/models/pointer.d.ts +0 -27
- package/models/touch.d.ts +0 -21
- package/navigation.d.ts +0 -131
- package/noop.d.ts +0 -8
- package/scrollbarWidth.d.ts +0 -12
- package/setter.d.ts +0 -20
- package/theme.d.ts +0 -12
- package/tree-utils/FieldsService.d.ts +0 -29
- package/tree-utils/SortedPublicItemIds.d.ts +0 -12
- package/tree-utils/itemIdUtils.d.ts +0 -64
- package/tree-utils/itemUtils.d.ts +0 -49
- package/tree-utils/misc.d.ts +0 -12
- package/treeDataOperations.d.ts +0 -43
- package/typography/Typography.d.ts +0 -39
- package/typography/TypographyProps.d.ts +0 -124
- package/typography/constants.d.ts +0 -88
- package/typography/models/margin.d.ts +0 -27
- package/validate-package.d.ts +0 -13
- package/watermark/WatermarkOverlay.d.ts +0 -9
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),a=require("../hooks/usePropsContext.js");function u(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const n=u(s),i=()=>n.createContext(e=>e),l=(e,o)=>n.forwardRef((t,r)=>{const c=a.usePropsContext(e,t);return n.createElement(o,{...c,ref:r})});exports.createPropsContext=i;exports.withPropsContext=l;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as e from "react";
|
|
10
|
+
import { usePropsContext as c } from "../hooks/usePropsContext.mjs";
|
|
11
|
+
const a = () => e.createContext((t) => t), x = (t, o) => e.forwardRef((r, n) => {
|
|
12
|
+
const s = c(t, r);
|
|
13
|
+
return /* @__PURE__ */ e.createElement(o, { ...s, ref: n });
|
|
14
|
+
});
|
|
15
|
+
export {
|
|
16
|
+
a as createPropsContext,
|
|
17
|
+
x as withPropsContext
|
|
18
|
+
};
|
package/hooks/use-id.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),o=require("../guid.js"),f=require("./use-isomorphic-layout-effect.js");function l(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const u=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,u.get?u:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const n=l(a);function d(e){const[r,t]=n.useState(!1);n.useEffect(()=>{t(!0)},[]);const[u,s]=n.useState(()=>{if(e)return e;if(r)return o.guid()});f.useIsomorphicLayoutEffect(()=>{u===void 0&&s(o.guid())},[]);const c=n.useId;if(c!==void 0){const i=c();return e!=null?e:i}return u}exports.useId=d;
|
package/hooks/use-id.mjs
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as e from "react";
|
|
10
|
+
import { guid as o } from "../guid.mjs";
|
|
11
|
+
import { useIsomorphicLayoutEffect as i } from "./use-isomorphic-layout-effect.mjs";
|
|
12
|
+
function I(t) {
|
|
13
|
+
const [u, n] = e.useState(!1);
|
|
14
|
+
e.useEffect(() => {
|
|
15
|
+
n(!0);
|
|
16
|
+
}, []);
|
|
17
|
+
const [r, c] = e.useState(() => {
|
|
18
|
+
if (t)
|
|
19
|
+
return t;
|
|
20
|
+
if (u)
|
|
21
|
+
return o();
|
|
22
|
+
});
|
|
23
|
+
i(() => {
|
|
24
|
+
r === void 0 && c(o());
|
|
25
|
+
}, []);
|
|
26
|
+
const s = e.useId;
|
|
27
|
+
if (s !== void 0) {
|
|
28
|
+
const f = s();
|
|
29
|
+
return t != null ? t : f;
|
|
30
|
+
}
|
|
31
|
+
return r;
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
I as useId
|
|
35
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react");function u(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const c=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,c.get?c:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const n=u(r),f=typeof window!="undefined"?n.useLayoutEffect:n.useEffect;exports.useIsomorphicLayoutEffect=f;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as e from "react";
|
|
10
|
+
const t = typeof window != "undefined" ? e.useLayoutEffect : e.useEffect;
|
|
11
|
+
export {
|
|
12
|
+
t as useIsomorphicLayoutEffect
|
|
13
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react");function d(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const u=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,u.get?u:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const n=d(f);function b({onFocus:e,onBlur:r,onSyncFocus:t,onSyncBlur:u}){const l=n.useRef(!1),a=n.useRef(0),i=n.useCallback(c=>{clearTimeout(a.current),a.current=window.setTimeout(()=>c())},[a]),s=n.useCallback((...c)=>{clearTimeout(a.current),t&&t.call(void 0,c[0]),!l.current&&(l.current=!0,e&&e.call(void 0,...c))},[l,e,t]),o=n.useCallback((...c)=>{u&&u.call(void 0,c[0]),i(()=>{l.current&&r&&(l.current=!1,r.call(void 0,...c))})},[l,i,r,u]);return n.useEffect(()=>()=>{clearTimeout(a.current)},[]),{onFocus:s,onBlur:o}}exports.useAsyncFocusBlur=b;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as t from "react";
|
|
10
|
+
function o({ onFocus: u, onBlur: l, onSyncFocus: i, onSyncBlur: a }) {
|
|
11
|
+
const r = t.useRef(!1), c = t.useRef(0), s = t.useCallback(
|
|
12
|
+
(e) => {
|
|
13
|
+
clearTimeout(c.current), c.current = window.setTimeout(() => e());
|
|
14
|
+
},
|
|
15
|
+
[c]
|
|
16
|
+
), f = t.useCallback(
|
|
17
|
+
(...e) => {
|
|
18
|
+
clearTimeout(c.current), i && i.call(void 0, e[0]), !r.current && (r.current = !0, u && u.call(void 0, ...e));
|
|
19
|
+
},
|
|
20
|
+
[r, u, i]
|
|
21
|
+
), n = t.useCallback(
|
|
22
|
+
(...e) => {
|
|
23
|
+
a && a.call(void 0, e[0]), s(() => {
|
|
24
|
+
r.current && l && (r.current = !1, l.call(void 0, ...e));
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
[r, s, l, a]
|
|
28
|
+
);
|
|
29
|
+
return t.useEffect(() => () => {
|
|
30
|
+
clearTimeout(c.current);
|
|
31
|
+
}, []), {
|
|
32
|
+
onFocus: f,
|
|
33
|
+
onBlur: n
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
o as useAsyncFocusBlur
|
|
38
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react");function s(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const c=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,c.get?c:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const n=s(l);var o=(e=>(e[e.add=0]="add",e[e.remove=1]="remove",e))(o||{});const a=(e=[])=>{const t=n.useRef(e),r=n.useCallback(c=>{switch(c.type){case 0:t.current.push(c.item);break;case 1:{const u=t.current.indexOf(c.item);t.current.splice(u,1);break}}},[]);return[t.current,r]};exports.COLLECTION_ACTION=o;exports.useCollection=a;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as c from "react";
|
|
10
|
+
var s = /* @__PURE__ */ ((e) => (e[e.add = 0] = "add", e[e.remove = 1] = "remove", e))(s || {});
|
|
11
|
+
const l = (e = []) => {
|
|
12
|
+
const r = c.useRef(e), n = c.useCallback(
|
|
13
|
+
(t) => {
|
|
14
|
+
switch (t.type) {
|
|
15
|
+
case 0:
|
|
16
|
+
r.current.push(t.item);
|
|
17
|
+
break;
|
|
18
|
+
case 1: {
|
|
19
|
+
const o = r.current.indexOf(t.item);
|
|
20
|
+
r.current.splice(o, 1);
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
[]
|
|
26
|
+
);
|
|
27
|
+
return [r.current, n];
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
s as COLLECTION_ACTION,
|
|
31
|
+
l as useCollection
|
|
32
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react");function l(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const o=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,o.get?o:{enumerable:!0,get:()=>t[e]})}}return n.default=t,Object.freeze(n)}const s=l(i),d=(t,n,e)=>{const[o,r]=s.useState(n||t),a=s.useCallback((c,u)=>{r(c),e&&e.call(void 0,{...u,value:c})},[e,r]);return[n!==void 0?n:o,a]};exports.useControlledState=d;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as n from "react";
|
|
10
|
+
const u = (i, t, e) => {
|
|
11
|
+
const [a, s] = n.useState(t || i), d = n.useCallback(
|
|
12
|
+
(o, r) => {
|
|
13
|
+
s(o), e && e.call(void 0, { ...r, value: o });
|
|
14
|
+
},
|
|
15
|
+
[e, s]
|
|
16
|
+
);
|
|
17
|
+
return [t !== void 0 ? t : a, d];
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
u as useControlledState
|
|
21
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react");function s(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const o=s(u),l=()=>null,a=({children:e})=>e,i=e=>{if(e){if(e===o.Fragment)return[a,{}];if(o.isValidElement(e))return[e.type,e.props]}else return[l,{}];return[e,{}]};exports.useCustomComponent=i;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as t from "react";
|
|
10
|
+
const n = () => null, r = ({ children: e }) => e, s = (e) => {
|
|
11
|
+
if (e) {
|
|
12
|
+
if (e === t.Fragment)
|
|
13
|
+
return [r, {}];
|
|
14
|
+
if (t.isValidElement(e))
|
|
15
|
+
return [e.type, e.props];
|
|
16
|
+
} else
|
|
17
|
+
return [n, {}];
|
|
18
|
+
return [e, {}];
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
s as useCustomComponent
|
|
22
|
+
};
|
package/hooks/useDir.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react");function a(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const i=a(u);function s(e,r,t){const[n,o]=i.useState(r);return i.useEffect(()=>{if(!n&&window&&e.current){const c=window.getComputedStyle(e.current).direction;c&&o(c)}},t),n}exports.useDir=s;
|
package/hooks/useDir.mjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as i from "react";
|
|
10
|
+
function u(t, n, o) {
|
|
11
|
+
const [e, c] = i.useState(n);
|
|
12
|
+
return i.useEffect(
|
|
13
|
+
() => {
|
|
14
|
+
if (!e && window && t.current) {
|
|
15
|
+
const r = window.getComputedStyle(t.current).direction;
|
|
16
|
+
r && c(r);
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
o
|
|
20
|
+
), e;
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
u as useDir
|
|
24
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react");function r(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const c=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,c.get?c:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const u=r(o),l=e=>{const t=u.useCallback(()=>e.current&&e.current.element?e.current.element:e.current,[e]);return u.useCallback(()=>{const c=t();return c&&c.ownerDocument||document},[t])};exports.useDocument=l;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as c from "react";
|
|
10
|
+
const o = (e) => {
|
|
11
|
+
const t = c.useCallback(
|
|
12
|
+
() => e.current && e.current.element ? e.current.element : e.current,
|
|
13
|
+
[e]
|
|
14
|
+
);
|
|
15
|
+
return c.useCallback(() => {
|
|
16
|
+
const n = t();
|
|
17
|
+
return n && n.ownerDocument || document;
|
|
18
|
+
}, [t]);
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
o as useDocument
|
|
22
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Pe=require("react"),S=require("@progress/kendo-draggable-common"),i=require("../noop.js"),ve=require("./useInheritedState.js"),D=require("../drag-n-drop/context/index.js"),xe=require("./use-isomorphic-layout-effect.js");function Ie(o){const m=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const d in o)if(d!=="default"){const h=Object.getOwnPropertyDescriptor(o,d);Object.defineProperty(m,d,h.get?h:{enumerable:!0,get:()=>o[d]})}}return m.default=o,Object.freeze(m)}const t=Ie(Pe),Me=2e3;function Te(o,m,d={}){const{onPress:h=i.noop,onRelease:N=i.noop,onDragStart:W=i.noop,onDrag:F=i.noop,onDragEnd:G=i.noop}=m,{hint:a=null,mouseOnly:O=!1,autoScroll:s=!0,scrollContainer:u=null}=d,[f,be]=t.useState(!1),[v,Ee]=t.useState(!1),[L]=ve.useInheritedState(D.DropContext),[R,b]=ve.useInheritedState(D.DragContext),[J]=t.useContext(D.DropsContext),[K,Q,X]=t.useContext(D.DragsContext),E=t.useRef({x:0,y:0}),w=t.useRef(),P=t.useRef(!1),Y=t.useRef(),C=t.useRef(null),x=t.useRef(!1),Z=t.useRef({x:0,y:0}),$=t.useRef({x:0,y:0}),k=t.useRef({x:0,y:0}),ee=t.useRef({x:0,y:0}),te=t.useRef({x:0,y:0}),ne=t.useRef({x:0,y:0}),ke=!!(typeof window!="undefined"&&window.PointerEvent),re=!O&&ke,l=t.useCallback(()=>o.current&&o.current.element?o.current.element:o.current,[o]),ye=t.useCallback(()=>a&&a.current&&a.current.element?a.current.element:a?a.current:null,[a]),oe=t.useCallback(()=>u&&u.current&&u.current.element?u.current.element:u?u.current:null,[u]),se=t.useCallback(()=>typeof s=="object"&&s.boundaryElementRef&&s.boundaryElementRef.current&&s.boundaryElementRef.current.element?s.boundaryElementRef.current.element:typeof s=="object"&&s.boundaryElementRef&&s.boundaryElementRef.current?s.boundaryElementRef.current:null,[s]),p=t.useRef(null);t.useImperativeHandle(p,()=>({element:l(),hint:ye(),onPress:Se,onDragStart:Oe,onDrag:Le,onDragEnd:Re,onRelease:De,data:o.current}));const y=t.useCallback(()=>{const e=l();return e&&e.ownerDocument||document},[l]),g=t.useCallback(()=>{const e=y();return e&&e.defaultView||window},[y]),ce=t.useCallback(()=>({drag:R?R.current:null,drop:L?L.current:null,drags:K.map(e=>e.current),drops:J.map(e=>e.current),pressed:f,ignoreMouse:P.current,scrollOffset:te.current,offset:Z.current,pageOffset:$.current,initialScrollOffset:ne.current,clientOffset:k.current,initialClientOffset:ee.current,velocity:E.current,autoScroll:!!(typeof s=="object"?s.enabled!==!1:s),scrollableParent:se(),autoScrollDirection:typeof s=="object"?s.direction:{horizontal:!0,vertical:!0},isScrolling:v}),[R,L,K,J,f,s,se,v]),le=t.useCallback(e=>{be(e)},[]),ae=t.useCallback(e=>{Ee(e)},[]),ue=t.useCallback(e=>{E.current=e},[]),ie=t.useCallback(e=>{Z.current=e},[]),de=t.useCallback(e=>{k.current=e},[]),fe=t.useCallback(e=>{$.current=e},[]),ge=t.useCallback(e=>{ee.current=e},[]),me=t.useCallback(e=>{te.current=e},[]),he=t.useCallback(e=>{ne.current=e},[]),Se=t.useCallback(e=>{h(e)},[h]),De=t.useCallback(e=>{N(e)},[N]),Oe=t.useCallback(e=>{b(p,{target:o.current,event:e}),W(e)},[b,o,W]),Le=t.useCallback(e=>{F(e)},[F]),Re=t.useCallback(e=>{x.current||(b(null,{target:o.current,event:e}),G(e))},[G,b,o]),n=t.useCallback(e=>{S.dispatchDragAndDrop(ce(),{event:e,payload:p.current},{onVelocityChange:ue,onOffsetChange:ie,onClientOffsetChange:de,onPageOffsetChange:fe,onInitialClientOffsetChange:ge,onScrollOffsetChange:me,onInitialScrollOffsetChange:he,onIsPressedChange:le,onIsScrollingChange:ae})},[ce,ue,ie,fe,de,ge,he,le,me,ae]),I=t.useCallback(e=>{n(e)},[n]),M=t.useCallback(e=>{n(e)},[n]),T=t.useCallback(e=>{n(e)},[n]),j=t.useCallback(e=>{n(e)},[n]),q=t.useCallback(e=>{n(e)},[n]),A=t.useCallback(e=>{n(e)},[n]),_=t.useCallback(e=>{n(e)},[n]),U=t.useCallback(e=>{e.preventDefault(),n(e)},[n]),V=t.useCallback(e=>{e.preventDefault(),n(e)},[n]),z=t.useCallback(e=>{e.preventDefault(),n(e)},[n]),B=t.useCallback(e=>{if(e.touches.length===0&&e.changedTouches.length===1){const r=g();P.current=!0,Y.current=r.setTimeout(()=>{P.current=!1},Me)}n(e)},[n,g]),H=t.useCallback(e=>{n(e)},[n]),Ce=t.useCallback(()=>{const e=l();if(e){const r=e.style.touchAction;return e.style.touchAction="none",()=>{e.style.touchAction=r}}},[l]),pe=t.useCallback(()=>(Q(p),()=>{X(p)}),[X,Q]),we=()=>{const e=g(),r=l(),c=y();return re?(r&&(C.current=S.getScrollableParent(r),C.current&&C.current.addEventListener("scroll",H,{passive:!0}),r.addEventListener("pointerdown",I,{passive:!0})),f&&(c.addEventListener("pointermove",M),c.addEventListener("pointerup",j,!0),c.addEventListener("contextmenu",U),c.addEventListener("pointercancel",T,{passive:!0}))):(e.addEventListener("touchmove",i.noop,{capture:!1,passive:!1}),r&&(r.addEventListener("mousedown",q,{passive:!0}),O||(r.addEventListener("touchstart",V,{passive:!0}),f&&(r.addEventListener("touchmove",z,{passive:!0}),r.addEventListener("touchend",B,{passive:!0})))),f&&(c.addEventListener("mousemove",A,{passive:!0}),c.addEventListener("mouseup",_,{passive:!0}))),()=>{C.current&&C.current.removeEventListener("scroll",H),r&&(r.removeEventListener("pointerdown",I),r.removeEventListener("mousedown",q),r.removeEventListener("touchstart",V),r.removeEventListener("touchmove",z),r.removeEventListener("touchend",B)),c.removeEventListener("pointermove",M),c.removeEventListener("pointerup",j,!0),c.removeEventListener("contextmenu",U),c.removeEventListener("pointercancel",T),c.removeEventListener("mousemove",A),c.removeEventListener("mouseup",_),e.removeEventListener("touchmove",i.noop),e.clearTimeout(Y.current)}};t.useEffect(()=>{const e=g();if(v){const r=oe()||S.getScrollableParent(document.elementFromPoint(k.current.x,k.current.y));e.clearInterval(w.current),w.current=e.setInterval(()=>{S.autoScroll(r,{x:E.current.x,y:E.current.y})},50)}return()=>{e.clearInterval(w.current)}},[l,oe,g,v]),t.useEffect(Ce,[Ce]),t.useEffect(we,[f,g,l,y,O,re,U,q,A,_,T,I,M,j,B,z,V,H]),t.useEffect(()=>(x.current=!1,()=>{x.current=!0}),[]),xe.useIsomorphicLayoutEffect(pe,[pe])}exports.useDraggable=Te;
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as t from "react";
|
|
10
|
+
import { dispatchDragAndDrop as we, getScrollableParent as he, autoScroll as xe } from "@progress/kendo-draggable-common";
|
|
11
|
+
import { noop as i } from "../noop.mjs";
|
|
12
|
+
import { useInheritedState as Ce } from "./useInheritedState.mjs";
|
|
13
|
+
import { DropsContext as Pe, DragsContext as Ie, DropContext as Me, DragContext as Te } from "../drag-n-drop/context/index.mjs";
|
|
14
|
+
import { useIsomorphicLayoutEffect as Ae } from "./use-isomorphic-layout-effect.mjs";
|
|
15
|
+
const je = 2e3;
|
|
16
|
+
function _e(l, ge, ve = {}) {
|
|
17
|
+
const {
|
|
18
|
+
onPress: B = i,
|
|
19
|
+
onRelease: H = i,
|
|
20
|
+
onDragStart: W = i,
|
|
21
|
+
onDrag: _ = i,
|
|
22
|
+
onDragEnd: q = i
|
|
23
|
+
} = ge, {
|
|
24
|
+
hint: a = null,
|
|
25
|
+
mouseOnly: E = !1,
|
|
26
|
+
autoScroll: o = !0,
|
|
27
|
+
scrollContainer: u = null
|
|
28
|
+
} = ve, [f, pe] = t.useState(!1), [C, be] = t.useState(!1), [k] = Ce(Me), [y, g] = Ce(Te), [z] = t.useContext(Pe), [F, G, N] = t.useContext(Ie), v = t.useRef({ x: 0, y: 0 }), D = t.useRef(), S = t.useRef(!1), $ = t.useRef(), m = t.useRef(null), L = t.useRef(!1), J = t.useRef({ x: 0, y: 0 }), K = t.useRef({ x: 0, y: 0 }), p = t.useRef({ x: 0, y: 0 }), Q = t.useRef({ x: 0, y: 0 }), X = t.useRef({ x: 0, y: 0 }), Y = t.useRef({ x: 0, y: 0 }), Ee = !!(typeof window != "undefined" && window.PointerEvent), Z = !E && Ee, c = t.useCallback(
|
|
29
|
+
() => l.current && l.current.element ? l.current.element : l.current,
|
|
30
|
+
[l]
|
|
31
|
+
), ke = t.useCallback(
|
|
32
|
+
() => a && a.current && a.current.element ? a.current.element : a ? a.current : null,
|
|
33
|
+
[a]
|
|
34
|
+
), ee = t.useCallback(
|
|
35
|
+
() => u && u.current && u.current.element ? u.current.element : u ? u.current : null,
|
|
36
|
+
[u]
|
|
37
|
+
), te = t.useCallback(
|
|
38
|
+
() => typeof o == "object" && o.boundaryElementRef && o.boundaryElementRef.current && o.boundaryElementRef.current.element ? o.boundaryElementRef.current.element : typeof o == "object" && o.boundaryElementRef && o.boundaryElementRef.current ? o.boundaryElementRef.current : null,
|
|
39
|
+
[o]
|
|
40
|
+
), h = t.useRef(null);
|
|
41
|
+
t.useImperativeHandle(h, () => ({
|
|
42
|
+
element: c(),
|
|
43
|
+
hint: ke(),
|
|
44
|
+
onPress: ye,
|
|
45
|
+
onDragStart: Se,
|
|
46
|
+
onDrag: Le,
|
|
47
|
+
onDragEnd: Oe,
|
|
48
|
+
onRelease: De,
|
|
49
|
+
data: l.current
|
|
50
|
+
}));
|
|
51
|
+
const b = t.useCallback(
|
|
52
|
+
() => {
|
|
53
|
+
const e = c();
|
|
54
|
+
return e && e.ownerDocument || document;
|
|
55
|
+
},
|
|
56
|
+
[c]
|
|
57
|
+
), d = t.useCallback(
|
|
58
|
+
() => {
|
|
59
|
+
const e = b();
|
|
60
|
+
return e && e.defaultView || window;
|
|
61
|
+
},
|
|
62
|
+
[b]
|
|
63
|
+
), ne = t.useCallback(
|
|
64
|
+
() => ({
|
|
65
|
+
drag: y ? y.current : null,
|
|
66
|
+
drop: k ? k.current : null,
|
|
67
|
+
drags: F.map((e) => e.current),
|
|
68
|
+
drops: z.map((e) => e.current),
|
|
69
|
+
pressed: f,
|
|
70
|
+
ignoreMouse: S.current,
|
|
71
|
+
scrollOffset: X.current,
|
|
72
|
+
offset: J.current,
|
|
73
|
+
pageOffset: K.current,
|
|
74
|
+
initialScrollOffset: Y.current,
|
|
75
|
+
clientOffset: p.current,
|
|
76
|
+
initialClientOffset: Q.current,
|
|
77
|
+
velocity: v.current,
|
|
78
|
+
autoScroll: !!(typeof o == "object" ? o.enabled !== !1 : o),
|
|
79
|
+
scrollableParent: te(),
|
|
80
|
+
autoScrollDirection: typeof o == "object" ? o.direction : { horizontal: !0, vertical: !0 },
|
|
81
|
+
isScrolling: C
|
|
82
|
+
}),
|
|
83
|
+
[y, k, F, z, f, o, te, C]
|
|
84
|
+
), re = t.useCallback(
|
|
85
|
+
(e) => {
|
|
86
|
+
pe(e);
|
|
87
|
+
},
|
|
88
|
+
[]
|
|
89
|
+
), oe = t.useCallback(
|
|
90
|
+
(e) => {
|
|
91
|
+
be(e);
|
|
92
|
+
},
|
|
93
|
+
[]
|
|
94
|
+
), se = t.useCallback(
|
|
95
|
+
(e) => {
|
|
96
|
+
v.current = e;
|
|
97
|
+
},
|
|
98
|
+
[]
|
|
99
|
+
), le = t.useCallback(
|
|
100
|
+
(e) => {
|
|
101
|
+
J.current = e;
|
|
102
|
+
},
|
|
103
|
+
[]
|
|
104
|
+
), ce = t.useCallback(
|
|
105
|
+
(e) => {
|
|
106
|
+
p.current = e;
|
|
107
|
+
},
|
|
108
|
+
[]
|
|
109
|
+
), ae = t.useCallback(
|
|
110
|
+
(e) => {
|
|
111
|
+
K.current = e;
|
|
112
|
+
},
|
|
113
|
+
[]
|
|
114
|
+
), ue = t.useCallback(
|
|
115
|
+
(e) => {
|
|
116
|
+
Q.current = e;
|
|
117
|
+
},
|
|
118
|
+
[]
|
|
119
|
+
), ie = t.useCallback(
|
|
120
|
+
(e) => {
|
|
121
|
+
X.current = e;
|
|
122
|
+
},
|
|
123
|
+
[]
|
|
124
|
+
), fe = t.useCallback(
|
|
125
|
+
(e) => {
|
|
126
|
+
Y.current = e;
|
|
127
|
+
},
|
|
128
|
+
[]
|
|
129
|
+
), ye = t.useCallback(
|
|
130
|
+
(e) => {
|
|
131
|
+
B(e);
|
|
132
|
+
},
|
|
133
|
+
[B]
|
|
134
|
+
), De = t.useCallback(
|
|
135
|
+
(e) => {
|
|
136
|
+
H(e);
|
|
137
|
+
},
|
|
138
|
+
[H]
|
|
139
|
+
), Se = t.useCallback(
|
|
140
|
+
(e) => {
|
|
141
|
+
g(h, { target: l.current, event: e }), W(e);
|
|
142
|
+
},
|
|
143
|
+
[g, l, W]
|
|
144
|
+
), Le = t.useCallback(
|
|
145
|
+
(e) => {
|
|
146
|
+
_(e);
|
|
147
|
+
},
|
|
148
|
+
[_]
|
|
149
|
+
), Oe = t.useCallback(
|
|
150
|
+
(e) => {
|
|
151
|
+
L.current || (g(null, { target: l.current, event: e }), q(e));
|
|
152
|
+
},
|
|
153
|
+
[q, g, l]
|
|
154
|
+
), n = t.useCallback(
|
|
155
|
+
(e) => {
|
|
156
|
+
we(
|
|
157
|
+
ne(),
|
|
158
|
+
{ event: e, payload: h.current },
|
|
159
|
+
{
|
|
160
|
+
onVelocityChange: se,
|
|
161
|
+
onOffsetChange: le,
|
|
162
|
+
onClientOffsetChange: ce,
|
|
163
|
+
onPageOffsetChange: ae,
|
|
164
|
+
onInitialClientOffsetChange: ue,
|
|
165
|
+
onScrollOffsetChange: ie,
|
|
166
|
+
onInitialScrollOffsetChange: fe,
|
|
167
|
+
onIsPressedChange: re,
|
|
168
|
+
onIsScrollingChange: oe
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
},
|
|
172
|
+
[
|
|
173
|
+
ne,
|
|
174
|
+
se,
|
|
175
|
+
le,
|
|
176
|
+
ae,
|
|
177
|
+
ce,
|
|
178
|
+
ue,
|
|
179
|
+
fe,
|
|
180
|
+
re,
|
|
181
|
+
ie,
|
|
182
|
+
oe
|
|
183
|
+
]
|
|
184
|
+
), O = t.useCallback(
|
|
185
|
+
(e) => {
|
|
186
|
+
n(e);
|
|
187
|
+
},
|
|
188
|
+
[n]
|
|
189
|
+
), R = t.useCallback(
|
|
190
|
+
(e) => {
|
|
191
|
+
n(e);
|
|
192
|
+
},
|
|
193
|
+
[n]
|
|
194
|
+
), w = t.useCallback(
|
|
195
|
+
(e) => {
|
|
196
|
+
n(e);
|
|
197
|
+
},
|
|
198
|
+
[n]
|
|
199
|
+
), x = t.useCallback(
|
|
200
|
+
(e) => {
|
|
201
|
+
n(e);
|
|
202
|
+
},
|
|
203
|
+
[n]
|
|
204
|
+
), P = t.useCallback(
|
|
205
|
+
(e) => {
|
|
206
|
+
n(e);
|
|
207
|
+
},
|
|
208
|
+
[n]
|
|
209
|
+
), I = t.useCallback(
|
|
210
|
+
(e) => {
|
|
211
|
+
n(e);
|
|
212
|
+
},
|
|
213
|
+
[n]
|
|
214
|
+
), M = t.useCallback(
|
|
215
|
+
(e) => {
|
|
216
|
+
n(e);
|
|
217
|
+
},
|
|
218
|
+
[n]
|
|
219
|
+
), T = t.useCallback(
|
|
220
|
+
(e) => {
|
|
221
|
+
e.preventDefault(), n(e);
|
|
222
|
+
},
|
|
223
|
+
[n]
|
|
224
|
+
), A = t.useCallback(
|
|
225
|
+
(e) => {
|
|
226
|
+
e.preventDefault(), n(e);
|
|
227
|
+
},
|
|
228
|
+
[n]
|
|
229
|
+
), j = t.useCallback(
|
|
230
|
+
(e) => {
|
|
231
|
+
e.preventDefault(), n(e);
|
|
232
|
+
},
|
|
233
|
+
[n]
|
|
234
|
+
), U = t.useCallback(
|
|
235
|
+
(e) => {
|
|
236
|
+
if (e.touches.length === 0 && e.changedTouches.length === 1) {
|
|
237
|
+
const r = d();
|
|
238
|
+
S.current = !0, $.current = r.setTimeout(() => {
|
|
239
|
+
S.current = !1;
|
|
240
|
+
}, je);
|
|
241
|
+
}
|
|
242
|
+
n(e);
|
|
243
|
+
},
|
|
244
|
+
[n, d]
|
|
245
|
+
), V = t.useCallback(
|
|
246
|
+
(e) => {
|
|
247
|
+
n(e);
|
|
248
|
+
},
|
|
249
|
+
[n]
|
|
250
|
+
), de = t.useCallback(
|
|
251
|
+
() => {
|
|
252
|
+
const e = c();
|
|
253
|
+
if (e) {
|
|
254
|
+
const r = e.style.touchAction;
|
|
255
|
+
return e.style.touchAction = "none", () => {
|
|
256
|
+
e.style.touchAction = r;
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
[c]
|
|
261
|
+
), me = t.useCallback(
|
|
262
|
+
() => (G(h), () => {
|
|
263
|
+
N(h);
|
|
264
|
+
}),
|
|
265
|
+
[N, G]
|
|
266
|
+
), Re = () => {
|
|
267
|
+
const e = d(), r = c(), s = b();
|
|
268
|
+
return Z ? (r && (m.current = he(r), m.current && m.current.addEventListener("scroll", V, { passive: !0 }), r.addEventListener("pointerdown", O, { passive: !0 })), f && (s.addEventListener("pointermove", R), s.addEventListener("pointerup", x, !0), s.addEventListener("contextmenu", T), s.addEventListener("pointercancel", w, { passive: !0 }))) : (e.addEventListener("touchmove", i, { capture: !1, passive: !1 }), r && (r.addEventListener("mousedown", P, { passive: !0 }), E || (r.addEventListener("touchstart", A, { passive: !0 }), f && (r.addEventListener("touchmove", j, { passive: !0 }), r.addEventListener("touchend", U, { passive: !0 })))), f && (s.addEventListener("mousemove", I, { passive: !0 }), s.addEventListener("mouseup", M, { passive: !0 }))), () => {
|
|
269
|
+
m.current && m.current.removeEventListener("scroll", V), r && (r.removeEventListener("pointerdown", O), r.removeEventListener("mousedown", P), r.removeEventListener("touchstart", A), r.removeEventListener("touchmove", j), r.removeEventListener("touchend", U)), s.removeEventListener("pointermove", R), s.removeEventListener("pointerup", x, !0), s.removeEventListener("contextmenu", T), s.removeEventListener("pointercancel", w), s.removeEventListener("mousemove", I), s.removeEventListener("mouseup", M), e.removeEventListener("touchmove", i), e.clearTimeout($.current);
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
t.useEffect(() => {
|
|
273
|
+
const e = d();
|
|
274
|
+
if (C) {
|
|
275
|
+
const r = ee() || he(document.elementFromPoint(p.current.x, p.current.y));
|
|
276
|
+
e.clearInterval(D.current), D.current = e.setInterval(() => {
|
|
277
|
+
xe(r, { x: v.current.x, y: v.current.y });
|
|
278
|
+
}, 50);
|
|
279
|
+
}
|
|
280
|
+
return () => {
|
|
281
|
+
e.clearInterval(D.current);
|
|
282
|
+
};
|
|
283
|
+
}, [c, ee, d, C]), t.useEffect(de, [de]), t.useEffect(Re, [
|
|
284
|
+
f,
|
|
285
|
+
d,
|
|
286
|
+
c,
|
|
287
|
+
b,
|
|
288
|
+
E,
|
|
289
|
+
Z,
|
|
290
|
+
T,
|
|
291
|
+
P,
|
|
292
|
+
I,
|
|
293
|
+
M,
|
|
294
|
+
w,
|
|
295
|
+
O,
|
|
296
|
+
R,
|
|
297
|
+
x,
|
|
298
|
+
U,
|
|
299
|
+
j,
|
|
300
|
+
A,
|
|
301
|
+
V
|
|
302
|
+
]), t.useEffect(() => (L.current = !1, () => {
|
|
303
|
+
L.current = !0;
|
|
304
|
+
}), []), Ae(me, [me]);
|
|
305
|
+
}
|
|
306
|
+
export {
|
|
307
|
+
_e as useDraggable
|
|
308
|
+
};
|