@bbodek/hooks 0.0.17 → 0.0.19
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/README.md +1 -1
- package/dist/effects/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts +2 -2
- package/dist/effects/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/useComposeEventHandler/useComposeEventHandler.d.ts +1 -1
- package/dist/hooks/useComposeEventHandler/useComposeEventHandler.d.ts.map +1 -1
- package/dist/hooks/useDropzone/useDropzoneRoot.d.ts +15 -15
- package/dist/hooks/useExecuteFunction/useExecuteFunction.d.ts.map +1 -1
- package/dist/hooks/useForm/types/index.d.ts +1 -1
- package/dist/hooks/useForm/types/index.d.ts.map +1 -1
- package/dist/hooks/useForm/useForm.d.ts +2 -2
- package/dist/hooks/useForm/useForm.d.ts.map +1 -1
- package/dist/hooks/useResponsible/constants/index.d.ts +11 -0
- package/dist/hooks/useResponsible/constants/index.d.ts.map +1 -0
- package/dist/hooks/useResponsible/effects/useResponsibleStatusEffect.d.ts +4 -0
- package/dist/hooks/useResponsible/effects/useResponsibleStatusEffect.d.ts.map +1 -0
- package/dist/hooks/useResponsible/index.d.ts +4 -0
- package/dist/hooks/useResponsible/index.d.ts.map +1 -0
- package/dist/hooks/useResponsible/types/index.d.ts +7 -0
- package/dist/hooks/useResponsible/types/index.d.ts.map +1 -0
- package/dist/hooks/useResponsible/useResponsible.d.ts +6 -0
- package/dist/hooks/useResponsible/useResponsible.d.ts.map +1 -0
- package/dist/index.es.js +504 -1
- package/dist/index.es.js.map +1 -1
- package/package.json +14 -17
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ useIsomorphicLayoutEffect(() => {
|
|
|
32
32
|
|
|
33
33
|
## License
|
|
34
34
|
|
|
35
|
-
Licensed under the [MIT license](https://github.com/thebbodek/dotoli/blob/main/LICENSE).
|
|
35
|
+
Licensed under the [MIT license](https://github.com/thebbodek/dotoli/blob/main/apps/hooks/LICENSE).
|
|
36
36
|
|
|
37
37
|
<a href="https://bbodek.com/" target="_blank">
|
|
38
38
|
<p align="center">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const useIsomorphicLayoutEffect: typeof
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
declare const useIsomorphicLayoutEffect: typeof useEffect;
|
|
3
3
|
export default useIsomorphicLayoutEffect;
|
|
4
4
|
//# sourceMappingURL=useIsomorphicLayoutEffect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsomorphicLayoutEffect.d.ts","sourceRoot":"","sources":["../../../src/effects/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"useIsomorphicLayoutEffect.d.ts","sourceRoot":"","sources":["../../../src/effects/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,MAAM,OAAO,CAAC;AAEnD,QAAA,MAAM,yBAAyB,kBAC8B,CAAC;AAE9D,eAAe,yBAAyB,CAAC"}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EventHandler, SyntheticEvent } from 'react';
|
|
2
1
|
import { ComposeEventHandler } from '@bbodek/utils';
|
|
2
|
+
import { EventHandler, SyntheticEvent } from 'react';
|
|
3
3
|
declare const useComposeEventHandler: () => {
|
|
4
4
|
compose: <T extends SyntheticEvent>(handler: ComposeEventHandler<T>) => EventHandler<T>;
|
|
5
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useComposeEventHandler.d.ts","sourceRoot":"","sources":["../../../src/hooks/useComposeEventHandler/useComposeEventHandler.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"useComposeEventHandler.d.ts","sourceRoot":"","sources":["../../../src/hooks/useComposeEventHandler/useComposeEventHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAe,MAAM,OAAO,CAAC;AAElE,QAAA,MAAM,sBAAsB;cAEvB,CAAC,SAAS,cAAc,WACd,mBAAmB,CAAC,CAAC,CAAC,KAC9B,YAAY,CAAC,CAAC,CAAC;CAKrB,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -10,17 +10,17 @@ declare const useDropzoneRoot: ({ inputRef, dispatch, disabled, handleUpload, }:
|
|
|
10
10
|
autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {});
|
|
11
11
|
autoFocus?: boolean | undefined;
|
|
12
12
|
className?: string | undefined;
|
|
13
|
-
contentEditable?: (boolean | "
|
|
13
|
+
contentEditable?: (boolean | "false" | "true") | "inherit" | "plaintext-only" | undefined;
|
|
14
14
|
contextMenu?: string | undefined;
|
|
15
15
|
dir?: string | undefined;
|
|
16
|
-
draggable?: (boolean | "
|
|
16
|
+
draggable?: (boolean | "false" | "true") | undefined;
|
|
17
17
|
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
|
|
18
18
|
hidden?: boolean | undefined;
|
|
19
19
|
id?: string | undefined;
|
|
20
20
|
lang?: string | undefined;
|
|
21
21
|
nonce?: string | undefined;
|
|
22
22
|
slot?: string | undefined;
|
|
23
|
-
spellCheck?: (boolean | "
|
|
23
|
+
spellCheck?: (boolean | "false" | "true") | undefined;
|
|
24
24
|
style?: import("react").CSSProperties | undefined;
|
|
25
25
|
tabIndex?: number | undefined;
|
|
26
26
|
title?: string | undefined;
|
|
@@ -57,11 +57,11 @@ declare const useDropzoneRoot: ({ inputRef, dispatch, disabled, handleUpload, }:
|
|
|
57
57
|
exportparts?: string | undefined;
|
|
58
58
|
part?: string | undefined;
|
|
59
59
|
"aria-activedescendant"?: string | undefined;
|
|
60
|
-
"aria-atomic"?: (boolean | "
|
|
60
|
+
"aria-atomic"?: (boolean | "false" | "true") | undefined;
|
|
61
61
|
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
|
|
62
62
|
"aria-braillelabel"?: string | undefined;
|
|
63
63
|
"aria-brailleroledescription"?: string | undefined;
|
|
64
|
-
"aria-busy"?: (boolean | "
|
|
64
|
+
"aria-busy"?: (boolean | "false" | "true") | undefined;
|
|
65
65
|
"aria-checked"?: boolean | "false" | "mixed" | "true" | undefined;
|
|
66
66
|
"aria-colcount"?: number | undefined;
|
|
67
67
|
"aria-colindex"?: number | undefined;
|
|
@@ -72,37 +72,37 @@ declare const useDropzoneRoot: ({ inputRef, dispatch, disabled, handleUpload, }:
|
|
|
72
72
|
"aria-describedby"?: string | undefined;
|
|
73
73
|
"aria-description"?: string | undefined;
|
|
74
74
|
"aria-details"?: string | undefined;
|
|
75
|
-
"aria-disabled"?: (boolean | "
|
|
75
|
+
"aria-disabled"?: (boolean | "false" | "true") | undefined;
|
|
76
76
|
"aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined;
|
|
77
77
|
"aria-errormessage"?: string | undefined;
|
|
78
|
-
"aria-expanded"?: (boolean | "
|
|
78
|
+
"aria-expanded"?: (boolean | "false" | "true") | undefined;
|
|
79
79
|
"aria-flowto"?: string | undefined;
|
|
80
|
-
"aria-grabbed"?: (boolean | "
|
|
80
|
+
"aria-grabbed"?: (boolean | "false" | "true") | undefined;
|
|
81
81
|
"aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
|
|
82
|
-
"aria-hidden"?: (boolean | "
|
|
82
|
+
"aria-hidden"?: (boolean | "false" | "true") | undefined;
|
|
83
83
|
"aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
|
|
84
84
|
"aria-keyshortcuts"?: string | undefined;
|
|
85
85
|
"aria-label"?: string | undefined;
|
|
86
86
|
"aria-labelledby"?: string | undefined;
|
|
87
87
|
"aria-level"?: number | undefined;
|
|
88
88
|
"aria-live"?: "off" | "assertive" | "polite" | undefined;
|
|
89
|
-
"aria-modal"?: (boolean | "
|
|
90
|
-
"aria-multiline"?: (boolean | "
|
|
91
|
-
"aria-multiselectable"?: (boolean | "
|
|
89
|
+
"aria-modal"?: (boolean | "false" | "true") | undefined;
|
|
90
|
+
"aria-multiline"?: (boolean | "false" | "true") | undefined;
|
|
91
|
+
"aria-multiselectable"?: (boolean | "false" | "true") | undefined;
|
|
92
92
|
"aria-orientation"?: "horizontal" | "vertical" | undefined;
|
|
93
93
|
"aria-owns"?: string | undefined;
|
|
94
94
|
"aria-placeholder"?: string | undefined;
|
|
95
95
|
"aria-posinset"?: number | undefined;
|
|
96
96
|
"aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined;
|
|
97
|
-
"aria-readonly"?: (boolean | "
|
|
97
|
+
"aria-readonly"?: (boolean | "false" | "true") | undefined;
|
|
98
98
|
"aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined;
|
|
99
|
-
"aria-required"?: (boolean | "
|
|
99
|
+
"aria-required"?: (boolean | "false" | "true") | undefined;
|
|
100
100
|
"aria-roledescription"?: string | undefined;
|
|
101
101
|
"aria-rowcount"?: number | undefined;
|
|
102
102
|
"aria-rowindex"?: number | undefined;
|
|
103
103
|
"aria-rowindextext"?: string | undefined;
|
|
104
104
|
"aria-rowspan"?: number | undefined;
|
|
105
|
-
"aria-selected"?: (boolean | "
|
|
105
|
+
"aria-selected"?: (boolean | "false" | "true") | undefined;
|
|
106
106
|
"aria-setsize"?: number | undefined;
|
|
107
107
|
"aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
|
|
108
108
|
"aria-valuemax"?: number | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExecuteFunction.d.ts","sourceRoot":"","sources":["../../../src/hooks/useExecuteFunction/useExecuteFunction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useExecuteFunction.d.ts","sourceRoot":"","sources":["../../../src/hooks/useExecuteFunction/useExecuteFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAmB,MAAM,eAAe,CAAC;AAGjE,QAAA,MAAM,kBAAkB;cAEnB,CAAC,UAAU,eAAe,CAAC,CAAC,CAAC;CAKjC,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useForm/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE9D,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM,CAAC;AAC3C,MAAM,MAAM,aAAa,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAEtD,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useForm/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE9D,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM,CAAC;AAC3C,MAAM,MAAM,aAAa,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAEtD,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,aAAa,EAAE,CAAC,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,aAAa,CAAC;CACzC;AAED,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,WAAW,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,CAAC;CAC5D;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,MAAM,EAAE,CAAC,CAAC;IACV,SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;IACvC,MAAM,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE,CAAC,KAAK,EAAE,yBAAyB,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IAClE,SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,CAAC;CACpD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const useForm: <T extends object>({ initialValues, validate, }:
|
|
1
|
+
import { UseFormParams, UseFormReturnType } from '../../hooks/useForm/types';
|
|
2
|
+
declare const useForm: <T extends object>({ initialValues, validate, }: UseFormParams<T>) => UseFormReturnType<T>;
|
|
3
3
|
export default useForm;
|
|
4
4
|
//# sourceMappingURL=useForm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useForm.d.ts","sourceRoot":"","sources":["../../../src/hooks/useForm/useForm.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"useForm.d.ts","sourceRoot":"","sources":["../../../src/hooks/useForm/useForm.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,aAAa,EACb,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAE/B,QAAA,MAAM,OAAO,GAAI,CAAC,SAAS,MAAM,EAAE,8BAGhC,aAAa,CAAC,CAAC,CAAC,KAAG,iBAAiB,CAAC,CAAC,CA2CxC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const RESPONSIBLE_STATUS: {
|
|
2
|
+
readonly MOBILE: "MOBILE";
|
|
3
|
+
readonly TABLET: "TABLET";
|
|
4
|
+
readonly DESKTOP: "DESKTOP";
|
|
5
|
+
};
|
|
6
|
+
export declare const BREAKPOINT_SIZE: {
|
|
7
|
+
readonly MOBILE: 360;
|
|
8
|
+
readonly TABLET: 820;
|
|
9
|
+
readonly DESKTOP: 1180;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useResponsible/constants/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB;;;;CAIrB,CAAC;AAEX,eAAO,MAAM,eAAe;;;;CAIlB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { UseResponsibleStatusEffectParams } from '../../../hooks/useResponsible/types';
|
|
2
|
+
declare const useResponsibleStatusEffect: ({ setStatus, }: UseResponsibleStatusEffectParams) => void;
|
|
3
|
+
export default useResponsibleStatusEffect;
|
|
4
|
+
//# sourceMappingURL=useResponsibleStatusEffect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResponsibleStatusEffect.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useResponsible/effects/useResponsibleStatusEffect.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gCAAgC,EAAE,MAAM,8BAA8B,CAAC;AAEhF,QAAA,MAAM,0BAA0B,GAAI,gBAEjC,gCAAgC,SA0BlC,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useResponsible/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { RESPONSIBLE_STATUS } from '../../../hooks/useResponsible/constants';
|
|
3
|
+
export type ResponsibleStatus = (typeof RESPONSIBLE_STATUS)[keyof typeof RESPONSIBLE_STATUS];
|
|
4
|
+
export interface UseResponsibleStatusEffectParams {
|
|
5
|
+
setStatus: Dispatch<SetStateAction<ResponsibleStatus | null>>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useResponsible/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE,MAAM,MAAM,iBAAiB,GAC3B,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE/D,MAAM,WAAW,gCAAgC;IAC/C,SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC,CAAC;CAC/D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResponsible.d.ts","sourceRoot":"","sources":["../../../src/hooks/useResponsible/useResponsible.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,QAAA,MAAM,cAAc;;CAMnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/dist/index.es.js
CHANGED
|
@@ -1,2 +1,505 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useRef, useEffect, useLayoutEffect, useCallback, useMemo, useReducer, useState } from 'react';
|
|
2
|
+
import { composeEventHandler, ACCEPT_FILES, executeFunction, getUUID } from '@bbodek/utils';
|
|
3
|
+
|
|
4
|
+
const useFirstRenderEffect = (effect) => {
|
|
5
|
+
const isFirstRender = useRef(true);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (isFirstRender.current) {
|
|
8
|
+
isFirstRender.current = false;
|
|
9
|
+
effect();
|
|
10
|
+
}
|
|
11
|
+
}, []);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
15
|
+
|
|
16
|
+
const useScrollLockEffect = ({ isLocked, target, }) => {
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
const element = target ? document.getElementById(target) : document.body;
|
|
19
|
+
if (element) {
|
|
20
|
+
if (isLocked) {
|
|
21
|
+
element.style.overflow = 'hidden';
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
element.style.overflow = 'auto';
|
|
25
|
+
}
|
|
26
|
+
return () => {
|
|
27
|
+
element.style.overflow = 'auto';
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}, [isLocked, target]);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const useClickOutSideEffect = ({ ref, onClose, useClickOutsideEvent = true, }) => {
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const onClickOutSide = (e) => {
|
|
36
|
+
if (!ref.current || ref.current.contains(e.target))
|
|
37
|
+
return;
|
|
38
|
+
onClose(e);
|
|
39
|
+
};
|
|
40
|
+
if (useClickOutsideEvent) {
|
|
41
|
+
document.addEventListener('mousedown', onClickOutSide);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
document.removeEventListener('mousedown', onClickOutSide);
|
|
45
|
+
}
|
|
46
|
+
return () => {
|
|
47
|
+
if (useClickOutsideEvent) {
|
|
48
|
+
document.removeEventListener('mousedown', onClickOutSide);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}, [ref.current, useClickOutsideEvent]);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const useClickOutside = ({ onClose, useClickOutsideEvent, }) => {
|
|
55
|
+
const contentRef = useRef(null);
|
|
56
|
+
useClickOutSideEffect({
|
|
57
|
+
ref: contentRef,
|
|
58
|
+
onClose,
|
|
59
|
+
useClickOutsideEvent,
|
|
60
|
+
});
|
|
61
|
+
return { contentRef };
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const useComposeEventHandler = () => {
|
|
65
|
+
const compose = useCallback((handler) => composeEventHandler(handler), []);
|
|
66
|
+
return { compose };
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const DROPZONE_ACTION_MAPPER = {
|
|
70
|
+
DRAG: 'drag',
|
|
71
|
+
HOVER: 'hover',
|
|
72
|
+
SET_FILES: 'setFiles',
|
|
73
|
+
SET_REJECT: 'setReject',
|
|
74
|
+
DELETE_FILE: 'deleteFile',
|
|
75
|
+
RESET_FILES: 'resetFiles',
|
|
76
|
+
};
|
|
77
|
+
const DROPZONE_REJECT_CODE_MAPPER = {
|
|
78
|
+
SINGLE_FILE_ONLY: 'SINGLE_FILE_ONLY',
|
|
79
|
+
TOO_MANY_FILES: 'TOO_MANY_FILES',
|
|
80
|
+
NEED_ACTIVE_MULTIPLE_OPTION: 'NEED_ACTIVE_MULTIPLE_OPTION',
|
|
81
|
+
INVALID_FILE_FORMAT: 'INVALID_FILE_FORMAT',
|
|
82
|
+
};
|
|
83
|
+
const DROPZONE_REJECT_MESSAGE = {
|
|
84
|
+
[DROPZONE_REJECT_CODE_MAPPER['SINGLE_FILE_ONLY']]: '한 개의 파일만 선택할 수 있어요',
|
|
85
|
+
[DROPZONE_REJECT_CODE_MAPPER['TOO_MANY_FILES']]: '너무 많은 파일이 선택되었어요',
|
|
86
|
+
[DROPZONE_REJECT_CODE_MAPPER['NEED_ACTIVE_MULTIPLE_OPTION']]: '다중 선택 옵션을 활성화 시켜주세요',
|
|
87
|
+
[DROPZONE_REJECT_CODE_MAPPER['INVALID_FILE_FORMAT']]: '지원하지 않는 형식의 파일이 있어요',
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const revokeFile = ({ url }) => Array.isArray(url)
|
|
91
|
+
? url.forEach((_url) => URL.revokeObjectURL(_url))
|
|
92
|
+
: URL.revokeObjectURL(url);
|
|
93
|
+
|
|
94
|
+
const useDropzoneFilesCleanupEffect = ({ acceptedFiles, }) => {
|
|
95
|
+
useFirstRenderEffect(() => {
|
|
96
|
+
revokeFile({ url: acceptedFiles.map((file) => file['blob']) });
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const parseAcceptAttr = ({ accept = ACCEPT_FILES, }) => accept.join(',');
|
|
101
|
+
|
|
102
|
+
const useExecuteFunction = () => {
|
|
103
|
+
const execute = useCallback((params) => executeFunction(params), []);
|
|
104
|
+
return { execute };
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const useDropzoneInput = ({ multiple = true, accept = ACCEPT_FILES, disabled = false, handleUpload, }) => {
|
|
108
|
+
const inputRef = useRef(null);
|
|
109
|
+
const { execute } = useExecuteFunction();
|
|
110
|
+
const { compose } = useComposeEventHandler();
|
|
111
|
+
const handleChangeCallback = useCallback((e) => {
|
|
112
|
+
e.preventDefault();
|
|
113
|
+
if (!e.target || !e.target.files)
|
|
114
|
+
return;
|
|
115
|
+
const { files } = e.target;
|
|
116
|
+
handleUpload({ files });
|
|
117
|
+
}, [handleUpload]);
|
|
118
|
+
const inputProps = useMemo(() => ({ onChange, ...rest } = {}) => {
|
|
119
|
+
const props = {
|
|
120
|
+
multiple,
|
|
121
|
+
type: 'file',
|
|
122
|
+
style: { display: 'none' },
|
|
123
|
+
tabIndex: -1,
|
|
124
|
+
ref: inputRef,
|
|
125
|
+
onChange: execute({
|
|
126
|
+
disabled,
|
|
127
|
+
fn: compose({
|
|
128
|
+
externalEventHandler: onChange,
|
|
129
|
+
internalEventHandler: handleChangeCallback,
|
|
130
|
+
}),
|
|
131
|
+
}),
|
|
132
|
+
accept: parseAcceptAttr({ accept }),
|
|
133
|
+
disabled,
|
|
134
|
+
};
|
|
135
|
+
return { ...props, ...rest };
|
|
136
|
+
}, [
|
|
137
|
+
multiple,
|
|
138
|
+
accept,
|
|
139
|
+
inputRef,
|
|
140
|
+
handleChangeCallback,
|
|
141
|
+
disabled,
|
|
142
|
+
execute,
|
|
143
|
+
compose,
|
|
144
|
+
]);
|
|
145
|
+
return { inputProps, inputRef };
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const initialState = {
|
|
149
|
+
isDragActive: false,
|
|
150
|
+
isHover: false,
|
|
151
|
+
isActive: false,
|
|
152
|
+
acceptedFiles: [],
|
|
153
|
+
rejectedFiles: undefined,
|
|
154
|
+
};
|
|
155
|
+
const dropZoneReducer = (state, action) => {
|
|
156
|
+
switch (action.type) {
|
|
157
|
+
case DROPZONE_ACTION_MAPPER['DRAG']:
|
|
158
|
+
return {
|
|
159
|
+
...state,
|
|
160
|
+
isDragActive: action['isDragActive'] ?? state['isDragActive'],
|
|
161
|
+
isActive: action['isDragActive'] ?? state['isDragActive'],
|
|
162
|
+
};
|
|
163
|
+
case DROPZONE_ACTION_MAPPER['HOVER']:
|
|
164
|
+
return {
|
|
165
|
+
...state,
|
|
166
|
+
isHover: action['isHover'] ?? state['isHover'],
|
|
167
|
+
isActive: action['isHover'] ?? state['isHover'],
|
|
168
|
+
};
|
|
169
|
+
case DROPZONE_ACTION_MAPPER['SET_FILES']:
|
|
170
|
+
return {
|
|
171
|
+
...state,
|
|
172
|
+
acceptedFiles: action['acceptedFiles'] ?? state['acceptedFiles'],
|
|
173
|
+
rejectedFiles: undefined,
|
|
174
|
+
isDragActive: false,
|
|
175
|
+
isHover: false,
|
|
176
|
+
isActive: false,
|
|
177
|
+
};
|
|
178
|
+
case DROPZONE_ACTION_MAPPER['SET_REJECT']:
|
|
179
|
+
return {
|
|
180
|
+
...state,
|
|
181
|
+
rejectedFiles: action['rejectedFiles'] ?? state['rejectedFiles'],
|
|
182
|
+
isDragActive: false,
|
|
183
|
+
isHover: false,
|
|
184
|
+
isActive: false,
|
|
185
|
+
};
|
|
186
|
+
case DROPZONE_ACTION_MAPPER['DELETE_FILE']:
|
|
187
|
+
return {
|
|
188
|
+
...state,
|
|
189
|
+
acceptedFiles: state['acceptedFiles'].filter((file) => file['id'] !== action['id']),
|
|
190
|
+
};
|
|
191
|
+
case DROPZONE_ACTION_MAPPER['RESET_FILES']:
|
|
192
|
+
return {
|
|
193
|
+
...state,
|
|
194
|
+
acceptedFiles: [],
|
|
195
|
+
};
|
|
196
|
+
default:
|
|
197
|
+
return state;
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
const useDropzoneReducer = () => {
|
|
201
|
+
const [state, dispatch] = useReducer(dropZoneReducer, initialState);
|
|
202
|
+
return { state, dispatch };
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const useDropzoneRoot = ({ inputRef, dispatch, disabled = false, handleUpload, }) => {
|
|
206
|
+
const rootRef = useRef(null);
|
|
207
|
+
const { execute } = useExecuteFunction();
|
|
208
|
+
const { compose } = useComposeEventHandler();
|
|
209
|
+
const isRelatedDropZone = useMemo(() => (e) => e.relatedTarget instanceof Node &&
|
|
210
|
+
rootRef.current &&
|
|
211
|
+
rootRef.current.contains(e.relatedTarget), [rootRef.current]);
|
|
212
|
+
const handleMouseEnterCallback = useCallback(() => dispatch({ type: DROPZONE_ACTION_MAPPER['HOVER'], isHover: true }), [dispatch]);
|
|
213
|
+
const handleMouseLeaveCallback = useCallback((e) => {
|
|
214
|
+
if (isRelatedDropZone(e))
|
|
215
|
+
return;
|
|
216
|
+
dispatch({ type: DROPZONE_ACTION_MAPPER['HOVER'], isHover: false });
|
|
217
|
+
}, [dispatch, isRelatedDropZone]);
|
|
218
|
+
const handleDragEnterCallback = useCallback((e) => {
|
|
219
|
+
e.preventDefault();
|
|
220
|
+
dispatch({ type: DROPZONE_ACTION_MAPPER['DRAG'], isDragActive: true });
|
|
221
|
+
}, [dispatch]);
|
|
222
|
+
const handleDragLeaveCallback = useCallback((e) => {
|
|
223
|
+
e.preventDefault();
|
|
224
|
+
if (isRelatedDropZone(e))
|
|
225
|
+
return;
|
|
226
|
+
dispatch({ type: DROPZONE_ACTION_MAPPER['DRAG'], isDragActive: false });
|
|
227
|
+
}, [dispatch, isRelatedDropZone]);
|
|
228
|
+
const handleDragOverCallback = useCallback((e) => e.preventDefault(), []);
|
|
229
|
+
const handleDropCallback = useCallback((e) => {
|
|
230
|
+
e.preventDefault();
|
|
231
|
+
if (!e.dataTransfer || !e.dataTransfer.files)
|
|
232
|
+
return;
|
|
233
|
+
const { files } = e.dataTransfer;
|
|
234
|
+
handleUpload({ files });
|
|
235
|
+
}, [handleUpload]);
|
|
236
|
+
const handleClickCallback = useCallback(() => {
|
|
237
|
+
if (inputRef.current) {
|
|
238
|
+
inputRef.current.value = '';
|
|
239
|
+
inputRef.current.click();
|
|
240
|
+
}
|
|
241
|
+
}, [inputRef.current]);
|
|
242
|
+
const rootProps = useMemo(() => ({ onDrop, onClick, onDragEnter, onDragLeave, onDragOver, onMouseEnter, onMouseLeave, role, ...rest } = {}) => {
|
|
243
|
+
const props = {
|
|
244
|
+
onDrop: execute({
|
|
245
|
+
disabled,
|
|
246
|
+
fn: compose({
|
|
247
|
+
externalEventHandler: onDrop,
|
|
248
|
+
internalEventHandler: handleDropCallback,
|
|
249
|
+
}),
|
|
250
|
+
}),
|
|
251
|
+
onClick: execute({
|
|
252
|
+
disabled,
|
|
253
|
+
fn: compose({
|
|
254
|
+
externalEventHandler: onClick,
|
|
255
|
+
internalEventHandler: handleClickCallback,
|
|
256
|
+
}),
|
|
257
|
+
}),
|
|
258
|
+
onDragEnter: execute({
|
|
259
|
+
disabled,
|
|
260
|
+
fn: compose({
|
|
261
|
+
externalEventHandler: onDragEnter,
|
|
262
|
+
internalEventHandler: handleDragEnterCallback,
|
|
263
|
+
}),
|
|
264
|
+
}),
|
|
265
|
+
onDragLeave: execute({
|
|
266
|
+
disabled,
|
|
267
|
+
fn: compose({
|
|
268
|
+
externalEventHandler: onDragLeave,
|
|
269
|
+
internalEventHandler: handleDragLeaveCallback,
|
|
270
|
+
}),
|
|
271
|
+
}),
|
|
272
|
+
onDragOver: execute({
|
|
273
|
+
disabled,
|
|
274
|
+
fn: compose({
|
|
275
|
+
externalEventHandler: onDragOver,
|
|
276
|
+
internalEventHandler: handleDragOverCallback,
|
|
277
|
+
}),
|
|
278
|
+
}),
|
|
279
|
+
onMouseEnter: execute({
|
|
280
|
+
disabled,
|
|
281
|
+
fn: compose({
|
|
282
|
+
externalEventHandler: onMouseEnter,
|
|
283
|
+
internalEventHandler: handleMouseEnterCallback,
|
|
284
|
+
}),
|
|
285
|
+
}),
|
|
286
|
+
onMouseLeave: execute({
|
|
287
|
+
disabled,
|
|
288
|
+
fn: compose({
|
|
289
|
+
externalEventHandler: onMouseLeave,
|
|
290
|
+
internalEventHandler: handleMouseLeaveCallback,
|
|
291
|
+
}),
|
|
292
|
+
}),
|
|
293
|
+
role: typeof role === 'string' && role !== '' ? role : 'presentation',
|
|
294
|
+
ref: rootRef,
|
|
295
|
+
};
|
|
296
|
+
return {
|
|
297
|
+
...props,
|
|
298
|
+
...rest,
|
|
299
|
+
};
|
|
300
|
+
}, [
|
|
301
|
+
handleDropCallback,
|
|
302
|
+
handleClickCallback,
|
|
303
|
+
handleDragEnterCallback,
|
|
304
|
+
handleDragLeaveCallback,
|
|
305
|
+
handleDragOverCallback,
|
|
306
|
+
handleMouseEnterCallback,
|
|
307
|
+
handleMouseLeaveCallback,
|
|
308
|
+
rootRef,
|
|
309
|
+
disabled,
|
|
310
|
+
execute,
|
|
311
|
+
compose,
|
|
312
|
+
]);
|
|
313
|
+
return { rootProps };
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
const useDropzoneUpload = ({ uploadedFiles, state, dispatch, multiple = true, limit, onDrop, onDropAccepted, onDropRejected, accept = ACCEPT_FILES, }) => {
|
|
317
|
+
const parseFileData = (file) => {
|
|
318
|
+
const { name, size, type, lastModified, webkitRelativePath } = file;
|
|
319
|
+
return {
|
|
320
|
+
id: getUUID(),
|
|
321
|
+
name,
|
|
322
|
+
size,
|
|
323
|
+
type,
|
|
324
|
+
lastModified,
|
|
325
|
+
webkitRelativePath,
|
|
326
|
+
blob: URL.createObjectURL(file),
|
|
327
|
+
original: file,
|
|
328
|
+
};
|
|
329
|
+
};
|
|
330
|
+
const rejectUpload = ({ acceptedFiles, rejectCode }) => {
|
|
331
|
+
const rejectedFiles = {
|
|
332
|
+
files: acceptedFiles,
|
|
333
|
+
code: rejectCode,
|
|
334
|
+
};
|
|
335
|
+
dispatch({
|
|
336
|
+
type: DROPZONE_ACTION_MAPPER['SET_REJECT'],
|
|
337
|
+
acceptedFiles,
|
|
338
|
+
rejectedFiles,
|
|
339
|
+
});
|
|
340
|
+
onDropRejected?.({ rejectedFiles, state, dispatch });
|
|
341
|
+
onDrop?.({
|
|
342
|
+
acceptedFiles: [],
|
|
343
|
+
rejectedFiles,
|
|
344
|
+
state,
|
|
345
|
+
dispatch,
|
|
346
|
+
});
|
|
347
|
+
console.error(`An error occurred in Dropzone. code: ${rejectCode}`);
|
|
348
|
+
};
|
|
349
|
+
const handleUpload = ({ files }) => {
|
|
350
|
+
const acceptedFiles = Array.from(files, parseFileData);
|
|
351
|
+
if (!multiple && acceptedFiles.length > 1) {
|
|
352
|
+
return rejectUpload({
|
|
353
|
+
acceptedFiles,
|
|
354
|
+
rejectCode: DROPZONE_REJECT_CODE_MAPPER['SINGLE_FILE_ONLY'],
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
if (typeof limit !== 'undefined') {
|
|
358
|
+
if (!multiple) {
|
|
359
|
+
return rejectUpload({
|
|
360
|
+
acceptedFiles,
|
|
361
|
+
rejectCode: DROPZONE_REJECT_CODE_MAPPER['NEED_ACTIVE_MULTIPLE_OPTION'],
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
if (acceptedFiles.length > limit) {
|
|
365
|
+
return rejectUpload({
|
|
366
|
+
acceptedFiles,
|
|
367
|
+
rejectCode: DROPZONE_REJECT_CODE_MAPPER['TOO_MANY_FILES'],
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
const isRejectAccept = acceptedFiles.some((file) => {
|
|
372
|
+
const acceptFileKeys = ['type', 'name'];
|
|
373
|
+
return acceptFileKeys.every((acceptFileKey) => !accept.some((acceptType) => file[acceptFileKey].toLowerCase().includes(acceptType)));
|
|
374
|
+
});
|
|
375
|
+
if (isRejectAccept) {
|
|
376
|
+
return rejectUpload({
|
|
377
|
+
acceptedFiles,
|
|
378
|
+
rejectCode: DROPZONE_REJECT_CODE_MAPPER['INVALID_FILE_FORMAT'],
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
dispatch({ type: DROPZONE_ACTION_MAPPER['SET_FILES'], acceptedFiles });
|
|
382
|
+
onDropAccepted?.({ acceptedFiles, state, dispatch });
|
|
383
|
+
onDrop?.({
|
|
384
|
+
acceptedFiles,
|
|
385
|
+
state,
|
|
386
|
+
dispatch,
|
|
387
|
+
});
|
|
388
|
+
};
|
|
389
|
+
const resetFiles = () => {
|
|
390
|
+
revokeFile({ url: uploadedFiles.map((file) => file['blob']) });
|
|
391
|
+
dispatch({ type: DROPZONE_ACTION_MAPPER['RESET_FILES'] });
|
|
392
|
+
};
|
|
393
|
+
const deleteFile = ({ id }) => {
|
|
394
|
+
dispatch({ type: DROPZONE_ACTION_MAPPER['DELETE_FILE'], id });
|
|
395
|
+
};
|
|
396
|
+
return { handleUpload, deleteFile, resetFiles };
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
const useDropzone = (props) => {
|
|
400
|
+
const { multiple = true, limit, disabled = false, onDrop, onDropAccepted, onDropRejected, accept = ACCEPT_FILES, } = props;
|
|
401
|
+
const { state, dispatch } = useDropzoneReducer();
|
|
402
|
+
const { handleUpload, deleteFile, resetFiles } = useDropzoneUpload({
|
|
403
|
+
uploadedFiles: state['acceptedFiles'],
|
|
404
|
+
state,
|
|
405
|
+
dispatch,
|
|
406
|
+
multiple,
|
|
407
|
+
limit,
|
|
408
|
+
onDrop,
|
|
409
|
+
onDropAccepted,
|
|
410
|
+
onDropRejected,
|
|
411
|
+
accept,
|
|
412
|
+
});
|
|
413
|
+
const { inputProps, inputRef } = useDropzoneInput({
|
|
414
|
+
disabled,
|
|
415
|
+
handleUpload,
|
|
416
|
+
multiple,
|
|
417
|
+
accept,
|
|
418
|
+
});
|
|
419
|
+
const { rootProps } = useDropzoneRoot({
|
|
420
|
+
inputRef,
|
|
421
|
+
dispatch,
|
|
422
|
+
disabled,
|
|
423
|
+
handleUpload,
|
|
424
|
+
});
|
|
425
|
+
useDropzoneFilesCleanupEffect({ acceptedFiles: state['acceptedFiles'] });
|
|
426
|
+
return { state, deleteFile, resetFiles, rootProps, inputProps, dispatch };
|
|
427
|
+
};
|
|
428
|
+
|
|
429
|
+
const useForm = ({ initialValues, validate, }) => {
|
|
430
|
+
const [values, setValuesState] = useState(initialValues);
|
|
431
|
+
const [errors, setErrors] = useState({});
|
|
432
|
+
const handleChange = (e) => {
|
|
433
|
+
const { name, value } = e.target;
|
|
434
|
+
if (name in initialValues) {
|
|
435
|
+
setValuesState({ ...values, [name]: value });
|
|
436
|
+
if (validate) {
|
|
437
|
+
const validationErrors = validate({
|
|
438
|
+
...values,
|
|
439
|
+
[name]: value,
|
|
440
|
+
});
|
|
441
|
+
setErrors(validationErrors);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
const setValues = (newValues) => {
|
|
446
|
+
const updatedValues = typeof newValues === 'function' ? newValues(values) : newValues;
|
|
447
|
+
setValuesState(updatedValues);
|
|
448
|
+
if (validate) {
|
|
449
|
+
const validationErrors = validate(updatedValues);
|
|
450
|
+
setErrors(validationErrors);
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
return {
|
|
454
|
+
values,
|
|
455
|
+
setValues,
|
|
456
|
+
errors,
|
|
457
|
+
handleChange,
|
|
458
|
+
setErrors,
|
|
459
|
+
};
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
const RESPONSIBLE_STATUS = {
|
|
463
|
+
MOBILE: 'MOBILE',
|
|
464
|
+
TABLET: 'TABLET',
|
|
465
|
+
DESKTOP: 'DESKTOP',
|
|
466
|
+
};
|
|
467
|
+
const BREAKPOINT_SIZE = {
|
|
468
|
+
[RESPONSIBLE_STATUS.MOBILE]: 360,
|
|
469
|
+
[RESPONSIBLE_STATUS.TABLET]: 820,
|
|
470
|
+
[RESPONSIBLE_STATUS.DESKTOP]: 1180,
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
const useResponsibleStatusEffect = ({ setStatus, }) => {
|
|
474
|
+
useEffect(() => {
|
|
475
|
+
const handleResize = () => {
|
|
476
|
+
const width = window.innerWidth;
|
|
477
|
+
const calculateStatus = () => {
|
|
478
|
+
if (width >= BREAKPOINT_SIZE.DESKTOP) {
|
|
479
|
+
return RESPONSIBLE_STATUS.DESKTOP;
|
|
480
|
+
}
|
|
481
|
+
else if (width >= BREAKPOINT_SIZE.TABLET) {
|
|
482
|
+
return RESPONSIBLE_STATUS.TABLET;
|
|
483
|
+
}
|
|
484
|
+
else {
|
|
485
|
+
return RESPONSIBLE_STATUS.MOBILE;
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
setStatus(calculateStatus());
|
|
489
|
+
};
|
|
490
|
+
handleResize();
|
|
491
|
+
window.addEventListener('resize', handleResize);
|
|
492
|
+
return () => {
|
|
493
|
+
window.removeEventListener('resize', handleResize);
|
|
494
|
+
};
|
|
495
|
+
}, []);
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
const useResponsible = () => {
|
|
499
|
+
const [status, setStatus] = useState(null);
|
|
500
|
+
useResponsibleStatusEffect({ setStatus });
|
|
501
|
+
return { status };
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
export { BREAKPOINT_SIZE, DROPZONE_ACTION_MAPPER, DROPZONE_REJECT_CODE_MAPPER, DROPZONE_REJECT_MESSAGE, RESPONSIBLE_STATUS, useClickOutSideEffect, useClickOutside, useComposeEventHandler, useDropzone, useExecuteFunction, useFirstRenderEffect, useForm, useIsomorphicLayoutEffect, useResponsible, useScrollLockEffect };
|
|
2
505
|
//# sourceMappingURL=index.es.js.map
|
package/dist/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bbodek/hooks",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -12,37 +12,34 @@
|
|
|
12
12
|
"files": [
|
|
13
13
|
"dist"
|
|
14
14
|
],
|
|
15
|
-
"scripts": {
|
|
16
|
-
"dev": "rollup -c --watch & tsc -p tsconfig.build.json --watch & tsc-alias -p tsconfig.build.json --watch",
|
|
17
|
-
"build": "rollup -c && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
18
|
-
"start": "next start",
|
|
19
|
-
"lint": "next lint"
|
|
20
|
-
},
|
|
21
15
|
"dependencies": {},
|
|
22
16
|
"peerDependencies": {
|
|
23
17
|
"next": "^15.3.1",
|
|
24
18
|
"react": "^19.1.0",
|
|
25
19
|
"react-dom": "^19.1.0",
|
|
26
|
-
"@bbodek/utils": "^0.0.
|
|
20
|
+
"@bbodek/utils": "^0.0.16"
|
|
27
21
|
},
|
|
28
22
|
"devDependencies": {
|
|
29
23
|
"next": "^15.3.1",
|
|
30
24
|
"react": "^19.1.0",
|
|
31
25
|
"react-dom": "^19.1.0",
|
|
32
|
-
"@bbodek/utils": "^0.0.
|
|
33
|
-
"@dotoli/eslint-config": "workspace:*",
|
|
34
|
-
"@dotoli/typescript-config": "workspace:*",
|
|
35
|
-
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
36
|
-
"@rollup/plugin-terser": "^0.4.4",
|
|
26
|
+
"@bbodek/utils": "^0.0.16",
|
|
37
27
|
"@types/node": "^20",
|
|
38
28
|
"@types/react": "^19",
|
|
39
29
|
"@types/react-dom": "^19",
|
|
40
30
|
"eslint": "^9.26.0",
|
|
41
31
|
"rollup": "^4.40.2",
|
|
42
|
-
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
43
|
-
"rollup-plugin-typescript2": "^0.36.0",
|
|
44
32
|
"tsc-alias": "^1.8.16",
|
|
45
33
|
"tslib": "^2.8.1",
|
|
46
|
-
"typescript": "^5.8.3"
|
|
34
|
+
"typescript": "^5.8.3",
|
|
35
|
+
"@dotoli/eslint-config": "0.0.0",
|
|
36
|
+
"@dotoli/typescript-config": "0.0.0",
|
|
37
|
+
"@dotoli/rollup-config": "0.0.0"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"dev": "rollup -c --watch & tsc -p tsconfig.build.json --watch & tsc-alias -p tsconfig.build.json --watch",
|
|
41
|
+
"build": "rollup -c && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
42
|
+
"start": "next start",
|
|
43
|
+
"lint": "next lint"
|
|
47
44
|
}
|
|
48
|
-
}
|
|
45
|
+
}
|