@progress/kendo-react-common 5.4.0-dev.202205200719 → 5.4.0-dev.202206061009
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/cdn/js/kendo-react-common.js +1 -1
- package/dist/es/Draggable.d.ts +1 -1
- package/dist/es/Droppable.d.ts +1 -1
- package/dist/es/FormComponent.d.ts +3 -3
- package/dist/es/browser-support.service.d.ts +1 -1
- package/dist/es/browser-support.service.js +2 -1
- package/dist/es/canUseRef.d.ts +1 -1
- package/dist/es/clone.d.ts +1 -1
- package/dist/es/contexts/ZIndexContext.d.ts +2 -2
- package/dist/es/drag-n-drop/context/index.d.ts +3 -2
- package/dist/es/events/BaseEvent.js +1 -0
- package/dist/es/getTabIndex.d.ts +1 -1
- package/dist/es/hasRelativeStackingContext.js +1 -1
- package/dist/es/hocs/AsyncFocusBlur.d.ts +1 -1
- package/dist/es/hocs/AsyncFocusBlur.js +2 -1
- package/dist/es/hocs/withPropsContext.d.ts +2 -2
- package/dist/es/hooks/useAsyncFocusBlur.js +13 -4
- package/dist/es/hooks/useCollection.d.ts +1 -1
- package/dist/es/hooks/useControlledState.d.ts +5 -2
- package/dist/es/hooks/useControlledState.js +1 -1
- package/dist/es/hooks/useCustomComponent.d.ts +3 -12
- package/dist/es/hooks/useCustomComponent.js +5 -6
- package/dist/es/hooks/useDocument.d.ts +2 -2
- package/dist/es/hooks/useInheritedState.d.ts +1 -1
- package/dist/es/hooks/useMouse.d.ts +10 -10
- package/dist/es/hooks/usePointer.d.ts +11 -11
- package/dist/es/hooks/usePointer.js +1 -1
- package/dist/es/hooks/usePropsContext.d.ts +1 -1
- package/dist/es/hooks/useTouch.d.ts +5 -5
- package/dist/es/hooks/useTouch.js +1 -1
- package/dist/es/hooks/useWindow.d.ts +2 -2
- package/dist/es/icons/BaseIconProps.js +1 -0
- package/dist/es/icons/Icon.d.ts +1 -1
- package/dist/es/icons/Icon.js +4 -2
- package/dist/es/icons/SvgIcon.d.ts +1 -1
- package/dist/es/icons/SvgIcon.js +4 -2
- package/dist/es/icons/constants.d.ts +6 -6
- package/dist/es/icons/models/flip.js +1 -0
- package/dist/es/icons/models/size.js +1 -0
- package/dist/es/icons/models/theme-color.js +1 -0
- package/dist/es/main.js +7 -0
- package/dist/es/models/auto-scroll-options.js +1 -0
- package/dist/es/models/index.js +5 -0
- package/dist/es/models/kendoReactComponentBaseProps.js +1 -0
- package/dist/es/models/mouse.js +1 -0
- package/dist/es/models/pointer.js +1 -0
- package/dist/es/models/touch.js +1 -0
- package/dist/es/scrollbarWidth.d.ts +1 -1
- package/dist/es/scrollbarWidth.js +1 -1
- package/dist/es/treeDataOperations.js +13 -4
- package/dist/es/typography/Typography.js +8 -6
- package/dist/es/typography/TypographyProps.js +1 -0
- package/dist/es/typography/constants.d.ts +44 -44
- package/dist/es/typography/models/margin.js +1 -0
- package/dist/es/validate-package.js +2 -2
- package/dist/npm/Draggable.d.ts +1 -1
- package/dist/npm/Draggable.js +2 -1
- package/dist/npm/Droppable.d.ts +1 -1
- package/dist/npm/Droppable.js +2 -1
- package/dist/npm/FormComponent.d.ts +3 -3
- package/dist/npm/FormComponent.js +1 -0
- package/dist/npm/browser-support.service.d.ts +1 -1
- package/dist/npm/browser-support.service.js +3 -1
- package/dist/npm/canUseDOM.js +1 -0
- package/dist/npm/canUseRef.d.ts +1 -1
- package/dist/npm/canUseRef.js +3 -1
- package/dist/npm/classNames.js +3 -1
- package/dist/npm/clone.d.ts +1 -1
- package/dist/npm/clone.js +4 -2
- package/dist/npm/constants/index.js +1 -0
- package/dist/npm/contexts/ZIndexContext.d.ts +2 -2
- package/dist/npm/contexts/ZIndexContext.js +3 -1
- package/dist/npm/drag-n-drop/context/index.d.ts +3 -2
- package/dist/npm/drag-n-drop/context/index.js +1 -0
- package/dist/npm/drag-n-drop/index.js +7 -5
- package/dist/npm/events/dispatchEvent.js +1 -0
- package/dist/npm/fieldList.js +1 -0
- package/dist/npm/focus.js +3 -1
- package/dist/npm/getTabIndex.d.ts +1 -1
- package/dist/npm/getTabIndex.js +3 -1
- package/dist/npm/getter.js +2 -1
- package/dist/npm/guid.js +3 -1
- package/dist/npm/hasRelativeStackingContext.js +4 -2
- package/dist/npm/hocs/AsyncFocusBlur.d.ts +1 -1
- package/dist/npm/hocs/AsyncFocusBlur.js +6 -3
- package/dist/npm/hocs/withPropsContext.d.ts +2 -2
- package/dist/npm/hocs/withPropsContext.js +6 -3
- package/dist/npm/hooks/index.js +26 -15
- package/dist/npm/hooks/useAsyncFocusBlur.js +14 -4
- package/dist/npm/hooks/useCollection.d.ts +1 -1
- package/dist/npm/hooks/useCollection.js +3 -1
- package/dist/npm/hooks/useControlledState.d.ts +5 -2
- package/dist/npm/hooks/useControlledState.js +4 -2
- package/dist/npm/hooks/useCustomComponent.d.ts +3 -12
- package/dist/npm/hooks/useCustomComponent.js +7 -6
- package/dist/npm/hooks/useDir.js +1 -0
- package/dist/npm/hooks/useDocument.d.ts +2 -2
- package/dist/npm/hooks/useDocument.js +3 -1
- package/dist/npm/hooks/useDraggable.js +7 -6
- package/dist/npm/hooks/useDroppable.js +2 -1
- package/dist/npm/hooks/useInheritedState.d.ts +1 -1
- package/dist/npm/hooks/useInheritedState.js +3 -1
- package/dist/npm/hooks/useMouse.d.ts +10 -10
- package/dist/npm/hooks/useMouse.js +3 -1
- package/dist/npm/hooks/usePointer.d.ts +11 -11
- package/dist/npm/hooks/usePointer.js +4 -2
- package/dist/npm/hooks/usePropsContext.d.ts +1 -1
- package/dist/npm/hooks/usePropsContext.js +3 -1
- package/dist/npm/hooks/useRtl.js +1 -0
- package/dist/npm/hooks/useTouch.d.ts +5 -5
- package/dist/npm/hooks/useTouch.js +4 -2
- package/dist/npm/hooks/useWindow.d.ts +2 -2
- package/dist/npm/hooks/useWindow.js +4 -2
- package/dist/npm/icons/Icon.d.ts +1 -1
- package/dist/npm/icons/Icon.js +7 -4
- package/dist/npm/icons/SvgIcon.d.ts +1 -1
- package/dist/npm/icons/SvgIcon.js +6 -3
- package/dist/npm/icons/constants.d.ts +6 -6
- package/dist/npm/icons/constants.js +1 -0
- package/dist/npm/keys.js +1 -0
- package/dist/npm/main.js +60 -42
- package/dist/npm/models/index.js +19 -0
- package/dist/npm/noop.js +3 -1
- package/dist/npm/scrollbarWidth.d.ts +1 -1
- package/dist/npm/scrollbarWidth.js +6 -3
- package/dist/npm/setter.js +2 -1
- package/dist/npm/theme.js +1 -0
- package/dist/npm/treeDataOperations.js +22 -8
- package/dist/npm/typography/Typography.js +9 -6
- package/dist/npm/typography/constants.d.ts +44 -44
- package/dist/npm/typography/constants.js +1 -0
- package/dist/npm/validate-package.js +3 -2
- package/dist/systemjs/kendo-react-common.js +1 -1
- package/package.json +10 -10
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DragTarget, DropTarget } from '@progress/kendo-draggable-common';
|
|
3
|
+
import { ControlledStateHook } from '../../hooks';
|
|
3
4
|
/**
|
|
4
5
|
* @hidden
|
|
5
6
|
*/
|
|
6
|
-
export declare const DragContext: React.Context<
|
|
7
|
+
export declare const DragContext: React.Context<ControlledStateHook<React.RefObject<DragTarget> | null | undefined, any>>;
|
|
7
8
|
/**
|
|
8
9
|
* @hidden
|
|
9
10
|
*/
|
|
10
|
-
export declare const DropContext: React.Context<
|
|
11
|
+
export declare const DropContext: React.Context<ControlledStateHook<React.RefObject<DropTarget> | null | undefined, any>>;
|
|
11
12
|
/**
|
|
12
13
|
* @hidden
|
|
13
14
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DragAndDrop = void 0;
|
|
3
4
|
var React = require("react");
|
|
4
5
|
var hooks_1 = require("../hooks");
|
|
5
6
|
var context_1 = require("./context");
|
|
@@ -9,11 +10,11 @@ var context_1 = require("./context");
|
|
|
9
10
|
* It is used internally to synchronize the `drag` and `drop` functionalities.
|
|
10
11
|
* Accepts properties of type [DragAndDropProps]({% slug api_common_draganddropprops %}).
|
|
11
12
|
*/
|
|
12
|
-
|
|
13
|
-
var _a = hooks_1.useControlledState(null, undefined), drag = _a[0], setDrag = _a[1];
|
|
14
|
-
var _b = hooks_1.useControlledState(null, undefined), drop = _b[0], setDrop = _b[1];
|
|
15
|
-
var _c = hooks_1.useCollection([]), drags = _c[0], dispatchDrags = _c[1];
|
|
16
|
-
var _d = hooks_1.useCollection([]), drops = _d[0], dispatchDrops = _d[1];
|
|
13
|
+
var DragAndDrop = function (props) {
|
|
14
|
+
var _a = (0, hooks_1.useControlledState)(null, undefined), drag = _a[0], setDrag = _a[1];
|
|
15
|
+
var _b = (0, hooks_1.useControlledState)(null, undefined), drop = _b[0], setDrop = _b[1];
|
|
16
|
+
var _c = (0, hooks_1.useCollection)([]), drags = _c[0], dispatchDrags = _c[1];
|
|
17
|
+
var _d = (0, hooks_1.useCollection)([]), drops = _d[0], dispatchDrops = _d[1];
|
|
17
18
|
var registerDrag = function (item) {
|
|
18
19
|
dispatchDrags({
|
|
19
20
|
type: hooks_1.COLLECTION_ACTION.add,
|
|
@@ -43,4 +44,5 @@ exports.DragAndDrop = function (props) {
|
|
|
43
44
|
React.createElement(context_1.DragsContext.Provider, { value: [drags, registerDrag, deregisterDrag] },
|
|
44
45
|
React.createElement(context_1.DropsContext.Provider, { value: [drops, registerDrop, deregisterDrop] }, props.children)))));
|
|
45
46
|
};
|
|
47
|
+
exports.DragAndDrop = DragAndDrop;
|
|
46
48
|
exports.DragAndDrop.displayName = 'KendoReactDragAndDrop';
|
package/dist/npm/fieldList.js
CHANGED
package/dist/npm/focus.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.focusFirstFocusableChild = void 0;
|
|
3
4
|
/**
|
|
4
5
|
* @hidden
|
|
5
6
|
*/
|
|
6
|
-
|
|
7
|
+
var focusFirstFocusableChild = function (target) {
|
|
7
8
|
if (target) {
|
|
8
9
|
if ((target instanceof HTMLInputElement || target.tabIndex !== -1) && target.focus) {
|
|
9
10
|
target.focus();
|
|
@@ -15,3 +16,4 @@ exports.focusFirstFocusableChild = function (target) {
|
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
};
|
|
19
|
+
exports.focusFirstFocusableChild = focusFirstFocusableChild;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @hidden
|
|
3
3
|
*/
|
|
4
|
-
export declare const getTabIndex: (tabIndex?:
|
|
4
|
+
export declare const getTabIndex: (tabIndex?: number | string, disabled?: boolean, useDefaultTabIndexWhenDisabled?: boolean) => number | undefined;
|
package/dist/npm/getTabIndex.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTabIndex = void 0;
|
|
3
4
|
/* eslint-disable radix */
|
|
4
5
|
/**
|
|
5
6
|
* @hidden
|
|
@@ -12,7 +13,7 @@ var DEFAULT_TABINDEX = 0;
|
|
|
12
13
|
/**
|
|
13
14
|
* @hidden
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
|
+
var getTabIndex = function (tabIndex, disabled, useDefaultTabIndexWhenDisabled) {
|
|
16
17
|
var parsedTabIndex = typeof tabIndex === 'string' ? parseInt(tabIndex, undefined) : tabIndex;
|
|
17
18
|
if (parsedTabIndex === NaN) {
|
|
18
19
|
return undefined;
|
|
@@ -23,3 +24,4 @@ exports.getTabIndex = function (tabIndex, disabled, useDefaultTabIndexWhenDisabl
|
|
|
23
24
|
(useDefaultTabIndexWhenDisabled ? undefined : DISABLED_TABINDEX)
|
|
24
25
|
: DEFAULT_TABINDEX;
|
|
25
26
|
};
|
|
27
|
+
exports.getTabIndex = getTabIndex;
|
package/dist/npm/getter.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getter = void 0;
|
|
3
4
|
var fieldList_1 = require("./fieldList");
|
|
4
5
|
var getterCache = {};
|
|
5
6
|
getterCache.undefined = function () { return undefined; };
|
|
@@ -20,7 +21,7 @@ function getter(field) {
|
|
|
20
21
|
if (getterCache[field]) {
|
|
21
22
|
return getterCache[field];
|
|
22
23
|
}
|
|
23
|
-
var fields = fieldList_1.fieldList(field);
|
|
24
|
+
var fields = (0, fieldList_1.fieldList)(field);
|
|
24
25
|
getterCache[field] = function (obj) {
|
|
25
26
|
var result = obj;
|
|
26
27
|
for (var idx = 0; idx < fields.length && result; idx++) {
|
package/dist/npm/guid.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* eslint-disable no-bitwise */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.guid = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* @hidden
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
+
var guid = function () {
|
|
8
9
|
var id = '';
|
|
9
10
|
var i;
|
|
10
11
|
var random;
|
|
@@ -17,3 +18,4 @@ exports.guid = function () {
|
|
|
17
18
|
}
|
|
18
19
|
return id;
|
|
19
20
|
};
|
|
21
|
+
exports.guid = guid;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasRelativeStackingContext = void 0;
|
|
3
4
|
var canUseDOM_1 = require("./canUseDOM");
|
|
4
5
|
/** @hidden */
|
|
5
|
-
|
|
6
|
+
var hasRelativeStackingContext = function (elementSource) {
|
|
6
7
|
if (!canUseDOM_1.canUseDOM) {
|
|
7
8
|
return false;
|
|
8
9
|
}
|
|
@@ -15,9 +16,10 @@ exports.hasRelativeStackingContext = function (elementSource) {
|
|
|
15
16
|
var top = 10;
|
|
16
17
|
var parent = currentDocument.createElement('div');
|
|
17
18
|
parent.style.transform = 'matrix(10, 0, 0, 10, 0, 0)';
|
|
18
|
-
parent.innerHTML = "<div style=\"position: fixed; top: "
|
|
19
|
+
parent.innerHTML = "<div style=\"position: fixed; top: ".concat(top, "px;\">child</div>");
|
|
19
20
|
currentDocument.body.appendChild(parent);
|
|
20
21
|
var isDifferent = parent.children[0].getBoundingClientRect().top !== top;
|
|
21
22
|
currentDocument.body.removeChild(parent);
|
|
22
23
|
return isDifferent;
|
|
23
24
|
};
|
|
25
|
+
exports.hasRelativeStackingContext = hasRelativeStackingContext;
|
|
@@ -10,4 +10,4 @@ import { AsyncFocusBlurArgs } from '../hooks/useAsyncFocusBlur';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare const AsyncFocusBlur: ({ children, onFocus, onBlur, onSyncFocus, onSyncBlur }: AsyncFocusBlurArgs<any> & {
|
|
12
12
|
children: (args: AsyncFocusBlurArgs<any>) => React.ReactNode;
|
|
13
|
-
}) =>
|
|
13
|
+
}) => JSX.Element;
|
|
@@ -11,6 +11,8 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.AsyncFocusBlur = void 0;
|
|
15
|
+
var React = require("react");
|
|
14
16
|
var useAsyncFocusBlur_1 = require("../hooks/useAsyncFocusBlur");
|
|
15
17
|
/**
|
|
16
18
|
* An utility High-order Component for asynchronous focus/blur handling.
|
|
@@ -20,8 +22,9 @@ var useAsyncFocusBlur_1 = require("../hooks/useAsyncFocusBlur");
|
|
|
20
22
|
*
|
|
21
23
|
* @returns
|
|
22
24
|
*/
|
|
23
|
-
|
|
25
|
+
var AsyncFocusBlur = function (_a) {
|
|
24
26
|
var children = _a.children, onFocus = _a.onFocus, onBlur = _a.onBlur, onSyncFocus = _a.onSyncFocus, onSyncBlur = _a.onSyncBlur;
|
|
25
|
-
var args = useAsyncFocusBlur_1.useAsyncFocusBlur({ onFocus: onFocus, onBlur: onBlur, onSyncFocus: onSyncFocus, onSyncBlur: onSyncBlur });
|
|
26
|
-
return children.call(undefined, __assign({}, args));
|
|
27
|
+
var args = (0, useAsyncFocusBlur_1.useAsyncFocusBlur)({ onFocus: onFocus, onBlur: onBlur, onSyncFocus: onSyncFocus, onSyncBlur: onSyncBlur });
|
|
28
|
+
return React.createElement(React.Fragment, null, children.call(undefined, __assign({}, args)));
|
|
27
29
|
};
|
|
30
|
+
exports.AsyncFocusBlur = AsyncFocusBlur;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
/** @hidden */
|
|
3
|
-
export declare const createPropsContext: <T extends
|
|
3
|
+
export declare const createPropsContext: <T extends unknown>() => React.Context<(p: T) => T>;
|
|
4
4
|
/** @hidden */
|
|
5
|
-
export declare const withPropsContext: <T extends
|
|
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>>;
|
|
@@ -11,14 +11,17 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.withPropsContext = exports.createPropsContext = void 0;
|
|
14
15
|
var React = require("react");
|
|
15
16
|
var usePropsContext_1 = require("../hooks/usePropsContext");
|
|
16
17
|
/** @hidden */
|
|
17
|
-
|
|
18
|
+
var createPropsContext = function () { return React.createContext(function (props) { return props; }); };
|
|
19
|
+
exports.createPropsContext = createPropsContext;
|
|
18
20
|
/** @hidden */
|
|
19
|
-
|
|
21
|
+
var withPropsContext = function (context, Component
|
|
20
22
|
// eslint-disable-next-line react/display-name
|
|
21
23
|
) { return React.forwardRef(function (props, ref) {
|
|
22
|
-
var contextProps = usePropsContext_1.usePropsContext(context, props);
|
|
24
|
+
var contextProps = (0, usePropsContext_1.usePropsContext)(context, props);
|
|
23
25
|
return (React.createElement(Component, __assign({}, contextProps, { ref: ref })));
|
|
24
26
|
}); };
|
|
27
|
+
exports.withPropsContext = withPropsContext;
|
package/dist/npm/hooks/index.js
CHANGED
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
5
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
__exportStar(require("./useMouse"), exports);
|
|
18
|
+
__exportStar(require("./useAsyncFocusBlur"), exports);
|
|
19
|
+
__exportStar(require("./useDir"), exports);
|
|
20
|
+
__exportStar(require("./useDraggable"), exports);
|
|
21
|
+
__exportStar(require("./useDroppable"), exports);
|
|
22
|
+
__exportStar(require("./useRtl"), exports);
|
|
23
|
+
__exportStar(require("./useCustomComponent"), exports);
|
|
24
|
+
__exportStar(require("./useControlledState"), exports);
|
|
25
|
+
__exportStar(require("./useInheritedState"), exports);
|
|
26
|
+
__exportStar(require("./useCollection"), exports);
|
|
27
|
+
__exportStar(require("./useDocument"), exports);
|
|
28
|
+
__exportStar(require("./useWindow"), exports);
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.useAsyncFocusBlur = void 0;
|
|
3
13
|
var React = require("react");
|
|
4
14
|
/**
|
|
5
15
|
* An utility function for asynchronous focus/blur handling.
|
|
@@ -24,7 +34,7 @@ function useAsyncFocusBlur(_a) {
|
|
|
24
34
|
}
|
|
25
35
|
clearTimeout(tick.current);
|
|
26
36
|
if (onSyncFocus) {
|
|
27
|
-
onSyncFocus.call
|
|
37
|
+
onSyncFocus.call(undefined, event[0]);
|
|
28
38
|
}
|
|
29
39
|
if (focused.current) {
|
|
30
40
|
return;
|
|
@@ -32,7 +42,7 @@ function useAsyncFocusBlur(_a) {
|
|
|
32
42
|
;
|
|
33
43
|
focused.current = true;
|
|
34
44
|
if (onFocus) {
|
|
35
|
-
onFocus.call.apply(onFocus, [undefined]
|
|
45
|
+
onFocus.call.apply(onFocus, __spreadArray([undefined], event, false));
|
|
36
46
|
}
|
|
37
47
|
}, [focused, onFocus, onSyncFocus]);
|
|
38
48
|
var handleBlur = React.useCallback(function () {
|
|
@@ -41,7 +51,7 @@ function useAsyncFocusBlur(_a) {
|
|
|
41
51
|
event[_i] = arguments[_i];
|
|
42
52
|
}
|
|
43
53
|
if (onSyncBlur) {
|
|
44
|
-
onSyncBlur.call
|
|
54
|
+
onSyncBlur.call(undefined, event[0]);
|
|
45
55
|
}
|
|
46
56
|
nextTick(function () {
|
|
47
57
|
if (!focused.current) {
|
|
@@ -49,7 +59,7 @@ function useAsyncFocusBlur(_a) {
|
|
|
49
59
|
}
|
|
50
60
|
if (onBlur) {
|
|
51
61
|
focused.current = false;
|
|
52
|
-
onBlur.call.apply(onBlur, [undefined]
|
|
62
|
+
onBlur.call.apply(onBlur, __spreadArray([undefined], event, false));
|
|
53
63
|
}
|
|
54
64
|
});
|
|
55
65
|
}, [focused, nextTick, onBlur, onSyncBlur]);
|
|
@@ -11,4 +11,4 @@ export interface CollectionAction<T> {
|
|
|
11
11
|
item: T;
|
|
12
12
|
}
|
|
13
13
|
/** @hidden */
|
|
14
|
-
export declare const useCollection: <T extends
|
|
14
|
+
export declare const useCollection: <T extends unknown>(initial?: T[]) => [T[], (event: CollectionAction<T>) => void];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useCollection = exports.COLLECTION_ACTION = void 0;
|
|
3
4
|
var React = require("react");
|
|
4
5
|
/** @hidden */
|
|
5
6
|
var COLLECTION_ACTION;
|
|
@@ -8,7 +9,7 @@ var COLLECTION_ACTION;
|
|
|
8
9
|
COLLECTION_ACTION[COLLECTION_ACTION["remove"] = 1] = "remove";
|
|
9
10
|
})(COLLECTION_ACTION = exports.COLLECTION_ACTION || (exports.COLLECTION_ACTION = {}));
|
|
10
11
|
/** @hidden */
|
|
11
|
-
|
|
12
|
+
var useCollection = function (initial) {
|
|
12
13
|
if (initial === void 0) { initial = []; }
|
|
13
14
|
var collection = React.useRef(initial);
|
|
14
15
|
var handleCollectionAction = React.useCallback(function (action) {
|
|
@@ -26,3 +27,4 @@ exports.useCollection = function (initial) {
|
|
|
26
27
|
}, []);
|
|
27
28
|
return [collection.current, handleCollectionAction];
|
|
28
29
|
};
|
|
30
|
+
exports.useCollection = useCollection;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
/** @hidden */
|
|
2
|
-
export declare type ControlledStateHook<T, A = any> = [
|
|
2
|
+
export declare type ControlledStateHook<T, A = any> = [
|
|
3
|
+
T,
|
|
4
|
+
(value: T, args?: A) => void
|
|
5
|
+
];
|
|
3
6
|
/** @hidden */
|
|
4
|
-
export declare const useControlledState: <T = any, A = any>(defaultProp: T, prop?: T, callback?: any) =>
|
|
7
|
+
export declare const useControlledState: <T = any, A = any>(defaultProp: T, prop?: T | undefined, callback?: any) => ControlledStateHook<T, any>;
|
|
@@ -11,15 +11,17 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.useControlledState = void 0;
|
|
14
15
|
var React = require("react");
|
|
15
16
|
/** @hidden */
|
|
16
|
-
|
|
17
|
+
var useControlledState = function (defaultProp, prop, callback) {
|
|
17
18
|
var _a = React.useState(prop || defaultProp), state = _a[0], setState = _a[1];
|
|
18
19
|
var handleSetEdit = React.useCallback(function (value, args) {
|
|
19
20
|
setState(value);
|
|
20
21
|
if (callback) {
|
|
21
|
-
callback.call(undefined, __assign({}, args, { value: value }));
|
|
22
|
+
callback.call(undefined, __assign(__assign({}, args), { value: value }));
|
|
22
23
|
}
|
|
23
24
|
}, [callback, setState]);
|
|
24
25
|
return [prop !== undefined ? prop : state, handleSetEdit];
|
|
25
26
|
};
|
|
27
|
+
exports.useControlledState = useControlledState;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* @hidden
|
|
4
|
-
*/
|
|
5
|
-
declare type Partial<T> = {
|
|
6
|
-
[P in keyof T]?: T[P];
|
|
7
|
-
};
|
|
8
2
|
/**
|
|
9
3
|
* @hidden
|
|
10
4
|
*/
|
|
@@ -12,9 +6,6 @@ export declare type CustomComponent<P extends {}> = React.ComponentType<P>;
|
|
|
12
6
|
/**
|
|
13
7
|
* @hidden
|
|
14
8
|
*/
|
|
15
|
-
export declare const useCustomComponent: <P
|
|
16
|
-
ref?: React.Ref<any
|
|
17
|
-
}
|
|
18
|
-
ref?: React.Ref<any>;
|
|
19
|
-
}>, {} | P];
|
|
20
|
-
export {};
|
|
9
|
+
export declare const useCustomComponent: <P = {}>(comp: CustomComponent<P>) => [React.ComponentType<P & {
|
|
10
|
+
ref?: React.Ref<any> | undefined;
|
|
11
|
+
}>, Partial<P>];
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
exports.useCustomComponent = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* @hidden
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
var useCustomComponent = function (comp) {
|
|
8
|
+
/* if(React.isValidElement<P>(comp)) {
|
|
9
|
+
return [comp.type, comp.props];
|
|
10
|
+
} */
|
|
11
|
+
return [comp, {}];
|
|
12
12
|
};
|
|
13
|
+
exports.useCustomComponent = useCustomComponent;
|
package/dist/npm/hooks/useDir.js
CHANGED
|
@@ -2,6 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
/**
|
|
3
3
|
* Returns a function, which gets the `ownerDocument` of the element.
|
|
4
4
|
*/
|
|
5
|
-
export declare const useDocument: (ref: React.RefObject<HTMLElement | {
|
|
6
|
-
element: HTMLElement;
|
|
5
|
+
export declare const useDocument: (ref: React.RefObject<HTMLElement | null | {
|
|
6
|
+
element: HTMLElement | null;
|
|
7
7
|
}>) => () => Document;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useDocument = void 0;
|
|
3
4
|
var React = require("react");
|
|
4
5
|
/**
|
|
5
6
|
* Returns a function, which gets the `ownerDocument` of the element.
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
+
var useDocument = function (ref) {
|
|
8
9
|
var getElement = React.useCallback(function () { return ref.current && ref.current.element
|
|
9
10
|
? ref.current.element
|
|
10
11
|
: ref.current; }, [ref]);
|
|
@@ -14,3 +15,4 @@ exports.useDocument = function (ref) {
|
|
|
14
15
|
}, [getElement]);
|
|
15
16
|
return getDocument;
|
|
16
17
|
};
|
|
18
|
+
exports.useDocument = useDocument;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useDraggable = void 0;
|
|
3
4
|
var React = require("react");
|
|
4
5
|
var kendo_draggable_common_1 = require("@progress/kendo-draggable-common");
|
|
5
6
|
var noop_1 = require("../noop");
|
|
@@ -22,8 +23,8 @@ function useDraggable(ref, callbacks, options) {
|
|
|
22
23
|
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;
|
|
23
24
|
var _k = React.useState(false), pressed = _k[0], setPressed = _k[1];
|
|
24
25
|
var _l = React.useState(false), scrolling = _l[0], setScrolling = _l[1];
|
|
25
|
-
var drop = useInheritedState_1.useInheritedState(context_1.DropContext)[0];
|
|
26
|
-
var _m = useInheritedState_1.useInheritedState(context_1.DragContext), drag = _m[0], setDrag = _m[1];
|
|
26
|
+
var drop = (0, useInheritedState_1.useInheritedState)(context_1.DropContext)[0];
|
|
27
|
+
var _m = (0, useInheritedState_1.useInheritedState)(context_1.DragContext), drag = _m[0], setDrag = _m[1];
|
|
27
28
|
var drops = React.useContext(context_1.DropsContext)[0];
|
|
28
29
|
var _o = React.useContext(context_1.DragsContext), drags = _o[0], registerDrag = _o[1], deregisterDrag = _o[2];
|
|
29
30
|
var velocity = React.useRef({ x: 0, y: 0 });
|
|
@@ -148,7 +149,7 @@ function useDraggable(ref, callbacks, options) {
|
|
|
148
149
|
onDragEnd(event);
|
|
149
150
|
}, [onDragEnd, setDrag, ref]);
|
|
150
151
|
var dispatchDragEvent = React.useCallback(function (event) {
|
|
151
|
-
kendo_draggable_common_1.dispatchDragAndDrop(getState(), { event: event, payload: target.current }, {
|
|
152
|
+
(0, kendo_draggable_common_1.dispatchDragAndDrop)(getState(), { event: event, payload: target.current }, {
|
|
152
153
|
onVelocityChange: handleVelocityChange,
|
|
153
154
|
onOffsetChange: handleOffsetChange,
|
|
154
155
|
onClientOffsetChange: handleClientOffsetChange,
|
|
@@ -241,7 +242,7 @@ function useDraggable(ref, callbacks, options) {
|
|
|
241
242
|
var document = getDocument();
|
|
242
243
|
if (pointers) {
|
|
243
244
|
if (element) {
|
|
244
|
-
scrollable.current = kendo_draggable_common_1.getScrollableParent(element);
|
|
245
|
+
scrollable.current = (0, kendo_draggable_common_1.getScrollableParent)(element);
|
|
245
246
|
if (scrollable.current) {
|
|
246
247
|
scrollable.current.addEventListener('scroll', handleScroll, { passive: true });
|
|
247
248
|
}
|
|
@@ -297,10 +298,10 @@ function useDraggable(ref, callbacks, options) {
|
|
|
297
298
|
var window = getWindow();
|
|
298
299
|
if (scrolling) {
|
|
299
300
|
var scrollableParent_1 = getScrollContainer()
|
|
300
|
-
|| kendo_draggable_common_1.getScrollableParent(document.elementFromPoint(clientOffset.current.x, clientOffset.current.y));
|
|
301
|
+
|| (0, kendo_draggable_common_1.getScrollableParent)(document.elementFromPoint(clientOffset.current.x, clientOffset.current.y));
|
|
301
302
|
window.clearInterval(scrollInterval.current);
|
|
302
303
|
scrollInterval.current = window.setInterval(function () {
|
|
303
|
-
kendo_draggable_common_1.autoScroll(scrollableParent_1, { x: velocity.current.x, y: velocity.current.y });
|
|
304
|
+
(0, kendo_draggable_common_1.autoScroll)(scrollableParent_1, { x: velocity.current.x, y: velocity.current.y });
|
|
304
305
|
}, 50);
|
|
305
306
|
}
|
|
306
307
|
return function () {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useDroppable = void 0;
|
|
3
4
|
var React = require("react");
|
|
4
5
|
var noop_1 = require("../noop");
|
|
5
6
|
var useInheritedState_1 = require("../hooks/useInheritedState");
|
|
@@ -21,7 +22,7 @@ function useDroppable(ref, callbacks) {
|
|
|
21
22
|
onDrop: noop_1.noop
|
|
22
23
|
}; }
|
|
23
24
|
var _a = callbacks.onDragEnter, onDragEnter = _a === void 0 ? noop_1.noop : _a, _b = callbacks.onDragOver, onDragOver = _b === void 0 ? noop_1.noop : _b, _c = callbacks.onDragLeave, onDragLeave = _c === void 0 ? noop_1.noop : _c, _d = callbacks.onDrop, onDrop = _d === void 0 ? noop_1.noop : _d;
|
|
24
|
-
var _e = useInheritedState_1.useInheritedState(context_1.DropContext), setDrop = _e[1];
|
|
25
|
+
var _e = (0, useInheritedState_1.useInheritedState)(context_1.DropContext), setDrop = _e[1];
|
|
25
26
|
var _f = React.useContext(context_1.DropsContext), registerDrop = _f[1], deregisterDrop = _f[2];
|
|
26
27
|
var getElement = React.useCallback(function () { return ref.current && ref.current.element
|
|
27
28
|
? ref.current.element
|
|
@@ -9,5 +9,5 @@ interface Setter<T> extends Array<any> {
|
|
|
9
9
|
/**
|
|
10
10
|
* @hidden
|
|
11
11
|
*/
|
|
12
|
-
export declare const useInheritedState: <T>(context: React.Context<[T, (...event: Setter<T>) => void]>, defaultValue?: any) => [T, (...event: Setter<T>) => void];
|
|
12
|
+
export declare const useInheritedState: <T>(context: React.Context<[T | undefined, (...event: Setter<T>) => void]>, defaultValue?: any) => [T, (...event: Setter<T>) => void];
|
|
13
13
|
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useInheritedState = void 0;
|
|
3
4
|
var React = require("react");
|
|
4
5
|
/**
|
|
5
6
|
* @hidden
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
+
var useInheritedState = function (context, defaultValue) {
|
|
8
9
|
var _a = React.useContext(context), contextValue = _a[0], contextSetter = _a[1];
|
|
9
10
|
var _b = React.useState(defaultValue), localValue = _b[0], localSetter = _b[1];
|
|
10
11
|
var value = contextValue !== undefined ? contextValue : localValue;
|
|
@@ -21,3 +22,4 @@ exports.useInheritedState = function (context, defaultValue) {
|
|
|
21
22
|
handleValueChange
|
|
22
23
|
];
|
|
23
24
|
};
|
|
25
|
+
exports.useInheritedState = useInheritedState;
|
|
@@ -6,15 +6,15 @@ declare type ElementMouse = {
|
|
|
6
6
|
/**
|
|
7
7
|
* @hidden
|
|
8
8
|
*/
|
|
9
|
-
export declare const useMouse: <E extends HTMLElement, P extends KendoMouse<any, any>, R extends {}>(props: P, target: React.RefObject<R>, extend?: {
|
|
10
|
-
onMouseDown?: (event: React.MouseEvent<E, MouseEvent>) => void;
|
|
11
|
-
onMouseUp?: (event: React.MouseEvent<E, MouseEvent>) => void;
|
|
12
|
-
onClick?: (event: React.MouseEvent<E, MouseEvent>) => void;
|
|
13
|
-
onDoubleClick?: (event: React.MouseEvent<E, MouseEvent>) => void;
|
|
14
|
-
onMouseEnter?: (event: React.MouseEvent<E, MouseEvent>) => void;
|
|
15
|
-
onMouseLeave?: (event: React.MouseEvent<E, MouseEvent>) => void;
|
|
16
|
-
onMouseMove?: (event: React.MouseEvent<E, MouseEvent>) => void;
|
|
17
|
-
onMouseOut?: (event: React.MouseEvent<E, MouseEvent>) => void;
|
|
18
|
-
onMouseOver?: (event: React.MouseEvent<E, MouseEvent>) => void;
|
|
9
|
+
export declare const useMouse: <E extends HTMLElement | null, P extends KendoMouse<any, any>, R extends {}>(props: P, target: React.RefObject<R>, extend?: {
|
|
10
|
+
onMouseDown?: ((event: React.MouseEvent<E, MouseEvent>) => void) | undefined;
|
|
11
|
+
onMouseUp?: ((event: React.MouseEvent<E, MouseEvent>) => void) | undefined;
|
|
12
|
+
onClick?: ((event: React.MouseEvent<E, MouseEvent>) => void) | undefined;
|
|
13
|
+
onDoubleClick?: ((event: React.MouseEvent<E, MouseEvent>) => void) | undefined;
|
|
14
|
+
onMouseEnter?: ((event: React.MouseEvent<E, MouseEvent>) => void) | undefined;
|
|
15
|
+
onMouseLeave?: ((event: React.MouseEvent<E, MouseEvent>) => void) | undefined;
|
|
16
|
+
onMouseMove?: ((event: React.MouseEvent<E, MouseEvent>) => void) | undefined;
|
|
17
|
+
onMouseOut?: ((event: React.MouseEvent<E, MouseEvent>) => void) | undefined;
|
|
18
|
+
onMouseOver?: ((event: React.MouseEvent<E, MouseEvent>) => void) | undefined;
|
|
19
19
|
}) => ElementMouse;
|
|
20
20
|
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useMouse = void 0;
|
|
3
4
|
var React = require("react");
|
|
4
5
|
/**
|
|
5
6
|
* @hidden
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
+
var useMouse = function (props, target, extend) {
|
|
8
9
|
if (extend === void 0) { extend = {}; }
|
|
9
10
|
var handleMouseDown = React.useCallback(function (event) {
|
|
10
11
|
if (extend.onMouseDown) {
|
|
@@ -117,3 +118,4 @@ exports.useMouse = function (props, target, extend) {
|
|
|
117
118
|
onMouseOver: handleMouseOver
|
|
118
119
|
};
|
|
119
120
|
};
|
|
121
|
+
exports.useMouse = useMouse;
|