@koine/react 1.1.4 → 1.1.6

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.
@@ -11,5 +11,5 @@ type ElementRef = React.MutableRefObject<HTMLElement | undefined>;
11
11
  * - reused internal helper functions
12
12
  * - compacted object arguments in functions as plain argument list to improve compression
13
13
  */
14
- export declare const useScrollPosition: (effect: (currentPosition: Position, prevPosition: Position) => void, deps?: import("react").DependencyList, element?: ElementRef, useWindow?: boolean, wait?: number, boundingElement?: ElementRef) => void;
14
+ export declare const useScrollPosition: (effect: (currentPosition: Position, prevPosition: Position) => void, deps?: import("react").DependencyList, element?: ElementRef, boundingElement?: ElementRef, wait?: number) => void;
15
15
  export default useScrollPosition;
@@ -1,19 +1,20 @@
1
1
  import { useRef } from "react";
2
2
  import { isBrowser } from "@koine/utils";
3
3
  import { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect";
4
+ import { listenScroll } from "@koine/dom";
4
5
  var zeroPosition = { x: 0, y: 0 };
5
6
  var getClientRect = function (element) {
6
7
  return element === null || element === void 0 ? void 0 : element.getBoundingClientRect();
7
8
  };
8
- var getScrollPosition = function (element, useWindow, boundingElement) {
9
+ var getScrollPosition = function (element, boundingElement) {
9
10
  if (!isBrowser) {
10
11
  return zeroPosition;
11
12
  }
12
- if (useWindow) {
13
+ if (!boundingElement) {
13
14
  return { x: window.scrollX, y: window.scrollY };
14
15
  }
15
16
  var targetPosition = getClientRect((element === null || element === void 0 ? void 0 : element.current) || document.body);
16
- var containerPosition = getClientRect(boundingElement === null || boundingElement === void 0 ? void 0 : boundingElement.current);
17
+ var containerPosition = getClientRect(boundingElement.current);
17
18
  if (!targetPosition) {
18
19
  return zeroPosition;
19
20
  }
@@ -31,18 +32,17 @@ var getScrollPosition = function (element, useWindow, boundingElement) {
31
32
  * - reused internal helper functions
32
33
  * - compacted object arguments in functions as plain argument list to improve compression
33
34
  */
34
- export var useScrollPosition = function (effect, deps, element, useWindow, wait, boundingElement) {
35
+ export var useScrollPosition = function (effect, deps, element, boundingElement, wait) {
35
36
  if (deps === void 0) { deps = []; }
36
- var position = useRef(getScrollPosition(null, useWindow, boundingElement));
37
+ var position = useRef(getScrollPosition(null, boundingElement));
37
38
  var throttleTimeout = null;
38
39
  var callBack = function () {
39
- var current = getScrollPosition(element, useWindow, boundingElement);
40
+ var current = getScrollPosition(element, boundingElement);
40
41
  effect(current, position.current);
41
42
  position.current = current;
42
43
  throttleTimeout = null;
43
44
  };
44
45
  useIsomorphicLayoutEffect(function () {
45
- var _a;
46
46
  if (!isBrowser) {
47
47
  return undefined;
48
48
  }
@@ -56,22 +56,9 @@ export var useScrollPosition = function (effect, deps, element, useWindow, wait,
56
56
  callBack();
57
57
  }
58
58
  };
59
- if (boundingElement) {
60
- (_a = boundingElement.current) === null || _a === void 0 ? void 0 : _a.addEventListener("scroll", handleScroll, {
61
- passive: true,
62
- });
63
- }
64
- else {
65
- window.addEventListener("scroll", handleScroll, { passive: true });
66
- }
59
+ var listener = listenScroll(handleScroll, boundingElement === null || boundingElement === void 0 ? void 0 : boundingElement.current);
67
60
  return function () {
68
- var _a;
69
- if (boundingElement) {
70
- (_a = boundingElement.current) === null || _a === void 0 ? void 0 : _a.removeEventListener("scroll", handleScroll);
71
- }
72
- else {
73
- window.removeEventListener("scroll", handleScroll);
74
- }
61
+ listener();
75
62
  if (throttleTimeout) {
76
63
  clearTimeout(throttleTimeout);
77
64
  }
@@ -1,6 +1,6 @@
1
1
  import { useCallback, useEffect, useState } from "react";
2
2
  import { noop } from "@koine/utils";
3
- import { /* listenScroll, */ on } from "@koine/dom";
3
+ import { listenScroll } from "@koine/dom";
4
4
  export var useScrollThreshold = function (threshold, callback) {
5
5
  var _a = useState(false), isBelow = _a[0], setIsBelow = _a[1];
6
6
  var handler = useCallback(function () {
@@ -16,8 +16,8 @@ export var useScrollThreshold = function (threshold, callback) {
16
16
  }, [threshold, callback]);
17
17
  useEffect(function () {
18
18
  if (threshold) {
19
- // const listener = listenScroll(handler, 50);
20
- var listener = on(window, "scroll", handler, { passive: true });
19
+ // const listener = listenScrollThrottled(0, handler, 50);
20
+ var listener = listenScroll(handler);
21
21
  handler();
22
22
  return listener;
23
23
  }
@@ -1,2 +1,2 @@
1
- export declare function useSmoothScroll(): (to?: number | string, offset?: number, callback?: () => void, fallbackTimeout?: number, behavior?: ScrollBehavior) => void;
1
+ export declare function useSmoothScroll(disregardAutomaticFixedOffset?: boolean): (to?: number | string, customOffset?: number, callback?: () => void, fallbackTimeout?: number, behavior?: ScrollBehavior) => void;
2
2
  export default useSmoothScroll;
@@ -1,11 +1,10 @@
1
1
  import { useCallback } from "react";
2
2
  import { isNumber } from "@koine/utils";
3
- import { scrollTo } from "@koine/dom";
3
+ import { getOffsetTopSlim, scrollTo } from "@koine/dom";
4
4
  import { useFixedOffset } from "./useFixedOffset";
5
- export function useSmoothScroll() {
5
+ export function useSmoothScroll(disregardAutomaticFixedOffset) {
6
6
  var fixedOffset = useFixedOffset();
7
- var scroll = useCallback(function (to, offset, callback, fallbackTimeout, behavior) {
8
- if (offset === void 0) { offset = 0; }
7
+ var scroll = useCallback(function (to, customOffset, callback, fallbackTimeout, behavior) {
9
8
  var top = undefined;
10
9
  if (isNumber(to)) {
11
10
  top = to;
@@ -13,14 +12,17 @@ export function useSmoothScroll() {
13
12
  else if (to) {
14
13
  var el = document.getElementById(to);
15
14
  if (el) {
16
- top = el.getBoundingClientRect().top;
15
+ top = getOffsetTopSlim(el);
17
16
  }
18
17
  }
19
18
  if (isNumber(top)) {
20
- top = top + window.scrollY - (fixedOffset.current + offset);
19
+ top =
20
+ top +
21
+ (customOffset || 0) +
22
+ (disregardAutomaticFixedOffset ? 0 : fixedOffset.current);
21
23
  scrollTo(top, callback, fallbackTimeout, behavior);
22
24
  }
23
- }, [fixedOffset]);
25
+ }, [disregardAutomaticFixedOffset, fixedOffset]);
24
26
  return scroll;
25
27
  }
26
28
  export default useSmoothScroll;
@@ -1,2 +1,12 @@
1
- export declare function useWindowSize(): number[];
1
+ import { debounce } from "@koine/utils";
2
+ /**
3
+ * # Use `window` size
4
+ *
5
+ * @param args Optionally pass {@link debounce} arguments (`wait` and `immediate`)
6
+ *
7
+ * @returns An array with:
8
+ * 1) _width_: using `window.innerWidth`
9
+ * 2) _height_: using `window.innerHeight`
10
+ */
11
+ export declare function useWindowSize(wait?: Parameters<typeof debounce>[1], immediate?: Parameters<typeof debounce>[2]): readonly [number, number];
2
12
  export default useWindowSize;
@@ -1,15 +1,28 @@
1
1
  import { useEffect, useState } from "react";
2
- import { on } from "@koine/dom";
3
- export function useWindowSize() {
4
- var _a = useState([0, 0]), size = _a[0], setSize = _a[1];
2
+ import { listenResize, listenResizeDebounced } from "@koine/dom";
3
+ /**
4
+ * # Use `window` size
5
+ *
6
+ * @param args Optionally pass {@link debounce} arguments (`wait` and `immediate`)
7
+ *
8
+ * @returns An array with:
9
+ * 1) _width_: using `window.innerWidth`
10
+ * 2) _height_: using `window.innerHeight`
11
+ */
12
+ export function useWindowSize(wait, immediate) {
13
+ var _a = useState(0), width = _a[0], widthSet = _a[1];
14
+ var _b = useState(0), height = _b[0], heightSet = _b[1];
5
15
  useEffect(function () {
6
16
  function updateSize() {
7
- setSize([window.innerWidth, window.innerHeight]);
17
+ widthSet(window.innerWidth);
18
+ heightSet(window.innerHeight);
8
19
  }
9
- var listener = on(window, "resize", updateSize);
20
+ var listener = wait
21
+ ? listenResizeDebounced(0, updateSize, wait, immediate)
22
+ : listenResize(updateSize);
10
23
  updateSize();
11
24
  return listener;
12
- }, []);
13
- return size;
25
+ }, [wait, immediate]);
26
+ return [width, height];
14
27
  }
15
28
  export default useWindowSize;
@@ -5,16 +5,19 @@ var react_1 = require("react");
5
5
  var dom_1 = require("@koine/dom");
6
6
  var utils_1 = require("@koine/utils");
7
7
  var useIsomorphicLayoutEffect_1 = require("./useIsomorphicLayoutEffect");
8
- var observer;
9
8
  var inject = function (value) {
10
9
  (0, dom_1.injectCss)("useFixedOffset", "html{scroll-padding-top: ".concat(value, "px}"));
11
10
  };
12
11
  /**
12
+ * # Use fixed offset
13
+ *
13
14
  * Maybe use [ResizeObserver polyfill](https://github.com/juggle/resize-observer)
14
15
  *
15
16
  * @see https://web.dev/resize-observer/
17
+ *
18
+ * @param selector By default `[data-fixed]`: anyhting with the data attribute `data-fixed`
16
19
  */
17
- function useFixedOffset() {
20
+ function useFixedOffset(selector) {
18
21
  var fixedOffset = (0, react_1.useRef)(0);
19
22
  (0, useIsomorphicLayoutEffect_1.useIsomorphicLayoutEffect)(function () {
20
23
  var update = function () {
@@ -25,30 +28,30 @@ function useFixedOffset() {
25
28
  inject(newFixedOffset);
26
29
  };
27
30
  update();
28
- if (!observer && ResizeObserver) {
31
+ if (ResizeObserver) {
29
32
  // const elements = $$("[data-fixed]");
30
- observer = new ResizeObserver(function (entries) {
33
+ var observer_1 = new ResizeObserver(function (entries) {
31
34
  var newFixedOffset = 0;
32
35
  entries.forEach(function (entry) {
33
36
  newFixedOffset += entry.contentRect.height;
34
37
  });
35
38
  fixedOffset.current = newFixedOffset;
36
- var updateOnResize = (0, utils_1.debounce)(function () { return inject(newFixedOffset); }, 400);
39
+ var updateOnResize = (0, utils_1.debounce)(function () { return inject(newFixedOffset); }, 400, true);
37
40
  updateOnResize();
38
41
  });
39
- (0, dom_1.$each)("[data-fixed]", function ($el) {
40
- if (observer)
41
- observer.observe($el);
42
+ (0, dom_1.$each)(selector || "[data-fixed]", function ($el) {
43
+ if (observer_1)
44
+ observer_1.observe($el);
42
45
  });
43
46
  return function () {
44
- observer === null || observer === void 0 ? void 0 : observer.disconnect();
47
+ observer_1 === null || observer_1 === void 0 ? void 0 : observer_1.disconnect();
45
48
  };
46
49
  }
47
50
  else {
48
- var listener = (0, dom_1.listenResize)(update);
51
+ var listener = (0, dom_1.listenResizeDebounced)(0, update);
49
52
  return listener;
50
53
  }
51
- }, []);
54
+ }, [selector]);
52
55
  return fixedOffset;
53
56
  }
54
57
  exports.useFixedOffset = useFixedOffset;
@@ -137,15 +137,15 @@ function useMeasure(options) {
137
137
  // });
138
138
  (0, react_1.useEffect)(function () {
139
139
  if (scroll) {
140
- var listener = (0, dom_1.listenScroll)(forceRefresh, 100);
140
+ var listener = (0, dom_1.listenScrollDebounced)(0, forceRefresh, 100);
141
141
  return listener;
142
142
  }
143
- return function () { return 0; };
143
+ return utils_1.noop;
144
144
  }, [scroll, forceRefresh]);
145
145
  (0, react_1.useEffect)(function () {
146
- // const listener = listenResize(onWindowResize);
146
+ // const listener = listenResizeDebounced(onWindowResize);
147
147
  // return listener;
148
- var listener = (0, dom_1.listenResize)(forceRefresh, 100);
148
+ var listener = (0, dom_1.listenResizeDebounced)(0, forceRefresh, 100);
149
149
  return listener;
150
150
  }, [forceRefresh]);
151
151
  // respond to changes that are relevant for the listeners
@@ -4,19 +4,20 @@ exports.useScrollPosition = void 0;
4
4
  var react_1 = require("react");
5
5
  var utils_1 = require("@koine/utils");
6
6
  var useIsomorphicLayoutEffect_1 = require("./useIsomorphicLayoutEffect");
7
+ var dom_1 = require("@koine/dom");
7
8
  var zeroPosition = { x: 0, y: 0 };
8
9
  var getClientRect = function (element) {
9
10
  return element === null || element === void 0 ? void 0 : element.getBoundingClientRect();
10
11
  };
11
- var getScrollPosition = function (element, useWindow, boundingElement) {
12
+ var getScrollPosition = function (element, boundingElement) {
12
13
  if (!utils_1.isBrowser) {
13
14
  return zeroPosition;
14
15
  }
15
- if (useWindow) {
16
+ if (!boundingElement) {
16
17
  return { x: window.scrollX, y: window.scrollY };
17
18
  }
18
19
  var targetPosition = getClientRect((element === null || element === void 0 ? void 0 : element.current) || document.body);
19
- var containerPosition = getClientRect(boundingElement === null || boundingElement === void 0 ? void 0 : boundingElement.current);
20
+ var containerPosition = getClientRect(boundingElement.current);
20
21
  if (!targetPosition) {
21
22
  return zeroPosition;
22
23
  }
@@ -34,18 +35,17 @@ var getScrollPosition = function (element, useWindow, boundingElement) {
34
35
  * - reused internal helper functions
35
36
  * - compacted object arguments in functions as plain argument list to improve compression
36
37
  */
37
- var useScrollPosition = function (effect, deps, element, useWindow, wait, boundingElement) {
38
+ var useScrollPosition = function (effect, deps, element, boundingElement, wait) {
38
39
  if (deps === void 0) { deps = []; }
39
- var position = (0, react_1.useRef)(getScrollPosition(null, useWindow, boundingElement));
40
+ var position = (0, react_1.useRef)(getScrollPosition(null, boundingElement));
40
41
  var throttleTimeout = null;
41
42
  var callBack = function () {
42
- var current = getScrollPosition(element, useWindow, boundingElement);
43
+ var current = getScrollPosition(element, boundingElement);
43
44
  effect(current, position.current);
44
45
  position.current = current;
45
46
  throttleTimeout = null;
46
47
  };
47
48
  (0, useIsomorphicLayoutEffect_1.useIsomorphicLayoutEffect)(function () {
48
- var _a;
49
49
  if (!utils_1.isBrowser) {
50
50
  return undefined;
51
51
  }
@@ -59,22 +59,9 @@ var useScrollPosition = function (effect, deps, element, useWindow, wait, boundi
59
59
  callBack();
60
60
  }
61
61
  };
62
- if (boundingElement) {
63
- (_a = boundingElement.current) === null || _a === void 0 ? void 0 : _a.addEventListener("scroll", handleScroll, {
64
- passive: true,
65
- });
66
- }
67
- else {
68
- window.addEventListener("scroll", handleScroll, { passive: true });
69
- }
62
+ var listener = (0, dom_1.listenScroll)(handleScroll, boundingElement === null || boundingElement === void 0 ? void 0 : boundingElement.current);
70
63
  return function () {
71
- var _a;
72
- if (boundingElement) {
73
- (_a = boundingElement.current) === null || _a === void 0 ? void 0 : _a.removeEventListener("scroll", handleScroll);
74
- }
75
- else {
76
- window.removeEventListener("scroll", handleScroll);
77
- }
64
+ listener();
78
65
  if (throttleTimeout) {
79
66
  clearTimeout(throttleTimeout);
80
67
  }
@@ -19,8 +19,8 @@ var useScrollThreshold = function (threshold, callback) {
19
19
  }, [threshold, callback]);
20
20
  (0, react_1.useEffect)(function () {
21
21
  if (threshold) {
22
- // const listener = listenScroll(handler, 50);
23
- var listener = (0, dom_1.on)(window, "scroll", handler, { passive: true });
22
+ // const listener = listenScrollThrottled(0, handler, 50);
23
+ var listener = (0, dom_1.listenScroll)(handler);
24
24
  handler();
25
25
  return listener;
26
26
  }
@@ -5,10 +5,9 @@ var react_1 = require("react");
5
5
  var utils_1 = require("@koine/utils");
6
6
  var dom_1 = require("@koine/dom");
7
7
  var useFixedOffset_1 = require("./useFixedOffset");
8
- function useSmoothScroll() {
8
+ function useSmoothScroll(disregardAutomaticFixedOffset) {
9
9
  var fixedOffset = (0, useFixedOffset_1.useFixedOffset)();
10
- var scroll = (0, react_1.useCallback)(function (to, offset, callback, fallbackTimeout, behavior) {
11
- if (offset === void 0) { offset = 0; }
10
+ var scroll = (0, react_1.useCallback)(function (to, customOffset, callback, fallbackTimeout, behavior) {
12
11
  var top = undefined;
13
12
  if ((0, utils_1.isNumber)(to)) {
14
13
  top = to;
@@ -16,14 +15,17 @@ function useSmoothScroll() {
16
15
  else if (to) {
17
16
  var el = document.getElementById(to);
18
17
  if (el) {
19
- top = el.getBoundingClientRect().top;
18
+ top = (0, dom_1.getOffsetTopSlim)(el);
20
19
  }
21
20
  }
22
21
  if ((0, utils_1.isNumber)(top)) {
23
- top = top + window.scrollY - (fixedOffset.current + offset);
22
+ top =
23
+ top +
24
+ (customOffset || 0) +
25
+ (disregardAutomaticFixedOffset ? 0 : fixedOffset.current);
24
26
  (0, dom_1.scrollTo)(top, callback, fallbackTimeout, behavior);
25
27
  }
26
- }, [fixedOffset]);
28
+ }, [disregardAutomaticFixedOffset, fixedOffset]);
27
29
  return scroll;
28
30
  }
29
31
  exports.useSmoothScroll = useSmoothScroll;
@@ -3,17 +3,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useWindowSize = void 0;
4
4
  var react_1 = require("react");
5
5
  var dom_1 = require("@koine/dom");
6
- function useWindowSize() {
7
- var _a = (0, react_1.useState)([0, 0]), size = _a[0], setSize = _a[1];
6
+ /**
7
+ * # Use `window` size
8
+ *
9
+ * @param args Optionally pass {@link debounce} arguments (`wait` and `immediate`)
10
+ *
11
+ * @returns An array with:
12
+ * 1) _width_: using `window.innerWidth`
13
+ * 2) _height_: using `window.innerHeight`
14
+ */
15
+ function useWindowSize(wait, immediate) {
16
+ var _a = (0, react_1.useState)(0), width = _a[0], widthSet = _a[1];
17
+ var _b = (0, react_1.useState)(0), height = _b[0], heightSet = _b[1];
8
18
  (0, react_1.useEffect)(function () {
9
19
  function updateSize() {
10
- setSize([window.innerWidth, window.innerHeight]);
20
+ widthSet(window.innerWidth);
21
+ heightSet(window.innerHeight);
11
22
  }
12
- var listener = (0, dom_1.on)(window, "resize", updateSize);
23
+ var listener = wait
24
+ ? (0, dom_1.listenResizeDebounced)(0, updateSize, wait, immediate)
25
+ : (0, dom_1.listenResize)(updateSize);
13
26
  updateSize();
14
27
  return listener;
15
- }, []);
16
- return size;
28
+ }, [wait, immediate]);
29
+ return [width, height];
17
30
  }
18
31
  exports.useWindowSize = useWindowSize;
19
32
  exports.default = useWindowSize;
package/package.json CHANGED
@@ -44,6 +44,26 @@
44
44
  },
45
45
  "main": "./node/index.js",
46
46
  "types": "./index.d.ts",
47
- "version": "1.1.4",
47
+ "dependencies": {},
48
+ "peerDependencies": {
49
+ "styled-components": "5.3.6",
50
+ "framer-motion": "8.5.5",
51
+ "react": "18.2.0",
52
+ "@mui/base": "5.0.0-alpha.115",
53
+ "@koine/utils": "1.1.6",
54
+ "ts-debounce": "4.0.0",
55
+ "type-fest": "3.5.3",
56
+ "react-icons": "4.7.1",
57
+ "date-fns": "2.29.3",
58
+ "react-swipeable": "7.0.0",
59
+ "@tiptap/react": "2.0.0-beta.209",
60
+ "@tiptap/starter-kit": "2.0.0-beta.209",
61
+ "@kuus/yup": "1.0.0-beta.7",
62
+ "react-hook-form": "7.42.1",
63
+ "@koine/dom": "1.1.6",
64
+ "react-popper": "2.3.0",
65
+ "tslib": "2.5.0"
66
+ },
67
+ "version": "1.1.6",
48
68
  "module": "./index.js"
49
69
  }
@@ -1,18 +0,0 @@
1
- export type FaviconTagsProps = {
2
- name: string;
3
- color?: string;
4
- safariTabColor?: string;
5
- tileColor?: string;
6
- themeColor?: string;
7
- };
8
- /**
9
- * Favicon tags.
10
- *
11
- * This component is meant to be wrapped in a `<head>` manager component.
12
- *
13
- * These tags have been produced by [realfavicongenerator.net](https://realfavicongenerator.net/)
14
- * on _**16 Feb 2022**_.
15
- *
16
- * @see https://realfavicongenerator.net/
17
- */
18
- export declare const FaviconTags: ({ name, color, safariTabColor, tileColor, themeColor, }: FaviconTagsProps) => JSX.Element;
@@ -1,15 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- /**
3
- * Favicon tags.
4
- *
5
- * This component is meant to be wrapped in a `<head>` manager component.
6
- *
7
- * These tags have been produced by [realfavicongenerator.net](https://realfavicongenerator.net/)
8
- * on _**16 Feb 2022**_.
9
- *
10
- * @see https://realfavicongenerator.net/
11
- */
12
- export var FaviconTags = function (_a) {
13
- var name = _a.name, color = _a.color, safariTabColor = _a.safariTabColor, tileColor = _a.tileColor, themeColor = _a.themeColor;
14
- return (_jsxs(_Fragment, { children: [_jsx("link", { rel: "shortcut icon", href: "/favicon.ico", type: "image/x-icon" }), _jsx("link", { rel: "apple-touch-icon", sizes: "180x180", href: "/apple-touch-icon.png" }), _jsx("link", { rel: "icon", type: "image/png", sizes: "32x32", href: "/favicon-32x32.png" }), _jsx("link", { rel: "icon", type: "image/png", sizes: "16x16", href: "/favicon-16x16.png" }), _jsx("link", { rel: "manifest", href: "/site.webmanifest" }), _jsx("link", { rel: "mask-icon", href: "/safari-pinned-tab.svg", color: safariTabColor || color }), _jsx("meta", { name: "apple-mobile-web-app-title", content: name }), _jsx("meta", { name: "application-name", content: name }), _jsx("meta", { name: "msapplication-TileColor", content: tileColor || color }), _jsx("meta", { name: "theme-color", content: themeColor || color })] }));
15
- };
@@ -1 +0,0 @@
1
- export * from "./FaviconTags";
package/Favicon/index.js DELETED
@@ -1 +0,0 @@
1
- export * from "./FaviconTags";
@@ -1,6 +0,0 @@
1
- {
2
- "sideEffects": false,
3
- "module": "./index.js",
4
- "main": "../node/Favicon/index.js",
5
- "types": "./index.d.ts"
6
- }
package/hooks/useId.d.ts DELETED
@@ -1,5 +0,0 @@
1
- /**
2
- * FIXME: once we can move to react 18 just replace this import with `{ useId } from "react";`
3
- */
4
- export declare function useId(prefix?: string): string;
5
- export default useId;
package/hooks/useId.js DELETED
@@ -1,9 +0,0 @@
1
- import { uid } from "@koine/utils";
2
- /**
3
- * FIXME: once we can move to react 18 just replace this import with `{ useId } from "react";`
4
- */
5
- export function useId(prefix) {
6
- if (prefix === void 0) { prefix = "uid"; }
7
- return "".concat(prefix, "-").concat(uid());
8
- }
9
- export default useId;