@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.
Files changed (83) hide show
  1. package/dist/cjs/lib/debounce.d.ts +2 -0
  2. package/dist/cjs/lib/debounce.d.ts.map +1 -0
  3. package/dist/cjs/lib/debounce.js +13 -0
  4. package/dist/cjs/lib/fetcher.d.ts +2 -0
  5. package/dist/cjs/lib/fetcher.d.ts.map +1 -0
  6. package/dist/cjs/lib/fetcher.js +5 -0
  7. package/dist/cjs/lib/useDebounce.d.ts +6 -0
  8. package/dist/cjs/lib/useDebounce.d.ts.map +1 -0
  9. package/dist/cjs/lib/useDebounce.js +11 -0
  10. package/dist/cjs/lib/useInterval.d.ts +5 -0
  11. package/dist/cjs/lib/useInterval.d.ts.map +1 -0
  12. package/dist/cjs/lib/useInterval.js +40 -0
  13. package/dist/cjs/lib/useIsDocumentHidden.d.ts +2 -0
  14. package/dist/cjs/lib/useIsDocumentHidden.d.ts.map +1 -0
  15. package/dist/cjs/lib/useIsDocumentHidden.js +14 -0
  16. package/dist/cjs/lib/useScrollAway.d.ts +6 -0
  17. package/dist/cjs/lib/useScrollAway.d.ts.map +1 -0
  18. package/dist/cjs/lib/useScrollAway.js +47 -0
  19. package/dist/cjs/lib/useTimeout.d.ts +5 -0
  20. package/dist/cjs/lib/useTimeout.d.ts.map +1 -0
  21. package/dist/cjs/lib/useTimeout.js +27 -0
  22. package/dist/cjs/types/prettify.d.ts +4 -0
  23. package/dist/cjs/types/prettify.d.ts.map +1 -0
  24. package/dist/cjs/types/prettify.js +2 -0
  25. package/dist/cjs/types/style.d.ts +5 -0
  26. package/dist/cjs/types/style.d.ts.map +1 -1
  27. package/dist/es/contentful/imageLoader.js +1 -5
  28. package/dist/es/contentful/inspector.js +18 -24
  29. package/dist/es/error/ErrorBoundary.js +2 -6
  30. package/dist/es/format/phone.js +1 -5
  31. package/dist/es/lib/click.js +4 -8
  32. package/dist/es/lib/debounce.d.ts +2 -0
  33. package/dist/es/lib/debounce.d.ts.map +1 -0
  34. package/dist/es/lib/debounce.js +9 -0
  35. package/dist/es/lib/escape.js +3 -7
  36. package/dist/es/lib/fetcher.d.ts +2 -0
  37. package/dist/es/lib/fetcher.d.ts.map +1 -0
  38. package/dist/es/lib/fetcher.js +1 -0
  39. package/dist/es/lib/focusTrap.js +10 -15
  40. package/dist/es/lib/geo.js +5 -10
  41. package/dist/es/lib/intersection.js +4 -8
  42. package/dist/es/lib/isMounted.js +7 -12
  43. package/dist/es/lib/shortcut.js +3 -7
  44. package/dist/es/lib/sleep.js +1 -5
  45. package/dist/es/lib/slider.js +11 -18
  46. package/dist/es/lib/staticContent.js +5 -9
  47. package/dist/es/lib/typeChecks.js +5 -13
  48. package/dist/es/lib/useDebounce.d.ts +6 -0
  49. package/dist/es/lib/useDebounce.d.ts.map +1 -0
  50. package/dist/es/lib/useDebounce.js +7 -0
  51. package/dist/es/lib/useInterval.d.ts +5 -0
  52. package/dist/es/lib/useInterval.d.ts.map +1 -0
  53. package/dist/es/lib/useInterval.js +36 -0
  54. package/dist/es/lib/useIsDocumentHidden.d.ts +2 -0
  55. package/dist/es/lib/useIsDocumentHidden.d.ts.map +1 -0
  56. package/dist/es/lib/useIsDocumentHidden.js +10 -0
  57. package/dist/es/lib/useMediaQuery.js +5 -9
  58. package/dist/es/lib/useScrollAway.d.ts +6 -0
  59. package/dist/es/lib/useScrollAway.d.ts.map +1 -0
  60. package/dist/es/lib/useScrollAway.js +43 -0
  61. package/dist/es/lib/useTimeout.d.ts +5 -0
  62. package/dist/es/lib/useTimeout.d.ts.map +1 -0
  63. package/dist/es/lib/useTimeout.js +23 -0
  64. package/dist/es/mock/block.js +1 -5
  65. package/dist/es/rte/generators.js +18 -30
  66. package/dist/es/rte/index.js +7 -11
  67. package/dist/es/structuredData/index.js +3 -7
  68. package/dist/es/tracking/cookiebot/index.js +17 -26
  69. package/dist/es/tracking/cookiebot/types.js +1 -2
  70. package/dist/es/tracking/gtm/index.js +18 -30
  71. package/dist/es/tracking/gtm/types.js +1 -2
  72. package/dist/es/tracking/index.js +1 -4
  73. package/dist/es/types/block.js +1 -2
  74. package/dist/es/types/prettify.d.ts +4 -0
  75. package/dist/es/types/prettify.d.ts.map +1 -0
  76. package/dist/es/types/prettify.js +1 -0
  77. package/dist/es/types/preview.js +1 -2
  78. package/dist/es/types/structuredData.js +1 -2
  79. package/dist/es/types/style.d.ts +5 -0
  80. package/dist/es/types/style.d.ts.map +1 -1
  81. package/dist/es/types/style.js +1 -2
  82. package/package.json +11 -5
  83. package/scss/story/story.scss +34 -0
