@superrb/react-addons 4.0.0-2 → 4.0.0-21
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/.idea/codeStyles/Project.xml +61 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/copilot.data.migration.ask2agent.xml +6 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/prettier.xml +6 -0
- package/.idea/react-addons.iml +8 -0
- package/.idea/vcs.xml +6 -0
- package/.yarn/install-state.gz +0 -0
- package/.yarnrc.yml +1 -0
- package/components/form.d.ts +2 -1
- package/components/form.d.ts.map +1 -1
- package/components/form.js +1 -1
- package/components/modal.d.ts.map +1 -1
- package/components/modal.js +24 -7
- package/config.d.ts +9 -0
- package/config.d.ts.map +1 -0
- package/config.js +90 -0
- package/hooks/use-draggable-scroll.js +11 -2
- package/hooks/use-escape.d.ts +3 -1
- package/hooks/use-escape.d.ts.map +1 -1
- package/hooks/use-escape.js +9 -4
- package/hooks/use-event-listener.d.ts +5 -6
- package/hooks/use-event-listener.d.ts.map +1 -1
- package/hooks/use-event-listener.js +13 -22
- package/hooks/use-hide-on-scroll.d.ts.map +1 -1
- package/hooks/use-hide-on-scroll.js +5 -5
- package/hooks/use-parallax.d.ts.map +1 -1
- package/hooks/use-parallax.js +5 -2
- package/hooks/use-slideshow.d.ts.map +1 -1
- package/hooks/use-slideshow.js +43 -35
- package/index.d.ts +2 -1
- package/index.d.ts.map +1 -1
- package/index.js +2 -1
- package/package.json +12 -9
- package/store/cookies.d.ts.map +1 -1
- package/store/cookies.js +0 -4
- package/store/modal.d.ts.map +1 -1
- package/store/modal.js +0 -4
- package/store/nav.d.ts.map +1 -1
- package/store/nav.js +0 -4
- package/tsconfig.tsbuildinfo +1 -1
- package/actions.d.ts +0 -6
- package/actions.d.ts.map +0 -1
- package/actions.js +0 -18
- package/components/video.d.ts +0 -17
- package/components/video.d.ts.map +0 -1
- package/components/video.js +0 -44
- package/context/cookies-context-provider.d.ts +0 -13
- package/context/cookies-context-provider.d.ts.map +0 -1
- package/context/cookies-context-provider.js +0 -54
- package/context.d.ts +0 -8
- package/context.d.ts.map +0 -1
- package/context.js +0 -7
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<component name="ProjectCodeStyleConfiguration">
|
|
2
|
+
<code_scheme name="Project" version="173">
|
|
3
|
+
<HTMLCodeStyleSettings>
|
|
4
|
+
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
|
|
5
|
+
</HTMLCodeStyleSettings>
|
|
6
|
+
<JSCodeStyleSettings version="0">
|
|
7
|
+
<option name="USE_SEMICOLON_AFTER_STATEMENT" value="false" />
|
|
8
|
+
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
|
9
|
+
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
|
10
|
+
<option name="USE_DOUBLE_QUOTES" value="false" />
|
|
11
|
+
<option name="FORCE_QUOTE_STYlE" value="true" />
|
|
12
|
+
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
|
|
13
|
+
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
|
14
|
+
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
|
15
|
+
</JSCodeStyleSettings>
|
|
16
|
+
<TypeScriptCodeStyleSettings version="0">
|
|
17
|
+
<option name="USE_SEMICOLON_AFTER_STATEMENT" value="false" />
|
|
18
|
+
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
|
19
|
+
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
|
20
|
+
<option name="USE_DOUBLE_QUOTES" value="false" />
|
|
21
|
+
<option name="FORCE_QUOTE_STYlE" value="true" />
|
|
22
|
+
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
|
|
23
|
+
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
|
24
|
+
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
|
25
|
+
</TypeScriptCodeStyleSettings>
|
|
26
|
+
<VueCodeStyleSettings>
|
|
27
|
+
<option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
|
|
28
|
+
<option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
|
|
29
|
+
</VueCodeStyleSettings>
|
|
30
|
+
<codeStyleSettings language="HTML">
|
|
31
|
+
<option name="SOFT_MARGINS" value="80" />
|
|
32
|
+
<indentOptions>
|
|
33
|
+
<option name="INDENT_SIZE" value="2" />
|
|
34
|
+
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
35
|
+
<option name="TAB_SIZE" value="2" />
|
|
36
|
+
</indentOptions>
|
|
37
|
+
</codeStyleSettings>
|
|
38
|
+
<codeStyleSettings language="JavaScript">
|
|
39
|
+
<option name="SOFT_MARGINS" value="80" />
|
|
40
|
+
<indentOptions>
|
|
41
|
+
<option name="INDENT_SIZE" value="2" />
|
|
42
|
+
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
43
|
+
<option name="TAB_SIZE" value="2" />
|
|
44
|
+
</indentOptions>
|
|
45
|
+
</codeStyleSettings>
|
|
46
|
+
<codeStyleSettings language="TypeScript">
|
|
47
|
+
<option name="SOFT_MARGINS" value="80" />
|
|
48
|
+
<indentOptions>
|
|
49
|
+
<option name="INDENT_SIZE" value="2" />
|
|
50
|
+
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
51
|
+
<option name="TAB_SIZE" value="2" />
|
|
52
|
+
</indentOptions>
|
|
53
|
+
</codeStyleSettings>
|
|
54
|
+
<codeStyleSettings language="Vue">
|
|
55
|
+
<option name="SOFT_MARGINS" value="80" />
|
|
56
|
+
<indentOptions>
|
|
57
|
+
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
58
|
+
</indentOptions>
|
|
59
|
+
</codeStyleSettings>
|
|
60
|
+
</code_scheme>
|
|
61
|
+
</component>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/react-addons.iml" filepath="$PROJECT_DIR$/.idea/react-addons.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="WEB_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$" />
|
|
5
|
+
<orderEntry type="inheritedJdk" />
|
|
6
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
7
|
+
</component>
|
|
8
|
+
</module>
|
package/.idea/vcs.xml
ADDED
|
Binary file
|
package/.yarnrc.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
nodeLinker: node-modules
|
package/components/form.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode, ButtonHTMLAttributes } from 'react';
|
|
2
2
|
import { ObjectSchema, InferType, AnySchema } from 'yup';
|
|
3
|
-
import { FieldError } from 'react-hook-form';
|
|
3
|
+
import { FieldError, Path } from 'react-hook-form';
|
|
4
4
|
import { Status } from '../hooks/use-async';
|
|
5
5
|
import { FieldRenderer } from './form/types';
|
|
6
6
|
type WithRecaptcha<T> = T & {
|
|
@@ -31,6 +31,7 @@ export interface FormProps<T extends ObjectSchema<any>, DataStructure extends In
|
|
|
31
31
|
}
|
|
32
32
|
export interface FormRef<T extends ObjectSchema<any>, DataStructure extends InferType<T> = InferType<T>> {
|
|
33
33
|
form: HTMLFormElement;
|
|
34
|
+
setValue: (name: Path<DataStructure>, value: any) => void;
|
|
34
35
|
submit: () => void;
|
|
35
36
|
reset: () => void;
|
|
36
37
|
values: WithRecaptcha<DataStructure>;
|
package/components/form.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../src/components/form.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,SAAS,EAST,oBAAoB,EAErB,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAExD,OAAO,EAAiB,UAAU,
|
|
1
|
+
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../src/components/form.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,SAAS,EAST,oBAAoB,EAErB,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAExD,OAAO,EAAiB,UAAU,EAAE,IAAI,EAAW,MAAM,iBAAiB,CAAA;AAE1E,OAAiB,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAY5C,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAEvD,MAAM,WAAW,SAAS,CACxB,CAAC,SAAS,YAAY,CAAC,GAAG,CAAC,EAC3B,aAAa,SAAS,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;IAEjD,MAAM,EAAE,CAAC,CAAA;IACT,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,GAAG,CAAA;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE;SAAG,CAAC,IAAI,CAAC,IAAI,MAAM,GAAG,GAAG;KAAE,CAAA;IACzC,QAAQ,CAAC,EAAE,C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ardRef(function FormInner({ schema, name, action, disabled
|
|
|
129
129
|
fieldRefs.current.set(fieldName, ref);
|
|
130
130
|
} }), fieldName in errors &&
|
|
131
131
|
renderErrorMessage(errors[fieldName], field), field.spec?.meta?.help && (_jsx("p", { className: "form__help", children: field.spec.meta.help }))] }))] }) })) }, key));
|
|
132
|
-
}), renderSubmit({ disabled }), useRecaptcha && (_jsxs("p", { className: "form__recaptcha-message", children: ["This site is protected by reCAPTCHA and the Google", ' ', _jsx("a", { href: "https://policies.google.com/privacy", target: "_blank", rel: "noopener", children: "Privacy Policy" }), ' ', "and", ' ', _jsx("a", { href: "https://policies.google.com/terms", target: "_blank", rel: "noopener", children: "Terms of Service" }), ' ', "apply."] }))] })) }));
|
|
132
|
+
}), renderSubmit({ disabled: disabled || status === 'pending' }), useRecaptcha && (_jsxs("p", { className: "form__recaptcha-message", children: ["This site is protected by reCAPTCHA and the Google", ' ', _jsx("a", { href: "https://policies.google.com/privacy", target: "_blank", rel: "noopener", children: "Privacy Policy" }), ' ', "and", ' ', _jsx("a", { href: "https://policies.google.com/terms", target: "_blank", rel: "noopener", children: "Terms of Service" }), ' ', "apply."] }))] })) }));
|
|
133
133
|
});
|
|
134
134
|
function Form(props, ref) {
|
|
135
135
|
const key = process.env.NEXT_PUBLIC_RECAPTCHA_KEY;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../src/components/modal.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../src/components/modal.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,iBAAiB,EAKlB,MAAM,OAAO,CAAA;AASd,UAAU,KAAK;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC5B,IAAI,EACJ,SAAS,EACT,SAAS,EACT,WAAmB,EACnB,aAAoB,EACpB,QAAQ,GACT,EAAE,iBAAiB,CAAC,KAAK,CAAC,2CA4E1B"}
|
package/components/modal.js
CHANGED
|
@@ -8,6 +8,7 @@ export default function Modal({ name, className, openAfter, dismissable = false,
|
|
|
8
8
|
const openTimer = useRef(null);
|
|
9
9
|
const ref = useRef(null);
|
|
10
10
|
const innerRef = useRef(null);
|
|
11
|
+
const documentRef = useRef(typeof document !== 'undefined' ? document : null);
|
|
11
12
|
const { isOpen, openModal, closeModal } = useModal(name);
|
|
12
13
|
useLockBodyScroll(isOpen && preventScroll);
|
|
13
14
|
useEffect(() => {
|
|
@@ -21,19 +22,35 @@ export default function Modal({ name, className, openAfter, dismissable = false,
|
|
|
21
22
|
}
|
|
22
23
|
if (!dismissed && openAfter) {
|
|
23
24
|
openTimer.current = setTimeout(() => {
|
|
24
|
-
|
|
25
|
+
if (!dismissed) {
|
|
26
|
+
openModal();
|
|
27
|
+
}
|
|
25
28
|
}, openAfter);
|
|
26
29
|
}
|
|
27
|
-
}, [dismissed, openAfter, openModal]);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
}, [isOpen, dismissed, openAfter, openModal]);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (isOpen) {
|
|
33
|
+
ref.current?.showModal();
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
ref.current?.close();
|
|
37
|
+
}
|
|
38
|
+
return () => {
|
|
39
|
+
ref.current?.close();
|
|
40
|
+
};
|
|
41
|
+
}, [isOpen]);
|
|
31
42
|
const close = useCallback(() => {
|
|
43
|
+
if (!isOpen)
|
|
44
|
+
return;
|
|
32
45
|
closeModal();
|
|
33
46
|
if (dismissable) {
|
|
34
47
|
local.setItem(`${name}-popup-dismissed`, 'true');
|
|
35
48
|
setDismissed(true);
|
|
36
49
|
}
|
|
37
|
-
}, [dismissable, name, closeModal]);
|
|
38
|
-
|
|
50
|
+
}, [isOpen, dismissable, name, closeModal]);
|
|
51
|
+
useEventListener('click', close, undefined, documentRef);
|
|
52
|
+
useEscape(documentRef, close, {
|
|
53
|
+
requireFocus: false,
|
|
54
|
+
});
|
|
55
|
+
return (_jsxs("dialog", { id: name, className: `modal ${className}`, ref: ref, children: [_jsxs("button", { className: 'modal__close', onClick: close, children: [_jsx("span", { className: "screenreader-text", children: "Close Modal" }), "\u00D7"] }), _jsx("div", { className: 'modal__inner', ref: innerRef, onClick: (event) => event.nativeEvent.stopImmediatePropagation(), children: children })] }));
|
|
39
56
|
}
|
package/config.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CSPDirectives } from 'csp-header';
|
|
2
|
+
export type CSPPresetGenerator = (...args: any[]) => Partial<CSPDirectives>;
|
|
3
|
+
export declare const cspConfig: CSPPresetGenerator;
|
|
4
|
+
export declare const recaptchaCspConfig: CSPPresetGenerator;
|
|
5
|
+
export declare const googleTagManagerCspConfig: CSPPresetGenerator;
|
|
6
|
+
export declare const facebookPixelCspConfig: CSPPresetGenerator;
|
|
7
|
+
export declare const typekitCspConfig: CSPPresetGenerator;
|
|
8
|
+
export declare const cloudflareCspConfig: CSPPresetGenerator;
|
|
9
|
+
//# sourceMappingURL=config.d.ts.map
|
package/config.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,aAAa,EAAE,MAAM,YAAY,CAAA;AAEhF,MAAM,MAAM,kBAAkB,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,aAAa,CAAC,CAAA;AAE3E,eAAO,MAAM,SAAS,EAAE,kBAatB,CAAA;AAEF,eAAO,MAAM,kBAAkB,EAAE,kBAO/B,CAAA;AAEF,eAAO,MAAM,yBAAyB,EAAE,kBA8CtC,CAAA;AAEF,eAAO,MAAM,sBAAsB,EAAE,kBAEnC,CAAA;AAEF,eAAO,MAAM,gBAAgB,EAAE,kBAK7B,CAAA;AAEF,eAAO,MAAM,mBAAmB,EAAE,kBAUhC,CAAA"}
|
package/config.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { EVAL, INLINE, SELF, NONE, DATA, BLOB } from 'csp-header';
|
|
2
|
+
export const cspConfig = () => ({
|
|
3
|
+
'default-src': [SELF],
|
|
4
|
+
'connect-src': [SELF],
|
|
5
|
+
'script-src': [SELF, INLINE, EVAL],
|
|
6
|
+
'style-src': [SELF, INLINE],
|
|
7
|
+
'img-src': [SELF, BLOB, DATA],
|
|
8
|
+
'font-src': [SELF, DATA],
|
|
9
|
+
'object-src': [NONE],
|
|
10
|
+
'media-src': [SELF, BLOB, DATA],
|
|
11
|
+
'frame-src': [SELF],
|
|
12
|
+
'frame-ancestors': [SELF],
|
|
13
|
+
'base-uri': [SELF],
|
|
14
|
+
'form-action': [SELF],
|
|
15
|
+
});
|
|
16
|
+
export const recaptchaCspConfig = () => ({
|
|
17
|
+
'connect-src': ['https://www.google.com/recaptcha/'],
|
|
18
|
+
'script-src': [
|
|
19
|
+
'https://www.google.com/recaptcha/',
|
|
20
|
+
'https://www.gstatic.com/recaptcha/',
|
|
21
|
+
],
|
|
22
|
+
'frame-src': ['https://www.google.com/recaptcha/'],
|
|
23
|
+
});
|
|
24
|
+
export const googleTagManagerCspConfig = () => ({
|
|
25
|
+
'connect-src': [
|
|
26
|
+
'www.googletagmanager.com',
|
|
27
|
+
'www.google.com',
|
|
28
|
+
'https://*.google-analytics.com',
|
|
29
|
+
'https://*.analytics.google.com',
|
|
30
|
+
'https://*.googletagmanager.com',
|
|
31
|
+
'https://pagead2.googlesyndication.com',
|
|
32
|
+
'https://www.googleadservices.com',
|
|
33
|
+
'https://googleads.g.doubleclick.net',
|
|
34
|
+
'https://www.google.com',
|
|
35
|
+
'https://google.com',
|
|
36
|
+
],
|
|
37
|
+
'script-src': [
|
|
38
|
+
'https://www.googletagmanager.com',
|
|
39
|
+
'https://googletagmanager.com',
|
|
40
|
+
'https://tagmanager.google.com',
|
|
41
|
+
'https://*.googletagmanager.com',
|
|
42
|
+
'https://www.googleadservices.com',
|
|
43
|
+
'https://www.google.com',
|
|
44
|
+
'https://pagead2.googlesyndication.com',
|
|
45
|
+
'https://googleads.g.doubleclick.net',
|
|
46
|
+
],
|
|
47
|
+
'frame-src': [
|
|
48
|
+
'https://www.googletagmanager.com',
|
|
49
|
+
],
|
|
50
|
+
'img-src': [
|
|
51
|
+
'www.googletagmanager.com',
|
|
52
|
+
'https://googletagmanager.com',
|
|
53
|
+
'https://ssl.gstatic.com',
|
|
54
|
+
'https://www.gstatic.com',
|
|
55
|
+
'https://*.google-analytics.com',
|
|
56
|
+
'https://*.googletagmanager.com',
|
|
57
|
+
'https://www.googletagmanager.com',
|
|
58
|
+
'https://googleads.g.doubleclick.net',
|
|
59
|
+
'https://www.google.com',
|
|
60
|
+
'https://pagead2.googlesyndication.com',
|
|
61
|
+
'https://www.googleadservices.com',
|
|
62
|
+
'https://google.com',
|
|
63
|
+
],
|
|
64
|
+
'style-src': [
|
|
65
|
+
'https://googletagmanager.com',
|
|
66
|
+
'https://tagmanager.google.com',
|
|
67
|
+
'https://fonts.googleapis.com',
|
|
68
|
+
],
|
|
69
|
+
'font-src': ['https://fonts.gstatic.com'],
|
|
70
|
+
});
|
|
71
|
+
export const facebookPixelCspConfig = () => ({
|
|
72
|
+
'script-src': ['https://connect.facebook.net'],
|
|
73
|
+
});
|
|
74
|
+
export const typekitCspConfig = () => ({
|
|
75
|
+
'script-src': ['use.typekit.net'],
|
|
76
|
+
'style-src': ['use.typekit.net'],
|
|
77
|
+
'img-src': ['p.typekit.net'],
|
|
78
|
+
'connect-src': ['performance.typekit.net'],
|
|
79
|
+
});
|
|
80
|
+
export const cloudflareCspConfig = () => ({
|
|
81
|
+
'script-src': [
|
|
82
|
+
SELF,
|
|
83
|
+
INLINE,
|
|
84
|
+
'ajax.cloudflare.com',
|
|
85
|
+
'static.cloudflareinsights.com',
|
|
86
|
+
'https://challenges.cloudflare.com',
|
|
87
|
+
],
|
|
88
|
+
'connect-src': ['cloudflareinsights.com'],
|
|
89
|
+
'frame-src': ['https://challenges.cloudflare.com'],
|
|
90
|
+
});
|
|
@@ -23,22 +23,31 @@ export default function useDraggableScroll(ref, { className, ...opts }) {
|
|
|
23
23
|
ref.current?.classList[fn](`${className}--draggable`);
|
|
24
24
|
}, [ref, className]);
|
|
25
25
|
const onDragStart = () => {
|
|
26
|
+
if (!isInViewport) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
26
29
|
setDragging(true);
|
|
27
30
|
ref.current?.classList.add(`${className}--dragging`);
|
|
28
31
|
};
|
|
29
32
|
const onDragMove = () => {
|
|
33
|
+
if (!isInViewport) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
30
36
|
if (timer.current && dragging) {
|
|
31
37
|
clearTimeout(timer.current);
|
|
32
38
|
}
|
|
33
39
|
};
|
|
34
40
|
const onDragEnd = () => {
|
|
41
|
+
if (!isInViewport) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
35
44
|
setDragging(false);
|
|
36
45
|
timer.current = setTimeout(() => {
|
|
37
46
|
ref.current?.classList.remove(`${className}--dragging`);
|
|
38
47
|
}, 100);
|
|
39
48
|
};
|
|
40
|
-
useEventListener('mousemove', onDragMove
|
|
41
|
-
useEventListener('mouseup', onDragEnd
|
|
49
|
+
useEventListener('mousemove', onDragMove);
|
|
50
|
+
useEventListener('mouseup', onDragEnd);
|
|
42
51
|
useEffect(() => {
|
|
43
52
|
if (!shouldScroll) {
|
|
44
53
|
setModifiedEvents({
|
package/hooks/use-escape.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
|
-
declare const useEscape: (ref: RefObject<HTMLElement | null>, callback: () => void
|
|
2
|
+
declare const useEscape: (ref: RefObject<HTMLElement | null>, callback: () => void, opts?: {
|
|
3
|
+
requireFocus: boolean;
|
|
4
|
+
}) => void;
|
|
3
5
|
export default useEscape;
|
|
4
6
|
//# sourceMappingURL=use-escape.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-escape.d.ts","sourceRoot":"","sources":["../src/hooks/use-escape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"use-escape.d.ts","sourceRoot":"","sources":["../src/hooks/use-escape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAU,MAAM,OAAO,CAAA;AAGzC,QAAA,MAAM,SAAS,GACb,KAAK,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAClC,UAAU,MAAM,IAAI,EACpB;;CAEC,SAqBF,CAAA;AAED,eAAe,SAAS,CAAA"}
|
package/hooks/use-escape.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { useRef } from 'react';
|
|
2
|
+
import useEventListener from './use-event-listener';
|
|
3
|
+
const useEscape = (ref, callback, opts = {
|
|
4
|
+
requireFocus: true,
|
|
5
|
+
}) => {
|
|
6
|
+
const documentRef = useRef(typeof document !== 'undefined' ? document : null);
|
|
3
7
|
useEventListener('keydown', (event) => {
|
|
4
|
-
if (
|
|
8
|
+
if ((opts.requireFocus == false ||
|
|
9
|
+
ref.current?.contains(document.activeElement)) &&
|
|
5
10
|
event.key === 'Escape') {
|
|
6
11
|
event.preventDefault();
|
|
7
12
|
callback();
|
|
8
13
|
}
|
|
9
|
-
},
|
|
14
|
+
}, undefined, documentRef);
|
|
10
15
|
};
|
|
11
16
|
export default useEscape;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export default function useEventListener<
|
|
6
|
-
export {};
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
export default function useEventListener<K extends keyof MediaQueryListEventMap>(eventName: K, handler: (event: MediaQueryListEventMap[K]) => void, options?: boolean | AddEventListenerOptions, element?: RefObject<MediaQueryList>, flag?: boolean): void;
|
|
3
|
+
export default function useEventListener<K extends keyof WindowEventMap>(eventName: K, handler: (event: WindowEventMap[K]) => void, options?: boolean | AddEventListenerOptions, element?: undefined, flag?: boolean): void;
|
|
4
|
+
export default function useEventListener<K extends keyof HTMLElementEventMap & keyof SVGElementEventMap, T extends Element = K extends keyof HTMLElementEventMap ? HTMLDivElement : SVGElement>(eventName: K, handler: ((event: HTMLElementEventMap[K]) => void) | ((event: SVGElementEventMap[K]) => void), options?: boolean | AddEventListenerOptions, element?: RefObject<T>, flag?: boolean): void;
|
|
5
|
+
export default function useEventListener<K extends keyof DocumentEventMap>(eventName: K, handler: (event: DocumentEventMap[K]) => void, options?: boolean | AddEventListenerOptions, element?: RefObject<Document>, flag?: boolean): void;
|
|
7
6
|
//# sourceMappingURL=use-event-listener.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-event-listener.d.ts","sourceRoot":"","sources":["../src/hooks/use-event-listener.ts"],"names":[],"mappings":"AAEA,KAAK,MAAM,
|
|
1
|
+
{"version":3,"file":"use-event-listener.d.ts","sourceRoot":"","sources":["../src/hooks/use-event-listener.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKtC,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,CAAC,SAAS,MAAM,sBAAsB,EAEtC,SAAS,EAAE,CAAC,EACZ,OAAO,EAAE,CAAC,KAAK,EAAE,sBAAsB,CAAC,CAAC,CAAC,KAAK,IAAI,EACnD,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,EAC3C,OAAO,CAAC,EAAE,SAAS,CAAC,cAAc,CAAC,EACnC,IAAI,CAAC,EAAE,OAAO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
|
+
import { useIsomorphicLayoutEffect } from 'usehooks-ts';
|
|
3
|
+
export default function useEventListener(eventName, handler, options, element, flag = true) {
|
|
4
4
|
// Create a ref that stores handler
|
|
5
|
-
const savedHandler = useRef(
|
|
6
|
-
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
elementRef.current = element || window;
|
|
9
|
-
}, [element]);
|
|
10
|
-
// Update ref.current value if handler changes.
|
|
11
|
-
// This allows our effect below to always get latest handler ...
|
|
12
|
-
// ... without us needing to pass it in effect deps array ...
|
|
13
|
-
// ... and potentially cause effect to re-run every render.
|
|
14
|
-
useEffect(() => {
|
|
5
|
+
const savedHandler = useRef(handler);
|
|
6
|
+
useIsomorphicLayoutEffect(() => {
|
|
15
7
|
savedHandler.current = handler;
|
|
16
8
|
}, [handler]);
|
|
17
9
|
useEffect(() => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const isSupported = elementRef.current && elementRef.current.addEventListener;
|
|
21
|
-
if (!isSupported)
|
|
10
|
+
const targetElement = element?.current ?? window;
|
|
11
|
+
if (!(targetElement && targetElement.addEventListener))
|
|
22
12
|
return;
|
|
23
13
|
// Create event listener that calls handler function stored in ref
|
|
24
|
-
const
|
|
14
|
+
const listener = (event) => {
|
|
15
|
+
savedHandler.current(event);
|
|
16
|
+
};
|
|
25
17
|
if (flag) {
|
|
26
|
-
|
|
27
|
-
elementRef.current?.addEventListener(eventName, eventListener, options);
|
|
18
|
+
targetElement.addEventListener(eventName, listener, options);
|
|
28
19
|
}
|
|
29
20
|
else {
|
|
30
|
-
|
|
21
|
+
targetElement.removeEventListener(eventName, listener, options);
|
|
31
22
|
}
|
|
32
23
|
// Remove event listener on cleanup
|
|
33
24
|
return () => {
|
|
34
|
-
|
|
25
|
+
targetElement.removeEventListener(eventName, listener, options);
|
|
35
26
|
};
|
|
36
|
-
}, [eventName,
|
|
27
|
+
}, [eventName, element, options, flag]);
|
|
37
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-hide-on-scroll.d.ts","sourceRoot":"","sources":["../src/hooks/use-hide-on-scroll.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,YAAY,GAAE,OAAe,GAC5B,OAAO,
|
|
1
|
+
{"version":3,"file":"use-hide-on-scroll.d.ts","sourceRoot":"","sources":["../src/hooks/use-hide-on-scroll.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,YAAY,GAAE,OAAe,GAC5B,OAAO,CA2CT"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useEventListener } from '../hooks';
|
|
2
1
|
import { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import useEventListener from './use-event-listener';
|
|
3
3
|
export default function useHideOnScroll(hiddenOnLoad = false) {
|
|
4
4
|
const [hidden, setHidden] = useState(hiddenOnLoad);
|
|
5
5
|
const handleScroll = useCallback(() => {
|
|
@@ -26,9 +26,9 @@ export default function useHideOnScroll(hiddenOnLoad = false) {
|
|
|
26
26
|
useEffect(() => {
|
|
27
27
|
handleScroll();
|
|
28
28
|
}, []);
|
|
29
|
-
useEventListener('scroll', handleScroll, { passive: true }
|
|
30
|
-
useEventListener('resize', handleLoad, { passive: true }
|
|
31
|
-
useEventListener('popstate', handleLoad, { passive: true }
|
|
32
|
-
useEventListener('pageshow', handleLoad, { passive: true }
|
|
29
|
+
useEventListener('scroll', handleScroll, { passive: true });
|
|
30
|
+
useEventListener('resize', handleLoad, { passive: true });
|
|
31
|
+
useEventListener('popstate', handleLoad, { passive: true });
|
|
32
|
+
useEventListener('pageshow', handleLoad, { passive: true });
|
|
33
33
|
return hidden;
|
|
34
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-parallax.d.ts","sourceRoot":"","sources":["../src/hooks/use-parallax.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,WAAW,CACjC,KAAK,EAAE,WAAW,EAAE,EACpB,IAAI,GAAE,OAAc,
|
|
1
|
+
{"version":3,"file":"use-parallax.d.ts","sourceRoot":"","sources":["../src/hooks/use-parallax.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,WAAW,CACjC,KAAK,EAAE,WAAW,EAAE,EACpB,IAAI,GAAE,OAAc,QA0BrB"}
|
package/hooks/use-parallax.js
CHANGED
|
@@ -3,6 +3,9 @@ import { useCallback } from 'react';
|
|
|
3
3
|
export default function useParallax(items, flag = true) {
|
|
4
4
|
const isMotionAllowed = useMotionAllowed();
|
|
5
5
|
const onScroll = useCallback((event) => {
|
|
6
|
+
if (!flag || !isMotionAllowed) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
6
9
|
items.forEach((item, index) => {
|
|
7
10
|
if (!item) {
|
|
8
11
|
return;
|
|
@@ -12,6 +15,6 @@ export default function useParallax(items, flag = true) {
|
|
|
12
15
|
item.style.transform = `translate3d(0, ${(box.top / window.innerHeight) * 100 * (1 + index / 500)}%, 0)`;
|
|
13
16
|
});
|
|
14
17
|
});
|
|
15
|
-
}, [items]);
|
|
16
|
-
useEventListener('scroll', onScroll, { passive: true }
|
|
18
|
+
}, [items, flag, isMotionAllowed]);
|
|
19
|
+
useEventListener('scroll', onScroll, { passive: true });
|
|
17
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-slideshow.d.ts","sourceRoot":"","sources":["../src/hooks/use-slideshow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAuB,MAAM,OAAO,CAAA;AAG7D,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,YAAY,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAA;IAChD,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,CAAC,KAAK,EAAE,MA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