@becklyn/next 4.2.6 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/lib/debounce.d.ts +2 -0
- package/dist/cjs/lib/debounce.d.ts.map +1 -0
- package/dist/cjs/lib/debounce.js +13 -0
- package/dist/cjs/lib/fetcher.d.ts +2 -0
- package/dist/cjs/lib/fetcher.d.ts.map +1 -0
- package/dist/cjs/lib/fetcher.js +5 -0
- package/dist/cjs/lib/useDebounce.d.ts +6 -0
- package/dist/cjs/lib/useDebounce.d.ts.map +1 -0
- package/dist/cjs/lib/useDebounce.js +11 -0
- package/dist/cjs/lib/useInterval.d.ts +5 -0
- package/dist/cjs/lib/useInterval.d.ts.map +1 -0
- package/dist/cjs/lib/useInterval.js +40 -0
- package/dist/cjs/lib/useIsDocumentHidden.d.ts +2 -0
- package/dist/cjs/lib/useIsDocumentHidden.d.ts.map +1 -0
- package/dist/cjs/lib/useIsDocumentHidden.js +14 -0
- package/dist/cjs/lib/useScrollAway.d.ts +6 -0
- package/dist/cjs/lib/useScrollAway.d.ts.map +1 -0
- package/dist/cjs/lib/useScrollAway.js +47 -0
- package/dist/cjs/lib/useTimeout.d.ts +5 -0
- package/dist/cjs/lib/useTimeout.d.ts.map +1 -0
- package/dist/cjs/lib/useTimeout.js +27 -0
- package/dist/cjs/types/prettify.d.ts +4 -0
- package/dist/cjs/types/prettify.d.ts.map +1 -0
- package/dist/cjs/types/prettify.js +2 -0
- package/dist/cjs/types/style.d.ts +5 -0
- package/dist/cjs/types/style.d.ts.map +1 -1
- package/dist/es/contentful/imageLoader.js +1 -5
- package/dist/es/contentful/inspector.js +18 -24
- package/dist/es/error/ErrorBoundary.js +2 -6
- package/dist/es/format/phone.js +1 -5
- package/dist/es/lib/click.js +4 -8
- package/dist/es/lib/debounce.d.ts +2 -0
- package/dist/es/lib/debounce.d.ts.map +1 -0
- package/dist/es/lib/debounce.js +9 -0
- package/dist/es/lib/escape.js +3 -7
- package/dist/es/lib/fetcher.d.ts +2 -0
- package/dist/es/lib/fetcher.d.ts.map +1 -0
- package/dist/es/lib/fetcher.js +1 -0
- package/dist/es/lib/focusTrap.js +10 -15
- package/dist/es/lib/geo.js +5 -10
- package/dist/es/lib/intersection.js +4 -8
- package/dist/es/lib/isMounted.js +7 -12
- package/dist/es/lib/shortcut.js +3 -7
- package/dist/es/lib/sleep.js +1 -5
- package/dist/es/lib/slider.js +11 -18
- package/dist/es/lib/staticContent.js +5 -9
- package/dist/es/lib/typeChecks.js +5 -13
- package/dist/es/lib/useDebounce.d.ts +6 -0
- package/dist/es/lib/useDebounce.d.ts.map +1 -0
- package/dist/es/lib/useDebounce.js +7 -0
- package/dist/es/lib/useInterval.d.ts +5 -0
- package/dist/es/lib/useInterval.d.ts.map +1 -0
- package/dist/es/lib/useInterval.js +36 -0
- package/dist/es/lib/useIsDocumentHidden.d.ts +2 -0
- package/dist/es/lib/useIsDocumentHidden.d.ts.map +1 -0
- package/dist/es/lib/useIsDocumentHidden.js +10 -0
- package/dist/es/lib/useMediaQuery.js +5 -9
- package/dist/es/lib/useScrollAway.d.ts +6 -0
- package/dist/es/lib/useScrollAway.d.ts.map +1 -0
- package/dist/es/lib/useScrollAway.js +43 -0
- package/dist/es/lib/useTimeout.d.ts +5 -0
- package/dist/es/lib/useTimeout.d.ts.map +1 -0
- package/dist/es/lib/useTimeout.js +23 -0
- package/dist/es/mock/block.js +1 -5
- package/dist/es/rte/generators.js +18 -30
- package/dist/es/rte/index.js +7 -11
- package/dist/es/structuredData/index.js +3 -7
- package/dist/es/tracking/cookiebot/index.js +17 -26
- package/dist/es/tracking/cookiebot/types.js +1 -2
- package/dist/es/tracking/gtm/index.js +18 -30
- package/dist/es/tracking/gtm/types.js +1 -2
- package/dist/es/tracking/index.js +1 -4
- package/dist/es/types/block.js +1 -2
- package/dist/es/types/prettify.d.ts +4 -0
- package/dist/es/types/prettify.d.ts.map +1 -0
- package/dist/es/types/prettify.js +1 -0
- package/dist/es/types/preview.js +1 -2
- package/dist/es/types/structuredData.js +1 -2
- package/dist/es/types/style.d.ts +5 -0
- package/dist/es/types/style.d.ts.map +1 -1
- package/dist/es/types/style.js +1 -2
- package/package.json +11 -5
- package/scss/story/story.scss +34 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../../lib/debounce.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,IAAI,EAAE,MAAM,MAAM,KAAG,CAAC,MAAM,IAAI,CAUpE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.debounce = void 0;
|
|
4
|
+
const debounce = (func, wait) => {
|
|
5
|
+
let timeout = null;
|
|
6
|
+
return () => {
|
|
7
|
+
if (timeout) {
|
|
8
|
+
clearTimeout(timeout);
|
|
9
|
+
}
|
|
10
|
+
timeout = setTimeout(func, wait);
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
exports.debounce = debounce;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../../../lib/fetcher.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,GAAI,CAAC,EAAE,GAAG,MAAM,UAAU,CAAC,OAAO,KAAK,CAAC,KAAG,OAAO,CAAC,CAAC,CAC9B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DependencyList } from "react";
|
|
2
|
+
import { debounce } from "./debounce";
|
|
3
|
+
type Props = Parameters<typeof debounce>;
|
|
4
|
+
export declare const useDebounce: (fn: Props[0], ms: Props[1], deps?: DependencyList) => void;
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=useDebounce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDebounce.d.ts","sourceRoot":"","sources":["../../../lib/useDebounce.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAsB,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,KAAK,KAAK,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEzC,eAAO,MAAM,WAAW,GAAI,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,cAAc,SAI5E,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.useDebounce = void 0;
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const debounce_1 = require("./debounce");
|
|
7
|
+
const useDebounce = (fn, ms, deps) => {
|
|
8
|
+
const bounce = (0, react_1.useMemo)(() => (0, debounce_1.debounce)(fn, ms), [fn, ms]);
|
|
9
|
+
(0, react_1.useEffect)(() => (deps && Array.isArray(deps) ? bounce() : bounce()), [deps, bounce]);
|
|
10
|
+
};
|
|
11
|
+
exports.useDebounce = useDebounce;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInterval.d.ts","sourceRoot":"","sources":["../../../lib/useInterval.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,GACpB,UAAU,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,EACtC,UAAU,MAAM,EAChB,gBAAgB,MAAM;;;CAyCzB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.useInterval = void 0;
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const useInterval = (callback, interval, maxExecutions) => {
|
|
7
|
+
const intervalRef = (0, react_1.useRef)(null);
|
|
8
|
+
const executions = (0, react_1.useRef)(0);
|
|
9
|
+
const startInterval = (0, react_1.useCallback)(() => {
|
|
10
|
+
if (intervalRef.current) {
|
|
11
|
+
clearInterval(intervalRef.current);
|
|
12
|
+
}
|
|
13
|
+
executions.current = 0;
|
|
14
|
+
intervalRef.current = setInterval(() => {
|
|
15
|
+
executions.current++;
|
|
16
|
+
callback(executions.current);
|
|
17
|
+
if (undefined !== maxExecutions && executions.current >= maxExecutions) {
|
|
18
|
+
if (intervalRef.current) {
|
|
19
|
+
clearInterval(intervalRef.current);
|
|
20
|
+
intervalRef.current = null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}, interval);
|
|
24
|
+
}, [callback, interval, maxExecutions]);
|
|
25
|
+
const cancelInterval = (0, react_1.useCallback)(() => {
|
|
26
|
+
if (intervalRef.current) {
|
|
27
|
+
clearInterval(intervalRef.current);
|
|
28
|
+
intervalRef.current = null;
|
|
29
|
+
}
|
|
30
|
+
}, []);
|
|
31
|
+
(0, react_1.useEffect)(() => {
|
|
32
|
+
return () => {
|
|
33
|
+
if (intervalRef.current) {
|
|
34
|
+
clearInterval(intervalRef.current);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}, []);
|
|
38
|
+
return { startInterval, cancelInterval };
|
|
39
|
+
};
|
|
40
|
+
exports.useInterval = useInterval;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIsDocumentHidden.d.ts","sourceRoot":"","sources":["../../../lib/useIsDocumentHidden.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB,eAW/B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useIsDocumentHidden = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useIsDocumentHidden = () => {
|
|
6
|
+
const [isDocumentHidden, setIsDocumentHidden] = (0, react_1.useState)(document.hidden);
|
|
7
|
+
(0, react_1.useEffect)(() => {
|
|
8
|
+
const handleVisibilityChange = () => setIsDocumentHidden(document.hidden);
|
|
9
|
+
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
10
|
+
return () => document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
11
|
+
}, []);
|
|
12
|
+
return isDocumentHidden;
|
|
13
|
+
};
|
|
14
|
+
exports.useIsDocumentHidden = useIsDocumentHidden;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useScrollAway.d.ts","sourceRoot":"","sources":["../../../lib/useScrollAway.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa,GACtB,WAAW,MAAM,EACjB,UAAU;IACN,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC9B,SAoDJ,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.useScrollAway = void 0;
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const useScrollAway = (elementId, options) => {
|
|
7
|
+
(0, react_1.useEffect)(() => {
|
|
8
|
+
if (typeof document === "undefined") {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const element = document.getElementById(elementId);
|
|
12
|
+
if (!element) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const { scrollContainerQuery, elementHeight, reverseDirection = false } = options || {};
|
|
16
|
+
const scrollContainer = scrollContainerQuery
|
|
17
|
+
? document.querySelector(scrollContainerQuery)
|
|
18
|
+
: null;
|
|
19
|
+
const scrollAnchor = scrollContainer || document.documentElement;
|
|
20
|
+
const distanceToTransform = elementHeight !== null && elementHeight !== void 0 ? elementHeight : element.offsetHeight;
|
|
21
|
+
let lastScrollPosition = scrollAnchor.scrollTop;
|
|
22
|
+
let ticking = false;
|
|
23
|
+
const update = () => {
|
|
24
|
+
const currentScroll = scrollAnchor.scrollTop;
|
|
25
|
+
const isScrollingDown = currentScroll > lastScrollPosition;
|
|
26
|
+
const shouldHide = reverseDirection ? !isScrollingDown : isScrollingDown;
|
|
27
|
+
if (currentScroll >= distanceToTransform && shouldHide) {
|
|
28
|
+
element.style.transform = `translateY(${-distanceToTransform}px)`;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
element.style.transform = "translateY(0)";
|
|
32
|
+
}
|
|
33
|
+
lastScrollPosition = currentScroll;
|
|
34
|
+
ticking = false;
|
|
35
|
+
};
|
|
36
|
+
const handleScroll = () => {
|
|
37
|
+
if (!ticking) {
|
|
38
|
+
window.requestAnimationFrame(update);
|
|
39
|
+
ticking = true;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const targetElement = scrollContainer || window;
|
|
43
|
+
targetElement.addEventListener("scroll", handleScroll, { passive: true });
|
|
44
|
+
return () => targetElement.removeEventListener("scroll", handleScroll);
|
|
45
|
+
}, [elementId, options]);
|
|
46
|
+
};
|
|
47
|
+
exports.useScrollAway = useScrollAway;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTimeout.d.ts","sourceRoot":"","sources":["../../../lib/useTimeout.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU,GACnB,UAAU,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,EACtC,UAAU,MAAM,EAChB,gBAAgB,MAAM;;;CA0BzB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.useTimeout = void 0;
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const useTimeout = (callback, duration, maxExecutions) => {
|
|
7
|
+
const timeoutRef = (0, react_1.useRef)(null);
|
|
8
|
+
const executions = (0, react_1.useRef)(0);
|
|
9
|
+
const startTimeout = (0, react_1.useCallback)(() => {
|
|
10
|
+
if (undefined !== maxExecutions && maxExecutions <= executions.current) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
executions.current++;
|
|
14
|
+
timeoutRef.current = setTimeout(() => {
|
|
15
|
+
callback(executions.current);
|
|
16
|
+
}, duration);
|
|
17
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
18
|
+
}, []);
|
|
19
|
+
const cancelTimeout = (0, react_1.useCallback)(() => {
|
|
20
|
+
if (timeoutRef.current) {
|
|
21
|
+
clearTimeout(timeoutRef.current);
|
|
22
|
+
timeoutRef.current = null;
|
|
23
|
+
}
|
|
24
|
+
}, []);
|
|
25
|
+
return { startTimeout, cancelTimeout };
|
|
26
|
+
};
|
|
27
|
+
exports.useTimeout = useTimeout;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prettify.d.ts","sourceRoot":"","sources":["../../../types/prettify.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;KACrB,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACvB,GAAG,EAAE,CAAC"}
|
|
@@ -4,4 +4,9 @@ export interface StyledProps {
|
|
|
4
4
|
export type PropsWithClassName<P = object> = P & {
|
|
5
5
|
className?: string;
|
|
6
6
|
};
|
|
7
|
+
export type PropsWithClassNames<K extends string, P = object> = P & {
|
|
8
|
+
classNames?: {
|
|
9
|
+
[Key in K]?: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
7
12
|
//# sourceMappingURL=style.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../types/style.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,kBAAkB,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../types/style.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,kBAAkB,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAExE,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,GAAG,MAAM,IAAI,CAAC,GAAG;IAChE,UAAU,CAAC,EAAE;SACR,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM;KACtB,CAAC;CACL,CAAC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
"
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.imageLoader = void 0;
|
|
4
|
-
const imageLoader = ({ src, width, quality, format = "webp" }) => {
|
|
1
|
+
export const imageLoader = ({ src, width, quality, format = "webp" }) => {
|
|
5
2
|
let url = src;
|
|
6
3
|
if (!src.startsWith("https")) {
|
|
7
4
|
if (src.startsWith("http")) {
|
|
@@ -21,4 +18,3 @@ const imageLoader = ({ src, width, quality, format = "webp" }) => {
|
|
|
21
18
|
return src;
|
|
22
19
|
}
|
|
23
20
|
};
|
|
24
|
-
exports.imageLoader = imageLoader;
|
|
@@ -1,34 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
entryId: zod_1.z.string().optional(),
|
|
7
|
-
draftMode: zod_1.z.boolean().optional(),
|
|
8
|
-
locale: zod_1.z.string().optional(),
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const InspectableItemSchema = z.object({
|
|
3
|
+
entryId: z.string().optional(),
|
|
4
|
+
draftMode: z.boolean().optional(),
|
|
5
|
+
locale: z.string().optional(),
|
|
9
6
|
});
|
|
10
|
-
|
|
7
|
+
export const InspectableFieldSchema = z
|
|
11
8
|
.object({
|
|
12
|
-
fieldId:
|
|
13
|
-
assetId:
|
|
9
|
+
fieldId: z.string().optional(),
|
|
10
|
+
assetId: z.string().optional(),
|
|
14
11
|
})
|
|
15
|
-
.extend(
|
|
16
|
-
|
|
17
|
-
entryId:
|
|
18
|
-
draftMode:
|
|
19
|
-
locale:
|
|
20
|
-
fieldId:
|
|
21
|
-
assetId:
|
|
12
|
+
.extend(InspectableItemSchema.shape);
|
|
13
|
+
export const InspectorPropsSchema = z.object({
|
|
14
|
+
entryId: z.string().optional(),
|
|
15
|
+
draftMode: z.boolean().optional(),
|
|
16
|
+
locale: z.string().optional(),
|
|
17
|
+
fieldId: z.string().optional(),
|
|
18
|
+
assetId: z.string().optional(),
|
|
22
19
|
});
|
|
23
|
-
const getInspectorProps = (data) => {
|
|
20
|
+
export const getInspectorProps = (data) => {
|
|
24
21
|
if (!data) {
|
|
25
22
|
return {};
|
|
26
23
|
}
|
|
27
24
|
const { entryId, fieldId, assetId, draftMode, locale } = data;
|
|
28
25
|
return { entryId, fieldId, assetId, draftMode, locale };
|
|
29
26
|
};
|
|
30
|
-
|
|
31
|
-
const removeInspectorProps = (data) => {
|
|
27
|
+
export const removeInspectorProps = (data) => {
|
|
32
28
|
if (!data) {
|
|
33
29
|
return {};
|
|
34
30
|
}
|
|
@@ -36,8 +32,7 @@ const removeInspectorProps = (data) => {
|
|
|
36
32
|
const { entryId, fieldId, assetId, draftMode, locale, ...props } = data;
|
|
37
33
|
return props;
|
|
38
34
|
};
|
|
39
|
-
|
|
40
|
-
const inspector = (data) => {
|
|
35
|
+
export const inspector = (data) => {
|
|
41
36
|
if (!data) {
|
|
42
37
|
return {};
|
|
43
38
|
}
|
|
@@ -53,4 +48,3 @@ const inspector = (data) => {
|
|
|
53
48
|
"data-contentful-locale": locale,
|
|
54
49
|
};
|
|
55
50
|
};
|
|
56
|
-
exports.inspector = inspector;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.ErrorBoundary = void 0;
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
class ErrorBoundary extends react_1.Component {
|
|
2
|
+
import { Component } from "react";
|
|
3
|
+
export class ErrorBoundary extends Component {
|
|
7
4
|
constructor(props) {
|
|
8
5
|
super(props);
|
|
9
6
|
this.state = { hasError: false };
|
|
@@ -18,4 +15,3 @@ class ErrorBoundary extends react_1.Component {
|
|
|
18
15
|
return this.props.children;
|
|
19
16
|
}
|
|
20
17
|
}
|
|
21
|
-
exports.ErrorBoundary = ErrorBoundary;
|
package/dist/es/format/phone.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatPhone = void 0;
|
|
4
|
-
const formatPhone = (phone) => {
|
|
1
|
+
export const formatPhone = (phone) => {
|
|
5
2
|
if (typeof phone === "number") {
|
|
6
3
|
return phone;
|
|
7
4
|
}
|
|
8
5
|
return phone.replace(/[-/)( ]/g, "").replace("+49", "0049");
|
|
9
6
|
};
|
|
10
|
-
exports.formatPhone = formatPhone;
|
package/dist/es/lib/click.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const useClickOutside = ({ callback }) => {
|
|
6
|
-
const ref = (0, react_1.useRef)(null);
|
|
7
|
-
(0, react_1.useEffect)(() => {
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
export const useClickOutside = ({ callback }) => {
|
|
3
|
+
const ref = useRef(null);
|
|
4
|
+
useEffect(() => {
|
|
8
5
|
const handleClickOutside = (event) => {
|
|
9
6
|
if (ref.current && !ref.current.contains(event.target)) {
|
|
10
7
|
callback(event);
|
|
@@ -15,4 +12,3 @@ const useClickOutside = ({ callback }) => {
|
|
|
15
12
|
});
|
|
16
13
|
return ref;
|
|
17
14
|
};
|
|
18
|
-
exports.useClickOutside = useClickOutside;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../../lib/debounce.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,IAAI,EAAE,MAAM,MAAM,KAAG,CAAC,MAAM,IAAI,CAUpE,CAAC"}
|
package/dist/es/lib/escape.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const useEscapeListener = (callback, deps, capture = false) => {
|
|
6
|
-
(0, react_1.useEffect)(() => {
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
export const useEscapeListener = (callback, deps, capture = false) => {
|
|
3
|
+
useEffect(() => {
|
|
7
4
|
const onKeyDown = (e) => {
|
|
8
5
|
if (e.key === "Escape") {
|
|
9
6
|
callback(e);
|
|
@@ -15,4 +12,3 @@ const useEscapeListener = (callback, deps, capture = false) => {
|
|
|
15
12
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
16
13
|
deps ? [...deps, capture] : undefined);
|
|
17
14
|
};
|
|
18
|
-
exports.useEscapeListener = useEscapeListener;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../../../lib/fetcher.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,GAAI,CAAC,EAAE,GAAG,MAAM,UAAU,CAAC,OAAO,KAAK,CAAC,KAAG,OAAO,CAAC,CAAC,CAC9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const fetcher = (...args) => fetch(...args).then(res => res.json());
|
package/dist/es/lib/focusTrap.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.useTrapFocus = exports.FOCUSABLE_ELEMENTS = exports.checkCanFocusTrap = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const checkCanFocusTrap = async (container) => {
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
+
export const checkCanFocusTrap = async (container) => {
|
|
6
3
|
const results = container.map(element => {
|
|
7
4
|
return new Promise(resolve => {
|
|
8
5
|
const interval = setInterval(() => {
|
|
@@ -15,19 +12,18 @@ const checkCanFocusTrap = async (container) => {
|
|
|
15
12
|
});
|
|
16
13
|
await Promise.all(results);
|
|
17
14
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const update = (0, react_1.useCallback)(() => {
|
|
15
|
+
export const FOCUSABLE_ELEMENTS = 'button:not([tabindex="-1"]), [href]:not([tabindex="-1"]), input:not([tabindex="-1"]), select:not([tabindex="-1"]), textarea:not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])';
|
|
16
|
+
export const useTrapFocus = (container) => {
|
|
17
|
+
const ref = useRef(null);
|
|
18
|
+
const [nodes, setNodes] = useState(null);
|
|
19
|
+
const update = useCallback(() => {
|
|
24
20
|
const el = ref.current || container;
|
|
25
21
|
if (!el) {
|
|
26
22
|
return;
|
|
27
23
|
}
|
|
28
|
-
setNodes(Array.from(el.querySelectorAll(
|
|
24
|
+
setNodes(Array.from(el.querySelectorAll(FOCUSABLE_ELEMENTS)));
|
|
29
25
|
}, [container]);
|
|
30
|
-
|
|
26
|
+
useEffect(() => {
|
|
31
27
|
const el = ref.current || container;
|
|
32
28
|
if (!el) {
|
|
33
29
|
return;
|
|
@@ -35,7 +31,7 @@ const useTrapFocus = (container) => {
|
|
|
35
31
|
// eslint-disable-next-line react-hooks/set-state-in-effect
|
|
36
32
|
update();
|
|
37
33
|
}, [container, update]);
|
|
38
|
-
|
|
34
|
+
useEffect(() => {
|
|
39
35
|
const el = ref.current || container;
|
|
40
36
|
if (!el || !nodes) {
|
|
41
37
|
return;
|
|
@@ -62,4 +58,3 @@ const useTrapFocus = (container) => {
|
|
|
62
58
|
}, [container, nodes]);
|
|
63
59
|
return [ref, { update }];
|
|
64
60
|
};
|
|
65
|
-
exports.useTrapFocus = useTrapFocus;
|
package/dist/es/lib/geo.js
CHANGED
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.useGeoLocation = exports.getGeoLocation = void 0;
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const getGeoLocation = async () => {
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
export const getGeoLocation = async () => {
|
|
7
4
|
if (navigator && "geolocation" in navigator) {
|
|
8
5
|
return new Promise((resolve, reject) => {
|
|
9
6
|
navigator.geolocation.getCurrentPosition(resolve, reject);
|
|
10
7
|
});
|
|
11
8
|
}
|
|
12
9
|
};
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
const [location, setLocation] = (0, react_1.useState)();
|
|
10
|
+
export const useGeoLocation = () => {
|
|
11
|
+
const [location, setLocation] = useState();
|
|
16
12
|
const onClick = async () => {
|
|
17
|
-
const l = await
|
|
13
|
+
const l = await getGeoLocation();
|
|
18
14
|
setLocation(l);
|
|
19
15
|
return l;
|
|
20
16
|
};
|
|
21
17
|
return [onClick, location];
|
|
22
18
|
};
|
|
23
|
-
exports.useGeoLocation = useGeoLocation;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const useIntersection = ({ ref, defaultValue = false, callback, filter, options, dependencies, }) => {
|
|
7
|
-
const [visible, setVisible] = (0, react_1.useState)(defaultValue);
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
export const useIntersection = ({ ref, defaultValue = false, callback, filter, options, dependencies, }) => {
|
|
4
|
+
const [visible, setVisible] = useState(defaultValue);
|
|
8
5
|
const { current } = ref;
|
|
9
|
-
|
|
6
|
+
useEffect(() => {
|
|
10
7
|
const observer = new IntersectionObserver(entries => {
|
|
11
8
|
entries.forEach(entry => {
|
|
12
9
|
const isVisible = filter ? filter(entry) : entry.isIntersecting;
|
|
@@ -24,4 +21,3 @@ const useIntersection = ({ ref, defaultValue = false, callback, filter, options,
|
|
|
24
21
|
}, [current, ...(dependencies ?? [])]);
|
|
25
22
|
return visible;
|
|
26
23
|
};
|
|
27
|
-
exports.useIntersection = useIntersection;
|
package/dist/es/lib/isMounted.js
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const useIsMounted = () => {
|
|
6
|
-
const [isMounted, setIsMounted] = (0, react_1.useState)(false);
|
|
7
|
-
(0, react_1.useEffect)(() => {
|
|
1
|
+
import { useEffect, useLayoutEffect, useState } from "react";
|
|
2
|
+
export const useIsMounted = () => {
|
|
3
|
+
const [isMounted, setIsMounted] = useState(false);
|
|
4
|
+
useEffect(() => {
|
|
8
5
|
// eslint-disable-next-line react-hooks/set-state-in-effect
|
|
9
6
|
setIsMounted(true);
|
|
10
7
|
}, []);
|
|
11
8
|
return isMounted;
|
|
12
9
|
};
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
(0, react_1.useLayoutEffect)(() => {
|
|
10
|
+
export const useIsLayoutMounted = () => {
|
|
11
|
+
const [isLayoutMounted, setIsLayoutMounted] = useState(false);
|
|
12
|
+
useLayoutEffect(() => {
|
|
17
13
|
// eslint-disable-next-line react-hooks/set-state-in-effect
|
|
18
14
|
setIsLayoutMounted(true);
|
|
19
15
|
}, []);
|
|
20
16
|
return isLayoutMounted;
|
|
21
17
|
};
|
|
22
|
-
exports.useIsLayoutMounted = useIsLayoutMounted;
|
package/dist/es/lib/shortcut.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const useShortcut = (key, callback, deps) => {
|
|
6
|
-
(0, react_1.useEffect)(() => {
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
export const useShortcut = (key, callback, deps) => {
|
|
3
|
+
useEffect(() => {
|
|
7
4
|
const onKeyDown = (e) => {
|
|
8
5
|
let input = "";
|
|
9
6
|
if (e.metaKey) {
|
|
@@ -28,4 +25,3 @@ const useShortcut = (key, callback, deps) => {
|
|
|
28
25
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
29
26
|
}, deps);
|
|
30
27
|
};
|
|
31
|
-
exports.useShortcut = useShortcut;
|
package/dist/es/lib/sleep.js
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sleep = void 0;
|
|
4
|
-
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
|
5
|
-
exports.sleep = sleep;
|
|
1
|
+
export const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|