@@ -0,0 +1,2 @@
1
+ export declare const debounce: (func: () => void, wait: number) => (() => void);
2
+ //# sourceMappingURL=debounce.d.ts.map
@@ -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,2 @@
1
+ export declare const fetcher: <T>(...args: Parameters<typeof fetch>) => Promise<T>;
2
+ //# sourceMappingURL=fetcher.d.ts.map
@@ -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,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetcher = void 0;
4
+ const fetcher = (...args) => fetch(...args).then(res => res.json());
5
+ exports.fetcher = fetcher;
@@ -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,5 @@
1
+ export declare const useInterval: (callback: (executions: number) => void, interval: number, maxExecutions?: number) => {
2
+ startInterval: () => void;
3
+ cancelInterval: () => void;
4
+ };
5
+ //# sourceMappingURL=useInterval.d.ts.map
@@ -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,2 @@
1
+ export declare const useIsDocumentHidden: () => boolean;
2
+ //# sourceMappingURL=useIsDocumentHidden.d.ts.map
@@ -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,6 @@
1
+ export declare const useScrollAway: (elementId: string, options?: {
2
+ scrollContainerQuery?: string;
3
+ elementHeight?: number;
4
+ reverseDirection?: boolean;
5
+ }) => void;
6
+ //# sourceMappingURL=useScrollAway.d.ts.map
@@ -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,5 @@
1
+ export declare const useTimeout: (callback: (executions: number) => void, duration: number, maxExecutions?: number) => {
2
+ startTimeout: () => void;
3
+ cancelTimeout: () => void;
4
+ };
5
+ //# sourceMappingURL=useTimeout.d.ts.map
@@ -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,4 @@
1
+ export type Prettify<T> = {
2
+ [K in keyof T]: T[K];
3
+ } & {};
4
+ //# sourceMappingURL=prettify.d.ts.map
@@ -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"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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
- "use strict";
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.inspector = exports.removeInspectorProps = exports.getInspectorProps = exports.InspectorPropsSchema = exports.InspectableFieldSchema = exports.InspectableItemSchema = void 0;
4
- const zod_1 = require("zod");
5
- exports.InspectableItemSchema = zod_1.z.object({
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
- exports.InspectableFieldSchema = zod_1.z
7
+ export const InspectableFieldSchema = z
11
8
  .object({
12
- fieldId: zod_1.z.string().optional(),
13
- assetId: zod_1.z.string().optional(),
9
+ fieldId: z.string().optional(),
10
+ assetId: z.string().optional(),
14
11
  })
15
- .extend(exports.InspectableItemSchema.shape);
16
- exports.InspectorPropsSchema = zod_1.z.object({
17
- entryId: zod_1.z.string().optional(),
18
- draftMode: zod_1.z.boolean().optional(),
19
- locale: zod_1.z.string().optional(),
20
- fieldId: zod_1.z.string().optional(),
21
- assetId: zod_1.z.string().optional(),
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
- exports.getInspectorProps = getInspectorProps;
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
- exports.removeInspectorProps = removeInspectorProps;
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
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
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;
@@ -1,10 +1,6 @@
1
- "use strict";
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;
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useClickOutside = void 0;
4
- const react_1 = require("react");
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,2 @@
1
+ export declare const debounce: (func: () => void, wait: number) => (() => void);
2
+ //# sourceMappingURL=debounce.d.ts.map
@@ -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,9 @@
1
+ export const debounce = (func, wait) => {
2
+ let timeout = null;
3
+ return () => {
4
+ if (timeout) {
5
+ clearTimeout(timeout);
6
+ }
7
+ timeout = setTimeout(func, wait);
8
+ };
9
+ };
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useEscapeListener = void 0;
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,2 @@
1
+ export declare const fetcher: <T>(...args: Parameters<typeof fetch>) => Promise<T>;
2
+ //# sourceMappingURL=fetcher.d.ts.map
@@ -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());
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
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
- exports.checkCanFocusTrap = checkCanFocusTrap;
19
- exports.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"])';
20
- const useTrapFocus = (container) => {
21
- const ref = (0, react_1.useRef)(null);
22
- const [nodes, setNodes] = (0, react_1.useState)(null);
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(exports.FOCUSABLE_ELEMENTS)));
24
+ setNodes(Array.from(el.querySelectorAll(FOCUSABLE_ELEMENTS)));
29
25
  }, [container]);
30
- (0, react_1.useEffect)(() => {
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
- (0, react_1.useEffect)(() => {
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;
@@ -1,23 +1,18 @@
1
1
  "use client";
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
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
- exports.getGeoLocation = getGeoLocation;
14
- const useGeoLocation = () => {
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 (0, exports.getGeoLocation)();
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
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.useIntersection = void 0;
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
- (0, react_1.useEffect)(() => {
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;
@@ -1,22 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useIsLayoutMounted = exports.useIsMounted = void 0;
4
- const react_1 = require("react");
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
- exports.useIsMounted = useIsMounted;
14
- const useIsLayoutMounted = () => {
15
- const [isLayoutMounted, setIsLayoutMounted] = (0, react_1.useState)(false);
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;
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useShortcut = void 0;
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;
@@ -1,5 +1 @@
1
- "use strict";
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));