react-hook-toolkit 1.1.9 → 1.2.0
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/chunk1213/chunk158261.d.ts +16 -0
- package/dist/chunk1213/chunk158261.js +41 -0
- package/dist/chunk1213/chunk158862.d.ts +17 -0
- package/dist/chunk1213/chunk158862.js +121 -0
- package/dist/chunk1415/chunk143.d.ts +20 -0
- package/dist/chunk1415/chunk143.js +58 -0
- package/dist/chunk1516/chunk0021.d.ts +109 -0
- package/dist/chunk1516/chunk0021.js +700 -0
- package/dist/chunk1516/chunk0022.d.ts +2 -0
- package/dist/chunk1516/chunk0022.js +381 -0
- package/dist/chunk1516/chunk613852.d.ts +10 -0
- package/dist/chunk1516/chunk613852.js +299 -0
- package/dist/chunk1516/chunk726433.d.ts +58 -0
- package/dist/chunk1516/chunk726433.js +621 -0
- package/dist/chunk1516/chunk940514.d.ts +93 -0
- package/dist/chunk1516/chunk940514.js +817 -0
- package/dist/chunk1617/chunk613555.d.ts +23 -0
- package/dist/chunk1617/chunk613555.js +115 -0
- package/dist/chunk1617/chunk613557.d.ts +3 -0
- package/dist/chunk1617/chunk613557.js +7 -0
- package/dist/index.d.ts +15 -565
- package/dist/index.js +17 -204
- package/dist/type.d.ts +286 -0
- package/dist/type.js +7 -0
- package/dist/utils.d.ts +21 -0
- package/dist/utils.js +104 -0
- package/package.json +34 -43
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -204
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FC, ReactNode } from 'react';
|
|
2
|
+
export interface DrawerContextValue {
|
|
3
|
+
drawerOpen: boolean;
|
|
4
|
+
openDrawer: () => void;
|
|
5
|
+
closeDrawer: () => void;
|
|
6
|
+
openDrawerInButton: () => void;
|
|
7
|
+
closeDrawerInButton: () => void;
|
|
8
|
+
currentMainMenu?: string;
|
|
9
|
+
setCurrentMainMenu?: (value: string) => void;
|
|
10
|
+
}
|
|
11
|
+
interface DrawerProviderProps {
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
declare const DrawerContext: import("react").Context<DrawerContextValue>;
|
|
15
|
+
export declare const DrawerProvider: FC<DrawerProviderProps>;
|
|
16
|
+
export default DrawerContext;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useState } from 'react';
|
|
3
|
+
var DrawerContext = createContext({
|
|
4
|
+
drawerOpen: false,
|
|
5
|
+
openDrawer: function () { },
|
|
6
|
+
closeDrawer: function () { },
|
|
7
|
+
openDrawerInButton: function () { },
|
|
8
|
+
closeDrawerInButton: function () { },
|
|
9
|
+
currentMainMenu: '',
|
|
10
|
+
setCurrentMainMenu: function () { },
|
|
11
|
+
});
|
|
12
|
+
export var DrawerProvider = function (props) {
|
|
13
|
+
var children = props.children;
|
|
14
|
+
var _a = useState(true), drawerOpen = _a[0], setDrawer = _a[1];
|
|
15
|
+
var _b = useState(''), currentMainMenu = _b[0], setCurrOpenMenu = _b[1];
|
|
16
|
+
var openDrawer = function () {
|
|
17
|
+
setDrawer(true);
|
|
18
|
+
};
|
|
19
|
+
var closeDrawer = function () {
|
|
20
|
+
setDrawer(false);
|
|
21
|
+
};
|
|
22
|
+
var openDrawerInButton = function () {
|
|
23
|
+
setDrawer(false);
|
|
24
|
+
};
|
|
25
|
+
var closeDrawerInButton = function () {
|
|
26
|
+
setDrawer(true);
|
|
27
|
+
};
|
|
28
|
+
var setCurrentMainMenu = function (value) {
|
|
29
|
+
setCurrOpenMenu(value);
|
|
30
|
+
};
|
|
31
|
+
return (_jsx(DrawerContext.Provider, { value: {
|
|
32
|
+
drawerOpen: drawerOpen,
|
|
33
|
+
openDrawer: openDrawer,
|
|
34
|
+
closeDrawer: closeDrawer,
|
|
35
|
+
openDrawerInButton: openDrawerInButton,
|
|
36
|
+
closeDrawerInButton: closeDrawerInButton,
|
|
37
|
+
currentMainMenu: currentMainMenu,
|
|
38
|
+
setCurrentMainMenu: setCurrentMainMenu,
|
|
39
|
+
}, children: children }));
|
|
40
|
+
};
|
|
41
|
+
export default DrawerContext;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AxiosInstance, AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios';
|
|
2
|
+
interface AxiosConfigProps {
|
|
3
|
+
baseURL: string;
|
|
4
|
+
handleAuthError?: (axiosInstance: AxiosInstance, originalRequest: AxiosRequestConfig, err: AxiosError) => Promise<AxiosResponse>;
|
|
5
|
+
timeout: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const privateAxios: ({ baseURL, handleAuthError, timeout }: AxiosConfigProps) => AxiosInstance;
|
|
8
|
+
interface AxiosNoAuthConfigProps {
|
|
9
|
+
baseURL: string;
|
|
10
|
+
timeout: number;
|
|
11
|
+
}
|
|
12
|
+
export declare const publicAxios: ({ baseURL, timeout }: AxiosNoAuthConfigProps) => AxiosInstance;
|
|
13
|
+
declare const _default: {
|
|
14
|
+
privateAxios: ({ baseURL, handleAuthError, timeout }: AxiosConfigProps) => AxiosInstance;
|
|
15
|
+
publicAxios: ({ baseURL, timeout }: AxiosNoAuthConfigProps) => AxiosInstance;
|
|
16
|
+
};
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
38
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
39
|
+
if (ar || !(i in from)) {
|
|
40
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
41
|
+
ar[i] = from[i];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
45
|
+
};
|
|
46
|
+
import axios from 'axios';
|
|
47
|
+
function formatDateWithTimezoneOffset(date) {
|
|
48
|
+
if (!(date instanceof Date))
|
|
49
|
+
return null;
|
|
50
|
+
var pad = function (n) { return String(n).padStart(2, '0'); };
|
|
51
|
+
var year = date.getFullYear();
|
|
52
|
+
var month = pad(date.getMonth() + 1);
|
|
53
|
+
var day = pad(date.getDate());
|
|
54
|
+
var hours = pad(date.getHours());
|
|
55
|
+
var minutes = pad(date.getMinutes());
|
|
56
|
+
var seconds = pad(date.getSeconds());
|
|
57
|
+
var timezoneOffset = -date.getTimezoneOffset(); // in minutes
|
|
58
|
+
var offsetSign = timezoneOffset >= 0 ? '+' : '-';
|
|
59
|
+
var offsetHours = pad(Math.floor(Math.abs(timezoneOffset) / 60));
|
|
60
|
+
var offsetMinutes = pad(Math.abs(timezoneOffset) % 60);
|
|
61
|
+
return "".concat(year, "-").concat(month, "-").concat(day, "T").concat(hours, ":").concat(minutes, ":").concat(seconds).concat(offsetSign).concat(offsetHours, ":").concat(offsetMinutes);
|
|
62
|
+
}
|
|
63
|
+
var dateTransformer = function (data) {
|
|
64
|
+
if (data instanceof Date) {
|
|
65
|
+
return formatDateWithTimezoneOffset(data);
|
|
66
|
+
}
|
|
67
|
+
if (Array.isArray(data)) {
|
|
68
|
+
return data.map(dateTransformer);
|
|
69
|
+
}
|
|
70
|
+
if (typeof data === 'object' && data !== null) {
|
|
71
|
+
return Object.fromEntries(Object.entries(data).map(function (_a) {
|
|
72
|
+
var key = _a[0], value = _a[1];
|
|
73
|
+
return [key, dateTransformer(value)];
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
return data;
|
|
77
|
+
};
|
|
78
|
+
export var privateAxios = function (_a) {
|
|
79
|
+
var baseURL = _a.baseURL, handleAuthError = _a.handleAuthError, timeout = _a.timeout;
|
|
80
|
+
var axiosInstance = axios.create({
|
|
81
|
+
baseURL: baseURL,
|
|
82
|
+
timeout: timeout,
|
|
83
|
+
transformRequest: __spreadArray([dateTransformer], axios.defaults.transformRequest, true),
|
|
84
|
+
});
|
|
85
|
+
axiosInstance.interceptors.response.use(function (res) { return res; }, function (err) { return __awaiter(void 0, void 0, void 0, function () {
|
|
86
|
+
var originalRequest;
|
|
87
|
+
var _a, _b, _c, _d;
|
|
88
|
+
return __generator(this, function (_e) {
|
|
89
|
+
switch (_e.label) {
|
|
90
|
+
case 0:
|
|
91
|
+
if (err.message === 'Network Error') {
|
|
92
|
+
return [2 /*return*/, Promise.reject({ title: 'Network Error: Please check your connection.' })];
|
|
93
|
+
}
|
|
94
|
+
originalRequest = err.config;
|
|
95
|
+
if (!(err.response && err.response.status === 401 && !originalRequest._retry)) return [3 /*break*/, 2];
|
|
96
|
+
originalRequest._retry = true;
|
|
97
|
+
if (!(typeof handleAuthError === 'function')) return [3 /*break*/, 2];
|
|
98
|
+
return [4 /*yield*/, handleAuthError(axiosInstance, originalRequest, err)];
|
|
99
|
+
case 1: return [2 /*return*/, _e.sent()];
|
|
100
|
+
case 2:
|
|
101
|
+
if (((_a = err.response) === null || _a === void 0 ? void 0 : _a.status) === 500) {
|
|
102
|
+
return [2 /*return*/, Promise.reject((_b = err.response.data) !== null && _b !== void 0 ? _b : { title: 'Internal Server Error' })];
|
|
103
|
+
}
|
|
104
|
+
return [2 /*return*/, Promise.reject((_d = (_c = err.response) === null || _c === void 0 ? void 0 : _c.data) !== null && _d !== void 0 ? _d : { title: 'Something went wrong' })];
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}); });
|
|
108
|
+
return axiosInstance;
|
|
109
|
+
};
|
|
110
|
+
export var publicAxios = function (_a) {
|
|
111
|
+
var baseURL = _a.baseURL, timeout = _a.timeout;
|
|
112
|
+
var axiosNoAuthInstance = axios.create({
|
|
113
|
+
baseURL: baseURL,
|
|
114
|
+
timeout: timeout,
|
|
115
|
+
});
|
|
116
|
+
axiosNoAuthInstance.interceptors.response.use(function (response) { return response; }, function (error) {
|
|
117
|
+
return Promise.reject((error.response && error.response.data) || { title: 'Something went wrong' });
|
|
118
|
+
});
|
|
119
|
+
return axiosNoAuthInstance;
|
|
120
|
+
};
|
|
121
|
+
export default { privateAxios: privateAxios, publicAxios: publicAxios };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license HEXE
|
|
3
|
+
* Copyright (c) 2020-2024 Shivaji & Collaborators
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
type HookFunction = () => any;
|
|
9
|
+
declare class HEXE {
|
|
10
|
+
private hs;
|
|
11
|
+
private ss;
|
|
12
|
+
constructor();
|
|
13
|
+
setHook(name: string, hookFunction: HookFunction): this;
|
|
14
|
+
private putHooks;
|
|
15
|
+
component(): React.FC;
|
|
16
|
+
getHook(name: string): any;
|
|
17
|
+
}
|
|
18
|
+
declare const ReactHooksWrapper: React.FC<{}>;
|
|
19
|
+
declare const getHook: (name: string) => any, setHook: (name: string, hookFunction: HookFunction) => HEXE;
|
|
20
|
+
export { ReactHooksWrapper, getHook, setHook };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license HEXE
|
|
3
|
+
* Copyright (c) 2020-2024 Shivaji & Collaborators
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
var HEXE = /** @class */ (function () {
|
|
9
|
+
function HEXE() {
|
|
10
|
+
this.hs = {};
|
|
11
|
+
this.ss = {};
|
|
12
|
+
this.setHook = this.setHook.bind(this);
|
|
13
|
+
this.getHook = this.getHook.bind(this);
|
|
14
|
+
this.putHooks = this.putHooks.bind(this);
|
|
15
|
+
}
|
|
16
|
+
HEXE.prototype.setHook = function (name, hookFunction) {
|
|
17
|
+
[
|
|
18
|
+
{ value: name, id: 'name', type: 'string' },
|
|
19
|
+
{ value: hookFunction, id: 'hook', type: 'function' },
|
|
20
|
+
].forEach(function (_a) {
|
|
21
|
+
var value = _a.value, id = _a.id, type = _a.type;
|
|
22
|
+
if (type === 'string' && typeof value !== 'string') {
|
|
23
|
+
throw new TypeError("\"".concat(id, "\" expected to be of type ").concat(type));
|
|
24
|
+
}
|
|
25
|
+
if (type === 'function' && typeof value !== 'function') {
|
|
26
|
+
throw new TypeError("\"".concat(id, "\" expected to be of type ").concat(type));
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
this.hs[name] = {
|
|
30
|
+
name: name,
|
|
31
|
+
hook: hookFunction,
|
|
32
|
+
};
|
|
33
|
+
return this;
|
|
34
|
+
};
|
|
35
|
+
HEXE.prototype.putHooks = function (name, value) {
|
|
36
|
+
this.ss[name] = value;
|
|
37
|
+
};
|
|
38
|
+
HEXE.prototype.component = function () {
|
|
39
|
+
var _this = this;
|
|
40
|
+
/* Author: Shivaji & Shyamal */
|
|
41
|
+
var Component = function () {
|
|
42
|
+
Object.values(_this.hs).forEach(function (_a) {
|
|
43
|
+
var name = _a.name, hook = _a.hook;
|
|
44
|
+
_this.putHooks(name, hook());
|
|
45
|
+
});
|
|
46
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null);
|
|
47
|
+
};
|
|
48
|
+
return Component;
|
|
49
|
+
};
|
|
50
|
+
HEXE.prototype.getHook = function (name) {
|
|
51
|
+
return this.ss[name];
|
|
52
|
+
};
|
|
53
|
+
return HEXE;
|
|
54
|
+
}());
|
|
55
|
+
var o = new HEXE();
|
|
56
|
+
var ReactHooksWrapper = o.component();
|
|
57
|
+
var getHook = o.getHook, setHook = o.setHook;
|
|
58
|
+
export { ReactHooksWrapper, getHook, setHook };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { BatteryState, UseHistory, UseSessionStorage, UseSound, UseTouch } from '../type';
|
|
2
|
+
export declare function useGeoLocation(): {
|
|
3
|
+
position: GeolocationPosition | null;
|
|
4
|
+
error: Error | null;
|
|
5
|
+
};
|
|
6
|
+
export declare function useTimer(initialTime: number): {
|
|
7
|
+
time: number;
|
|
8
|
+
error: Error | null;
|
|
9
|
+
};
|
|
10
|
+
export declare function useIsMounted(): boolean;
|
|
11
|
+
export declare function useCss(css: string): {
|
|
12
|
+
error: Error | null;
|
|
13
|
+
};
|
|
14
|
+
export declare function useSpeak(text: string): {
|
|
15
|
+
speak: () => void;
|
|
16
|
+
error: Error | null;
|
|
17
|
+
};
|
|
18
|
+
export declare function useCountUp(target: number, duration: number): {
|
|
19
|
+
count: number;
|
|
20
|
+
error: Error | null;
|
|
21
|
+
};
|
|
22
|
+
export declare function useCountDown(start: number): {
|
|
23
|
+
count: number;
|
|
24
|
+
error: Error | null;
|
|
25
|
+
};
|
|
26
|
+
export declare const useBattery: () => BatteryState;
|
|
27
|
+
export declare const useEventListener: (eventName: string, handler: (event: Event) => void, elementRef?: React.RefObject<HTMLElement>, options?: boolean | AddEventListenerOptions) => void;
|
|
28
|
+
export declare const useHistory: () => UseHistory;
|
|
29
|
+
interface UsePreferredLanguage {
|
|
30
|
+
language: string;
|
|
31
|
+
languages: Array<string>;
|
|
32
|
+
isSupported: boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare const usePreferredLanguage: () => UsePreferredLanguage;
|
|
35
|
+
export declare const useSessionStorage: UseSessionStorage<any>;
|
|
36
|
+
export declare const useSound: (url: string) => UseSound;
|
|
37
|
+
export declare const useTouch: UseTouch;
|
|
38
|
+
export declare const useUpdateEffect: (effect: React.EffectCallback, deps: React.DependencyList) => void;
|
|
39
|
+
export declare const usePersistedForm: <T>(key: string, initialValue: T) => [T, (value: T) => void];
|
|
40
|
+
export declare const useCrossFieldValidation: <T extends Record<string, any>>(validate: (values: T) => Record<keyof T, string | null>) => {
|
|
41
|
+
errors: Record<keyof T, string | null>;
|
|
42
|
+
validateFields: (values: T) => boolean;
|
|
43
|
+
};
|
|
44
|
+
export declare const useFieldArray: <T>(initialValue: T[]) => {
|
|
45
|
+
fields: T[];
|
|
46
|
+
append: (item: T) => void;
|
|
47
|
+
remove: (index: number) => void;
|
|
48
|
+
update: (index: number, item: T) => void;
|
|
49
|
+
};
|
|
50
|
+
type SubmitHandler<T> = (data: T) => Promise<void>;
|
|
51
|
+
export declare const useFormSubmit: <T>(handler: SubmitHandler<T>) => {
|
|
52
|
+
handleSubmit: (data: T) => Promise<void>;
|
|
53
|
+
isSubmitting: boolean;
|
|
54
|
+
submitError: string | null;
|
|
55
|
+
};
|
|
56
|
+
export declare const useSmartForm: <T extends Record<string, any>>(initialValues: T, storageKey?: string) => {
|
|
57
|
+
values: T;
|
|
58
|
+
handleChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
59
|
+
setValues: import("react").Dispatch<import("react").SetStateAction<T>>;
|
|
60
|
+
dirty: boolean;
|
|
61
|
+
};
|
|
62
|
+
export declare const useUndo: <T>(initialState: T) => {
|
|
63
|
+
state: T;
|
|
64
|
+
setState: (newState: T) => void;
|
|
65
|
+
undo: () => false | void;
|
|
66
|
+
redo: () => false | void;
|
|
67
|
+
canUndo: boolean;
|
|
68
|
+
canRedo: boolean;
|
|
69
|
+
};
|
|
70
|
+
export declare const useFormWizard: <T extends Record<string, any>>(steps: {
|
|
71
|
+
validate?: (values: T) => Record<string, string>;
|
|
72
|
+
component: React.FC<{
|
|
73
|
+
values: T;
|
|
74
|
+
setValues: (v: T) => void;
|
|
75
|
+
}>;
|
|
76
|
+
}[], initialValues: T) => {
|
|
77
|
+
currentStep: number;
|
|
78
|
+
CurrentStep: import("react").FC<{
|
|
79
|
+
values: T;
|
|
80
|
+
setValues: (v: T) => void;
|
|
81
|
+
}>;
|
|
82
|
+
values: T;
|
|
83
|
+
setValues: import("react").Dispatch<import("react").SetStateAction<T>>;
|
|
84
|
+
next: () => void;
|
|
85
|
+
prev: () => void;
|
|
86
|
+
errors: Record<string, string>;
|
|
87
|
+
isFirstStep: boolean;
|
|
88
|
+
isLastStep: boolean;
|
|
89
|
+
};
|
|
90
|
+
export declare const createOptimizedContext: <T>() => readonly [import("react").Provider<T | undefined>, <U>(selector: (value: T) => U) => U];
|
|
91
|
+
export declare const useWebSocket: <T>(url: string, onMessage?: (data: T) => void) => {
|
|
92
|
+
data: T | null;
|
|
93
|
+
send: (message: any) => void;
|
|
94
|
+
isConnected: boolean;
|
|
95
|
+
};
|
|
96
|
+
export declare const useDragReorder: <T>(initialItems: T[]) => {
|
|
97
|
+
items: T[];
|
|
98
|
+
handleDragStart: (index: number) => void;
|
|
99
|
+
handleDragEnter: (index: number) => void;
|
|
100
|
+
handleDrop: () => void;
|
|
101
|
+
};
|
|
102
|
+
export declare const useInfiniteScroll: <T>(fetchData: (page: number) => Promise<T[]>, initialData?: T[]) => {
|
|
103
|
+
data: T[];
|
|
104
|
+
loading: boolean;
|
|
105
|
+
hasMore: boolean;
|
|
106
|
+
lastElementRef: (node: HTMLElement | null) => void;
|
|
107
|
+
};
|
|
108
|
+
export declare const useEventListeners: (eventType: string, handler: (event: Event) => void, element?: HTMLElement | Window, options?: AddEventListenerOptions) => void;
|
|
109
|
+
export {};
|