react-hook-toolkit 1.1.5 → 1.1.7

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.
@@ -1,23 +0,0 @@
1
- export declare const FileSkeleton: ({ length, width, borderColor }: {
2
- length?: number | undefined;
3
- width?: number | undefined;
4
- borderColor?: string | undefined;
5
- }) => import("react/jsx-runtime").JSX.Element;
6
- export declare const TableSkeleton: ({ rows, columns }: {
7
- rows?: number | undefined;
8
- columns?: number | undefined;
9
- }) => import("react/jsx-runtime").JSX.Element;
10
- export declare const LineChartSkeleton: () => import("react/jsx-runtime").JSX.Element;
11
- export declare const CardSkeleton: () => import("react/jsx-runtime").JSX.Element;
12
- export declare const PieChartSkeleton: React.FC;
13
- export declare const FieldSkeleton: ({ length, width, spacing, isLabel, responsive, }: {
14
- length?: number | undefined;
15
- width?: string | undefined;
16
- spacing?: number | undefined;
17
- isLabel?: boolean | undefined;
18
- responsive?: {
19
- xs: number;
20
- sm: number;
21
- md: number;
22
- } | undefined;
23
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,115 +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 { createElement as _createElement } from "react";
13
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
- import { Box, Card, CardContent, CardHeader, Grid, IconButton, Skeleton, Table, TableBody, TableCell, TableHead, TableRow, Toolbar, Tooltip, } from "@mui/material";
15
- import { Download } from "@mui/icons-material";
16
- export var FileSkeleton = function (_a) {
17
- var _b = _a.length, length = _b === void 0 ? 1 : _b, _c = _a.width, width = _c === void 0 ? 350 : _c, _d = _a.borderColor, borderColor = _d === void 0 ? '#dfdfdf' : _d;
18
- return (_jsx(Grid, { container: true, spacing: 2, children: Array.from({ length: length }).map(function (_, index) { return (_jsx(Grid, { item: true, children: _jsx(Card, { variant: "outlined", sx: {
19
- maxWidth: width,
20
- minWidth: width,
21
- border: "1px solid ".concat(borderColor),
22
- borderRadius: 1,
23
- '&:hover': { boxShadow: 2 },
24
- marginLeft: 3,
25
- }, children: _jsxs(CardContent, { sx: {
26
- display: 'flex',
27
- alignItems: 'center',
28
- gap: 2,
29
- padding: '8px !important',
30
- }, children: [_jsx(Skeleton, { variant: "rectangular", width: 50, height: 40 }), _jsxs(Box, { sx: { flexGrow: 1 }, children: [_jsx(Skeleton, { variant: "text", width: width - 120, height: 20 }), _jsx(Skeleton, { variant: "text", width: 60, height: 14 })] }), _jsx(IconButton, { disabled: true, sx: { color: '#dfdfdf' }, children: _jsx(Download, { fontSize: "small", color: "disabled" }) })] }) }) }, index.toString())); }) }));
31
- };
32
- export var TableSkeleton = function (_a) {
33
- var _b = _a.rows, rows = _b === void 0 ? 6 : _b, _c = _a.columns, columns = _c === void 0 ? 6 : _c;
34
- return (_jsxs(Box, { sx: { width: '100%', overflowX: 'auto' }, children: [_jsxs(Toolbar, { sx: {
35
- display: 'flex',
36
- justifyContent: 'space-between',
37
- p: 1,
38
- borderBottom: '1px solid #dbdbdb',
39
- }, children: [_jsx(Box, { sx: { display: 'flex', alignItems: 'center', gap: 1 }, children: _jsx(Skeleton, { variant: "rectangular", width: 200, height: 40 }) }), _jsx(Box, { children: _jsx(Tooltip, { title: "Filter", children: _jsx(IconButton, { children: _jsx(Skeleton, { variant: "circular", width: 40, height: 40 }) }) }) })] }), _jsxs(Table, { "aria-label": "loading table", children: [_jsx(TableHead, { children: _jsx(TableRow, { children: Array.from({ length: columns }).map(function (_, index) { return (_jsx(TableCell, { children: _jsx(Skeleton, { variant: "rectangular", height: 20 }) }, "head-".concat(index))); }) }) }), _jsx(TableBody, { children: Array.from({ length: rows }).map(function (_, rowIndex) { return (_jsx(TableRow, { children: Array.from({ length: columns }).map(function (_, colIndex) { return (_jsx(TableCell, { children: _jsx(Skeleton, { animation: "wave", variant: "text", width: "100%" }) }, "cell-".concat(rowIndex, "-").concat(colIndex))); }) }, "row-".concat(rowIndex))); }) })] })] }));
40
- };
41
- export var LineChartSkeleton = function () {
42
- return (_jsxs(Box, { sx: { width: '100%', height: '300px', position: 'relative', padding: '16px' }, children: [_jsx(Skeleton, { variant: "text", width: "30%", height: 30, sx: { position: 'absolute', top: 10, left: '50%', transform: 'translateX(-50%)' } }), _jsx(Skeleton, { variant: "rectangular", width: "calc(100% - 40px)", height: 4, sx: { position: 'absolute', bottom: 40, left: 20 } }), _jsx(Skeleton, { variant: "rectangular", width: 2, height: "calc(100% - 40px)", sx: { position: 'absolute', top: 0, bottom: 40, left: 20 } }), _jsx(Skeleton, { variant: "rectangular", width: 2, height: "calc(100% - 40px)", sx: { position: 'absolute', top: 0, bottom: 40, right: 20 } }), [1, 2, 3, 4].map(function (_, index) { return (_jsx(Skeleton, { variant: "rectangular", width: "calc(100% - 40px)", height: 4, sx: { position: 'absolute', bottom: "".concat(40 + index * 50, "px"), left: '20px' } }, index.toString())); }), _jsx(Skeleton, { variant: "rectangular", width: "calc(100% - 40px)", height: 2, sx: {
43
- position: 'absolute',
44
- left: '20px',
45
- top: '85%',
46
- transform: 'rotate(-7deg)',
47
- transformOrigin: 'left center',
48
- } })] }));
49
- };
50
- export var CardSkeleton = function () {
51
- var skeletonStyles = {
52
- boxShadow: '0px 1px 8px -2px #444444de',
53
- borderRadius: '10px',
54
- overflow: 'hidden',
55
- padding: '12px',
56
- transition: '0.3s',
57
- background: 'linear-gradient(to top left, #fff 20%, #f5f5f5 80%)',
58
- width: {
59
- xs: '90%',
60
- sm: '70%',
61
- md: '150%',
62
- lg: '195%',
63
- xl: '200%',
64
- },
65
- maxWidth: '600px',
66
- };
67
- return (_jsx(Grid, { item: true, xs: 12, sm: 6, md: 6, children: _jsxs(Box, { sx: skeletonStyles, children: [_jsx(Skeleton, { variant: "rectangular", width: "100%", height: 30, sx: {
68
- marginBottom: '12px',
69
- borderRadius: '4px',
70
- background: 'linear-gradient(to left, #e0e0e0 10%, #cfcfcf 100%)',
71
- } }), _jsx(Box, { children: Array.from(new Array(4)).map(function (__, index) { return (_jsxs(Box, { sx: {
72
- display: 'flex',
73
- justifyContent: 'space-between',
74
- alignItems: 'center',
75
- marginBottom: index !== 3 ? 1 : 0,
76
- }, children: [_jsx(Skeleton, { variant: "text", width: "70%", height: 20 }), _jsx(Skeleton, { variant: "text", width: "20%", height: 20 })] }, index.toString())); }) })] }) }));
77
- };
78
- export var PieChartSkeleton = function () {
79
- return (_jsxs(_Fragment, { children: [_jsx(Grid, { item: true, xs: 12, sm: 6, md: 6, lg: 6, sx: { padding: '10px' }, children: _jsxs(Card, { sx: {
80
- borderRadius: '6px',
81
- height: '100%',
82
- display: 'flex',
83
- flexDirection: 'column',
84
- justifyContent: 'space-between',
85
- cursor: 'default',
86
- }, children: [_jsx(CardHeader, { title: _jsx(Skeleton, { variant: "rectangular", width: "80%", height: "20px", sx: { margin: '0 auto', borderRadius: '4px' } }), sx: {
87
- background: '#dbe7f2',
88
- padding: '8px',
89
- } }), _jsx(CardContent, { sx: {
90
- display: 'flex',
91
- justifyContent: 'center',
92
- alignItems: 'center',
93
- height: '320px',
94
- }, children: _jsx(Skeleton, { variant: "circular", width: 200, height: 200, sx: { marginBottom: '16px' } }) })] }) }), _jsx(Grid, { item: true, xs: 12, sm: 6, md: 6, lg: 6, sx: { padding: '10px' }, children: _jsxs(Card, { sx: {
95
- borderRadius: '6px',
96
- height: '100%',
97
- display: 'flex',
98
- flexDirection: 'column',
99
- justifyContent: 'space-between',
100
- cursor: 'default',
101
- }, children: [_jsx(CardHeader, { title: _jsx(Skeleton, { variant: "rectangular", width: "80%", height: "20px", sx: { margin: '0 auto', borderRadius: '4px' } }), sx: {
102
- background: '#dbe7f2',
103
- padding: '8px',
104
- } }), _jsx(CardContent, { sx: {
105
- display: 'flex',
106
- justifyContent: 'center',
107
- alignItems: 'center',
108
- height: '320px',
109
- }, children: _jsx(Skeleton, { variant: "circular", width: 200, height: 200, sx: { marginBottom: '16px' } }) })] }) })] }));
110
- };
111
- export var FieldSkeleton = function (_a) {
112
- var _b = _a.length, length = _b === void 0 ? 1 : _b, _c = _a.width, width = _c === void 0 ? '100%' : _c, _d = _a.spacing, spacing = _d === void 0 ? 2 : _d, _e = _a.isLabel, isLabel = _e === void 0 ? false : _e, _f = _a.responsive, responsive = _f === void 0 ? { xs: 12, sm: 6, md: 4 } : _f;
113
- return (_jsx(Grid, { container: true, spacing: spacing, children: Array.from({ length: length }).map(function (_, index) { return (_createElement(Grid, __assign({ item: true }, responsive, { key: index.toString() }),
114
- _jsxs(Box, { sx: { width: '100%', margin: 2 }, children: [isLabel && _jsx(Skeleton, { variant: "text", width: "40%", height: 20, sx: { marginBottom: 1 } }), _jsx(Skeleton, { variant: "rectangular", width: width, height: 40, sx: { borderRadius: 1 } })] }))); }) }));
115
- };
@@ -1,4 +0,0 @@
1
- import 'react-draft-wysiwyg/dist/react-draft-wysiwyg.css';
2
- import 'draft-js/dist/Draft.css';
3
- import { RichTextEditorProps } from '../type';
4
- export declare const RichTextEditor: React.FC<RichTextEditorProps>;
@@ -1,145 +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
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
- import { jsx as _jsx } from "react/jsx-runtime";
24
- import { useCallback, useEffect, useState, useRef } from 'react';
25
- import { convertToRaw, EditorState, ContentState } from 'draft-js';
26
- import { Editor } from 'react-draft-wysiwyg';
27
- import draftToHtml from 'draftjs-to-html';
28
- import htmlToDraft from 'html-to-draftjs';
29
- import 'react-draft-wysiwyg/dist/react-draft-wysiwyg.css';
30
- import 'draft-js/dist/Draft.css';
31
- export var RichTextEditor = function (_a) {
32
- var _b = _a.initialHtml, initialHtml = _b === void 0 ? '' : _b, onChange = _a.onChange, _c = _a.wrapperClassName, wrapperClassName = _c === void 0 ? 'rich-text-wrapper' : _c, _d = _a.editorClassName, editorClassName = _d === void 0 ? 'rich-text-editor' : _d, _e = _a.toolbarClassName, toolbarClassName = _e === void 0 ? 'rich-text-toolbar' : _e, _f = _a.placeholder, placeholder = _f === void 0 ? 'Comment...' : _f, _g = _a.readOnly, readOnly = _g === void 0 ? false : _g, _h = _a.toolbar, toolbar = _h === void 0 ? undefined : _h, _j = _a.minHeight, minHeight = _j === void 0 ? '200px' : _j, _k = _a.editorStyle, editorStyle = _k === void 0 ? undefined : _k, _l = _a.wrapperStyle, wrapperStyle = _l === void 0 ? undefined : _l, _m = _a.toolbarStyle, toolbarStyle = _m === void 0 ? undefined : _m, restProps = __rest(_a, ["initialHtml", "onChange", "wrapperClassName", "editorClassName", "toolbarClassName", "placeholder", "readOnly", "toolbar", "minHeight", "editorStyle", "wrapperStyle", "toolbarStyle"]);
33
- var editorRef = useRef(null);
34
- var _o = useState(function () {
35
- try {
36
- if (initialHtml) {
37
- var contentBlock = htmlToDraft(initialHtml);
38
- if (contentBlock) {
39
- var contentState = ContentState.createFromBlockArray(contentBlock.contentBlocks, contentBlock.entityMap);
40
- return EditorState.createWithContent(contentState);
41
- }
42
- }
43
- }
44
- catch (error) {
45
- console.error('Failed to parse initial HTML:', error);
46
- }
47
- return EditorState.createEmpty();
48
- }), editorState = _o[0], setEditorState = _o[1];
49
- useEffect(function () {
50
- if (initialHtml && editorState.getCurrentContent().hasText() === false) {
51
- try {
52
- var contentBlock = htmlToDraft(initialHtml);
53
- var contentState = ContentState.createFromBlockArray(contentBlock.contentBlocks, contentBlock.entityMap);
54
- var newEditorState = EditorState.createWithContent(contentState);
55
- var focusedState = EditorState.moveFocusToEnd(newEditorState);
56
- setEditorState(focusedState);
57
- }
58
- catch (error) {
59
- console.error('Error setting editor content:', error);
60
- }
61
- }
62
- }, [initialHtml, editorState]);
63
- var handleEditorStateChange = useCallback(function (newEditorState) {
64
- setEditorState(newEditorState);
65
- if (onChange) {
66
- var html = draftToHtml(convertToRaw(newEditorState.getCurrentContent()));
67
- onChange(html);
68
- }
69
- }, [onChange]);
70
- var defaultToolbar = {
71
- options: [
72
- 'inline',
73
- 'blockType',
74
- 'fontSize',
75
- 'fontFamily',
76
- 'list',
77
- 'textAlign',
78
- 'colorPicker',
79
- 'link',
80
- 'embedded',
81
- 'emoji',
82
- 'image',
83
- 'remove',
84
- 'history',
85
- ],
86
- inline: {
87
- options: ['bold', 'italic', 'underline', 'strikethrough', 'monospace', 'superscript', 'subscript'],
88
- },
89
- blockType: {
90
- inDropdown: true,
91
- options: ['Normal', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'Blockquote', 'Code'],
92
- },
93
- fontSize: {
94
- options: [8, 9, 10, 11, 12, 14, 16, 18, 24, 30, 36, 48, 60, 72, 96],
95
- },
96
- fontFamily: {
97
- options: ['Arial', 'Georgia', 'Impact', 'Tahoma', 'Times New Roman', 'Verdana', 'Courier New'],
98
- },
99
- list: {
100
- options: ['unordered', 'ordered'],
101
- },
102
- textAlign: {
103
- options: ['left', 'center', 'right', 'justify'],
104
- },
105
- link: {
106
- defaultTargetOption: '_blank',
107
- },
108
- image: {
109
- uploadCallback: function (file) {
110
- return new Promise(function (resolve) {
111
- var reader = new FileReader();
112
- reader.onload = function (e) {
113
- var _a;
114
- var dataUrl = (_a = e.target) === null || _a === void 0 ? void 0 : _a.result;
115
- resolve({ data: { link: dataUrl } });
116
- };
117
- reader.readAsDataURL(file);
118
- });
119
- },
120
- previewImage: true,
121
- alt: { present: true, mandatory: false },
122
- },
123
- };
124
- return (_jsx("div", { className: wrapperClassName, style: {
125
- border: '1px solid #e0e0e0',
126
- borderRadius: '4px',
127
- direction: 'ltr',
128
- }, children: _jsx(Editor, __assign({ ref: editorRef, editorState: editorState, onEditorStateChange: handleEditorStateChange, wrapperClassName: wrapperClassName, editorClassName: editorClassName, toolbarClassName: toolbarClassName, placeholder: placeholder, readOnly: readOnly, toolbar: toolbar || defaultToolbar, wrapperStyle: wrapperStyle || {
129
- padding: '0px',
130
- backgroundColor: '#fff',
131
- direction: 'ltr',
132
- }, editorStyle: editorStyle || {
133
- minHeight: minHeight,
134
- padding: '10px',
135
- lineHeight: '1.0',
136
- fontSize: '16px',
137
- direction: 'ltr',
138
- textAlign: 'left',
139
- }, toolbarStyle: toolbarStyle || {
140
- marginBottom: '0',
141
- borderBottom: '1px solid #e0e0e0',
142
- backgroundColor: '#f5f5f5',
143
- direction: 'ltr',
144
- } }, restProps)) }));
145
- };
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import { AnimatedWrapperProps } from '../type';
3
- export declare const AnimatedWrapper: React.FC<AnimatedWrapperProps>;
@@ -1,7 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- export var AnimatedWrapper = function (_a) {
3
- var _b = _a.animationClass, animationClass = _b === void 0 ? 'animate__bounceIn' : _b, _c = _a.delay, delay = _c === void 0 ? '0' : _c, children = _a.children;
4
- var delayValue = Number(delay);
5
- var delayClass = delayValue > 0 ? "animate__delay-".concat(delayValue, "s") : '';
6
- return (_jsx("div", { className: "animate__animated ".concat(animationClass, " ").concat(delayClass), children: children }));
7
- };
package/dist/type.d.ts DELETED
@@ -1,301 +0,0 @@
1
- import { AxiosRequestConfig } from 'axios';
2
- import { ReactNode } from 'react';
3
- export interface DrawerContextValue {
4
- drawerOpen: boolean;
5
- openDrawer: () => void;
6
- closeDrawer: () => void;
7
- openDrawerInButton: () => void;
8
- closeDrawerInButton: () => void;
9
- currentMainMenu?: string;
10
- setCurrentMainMenu?: (value: string) => void;
11
- }
12
- export interface DrawerProviderProps {
13
- children: ReactNode;
14
- }
15
- export interface FileComponentProps {
16
- primaryKey: string | number;
17
- filename: string;
18
- size: string | number;
19
- onDownload?: any;
20
- width?: number;
21
- borderColor?: string;
22
- fileColor?: 'inherit' | 'primary' | 'secondary' | 'error' | 'disabled' | 'action';
23
- isDownloading: boolean;
24
- }
25
- export interface AlertPropsType {
26
- type: string;
27
- msg: string;
28
- duration?: number;
29
- }
30
- export interface DetailsCardProps {
31
- isLoading?: boolean;
32
- title: string;
33
- details: any[];
34
- spacing?: number;
35
- boxShadow?: string;
36
- background?: string;
37
- loaderType?: 'skeleton' | 'circular';
38
- displayType?: 'flex' | 'block';
39
- }
40
- export interface UploadButtonProps {
41
- isUpload?: boolean;
42
- color?: 'inherit' | 'primary' | 'secondary' | 'success' | 'error' | 'info' | 'warning';
43
- state?: {
44
- isUploaded?: boolean;
45
- isUploadError?: boolean;
46
- isLoadingUpload?: boolean;
47
- };
48
- onFileSelect: (file: File) => void;
49
- }
50
- export interface DownloadButtonState {
51
- isDownloaded?: boolean;
52
- isDownloadError?: boolean;
53
- isLoadingDownload?: boolean;
54
- }
55
- export interface DownloadFileProps {
56
- isDownload?: boolean;
57
- color?: 'inherit' | 'primary' | 'secondary' | 'success' | 'error' | 'info' | 'warning';
58
- state?: DownloadButtonState;
59
- onDownload: () => void;
60
- }
61
- type MenuPosition = 'auto' | 'fixed';
62
- type ThemeMode = 'light' | 'dark';
63
- export interface ContextMenuProps {
64
- options: any;
65
- children: React.ReactNode;
66
- disabled?: boolean;
67
- className?: string;
68
- menuClassName?: string;
69
- position?: MenuPosition;
70
- onShow?: () => void;
71
- onHide?: () => void;
72
- currentInstance?: any;
73
- theme?: ThemeMode;
74
- }
75
- export interface UndoableHistoryState<T> {
76
- past: T[];
77
- present: T;
78
- future: T[];
79
- }
80
- export type HistoryAction<T> = {
81
- type: 'UNDO';
82
- } | {
83
- type: 'REDO';
84
- } | {
85
- type: 'CLEAR';
86
- } | {
87
- type: 'SET';
88
- newPresent: T;
89
- } | {
90
- type: 'RESET';
91
- newPresent: T;
92
- };
93
- export type UseRecentSearchOptions = {
94
- key?: string;
95
- limit?: number;
96
- uniqueKey?: string;
97
- excludeEmpty?: boolean;
98
- };
99
- export interface UseAxiosResponse<T> {
100
- data: T | null;
101
- loading: boolean;
102
- error: string | null;
103
- makeRequest: (url: string, method?: string, requestData?: any) => void;
104
- cancelRequest: () => void;
105
- }
106
- export interface UseAxiosConfig extends AxiosRequestConfig {
107
- baseURL?: string;
108
- headers?: {
109
- [key: string]: string;
110
- };
111
- }
112
- export interface FetchState<T> {
113
- data: T | null;
114
- loading: boolean;
115
- error: string | null;
116
- }
117
- export interface WindowSize {
118
- width: number;
119
- height: number;
120
- }
121
- export interface ScrollPosition {
122
- x: number;
123
- y: number;
124
- }
125
- export interface MousePosition {
126
- x: number;
127
- y: number;
128
- }
129
- export type IdleStatus = 'idle' | 'pending' | 'success' | 'error';
130
- export type AsyncFunction<T> = () => Promise<T>;
131
- export interface UseAsyncReturn<T> {
132
- execute: () => void;
133
- status: IdleStatus;
134
- value: T | null;
135
- error: Error | null;
136
- }
137
- export interface BatteryManager {
138
- level: number;
139
- charging: boolean;
140
- chargingTime: number;
141
- dischargingTime: number;
142
- addEventListener(type: string, listener: EventListener | EventListenerObject | null, options?: boolean | AddEventListenerOptions): void;
143
- removeEventListener(type: string, listener: EventListener | EventListenerObject | null, options?: boolean | EventListenerOptions): void;
144
- }
145
- export interface BatteryState {
146
- supported: boolean;
147
- loading: boolean;
148
- level: number | null;
149
- charging: boolean | null;
150
- chargingTime: number | null;
151
- dischargingTime: number | null;
152
- }
153
- export interface NavigatorWithBattery extends Navigator {
154
- getBattery: () => Promise<BatteryManager>;
155
- }
156
- export interface HistoryState {
157
- [key: string]: any;
158
- }
159
- export interface UseHistory {
160
- history: History;
161
- state: HistoryState | null;
162
- push: (path: string, state?: HistoryState) => void;
163
- replace: (path: string, state?: HistoryState) => void;
164
- goBack: () => void;
165
- goForward: () => void;
166
- }
167
- export interface UseSessionStorage<T> {
168
- (key: string, initialValue: T): [T, (value: T) => void];
169
- }
170
- export interface UseSound {
171
- play: () => void;
172
- pause: () => void;
173
- stop: () => void;
174
- setVolume: (volume: number) => void;
175
- isPlaying: boolean;
176
- error: Error | null;
177
- }
178
- export interface TouchPosition {
179
- x: number | null;
180
- y: number | null;
181
- }
182
- export interface UseTouch {
183
- (elementRef: React.RefObject<HTMLElement>): {
184
- touchStart: TouchPosition;
185
- touchMove: TouchPosition;
186
- touchEnd: TouchPosition;
187
- };
188
- }
189
- export interface MotionSensorState {
190
- acceleration: {
191
- x: number | null;
192
- y: number | null;
193
- z: number | null;
194
- };
195
- accelerationIncludingGravity: {
196
- x: number | null;
197
- y: number | null;
198
- z: number | null;
199
- };
200
- rotationRate: {
201
- alpha: number | null;
202
- beta: number | null;
203
- gamma: number | null;
204
- };
205
- interval: number | null;
206
- }
207
- export type SpeechOptions = {
208
- lang: string;
209
- voice?: SpeechSynthesisVoice;
210
- rate: number;
211
- pitch: number;
212
- volume: number;
213
- };
214
- export type IState = PermissionState | '';
215
- export type IPermissionDescriptor = PermissionDescriptor | (PermissionDescriptor & {
216
- deviceId?: string;
217
- }) | (PermissionDescriptor & {
218
- sysex?: boolean;
219
- }) | (PermissionDescriptor & {
220
- userVisibleOnly?: boolean;
221
- });
222
- export type ISpeechOptions = Partial<SpeechOptions>;
223
- export type VoiceInfo = Pick<SpeechSynthesisVoice, 'lang' | 'name'>;
224
- export type ISpeechState = SpeechOptions & {
225
- isPlaying: boolean;
226
- status: string;
227
- voiceInfo: VoiceInfo;
228
- };
229
- export declare enum VoiceStatus {
230
- init = 0,
231
- play = 1,
232
- pause = 2,
233
- end = 3
234
- }
235
- export interface RichTextEditorProps {
236
- initialHtml?: string;
237
- onChange?: any;
238
- wrapperClassName?: string;
239
- editorClassName?: string;
240
- toolbarClassName?: string;
241
- placeholder?: string;
242
- readOnly?: boolean;
243
- toolbar?: object;
244
- minHeight?: string;
245
- editorStyle?: object;
246
- wrapperStyle?: object;
247
- toolbarStyle?: object;
248
- restProps?: any;
249
- }
250
- export interface BrowserHistoryState {
251
- canGoBack: boolean;
252
- canGoForward: boolean;
253
- historyLength: number;
254
- }
255
- export interface BrowserSettings {
256
- clearCache: boolean;
257
- clearCookies: boolean;
258
- clearLocalStorage: boolean;
259
- clearSessionStorage: boolean;
260
- }
261
- export interface UseBrowserControlsReturn {
262
- currentUrl: URL;
263
- currentPath: string;
264
- currentHash: string;
265
- currentSearchParams: URLSearchParams;
266
- goBack: () => void;
267
- goForward: () => void;
268
- reload: (hardReload?: boolean, scrollToTop?: boolean) => void;
269
- navigateTo: (url: string | URL, replace?: boolean) => void;
270
- clearBrowserData: (settings: Partial<BrowserSettings>) => Promise<void>;
271
- historyState: BrowserHistoryState;
272
- isOnline: boolean;
273
- copyCurrentUrl: () => Promise<void>;
274
- openNewTab: (url?: string) => void;
275
- getFaviconUrl: (size?: number) => string;
276
- getPageTitle: () => string;
277
- setPageTitle: (title: string) => void;
278
- isSecureContext: boolean;
279
- viewportSize: {
280
- width: number;
281
- height: number;
282
- };
283
- screenSize: {
284
- width: number;
285
- height: number;
286
- };
287
- enableFullscreen: () => Promise<void>;
288
- disableFullscreen: () => Promise<void>;
289
- isFullscreen: boolean;
290
- printPage: () => void;
291
- getUserAgent: () => string;
292
- shareContent: (data: ShareData) => Promise<void>;
293
- isShareSupported: boolean;
294
- closeCurrentTab: () => void;
295
- }
296
- export interface AnimatedWrapperProps {
297
- animationClass?: string;
298
- delay?: any;
299
- children: React.ReactNode;
300
- }
301
- export {};
package/dist/type.js DELETED
@@ -1,7 +0,0 @@
1
- export var VoiceStatus;
2
- (function (VoiceStatus) {
3
- VoiceStatus[VoiceStatus["init"] = 0] = "init";
4
- VoiceStatus[VoiceStatus["play"] = 1] = "play";
5
- VoiceStatus[VoiceStatus["pause"] = 2] = "pause";
6
- VoiceStatus[VoiceStatus["end"] = 3] = "end";
7
- })(VoiceStatus || (VoiceStatus = {}));
package/dist/utils.d.ts DELETED
@@ -1,21 +0,0 @@
1
- export declare const promise: (time: number) => Promise<unknown>;
2
- export declare function throttle<T extends (...args: any[]) => void>(func: T, limit: number): T;
3
- export declare const debounceUtils: <T extends (...args: any[]) => void>(func: T, delay: number) => (...args: Parameters<T>) => void;
4
- export declare const isBrowser: boolean;
5
- export declare const isDev: boolean;
6
- export declare const isObject: (value: unknown) => value is Record<any, any>;
7
- export declare const isFunction: (value: unknown) => value is (...args: any) => any;
8
- export declare const isString: (value: unknown) => value is string;
9
- export declare const isBoolean: (value: unknown) => value is boolean;
10
- export declare const isNumber: (value: unknown) => value is number;
11
- export declare const isUndef: (value: unknown) => value is undefined;
12
- export declare const isAppleDevice: boolean;
13
- export declare const isNavigator: boolean;
14
- export declare const getScrollTop: (el: Document | Element) => number;
15
- export declare const getScrollHeight: (el: Document | Element) => number;
16
- export declare const getClientHeight: (el: Document | Element) => number;
17
- export declare function sleep(time: number): Promise<void>;
18
- export declare function request(req: any): Promise<unknown>;
19
- export declare const noop: () => void;
20
- export declare function on<T extends Window | Document | HTMLElement | EventTarget>(obj: T | null, ...args: Parameters<T['addEventListener']> | [string, Function | null, ...any]): void;
21
- export declare function off<T extends Window | Document | HTMLElement | EventTarget>(obj: T | null, ...args: Parameters<T['removeEventListener']> | [string, Function | null, ...any]): void;