@progress/kendo-react-common 6.1.1 → 7.0.0-develop.2
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/npm/Draggable.d.ts → Draggable.d.ts} +5 -1
- package/{dist/npm/Droppable.d.ts → Droppable.d.ts} +5 -1
- package/{dist/es/FormComponent.d.ts → FormComponent.d.ts} +4 -0
- package/LICENSE.md +1 -1
- package/browser-support.service.d.ts +11 -0
- package/canUseDOM.d.ts +8 -0
- package/canUseRef.d.ts +9 -0
- package/classNames.d.ts +8 -0
- package/{dist/npm/clone.d.ts → clone.d.ts} +4 -0
- package/constants/index.d.ts +8 -0
- package/contexts/ZIndexContext.d.ts +11 -0
- package/dist/cdn/js/kendo-react-common.js +8 -1
- package/{dist/npm/drag-n-drop → drag-n-drop}/context/index.d.ts +6 -2
- package/{dist/es/drag-n-drop → drag-n-drop}/index.d.ts +6 -2
- package/events/BaseEvent.d.ts +22 -0
- package/{dist/npm/events → events}/dispatchEvent.d.ts +4 -1
- package/fieldList.d.ts +8 -0
- package/focus.d.ts +8 -0
- package/getActiveElement.d.ts +12 -0
- package/getTabIndex.d.ts +8 -0
- package/{dist/es/getter.d.ts → getter.d.ts} +4 -0
- package/guid.d.ts +8 -0
- package/hasRelativeStackingContext.d.ts +6 -0
- package/{dist/npm/hocs → hocs}/AsyncFocusBlur.d.ts +5 -1
- package/{dist/npm/hocs → hocs}/withPropsContext.d.ts +4 -0
- package/{dist/npm/hooks → hooks}/index.d.ts +4 -0
- package/{dist/npm/hooks → hooks}/useAsyncFocusBlur.d.ts +5 -1
- package/hooks/useCollection.d.ts +18 -0
- package/hooks/useControlledState.d.ts +11 -0
- package/hooks/useCustomComponent.d.ts +17 -0
- package/hooks/useDir.d.ts +9 -0
- package/hooks/useDocument.d.ts +11 -0
- package/{dist/es/hooks → hooks}/useDraggable.d.ts +4 -0
- package/{dist/es/hooks → hooks}/useDroppable.d.ts +4 -0
- package/hooks/useInheritedState.d.ts +17 -0
- package/{dist/es/hooks → hooks}/useMouse.d.ts +5 -1
- package/hooks/usePropsContext.d.ts +7 -0
- package/hooks/useRtl.d.ts +9 -0
- package/hooks/useWindow.d.ts +11 -0
- package/{dist/npm/icons → icons}/BaseIconProps.d.ts +4 -1
- package/{dist/es/icons → icons}/Icon.d.ts +4 -0
- package/icons/IconWrap.d.ts +11 -0
- package/{dist/es/icons → icons}/IconsContext.d.ts +4 -0
- package/{dist/es/icons → icons}/SvgIcon.d.ts +4 -0
- package/icons/constants.d.ts +17 -0
- package/icons/models/flip.d.ts +15 -0
- package/{dist/npm/icons → icons}/models/size.d.ts +5 -1
- package/{dist/es/icons → icons}/models/theme-color.d.ts +5 -1
- package/{dist/es/icons → icons}/utils.d.ts +4 -0
- package/{dist/es/main.d.ts → index.d.ts} +4 -0
- package/index.js +8 -0
- package/index.mjs +1787 -0
- package/keys.d.ts +24 -0
- package/memoize.d.ts +14 -0
- package/{dist/es/models → models}/auto-scroll-options.d.ts +4 -1
- package/models/index.d.ts +9 -0
- package/{dist/npm/models → models}/kendoReactComponentBaseProps.d.ts +4 -1
- package/{dist/npm/models → models}/mouse.d.ts +4 -0
- package/{dist/npm/models → models}/pointer.d.ts +4 -0
- package/{dist/es/models → models}/touch.d.ts +4 -0
- package/{dist/npm/navigation.d.ts → navigation.d.ts} +4 -1
- package/noop.d.ts +8 -0
- package/package.json +26 -45
- package/scrollbarWidth.d.ts +12 -0
- package/{dist/npm/setter.d.ts → setter.d.ts} +4 -0
- package/theme.d.ts +12 -0
- package/{dist/es/tree-utils → tree-utils}/FieldsService.d.ts +4 -0
- package/tree-utils/SortedPublicItemIds.d.ts +12 -0
- package/{dist/es/tree-utils → tree-utils}/itemIdUtils.d.ts +4 -0
- package/{dist/es/tree-utils → tree-utils}/itemUtils.d.ts +4 -0
- package/tree-utils/misc.d.ts +12 -0
- package/{dist/es/treeDataOperations.d.ts → treeDataOperations.d.ts} +4 -0
- package/{dist/npm/typography → typography}/Typography.d.ts +4 -0
- package/{dist/es/typography → typography}/TypographyProps.d.ts +4 -1
- package/{dist/npm/typography → typography}/constants.d.ts +4 -0
- package/{dist/es/typography → typography}/models/margin.d.ts +5 -1
- package/validate-package.d.ts +12 -0
- package/watermark/WatermarkOverlay.d.ts +9 -0
- package/about.md +0 -3
- package/dist/es/Draggable.d.ts +0 -86
- package/dist/es/Draggable.js +0 -84
- package/dist/es/Droppable.d.ts +0 -77
- package/dist/es/Droppable.js +0 -68
- package/dist/es/FormComponent.js +0 -9
- package/dist/es/browser-support.service.d.ts +0 -7
- package/dist/es/browser-support.service.js +0 -30
- package/dist/es/canUseDOM.d.ts +0 -4
- package/dist/es/canUseDOM.js +0 -8
- package/dist/es/canUseRef.d.ts +0 -5
- package/dist/es/canUseRef.js +0 -12
- package/dist/es/classNames.d.ts +0 -4
- package/dist/es/classNames.js +0 -30
- package/dist/es/clone.d.ts +0 -20
- package/dist/es/clone.js +0 -52
- package/dist/es/constants/index.d.ts +0 -4
- package/dist/es/constants/index.js +0 -4
- package/dist/es/contexts/ZIndexContext.d.ts +0 -7
- package/dist/es/contexts/ZIndexContext.js +0 -6
- package/dist/es/drag-n-drop/context/index.d.ts +0 -19
- package/dist/es/drag-n-drop/context/index.js +0 -24
- package/dist/es/drag-n-drop/index.js +0 -44
- package/dist/es/events/BaseEvent.d.ts +0 -18
- package/dist/es/events/BaseEvent.js +0 -1
- package/dist/es/events/dispatchEvent.d.ts +0 -15
- package/dist/es/events/dispatchEvent.js +0 -22
- package/dist/es/fieldList.d.ts +0 -4
- package/dist/es/fieldList.js +0 -11
- package/dist/es/focus.d.ts +0 -4
- package/dist/es/focus.js +0 -15
- package/dist/es/getActiveElement.d.ts +0 -8
- package/dist/es/getActiveElement.js +0 -23
- package/dist/es/getTabIndex.d.ts +0 -4
- package/dist/es/getTabIndex.js +0 -23
- package/dist/es/getter.js +0 -30
- package/dist/es/guid.d.ts +0 -4
- package/dist/es/guid.js +0 -17
- package/dist/es/hasRelativeStackingContext.d.ts +0 -2
- package/dist/es/hasRelativeStackingContext.js +0 -25
- package/dist/es/hocs/AsyncFocusBlur.d.ts +0 -13
- package/dist/es/hocs/AsyncFocusBlur.js +0 -26
- package/dist/es/hocs/withPropsContext.d.ts +0 -5
- package/dist/es/hocs/withPropsContext.js +0 -22
- package/dist/es/hooks/index.d.ts +0 -12
- package/dist/es/hooks/index.js +0 -12
- package/dist/es/hooks/useAsyncFocusBlur.d.ts +0 -25
- package/dist/es/hooks/useAsyncFocusBlur.js +0 -72
- package/dist/es/hooks/useCollection.d.ts +0 -14
- package/dist/es/hooks/useCollection.js +0 -26
- package/dist/es/hooks/useControlledState.d.ts +0 -7
- package/dist/es/hooks/useControlledState.js +0 -23
- package/dist/es/hooks/useCustomComponent.d.ts +0 -13
- package/dist/es/hooks/useCustomComponent.js +0 -9
- package/dist/es/hooks/useDir.d.ts +0 -5
- package/dist/es/hooks/useDir.js +0 -19
- package/dist/es/hooks/useDocument.d.ts +0 -7
- package/dist/es/hooks/useDocument.js +0 -14
- package/dist/es/hooks/useDraggable.js +0 -336
- package/dist/es/hooks/useDroppable.js +0 -59
- package/dist/es/hooks/useInheritedState.d.ts +0 -13
- package/dist/es/hooks/useInheritedState.js +0 -21
- package/dist/es/hooks/useMouse.js +0 -117
- package/dist/es/hooks/usePointer.d.ts +0 -21
- package/dist/es/hooks/usePointer.js +0 -29
- package/dist/es/hooks/usePropsContext.d.ts +0 -3
- package/dist/es/hooks/usePropsContext.js +0 -7
- package/dist/es/hooks/useRtl.d.ts +0 -5
- package/dist/es/hooks/useRtl.js +0 -22
- package/dist/es/hooks/useTouch.d.ts +0 -15
- package/dist/es/hooks/useTouch.js +0 -29
- package/dist/es/hooks/useWindow.d.ts +0 -7
- package/dist/es/hooks/useWindow.js +0 -15
- package/dist/es/icons/BaseIconProps.d.ts +0 -73
- package/dist/es/icons/BaseIconProps.js +0 -1
- package/dist/es/icons/Icon.js +0 -78
- package/dist/es/icons/IconWrap.d.ts +0 -7
- package/dist/es/icons/IconWrap.js +0 -41
- package/dist/es/icons/IconsContext.js +0 -7
- package/dist/es/icons/SvgIcon.js +0 -96
- package/dist/es/icons/constants.d.ts +0 -13
- package/dist/es/icons/constants.js +0 -13
- package/dist/es/icons/models/flip.d.ts +0 -11
- package/dist/es/icons/models/flip.js +0 -1
- package/dist/es/icons/models/size.d.ts +0 -15
- package/dist/es/icons/models/size.js +0 -1
- package/dist/es/icons/models/theme-color.js +0 -1
- package/dist/es/icons/utils.js +0 -17
- package/dist/es/keys.d.ts +0 -20
- package/dist/es/keys.js +0 -20
- package/dist/es/main.js +0 -59
- package/dist/es/memoize.d.ts +0 -10
- package/dist/es/memoize.js +0 -41
- package/dist/es/models/auto-scroll-options.js +0 -1
- package/dist/es/models/index.d.ts +0 -5
- package/dist/es/models/index.js +0 -5
- package/dist/es/models/kendoReactComponentBaseProps.d.ts +0 -24
- package/dist/es/models/kendoReactComponentBaseProps.js +0 -1
- package/dist/es/models/mouse.d.ts +0 -16
- package/dist/es/models/mouse.js +0 -1
- package/dist/es/models/pointer.d.ts +0 -23
- package/dist/es/models/pointer.js +0 -1
- package/dist/es/models/touch.js +0 -1
- package/dist/es/navigation.d.ts +0 -128
- package/dist/es/navigation.js +0 -144
- package/dist/es/noop.d.ts +0 -4
- package/dist/es/noop.js +0 -4
- package/dist/es/scrollbarWidth.d.ts +0 -8
- package/dist/es/scrollbarWidth.js +0 -22
- package/dist/es/setter.d.ts +0 -16
- package/dist/es/setter.js +0 -36
- package/dist/es/theme.d.ts +0 -8
- package/dist/es/theme.js +0 -17
- package/dist/es/tree-utils/FieldsService.js +0 -50
- package/dist/es/tree-utils/SortedPublicItemIds.d.ts +0 -8
- package/dist/es/tree-utils/SortedPublicItemIds.js +0 -26
- package/dist/es/tree-utils/itemIdUtils.js +0 -117
- package/dist/es/tree-utils/itemUtils.js +0 -191
- package/dist/es/tree-utils/misc.d.ts +0 -8
- package/dist/es/tree-utils/misc.js +0 -17
- package/dist/es/treeDataOperations.js +0 -105
- package/dist/es/typography/Typography.d.ts +0 -35
- package/dist/es/typography/Typography.js +0 -266
- package/dist/es/typography/TypographyProps.js +0 -1
- package/dist/es/typography/constants.d.ts +0 -84
- package/dist/es/typography/constants.js +0 -84
- package/dist/es/typography/models/margin.js +0 -1
- package/dist/es/validate-package.d.ts +0 -8
- package/dist/es/validate-package.js +0 -23
- package/dist/es/watermark/WatermarkOverlay.d.ts +0 -6
- package/dist/es/watermark/WatermarkOverlay.js +0 -86
- package/dist/npm/Draggable.js +0 -87
- package/dist/npm/Droppable.js +0 -71
- package/dist/npm/FormComponent.d.ts +0 -98
- package/dist/npm/FormComponent.js +0 -12
- package/dist/npm/browser-support.service.d.ts +0 -7
- package/dist/npm/browser-support.service.js +0 -33
- package/dist/npm/canUseDOM.d.ts +0 -4
- package/dist/npm/canUseDOM.js +0 -11
- package/dist/npm/canUseRef.d.ts +0 -5
- package/dist/npm/canUseRef.js +0 -16
- package/dist/npm/classNames.d.ts +0 -4
- package/dist/npm/classNames.js +0 -34
- package/dist/npm/clone.js +0 -60
- package/dist/npm/constants/index.d.ts +0 -4
- package/dist/npm/constants/index.js +0 -7
- package/dist/npm/contexts/ZIndexContext.d.ts +0 -7
- package/dist/npm/contexts/ZIndexContext.js +0 -10
- package/dist/npm/drag-n-drop/context/index.js +0 -27
- package/dist/npm/drag-n-drop/index.d.ts +0 -21
- package/dist/npm/drag-n-drop/index.js +0 -48
- package/dist/npm/events/BaseEvent.d.ts +0 -18
- package/dist/npm/events/BaseEvent.js +0 -2
- package/dist/npm/events/dispatchEvent.js +0 -26
- package/dist/npm/fieldList.d.ts +0 -4
- package/dist/npm/fieldList.js +0 -15
- package/dist/npm/focus.d.ts +0 -4
- package/dist/npm/focus.js +0 -19
- package/dist/npm/getActiveElement.d.ts +0 -8
- package/dist/npm/getActiveElement.js +0 -28
- package/dist/npm/getTabIndex.d.ts +0 -4
- package/dist/npm/getTabIndex.js +0 -27
- package/dist/npm/getter.d.ts +0 -14
- package/dist/npm/getter.js +0 -34
- package/dist/npm/guid.d.ts +0 -4
- package/dist/npm/guid.js +0 -21
- package/dist/npm/hasRelativeStackingContext.d.ts +0 -2
- package/dist/npm/hasRelativeStackingContext.js +0 -29
- package/dist/npm/hocs/AsyncFocusBlur.js +0 -30
- package/dist/npm/hocs/withPropsContext.js +0 -27
- package/dist/npm/hooks/index.js +0 -28
- package/dist/npm/hooks/useAsyncFocusBlur.js +0 -76
- package/dist/npm/hooks/useCollection.d.ts +0 -14
- package/dist/npm/hooks/useCollection.js +0 -30
- package/dist/npm/hooks/useControlledState.d.ts +0 -7
- package/dist/npm/hooks/useControlledState.js +0 -27
- package/dist/npm/hooks/useCustomComponent.d.ts +0 -13
- package/dist/npm/hooks/useCustomComponent.js +0 -13
- package/dist/npm/hooks/useDir.d.ts +0 -5
- package/dist/npm/hooks/useDir.js +0 -23
- package/dist/npm/hooks/useDocument.d.ts +0 -7
- package/dist/npm/hooks/useDocument.js +0 -18
- package/dist/npm/hooks/useDraggable.d.ts +0 -63
- package/dist/npm/hooks/useDraggable.js +0 -340
- package/dist/npm/hooks/useDroppable.d.ts +0 -28
- package/dist/npm/hooks/useDroppable.js +0 -63
- package/dist/npm/hooks/useInheritedState.d.ts +0 -13
- package/dist/npm/hooks/useInheritedState.js +0 -25
- package/dist/npm/hooks/useMouse.d.ts +0 -20
- package/dist/npm/hooks/useMouse.js +0 -121
- package/dist/npm/hooks/usePointer.d.ts +0 -21
- package/dist/npm/hooks/usePointer.js +0 -33
- package/dist/npm/hooks/usePropsContext.d.ts +0 -3
- package/dist/npm/hooks/usePropsContext.js +0 -11
- package/dist/npm/hooks/useRtl.d.ts +0 -5
- package/dist/npm/hooks/useRtl.js +0 -26
- package/dist/npm/hooks/useTouch.d.ts +0 -15
- package/dist/npm/hooks/useTouch.js +0 -33
- package/dist/npm/hooks/useWindow.d.ts +0 -7
- package/dist/npm/hooks/useWindow.js +0 -19
- package/dist/npm/icons/BaseIconProps.js +0 -2
- package/dist/npm/icons/Icon.d.ts +0 -35
- package/dist/npm/icons/Icon.js +0 -81
- package/dist/npm/icons/IconWrap.d.ts +0 -7
- package/dist/npm/icons/IconWrap.js +0 -44
- package/dist/npm/icons/IconsContext.d.ts +0 -21
- package/dist/npm/icons/IconsContext.js +0 -10
- package/dist/npm/icons/SvgIcon.d.ts +0 -71
- package/dist/npm/icons/SvgIcon.js +0 -99
- package/dist/npm/icons/constants.d.ts +0 -13
- package/dist/npm/icons/constants.js +0 -16
- package/dist/npm/icons/models/flip.d.ts +0 -11
- package/dist/npm/icons/models/flip.js +0 -2
- package/dist/npm/icons/models/size.js +0 -2
- package/dist/npm/icons/models/theme-color.d.ts +0 -21
- package/dist/npm/icons/models/theme-color.js +0 -2
- package/dist/npm/icons/utils.d.ts +0 -17
- package/dist/npm/icons/utils.js +0 -22
- package/dist/npm/keys.d.ts +0 -20
- package/dist/npm/keys.js +0 -23
- package/dist/npm/main.d.ts +0 -58
- package/dist/npm/main.js +0 -75
- package/dist/npm/memoize.d.ts +0 -10
- package/dist/npm/memoize.js +0 -45
- package/dist/npm/models/auto-scroll-options.d.ts +0 -23
- package/dist/npm/models/auto-scroll-options.js +0 -2
- package/dist/npm/models/index.d.ts +0 -5
- package/dist/npm/models/index.js +0 -21
- package/dist/npm/models/kendoReactComponentBaseProps.js +0 -2
- package/dist/npm/models/mouse.js +0 -2
- package/dist/npm/models/pointer.js +0 -2
- package/dist/npm/models/touch.d.ts +0 -17
- package/dist/npm/models/touch.js +0 -2
- package/dist/npm/navigation.js +0 -147
- package/dist/npm/noop.d.ts +0 -4
- package/dist/npm/noop.js +0 -8
- package/dist/npm/scrollbarWidth.d.ts +0 -8
- package/dist/npm/scrollbarWidth.js +0 -27
- package/dist/npm/setter.js +0 -40
- package/dist/npm/theme.d.ts +0 -8
- package/dist/npm/theme.js +0 -20
- package/dist/npm/tree-utils/FieldsService.d.ts +0 -25
- package/dist/npm/tree-utils/FieldsService.js +0 -53
- package/dist/npm/tree-utils/SortedPublicItemIds.d.ts +0 -8
- package/dist/npm/tree-utils/SortedPublicItemIds.js +0 -29
- package/dist/npm/tree-utils/itemIdUtils.d.ts +0 -60
- package/dist/npm/tree-utils/itemIdUtils.js +0 -132
- package/dist/npm/tree-utils/itemUtils.d.ts +0 -45
- package/dist/npm/tree-utils/itemUtils.js +0 -205
- package/dist/npm/tree-utils/misc.d.ts +0 -8
- package/dist/npm/tree-utils/misc.js +0 -22
- package/dist/npm/treeDataOperations.d.ts +0 -39
- package/dist/npm/treeDataOperations.js +0 -112
- package/dist/npm/typography/Typography.js +0 -269
- package/dist/npm/typography/TypographyProps.d.ts +0 -121
- package/dist/npm/typography/TypographyProps.js +0 -2
- package/dist/npm/typography/constants.js +0 -87
- package/dist/npm/typography/models/margin.d.ts +0 -23
- package/dist/npm/typography/models/margin.js +0 -2
- package/dist/npm/validate-package.d.ts +0 -8
- package/dist/npm/validate-package.js +0 -28
- package/dist/npm/watermark/WatermarkOverlay.d.ts +0 -6
- package/dist/npm/watermark/WatermarkOverlay.js +0 -90
- package/dist/systemjs/kendo-react-common.js +0 -1
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import * as React from 'react';
|
|
13
|
-
import { useAsyncFocusBlur } from '../hooks/useAsyncFocusBlur';
|
|
14
|
-
/**
|
|
15
|
-
* An utility High-order Component for asynchronous focus/blur handling.
|
|
16
|
-
*
|
|
17
|
-
* By default, the `onFocus` and `onBlur` callbacks are called every time a child components receives/loses focus.
|
|
18
|
-
* Use this utility HOC for scenarios where you need to know if the parent has received focus for the first time, or completely lost focus.
|
|
19
|
-
*
|
|
20
|
-
* @returns
|
|
21
|
-
*/
|
|
22
|
-
export var AsyncFocusBlur = function (_a) {
|
|
23
|
-
var children = _a.children, onFocus = _a.onFocus, onBlur = _a.onBlur, onSyncFocus = _a.onSyncFocus, onSyncBlur = _a.onSyncBlur;
|
|
24
|
-
var args = useAsyncFocusBlur({ onFocus: onFocus, onBlur: onBlur, onSyncFocus: onSyncFocus, onSyncBlur: onSyncBlur });
|
|
25
|
-
return React.createElement(React.Fragment, null, children.call(undefined, __assign({}, args)));
|
|
26
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
/** @hidden */
|
|
3
|
-
export declare const createPropsContext: <T extends unknown>() => React.Context<(p: T) => T>;
|
|
4
|
-
/** @hidden */
|
|
5
|
-
export declare const withPropsContext: <T extends unknown>(context: React.Context<(p: T) => T>, Component: React.ComponentType<T>) => React.ForwardRefExoticComponent<React.PropsWithoutRef<T> & React.RefAttributes<any>>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import * as React from 'react';
|
|
13
|
-
import { usePropsContext } from '../hooks/usePropsContext';
|
|
14
|
-
/** @hidden */
|
|
15
|
-
export var createPropsContext = function () { return React.createContext(function (props) { return props; }); };
|
|
16
|
-
/** @hidden */
|
|
17
|
-
export var withPropsContext = function (context, Component
|
|
18
|
-
// eslint-disable-next-line react/display-name
|
|
19
|
-
) { return React.forwardRef(function (props, ref) {
|
|
20
|
-
var contextProps = usePropsContext(context, props);
|
|
21
|
-
return (React.createElement(Component, __assign({}, contextProps, { ref: ref })));
|
|
22
|
-
}); };
|
package/dist/es/hooks/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export * from './useMouse';
|
|
2
|
-
export * from './useAsyncFocusBlur';
|
|
3
|
-
export * from './useDir';
|
|
4
|
-
export * from './useDraggable';
|
|
5
|
-
export * from './useDroppable';
|
|
6
|
-
export * from './useRtl';
|
|
7
|
-
export * from './useCustomComponent';
|
|
8
|
-
export * from './useControlledState';
|
|
9
|
-
export * from './useInheritedState';
|
|
10
|
-
export * from './useCollection';
|
|
11
|
-
export * from './useDocument';
|
|
12
|
-
export * from './useWindow';
|
package/dist/es/hooks/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export * from './useMouse';
|
|
2
|
-
export * from './useAsyncFocusBlur';
|
|
3
|
-
export * from './useDir';
|
|
4
|
-
export * from './useDraggable';
|
|
5
|
-
export * from './useDroppable';
|
|
6
|
-
export * from './useRtl';
|
|
7
|
-
export * from './useCustomComponent';
|
|
8
|
-
export * from './useControlledState';
|
|
9
|
-
export * from './useInheritedState';
|
|
10
|
-
export * from './useCollection';
|
|
11
|
-
export * from './useDocument';
|
|
12
|
-
export * from './useWindow';
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* @hidden
|
|
4
|
-
*/
|
|
5
|
-
export declare type AsyncFocusBlurArgs<T extends any[]> = {
|
|
6
|
-
onFocus?: (...event: T) => void;
|
|
7
|
-
onBlur?: (...event: T) => void;
|
|
8
|
-
/**
|
|
9
|
-
* @hidden
|
|
10
|
-
*/
|
|
11
|
-
onSyncFocus?: (event: React.FocusEvent<any>) => void;
|
|
12
|
-
/**
|
|
13
|
-
* @hidden
|
|
14
|
-
*/
|
|
15
|
-
onSyncBlur?: (event: React.FocusEvent<any>) => void;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* An utility function for asynchronous focus/blur handling.
|
|
19
|
-
*
|
|
20
|
-
* By default, the `onFocus` and `onBlur` callbacks are called every time a child components receives/loses focus.
|
|
21
|
-
* Use this utility hook for scenarios where you need to know if the parent has received focus for the first time, or completely lost focus.
|
|
22
|
-
*
|
|
23
|
-
* @returns
|
|
24
|
-
*/
|
|
25
|
-
export declare function useAsyncFocusBlur<T extends any[]>({ onFocus, onBlur, onSyncFocus, onSyncBlur }: AsyncFocusBlurArgs<T>): AsyncFocusBlurArgs<T>;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
-
if (ar || !(i in from)) {
|
|
4
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
-
ar[i] = from[i];
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
|
-
};
|
|
10
|
-
import * as React from 'react';
|
|
11
|
-
/**
|
|
12
|
-
* An utility function for asynchronous focus/blur handling.
|
|
13
|
-
*
|
|
14
|
-
* By default, the `onFocus` and `onBlur` callbacks are called every time a child components receives/loses focus.
|
|
15
|
-
* Use this utility hook for scenarios where you need to know if the parent has received focus for the first time, or completely lost focus.
|
|
16
|
-
*
|
|
17
|
-
* @returns
|
|
18
|
-
*/
|
|
19
|
-
export function useAsyncFocusBlur(_a) {
|
|
20
|
-
var onFocus = _a.onFocus, onBlur = _a.onBlur, onSyncFocus = _a.onSyncFocus, onSyncBlur = _a.onSyncBlur;
|
|
21
|
-
var focused = React.useRef(false);
|
|
22
|
-
var tick = React.useRef(0);
|
|
23
|
-
var nextTick = React.useCallback(function (f) {
|
|
24
|
-
clearTimeout(tick.current);
|
|
25
|
-
tick.current = window.setTimeout(function () { return f(); });
|
|
26
|
-
}, [tick]);
|
|
27
|
-
var handleFocus = React.useCallback(function () {
|
|
28
|
-
var event = [];
|
|
29
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
30
|
-
event[_i] = arguments[_i];
|
|
31
|
-
}
|
|
32
|
-
clearTimeout(tick.current);
|
|
33
|
-
if (onSyncFocus) {
|
|
34
|
-
onSyncFocus.call(undefined, event[0]);
|
|
35
|
-
}
|
|
36
|
-
if (focused.current) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
;
|
|
40
|
-
focused.current = true;
|
|
41
|
-
if (onFocus) {
|
|
42
|
-
onFocus.call.apply(onFocus, __spreadArray([undefined], event, false));
|
|
43
|
-
}
|
|
44
|
-
}, [focused, onFocus, onSyncFocus]);
|
|
45
|
-
var handleBlur = React.useCallback(function () {
|
|
46
|
-
var event = [];
|
|
47
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
48
|
-
event[_i] = arguments[_i];
|
|
49
|
-
}
|
|
50
|
-
if (onSyncBlur) {
|
|
51
|
-
onSyncBlur.call(undefined, event[0]);
|
|
52
|
-
}
|
|
53
|
-
nextTick(function () {
|
|
54
|
-
if (!focused.current) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
if (onBlur) {
|
|
58
|
-
focused.current = false;
|
|
59
|
-
onBlur.call.apply(onBlur, __spreadArray([undefined], event, false));
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}, [focused, nextTick, onBlur, onSyncBlur]);
|
|
63
|
-
React.useEffect(function () {
|
|
64
|
-
return function () {
|
|
65
|
-
clearTimeout(tick.current);
|
|
66
|
-
};
|
|
67
|
-
}, []);
|
|
68
|
-
return {
|
|
69
|
-
onFocus: handleFocus,
|
|
70
|
-
onBlur: handleBlur
|
|
71
|
-
};
|
|
72
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/** @hidden */
|
|
2
|
-
export declare enum COLLECTION_ACTION {
|
|
3
|
-
add = 0,
|
|
4
|
-
remove = 1
|
|
5
|
-
}
|
|
6
|
-
/** @hidden */
|
|
7
|
-
export declare type Collection<T> = T[];
|
|
8
|
-
/** @hidden */
|
|
9
|
-
export interface CollectionAction<T> {
|
|
10
|
-
type: COLLECTION_ACTION;
|
|
11
|
-
item: T;
|
|
12
|
-
}
|
|
13
|
-
/** @hidden */
|
|
14
|
-
export declare const useCollection: <T extends unknown>(initial?: T[]) => [T[], (event: CollectionAction<T>) => void];
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
/** @hidden */
|
|
3
|
-
export var COLLECTION_ACTION;
|
|
4
|
-
(function (COLLECTION_ACTION) {
|
|
5
|
-
COLLECTION_ACTION[COLLECTION_ACTION["add"] = 0] = "add";
|
|
6
|
-
COLLECTION_ACTION[COLLECTION_ACTION["remove"] = 1] = "remove";
|
|
7
|
-
})(COLLECTION_ACTION || (COLLECTION_ACTION = {}));
|
|
8
|
-
/** @hidden */
|
|
9
|
-
export var useCollection = function (initial) {
|
|
10
|
-
if (initial === void 0) { initial = []; }
|
|
11
|
-
var collection = React.useRef(initial);
|
|
12
|
-
var handleCollectionAction = React.useCallback(function (action) {
|
|
13
|
-
switch (action.type) {
|
|
14
|
-
case COLLECTION_ACTION.add:
|
|
15
|
-
collection.current.push(action.item);
|
|
16
|
-
break;
|
|
17
|
-
case COLLECTION_ACTION.remove:
|
|
18
|
-
var index = collection.current.indexOf(action.item);
|
|
19
|
-
collection.current.splice(index, 1);
|
|
20
|
-
break;
|
|
21
|
-
default:
|
|
22
|
-
break;
|
|
23
|
-
}
|
|
24
|
-
}, []);
|
|
25
|
-
return [collection.current, handleCollectionAction];
|
|
26
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/** @hidden */
|
|
2
|
-
export declare type ControlledStateHook<T, A = any> = [
|
|
3
|
-
T,
|
|
4
|
-
(value: T, args?: A) => void
|
|
5
|
-
];
|
|
6
|
-
/** @hidden */
|
|
7
|
-
export declare const useControlledState: <T = any, A = any>(defaultProp: T, prop?: T | undefined, callback?: any) => ControlledStateHook<T, any>;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import * as React from 'react';
|
|
13
|
-
/** @hidden */
|
|
14
|
-
export var useControlledState = function (defaultProp, prop, callback) {
|
|
15
|
-
var _a = React.useState(prop || defaultProp), state = _a[0], setState = _a[1];
|
|
16
|
-
var handleSetEdit = React.useCallback(function (value, args) {
|
|
17
|
-
setState(value);
|
|
18
|
-
if (callback) {
|
|
19
|
-
callback.call(undefined, __assign(__assign({}, args), { value: value }));
|
|
20
|
-
}
|
|
21
|
-
}, [callback, setState]);
|
|
22
|
-
return [prop !== undefined ? prop : state, handleSetEdit];
|
|
23
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* @hidden
|
|
4
|
-
*/
|
|
5
|
-
export declare type CustomComponent<P extends any> = React.ComponentType<P & {
|
|
6
|
-
ref?: React.Ref<any>;
|
|
7
|
-
}>;
|
|
8
|
-
/**
|
|
9
|
-
* @hidden
|
|
10
|
-
*/
|
|
11
|
-
export declare const useCustomComponent: <P = {}>(comp: CustomComponent<P>) => [React.ComponentType<P & {
|
|
12
|
-
ref?: React.Ref<any> | undefined;
|
|
13
|
-
}>, Partial<P>];
|
package/dist/es/hooks/useDir.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* @hidden
|
|
4
|
-
*/
|
|
5
|
-
export function useDir(elementRef, initialDir, args) {
|
|
6
|
-
// Dir prop is read only on initial rendering due to specifics of getComputedStyles - see below
|
|
7
|
-
var _a = React.useState(initialDir), dir = _a[0], setDir = _a[1];
|
|
8
|
-
React.useEffect(function () {
|
|
9
|
-
if (!dir && window && elementRef.current) {
|
|
10
|
-
// Note: getComputedStyle forces reflow
|
|
11
|
-
var rtlCandidate = window.getComputedStyle(elementRef.current).direction;
|
|
12
|
-
if (rtlCandidate) {
|
|
13
|
-
// rerender is needed as DOM is read after first render
|
|
14
|
-
setDir(rtlCandidate);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}, args);
|
|
18
|
-
return dir;
|
|
19
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Returns a function, which gets the `ownerDocument` of the element.
|
|
4
|
-
*/
|
|
5
|
-
export var useDocument = function (ref) {
|
|
6
|
-
var getElement = React.useCallback(function () { return ref.current && ref.current.element
|
|
7
|
-
? ref.current.element
|
|
8
|
-
: ref.current; }, [ref]);
|
|
9
|
-
var getDocument = React.useCallback(function () {
|
|
10
|
-
var element = getElement();
|
|
11
|
-
return element ? element.ownerDocument || document : document;
|
|
12
|
-
}, [getElement]);
|
|
13
|
-
return getDocument;
|
|
14
|
-
};
|
|
@@ -1,336 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { dispatchDragAndDrop, autoScroll as autoScrollElement, getScrollableParent } from '@progress/kendo-draggable-common';
|
|
3
|
-
import { noop } from '../noop';
|
|
4
|
-
import { useInheritedState } from '../hooks/useInheritedState';
|
|
5
|
-
import { DragContext, DropContext, DragsContext, DropsContext } from '../drag-n-drop/context';
|
|
6
|
-
var IGNORE_MOUSE_TIMEOUT = 2000;
|
|
7
|
-
/**
|
|
8
|
-
* Represents the KendoReact `useDraggable` hook.
|
|
9
|
-
* Use it to attach `drag` events to a native HTML DOM elements, or custom React Components.
|
|
10
|
-
*
|
|
11
|
-
* For more information, refer to the [KendoReact Draggable]({% slug draggable_drag-and-drop %}) article.
|
|
12
|
-
*
|
|
13
|
-
* @param ref - The `ref` of the HTML Element or React Component which will enable the `draggable` functionality.
|
|
14
|
-
* @param callbacks - A collection of callbacks, called by the `useDraggable` hook when a specific action occurs.
|
|
15
|
-
* @param options - Additional configuration of the `useDraggable` hook.
|
|
16
|
-
*/
|
|
17
|
-
export function useDraggable(ref, callbacks, options) {
|
|
18
|
-
if (options === void 0) { options = {}; }
|
|
19
|
-
var _a = callbacks.onPress, onPress = _a === void 0 ? noop : _a, _b = callbacks.onRelease, onRelease = _b === void 0 ? noop : _b, _c = callbacks.onDragStart, onDragStart = _c === void 0 ? noop : _c, _d = callbacks.onDrag, onDrag = _d === void 0 ? noop : _d, _e = callbacks.onDragEnd, onDragEnd = _e === void 0 ? noop : _e;
|
|
20
|
-
var _f = options.hint, hint = _f === void 0 ? null : _f, _g = options.mouseOnly, mouseOnly = _g === void 0 ? false : _g, _h = options.autoScroll, autoScroll = _h === void 0 ? true : _h, _j = options.scrollContainer, scrollContainer = _j === void 0 ? null : _j;
|
|
21
|
-
var _k = React.useState(false), pressed = _k[0], setPressed = _k[1];
|
|
22
|
-
var _l = React.useState(false), scrolling = _l[0], setScrolling = _l[1];
|
|
23
|
-
var drop = useInheritedState(DropContext)[0];
|
|
24
|
-
var _m = useInheritedState(DragContext), drag = _m[0], setDrag = _m[1];
|
|
25
|
-
var drops = React.useContext(DropsContext)[0];
|
|
26
|
-
var _o = React.useContext(DragsContext), drags = _o[0], registerDrag = _o[1], deregisterDrag = _o[2];
|
|
27
|
-
var velocity = React.useRef({ x: 0, y: 0 });
|
|
28
|
-
var scrollInterval = React.useRef();
|
|
29
|
-
var ignoreMouse = React.useRef(false);
|
|
30
|
-
var restoreMouseTimeout = React.useRef();
|
|
31
|
-
var scrollable = React.useRef(null);
|
|
32
|
-
var unmount = React.useRef(false);
|
|
33
|
-
var offset = React.useRef({ x: 0, y: 0 });
|
|
34
|
-
var pageOffset = React.useRef({ x: 0, y: 0 });
|
|
35
|
-
var clientOffset = React.useRef({ x: 0, y: 0 });
|
|
36
|
-
var initialClientOffset = React.useRef({ x: 0, y: 0 });
|
|
37
|
-
var scrollOffset = React.useRef({ x: 0, y: 0 });
|
|
38
|
-
var initialScrollOffset = React.useRef({ x: 0, y: 0 });
|
|
39
|
-
var supportPointerEvent = Boolean((typeof window !== 'undefined') && window.PointerEvent);
|
|
40
|
-
var pointers = !mouseOnly && supportPointerEvent;
|
|
41
|
-
var getElement = React.useCallback(function () { return ref.current && ref.current.element
|
|
42
|
-
? ref.current.element
|
|
43
|
-
: ref.current; }, [ref]);
|
|
44
|
-
var getHintElement = React.useCallback(function () { return hint && hint.current && hint.current.element
|
|
45
|
-
? hint.current.element
|
|
46
|
-
: hint
|
|
47
|
-
? hint.current
|
|
48
|
-
: null; }, [hint]);
|
|
49
|
-
var getScrollContainer = React.useCallback(function () { return scrollContainer && scrollContainer.current && scrollContainer.current.element
|
|
50
|
-
? scrollContainer.current.element
|
|
51
|
-
: scrollContainer
|
|
52
|
-
? scrollContainer.current
|
|
53
|
-
: null; }, [scrollContainer]);
|
|
54
|
-
var getAutoScrollContainer = React.useCallback(function () { return typeof autoScroll === 'object' && autoScroll.boundaryElementRef
|
|
55
|
-
&& autoScroll.boundaryElementRef.current && autoScroll.boundaryElementRef.current.element
|
|
56
|
-
? autoScroll.boundaryElementRef.current.element
|
|
57
|
-
: typeof autoScroll === 'object' && autoScroll.boundaryElementRef && autoScroll.boundaryElementRef.current
|
|
58
|
-
? autoScroll.boundaryElementRef.current
|
|
59
|
-
: null; }, [autoScroll]);
|
|
60
|
-
var target = React.useRef(null);
|
|
61
|
-
React.useImperativeHandle(target, function () { return ({
|
|
62
|
-
element: getElement(),
|
|
63
|
-
hint: getHintElement(),
|
|
64
|
-
onPress: handlePress,
|
|
65
|
-
onDragStart: handleDragStart,
|
|
66
|
-
onDrag: handleDrag,
|
|
67
|
-
onDragEnd: handleDragEnd,
|
|
68
|
-
onRelease: handleRelease,
|
|
69
|
-
data: ref.current
|
|
70
|
-
}); });
|
|
71
|
-
var getDocument = React.useCallback(function () {
|
|
72
|
-
var element = getElement();
|
|
73
|
-
return element ? element.ownerDocument || document : document;
|
|
74
|
-
}, [getElement]);
|
|
75
|
-
var getWindow = React.useCallback(function () {
|
|
76
|
-
var document = getDocument();
|
|
77
|
-
return document
|
|
78
|
-
? document.defaultView || window
|
|
79
|
-
: window;
|
|
80
|
-
}, [getDocument]);
|
|
81
|
-
var getState = React.useCallback(function () { return ({
|
|
82
|
-
drag: drag ? drag.current : null,
|
|
83
|
-
drop: drop ? drop.current : null,
|
|
84
|
-
drags: drags.map(function (d) { return d.current; }),
|
|
85
|
-
drops: drops.map(function (d) { return d.current; }),
|
|
86
|
-
pressed: pressed,
|
|
87
|
-
ignoreMouse: ignoreMouse.current,
|
|
88
|
-
scrollOffset: scrollOffset.current,
|
|
89
|
-
offset: offset.current,
|
|
90
|
-
pageOffset: pageOffset.current,
|
|
91
|
-
initialScrollOffset: initialScrollOffset.current,
|
|
92
|
-
clientOffset: clientOffset.current,
|
|
93
|
-
initialClientOffset: initialClientOffset.current,
|
|
94
|
-
velocity: velocity.current,
|
|
95
|
-
autoScroll: Boolean(typeof autoScroll === 'object' ? autoScroll.enabled !== false : autoScroll),
|
|
96
|
-
scrollableParent: getAutoScrollContainer(),
|
|
97
|
-
autoScrollDirection: typeof autoScroll === 'object' ? autoScroll.direction : { horizontal: true, vertical: true },
|
|
98
|
-
isScrolling: scrolling
|
|
99
|
-
}); }, [drag, drop, drags, drops, pressed, autoScroll, getAutoScrollContainer, scrolling]);
|
|
100
|
-
var handlePressedChange = React.useCallback(function (value) {
|
|
101
|
-
setPressed(value);
|
|
102
|
-
}, []);
|
|
103
|
-
var handleScrollingChange = React.useCallback(function (value) {
|
|
104
|
-
setScrolling(value);
|
|
105
|
-
}, []);
|
|
106
|
-
var handleVelocityChange = React.useCallback(function (value) {
|
|
107
|
-
velocity.current = value;
|
|
108
|
-
}, []);
|
|
109
|
-
var handleOffsetChange = React.useCallback(function (value) {
|
|
110
|
-
offset.current = value;
|
|
111
|
-
}, []);
|
|
112
|
-
var handleClientOffsetChange = React.useCallback(function (value) {
|
|
113
|
-
clientOffset.current = value;
|
|
114
|
-
}, []);
|
|
115
|
-
var handlePageOffsetChange = React.useCallback(function (value) {
|
|
116
|
-
pageOffset.current = value;
|
|
117
|
-
}, []);
|
|
118
|
-
var handleInitialClientOffsetChange = React.useCallback(function (value) {
|
|
119
|
-
initialClientOffset.current = value;
|
|
120
|
-
}, []);
|
|
121
|
-
var handleScrollOffsetChange = React.useCallback(function (value) {
|
|
122
|
-
scrollOffset.current = value;
|
|
123
|
-
}, []);
|
|
124
|
-
var handleInitialScrollOffsetChange = React.useCallback(function (value) {
|
|
125
|
-
initialScrollOffset.current = value;
|
|
126
|
-
}, []);
|
|
127
|
-
// Drag Events
|
|
128
|
-
var handlePress = React.useCallback(function (event) {
|
|
129
|
-
onPress(event);
|
|
130
|
-
}, [onPress]);
|
|
131
|
-
var handleRelease = React.useCallback(function (event) {
|
|
132
|
-
onRelease(event);
|
|
133
|
-
}, [onRelease]);
|
|
134
|
-
var handleDragStart = React.useCallback(function (event) {
|
|
135
|
-
setDrag(target, { target: ref.current, event: event });
|
|
136
|
-
onDragStart(event);
|
|
137
|
-
}, [setDrag, ref, onDragStart]);
|
|
138
|
-
var handleDrag = React.useCallback(function (event) {
|
|
139
|
-
onDrag(event);
|
|
140
|
-
}, [onDrag]);
|
|
141
|
-
var handleDragEnd = React.useCallback(function (event) {
|
|
142
|
-
if (unmount.current) {
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
setDrag(null, { target: ref.current, event: event });
|
|
146
|
-
onDragEnd(event);
|
|
147
|
-
}, [onDragEnd, setDrag, ref]);
|
|
148
|
-
var dispatchDragEvent = React.useCallback(function (event) {
|
|
149
|
-
dispatchDragAndDrop(getState(), { event: event, payload: target.current }, {
|
|
150
|
-
onVelocityChange: handleVelocityChange,
|
|
151
|
-
onOffsetChange: handleOffsetChange,
|
|
152
|
-
onClientOffsetChange: handleClientOffsetChange,
|
|
153
|
-
onPageOffsetChange: handlePageOffsetChange,
|
|
154
|
-
onInitialClientOffsetChange: handleInitialClientOffsetChange,
|
|
155
|
-
onScrollOffsetChange: handleScrollOffsetChange,
|
|
156
|
-
onInitialScrollOffsetChange: handleInitialScrollOffsetChange,
|
|
157
|
-
onIsPressedChange: handlePressedChange,
|
|
158
|
-
onIsScrollingChange: handleScrollingChange
|
|
159
|
-
});
|
|
160
|
-
}, [
|
|
161
|
-
getState,
|
|
162
|
-
handleVelocityChange,
|
|
163
|
-
handleOffsetChange,
|
|
164
|
-
handlePageOffsetChange,
|
|
165
|
-
handleClientOffsetChange,
|
|
166
|
-
handleInitialClientOffsetChange,
|
|
167
|
-
handleInitialScrollOffsetChange,
|
|
168
|
-
handlePressedChange,
|
|
169
|
-
handleScrollOffsetChange,
|
|
170
|
-
handleScrollingChange
|
|
171
|
-
]);
|
|
172
|
-
// Pointer Events
|
|
173
|
-
var handlePointerDown = React.useCallback(function (event) {
|
|
174
|
-
dispatchDragEvent(event);
|
|
175
|
-
}, [dispatchDragEvent]);
|
|
176
|
-
var handlePointerMove = React.useCallback(function (event) {
|
|
177
|
-
dispatchDragEvent(event);
|
|
178
|
-
}, [dispatchDragEvent]);
|
|
179
|
-
var handlePointerCancel = React.useCallback(function (event) {
|
|
180
|
-
dispatchDragEvent(event);
|
|
181
|
-
}, [dispatchDragEvent]);
|
|
182
|
-
var handlePointerUp = React.useCallback(function (event) {
|
|
183
|
-
dispatchDragEvent(event);
|
|
184
|
-
}, [dispatchDragEvent]);
|
|
185
|
-
// Mouse Events
|
|
186
|
-
var handleMouseDown = React.useCallback(function (event) {
|
|
187
|
-
dispatchDragEvent(event);
|
|
188
|
-
}, [dispatchDragEvent]);
|
|
189
|
-
var handleMouseMove = React.useCallback(function (event) {
|
|
190
|
-
dispatchDragEvent(event);
|
|
191
|
-
}, [dispatchDragEvent]);
|
|
192
|
-
var handleMouseUp = React.useCallback(function (event) {
|
|
193
|
-
dispatchDragEvent(event);
|
|
194
|
-
}, [dispatchDragEvent]);
|
|
195
|
-
var handleContextMenu = React.useCallback(function (event) {
|
|
196
|
-
event.preventDefault();
|
|
197
|
-
dispatchDragEvent(event);
|
|
198
|
-
}, [dispatchDragEvent]);
|
|
199
|
-
// Touch Events
|
|
200
|
-
var handleTouchStart = React.useCallback(function (event) {
|
|
201
|
-
event.preventDefault();
|
|
202
|
-
dispatchDragEvent(event);
|
|
203
|
-
}, [dispatchDragEvent]);
|
|
204
|
-
var handleTouchMove = React.useCallback(function (event) {
|
|
205
|
-
event.preventDefault();
|
|
206
|
-
dispatchDragEvent(event);
|
|
207
|
-
}, [dispatchDragEvent]);
|
|
208
|
-
var handleTouchEnd = React.useCallback(function (event) {
|
|
209
|
-
if (event.touches.length === 0 && event.changedTouches.length === 1) {
|
|
210
|
-
var currentWindow = getWindow();
|
|
211
|
-
ignoreMouse.current = true;
|
|
212
|
-
restoreMouseTimeout.current = currentWindow.setTimeout(function () { ignoreMouse.current = false; }, IGNORE_MOUSE_TIMEOUT);
|
|
213
|
-
}
|
|
214
|
-
dispatchDragEvent(event);
|
|
215
|
-
}, [dispatchDragEvent, getWindow]);
|
|
216
|
-
var handleScroll = React.useCallback(function (event) {
|
|
217
|
-
dispatchDragEvent(event);
|
|
218
|
-
}, [dispatchDragEvent]);
|
|
219
|
-
// Misc
|
|
220
|
-
var prerequisites = React.useCallback(function () {
|
|
221
|
-
var element = getElement();
|
|
222
|
-
if (element) {
|
|
223
|
-
var initialTouchAction_1 = element.style.touchAction;
|
|
224
|
-
element.style.touchAction = 'none';
|
|
225
|
-
return function () {
|
|
226
|
-
element.style.touchAction = initialTouchAction_1;
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
}, [getElement]);
|
|
230
|
-
var register = React.useCallback(function () {
|
|
231
|
-
registerDrag(target);
|
|
232
|
-
return function () {
|
|
233
|
-
deregisterDrag(target);
|
|
234
|
-
};
|
|
235
|
-
}, [deregisterDrag, registerDrag]);
|
|
236
|
-
var init = function () {
|
|
237
|
-
var window = getWindow();
|
|
238
|
-
var element = getElement();
|
|
239
|
-
var document = getDocument();
|
|
240
|
-
if (pointers) {
|
|
241
|
-
if (element) {
|
|
242
|
-
scrollable.current = getScrollableParent(element);
|
|
243
|
-
if (scrollable.current) {
|
|
244
|
-
scrollable.current.addEventListener('scroll', handleScroll, { passive: true });
|
|
245
|
-
}
|
|
246
|
-
element.addEventListener('pointerdown', handlePointerDown, { passive: true });
|
|
247
|
-
}
|
|
248
|
-
if (pressed) {
|
|
249
|
-
document.addEventListener('pointermove', handlePointerMove);
|
|
250
|
-
document.addEventListener('pointerup', handlePointerUp, true);
|
|
251
|
-
document.addEventListener('contextmenu', handleContextMenu);
|
|
252
|
-
document.addEventListener('pointercancel', handlePointerCancel, { passive: true });
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
else {
|
|
256
|
-
// Hacky-hacky iOS Safari
|
|
257
|
-
window.addEventListener('touchmove', noop, { capture: false, passive: false });
|
|
258
|
-
if (element) {
|
|
259
|
-
element.addEventListener('mousedown', handleMouseDown, { passive: true });
|
|
260
|
-
if (!mouseOnly) {
|
|
261
|
-
element.addEventListener('touchstart', handleTouchStart, { passive: true });
|
|
262
|
-
if (pressed) {
|
|
263
|
-
element.addEventListener('touchmove', handleTouchMove, { passive: true });
|
|
264
|
-
element.addEventListener('touchend', handleTouchEnd, { passive: true });
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
if (pressed) {
|
|
269
|
-
document.addEventListener('mousemove', handleMouseMove, { passive: true });
|
|
270
|
-
document.addEventListener('mouseup', handleMouseUp, { passive: true });
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
return function () {
|
|
274
|
-
if (scrollable.current) {
|
|
275
|
-
scrollable.current.removeEventListener('scroll', handleScroll);
|
|
276
|
-
}
|
|
277
|
-
if (element) {
|
|
278
|
-
element.removeEventListener('pointerdown', handlePointerDown);
|
|
279
|
-
element.removeEventListener('mousedown', handleMouseDown);
|
|
280
|
-
element.removeEventListener('touchstart', handleTouchStart);
|
|
281
|
-
element.removeEventListener('touchmove', handleTouchMove);
|
|
282
|
-
element.removeEventListener('touchend', handleTouchEnd);
|
|
283
|
-
}
|
|
284
|
-
document.removeEventListener('pointermove', handlePointerMove);
|
|
285
|
-
document.removeEventListener('pointerup', handlePointerUp, true);
|
|
286
|
-
document.removeEventListener('contextmenu', handleContextMenu);
|
|
287
|
-
document.removeEventListener('pointercancel', handlePointerCancel);
|
|
288
|
-
document.removeEventListener('mousemove', handleMouseMove);
|
|
289
|
-
document.removeEventListener('mouseup', handleMouseUp);
|
|
290
|
-
window.removeEventListener('touchmove', noop);
|
|
291
|
-
window.clearTimeout(restoreMouseTimeout.current);
|
|
292
|
-
};
|
|
293
|
-
};
|
|
294
|
-
React.useEffect(function () {
|
|
295
|
-
var window = getWindow();
|
|
296
|
-
if (scrolling) {
|
|
297
|
-
var scrollableParent_1 = getScrollContainer()
|
|
298
|
-
|| getScrollableParent(document.elementFromPoint(clientOffset.current.x, clientOffset.current.y));
|
|
299
|
-
window.clearInterval(scrollInterval.current);
|
|
300
|
-
scrollInterval.current = window.setInterval(function () {
|
|
301
|
-
autoScrollElement(scrollableParent_1, { x: velocity.current.x, y: velocity.current.y });
|
|
302
|
-
}, 50);
|
|
303
|
-
}
|
|
304
|
-
return function () {
|
|
305
|
-
window.clearInterval(scrollInterval.current);
|
|
306
|
-
};
|
|
307
|
-
}, [getElement, getScrollContainer, getWindow, scrolling]);
|
|
308
|
-
React.useEffect(prerequisites, [prerequisites]);
|
|
309
|
-
React.useEffect(init, [
|
|
310
|
-
pressed,
|
|
311
|
-
getWindow,
|
|
312
|
-
getElement,
|
|
313
|
-
getDocument,
|
|
314
|
-
mouseOnly,
|
|
315
|
-
pointers,
|
|
316
|
-
handleContextMenu,
|
|
317
|
-
handleMouseDown,
|
|
318
|
-
handleMouseMove,
|
|
319
|
-
handleMouseUp,
|
|
320
|
-
handlePointerCancel,
|
|
321
|
-
handlePointerDown,
|
|
322
|
-
handlePointerMove,
|
|
323
|
-
handlePointerUp,
|
|
324
|
-
handleTouchEnd,
|
|
325
|
-
handleTouchMove,
|
|
326
|
-
handleTouchStart,
|
|
327
|
-
handleScroll
|
|
328
|
-
]);
|
|
329
|
-
React.useEffect(function () {
|
|
330
|
-
unmount.current = false;
|
|
331
|
-
return function () {
|
|
332
|
-
unmount.current = true;
|
|
333
|
-
};
|
|
334
|
-
}, []);
|
|
335
|
-
React.useLayoutEffect(register, [register]);
|
|
336
|
-
}
|