@mantine/hooks 5.0.0-alpha.2 → 5.0.0-alpha.5

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 (69) hide show
  1. package/cjs/index.js +0 -2
  2. package/cjs/index.js.map +1 -1
  3. package/cjs/use-click-outside/use-click-outside.js +3 -3
  4. package/cjs/use-clipboard/use-clipboard.js +4 -4
  5. package/cjs/use-counter/use-counter.js +2 -2
  6. package/cjs/use-debounced-value/use-debounced-value.js +7 -7
  7. package/cjs/use-did-update/use-did-update.js +3 -3
  8. package/cjs/use-disclosure/use-disclosure.js +2 -2
  9. package/cjs/use-document-visibility/use-document-visibility.js +3 -3
  10. package/cjs/use-event-listener/use-event-listener.js +3 -3
  11. package/cjs/use-focus-return/use-focus-return.js +2 -2
  12. package/cjs/use-focus-trap/use-focus-trap.js +5 -5
  13. package/cjs/use-focus-within/use-focus-within.js +5 -5
  14. package/cjs/use-force-update/use-force-update.js +2 -2
  15. package/cjs/use-fullscreen/use-fullscreen.js +8 -8
  16. package/cjs/use-hash/use-hash.js +2 -2
  17. package/cjs/use-hotkeys/use-hotkeys.js +2 -2
  18. package/cjs/use-hover/use-hover.js +6 -6
  19. package/cjs/use-id/use-id.js +21 -5
  20. package/cjs/use-id/use-id.js.map +1 -1
  21. package/cjs/use-idle/use-idle.js +4 -4
  22. package/cjs/use-input-state/use-input-state.js +2 -2
  23. package/cjs/use-intersection/use-intersection.js +4 -4
  24. package/cjs/use-interval/use-interval.js +3 -3
  25. package/cjs/use-isomorphic-effect/use-isomorphic-effect.js +2 -2
  26. package/cjs/use-list-state/use-list-state.js +2 -2
  27. package/cjs/use-list-state/use-list-state.js.map +1 -1
  28. package/cjs/use-local-storage/use-local-storage.js +5 -5
  29. package/cjs/use-logger/use-logger.js +2 -2
  30. package/cjs/use-media-query/use-media-query.js +4 -4
  31. package/cjs/use-merged-ref/use-merged-ref.js +2 -2
  32. package/cjs/use-mouse/use-mouse.js +4 -4
  33. package/cjs/use-move/use-move.js +8 -8
  34. package/cjs/use-network/use-network.js +4 -4
  35. package/cjs/use-page-leave/use-page-leave.js +2 -2
  36. package/cjs/use-pagination/use-pagination.js +3 -4
  37. package/cjs/use-pagination/use-pagination.js.map +1 -1
  38. package/cjs/use-queue/use-queue.js +2 -2
  39. package/cjs/use-resize-observer/use-resize-observer.js +6 -6
  40. package/cjs/use-scroll-into-view/use-scroll-into-view.js +8 -8
  41. package/cjs/use-scroll-lock/use-scroll-lock.js +7 -7
  42. package/cjs/use-set-state/use-set-state.js +2 -2
  43. package/cjs/use-shallow-effect/use-shallow-effect.js +4 -4
  44. package/cjs/use-toggle/use-toggle.js +2 -2
  45. package/cjs/use-uncontrolled/use-uncontrolled.js +8 -26
  46. package/cjs/use-uncontrolled/use-uncontrolled.js.map +1 -1
  47. package/cjs/use-validated-state/use-validated-state.js +4 -4
  48. package/cjs/use-viewport-size/use-viewport-size.js +3 -3
  49. package/cjs/use-window-event/use-window-event.js +2 -2
  50. package/cjs/use-window-scroll/use-window-scroll.js +2 -2
  51. package/esm/index.js +0 -1
  52. package/esm/index.js.map +1 -1
  53. package/esm/use-id/use-id.js +17 -5
  54. package/esm/use-id/use-id.js.map +1 -1
  55. package/esm/use-list-state/use-list-state.js.map +1 -1
  56. package/esm/use-pagination/use-pagination.js +1 -2
  57. package/esm/use-pagination/use-pagination.js.map +1 -1
  58. package/esm/use-uncontrolled/use-uncontrolled.js +8 -26
  59. package/esm/use-uncontrolled/use-uncontrolled.js.map +1 -1
  60. package/lib/index.d.ts +1 -1
  61. package/lib/index.d.ts.map +1 -1
  62. package/lib/use-id/use-id.d.ts +1 -1
  63. package/lib/use-id/use-id.d.ts.map +1 -1
  64. package/lib/use-list-state/use-list-state.d.ts +2 -2
  65. package/lib/use-list-state/use-list-state.d.ts.map +1 -1
  66. package/lib/use-pagination/use-pagination.d.ts.map +1 -1
  67. package/lib/use-uncontrolled/use-uncontrolled.d.ts +11 -9
  68. package/lib/use-uncontrolled/use-uncontrolled.d.ts.map +1 -1
  69. package/package.json +1 -1
package/cjs/index.js CHANGED
@@ -42,7 +42,6 @@ var useHotkeys = require('./use-hotkeys/use-hotkeys.js');
42
42
  var useFullscreen = require('./use-fullscreen/use-fullscreen.js');
43
43
  var useLogger = require('./use-logger/use-logger.js');
44
44
  var useHover = require('./use-hover/use-hover.js');
45
- var useUuid = require('./use-uuid/use-uuid.js');
46
45
  var useValidatedState = require('./use-validated-state/use-validated-state.js');
47
46
  var useOs = require('./use-os/use-os.js');
48
47
  var useSetState = require('./use-set-state/use-set-state.js');
@@ -106,7 +105,6 @@ exports.useHotkeys = useHotkeys.useHotkeys;
106
105
  exports.useFullscreen = useFullscreen.useFullscreen;
107
106
  exports.useLogger = useLogger.useLogger;
108
107
  exports.useHover = useHover.useHover;
109
- exports.useUuid = useUuid.useUuid;
110
108
  exports.useValidatedState = useValidatedState.useValidatedState;
111
109
  exports.useOs = useOs.useOs;
112
110
  exports.useSetState = useSetState.useSetState;
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -2,12 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
5
+ var React = require('react');
6
6
 
7
7
  const DEFAULT_EVENTS = ["mousedown", "touchstart"];
8
8
  function useClickOutside(handler, events, nodes) {
9
- const ref = react.useRef();
10
- react.useEffect(() => {
9
+ const ref = React.useRef();
10
+ React.useEffect(() => {
11
11
  const listener = (event) => {
12
12
  var _a;
13
13
  if (Array.isArray(nodes)) {
@@ -2,12 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
5
+ var React = require('react');
6
6
 
7
7
  function useClipboard({ timeout = 2e3 } = {}) {
8
- const [error, setError] = react.useState(null);
9
- const [copied, setCopied] = react.useState(false);
10
- const [copyTimeout, setCopyTimeout] = react.useState(null);
8
+ const [error, setError] = React.useState(null);
9
+ const [copied, setCopied] = React.useState(false);
10
+ const [copyTimeout, setCopyTimeout] = React.useState(null);
11
11
  const handleCopyResult = (value) => {
12
12
  clearTimeout(copyTimeout);
13
13
  setCopyTimeout(setTimeout(() => setCopied(false), timeout));
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
5
+ var React = require('react');
6
6
  var clamp = require('../utils/clamp/clamp.js');
7
7
 
8
8
  var __defProp = Object.defineProperty;
@@ -27,7 +27,7 @@ const DEFAULT_OPTIONS = {
27
27
  };
28
28
  function useCounter(initialValue = 0, options) {
29
29
  const { min, max } = __spreadValues(__spreadValues({}, DEFAULT_OPTIONS), options);
30
- const [count, setCount] = react.useState(clamp.clamp({ value: initialValue, min, max }));
30
+ const [count, setCount] = React.useState(clamp.clamp({ value: initialValue, min, max }));
31
31
  const increment = (delta = 1) => {
32
32
  setCount((current) => clamp.clamp({ value: current + delta, min, max }));
33
33
  };
@@ -2,15 +2,15 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
5
+ var React = require('react');
6
6
 
7
7
  function useDebouncedValue(value, wait, options = { leading: false }) {
8
- const [_value, setValue] = react.useState(value);
9
- const mountedRef = react.useRef(false);
10
- const timeoutRef = react.useRef(null);
11
- const cooldownRef = react.useRef(false);
8
+ const [_value, setValue] = React.useState(value);
9
+ const mountedRef = React.useRef(false);
10
+ const timeoutRef = React.useRef(null);
11
+ const cooldownRef = React.useRef(false);
12
12
  const cancel = () => window.clearTimeout(timeoutRef.current);
13
- react.useEffect(() => {
13
+ React.useEffect(() => {
14
14
  if (mountedRef.current) {
15
15
  if (!cooldownRef.current && options.leading) {
16
16
  cooldownRef.current = true;
@@ -24,7 +24,7 @@ function useDebouncedValue(value, wait, options = { leading: false }) {
24
24
  }
25
25
  }
26
26
  }, [value, options.leading]);
27
- react.useEffect(() => {
27
+ React.useEffect(() => {
28
28
  mountedRef.current = true;
29
29
  return cancel;
30
30
  }, []);
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
5
+ var React = require('react');
6
6
 
7
7
  function useDidUpdate(fn, dependencies) {
8
- const mounted = react.useRef(false);
9
- react.useEffect(() => {
8
+ const mounted = React.useRef(false);
9
+ React.useEffect(() => {
10
10
  if (mounted.current) {
11
11
  fn();
12
12
  } else {
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
5
+ var React = require('react');
6
6
 
7
7
  function useDisclosure(initialState, callbacks) {
8
- const [opened, setOpened] = react.useState(initialState);
8
+ const [opened, setOpened] = React.useState(initialState);
9
9
  const open = () => {
10
10
  var _a;
11
11
  if (!opened) {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
5
+ var React = require('react');
6
6
 
7
7
  const getVisibility = () => {
8
8
  if (typeof document === "undefined")
@@ -10,8 +10,8 @@ const getVisibility = () => {
10
10
  return document.visibilityState;
11
11
  };
12
12
  function useDocumentVisibility() {
13
- const [documentVisibility, setDocumentVisibility] = react.useState(getVisibility());
14
- react.useEffect(() => {
13
+ const [documentVisibility, setDocumentVisibility] = React.useState(getVisibility());
14
+ React.useEffect(() => {
15
15
  const listener = () => setDocumentVisibility(getVisibility());
16
16
  document.addEventListener("visibilitychange", listener);
17
17
  return () => document.removeEventListener("visibilitychange", listener);
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
5
+ var React = require('react');
6
6
 
7
7
  function useEventListener(type, listener, options) {
8
- const ref = react.useRef();
9
- react.useEffect(() => {
8
+ const ref = React.useRef();
9
+ React.useEffect(() => {
10
10
  if (ref.current) {
11
11
  ref.current.addEventListener(type, listener, options);
12
12
  return () => {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
5
+ var React = require('react');
6
6
  var useDidUpdate = require('../use-did-update/use-did-update.js');
7
7
 
8
8
  function useFocusReturn({
@@ -10,7 +10,7 @@ function useFocusReturn({
10
10
  transitionDuration,
11
11
  shouldReturnFocus = true
12
12
  }) {
13
- const lastActiveElement = react.useRef();
13
+ const lastActiveElement = React.useRef();
14
14
  const returnFocus = () => {
15
15
  var _a;
16
16
  if (lastActiveElement.current && "focus" in lastActiveElement.current && typeof lastActiveElement.current.focus === "function") {
@@ -2,15 +2,15 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
5
+ var React = require('react');
6
6
  var tabbable = require('./tabbable.js');
7
7
  var scopeTab = require('./scope-tab.js');
8
8
  var createAriaHider = require('./create-aria-hider.js');
9
9
 
10
10
  function useFocusTrap(active = true) {
11
- const ref = react.useRef();
12
- const restoreAria = react.useRef(null);
13
- const setRef = react.useCallback((node) => {
11
+ const ref = React.useRef();
12
+ const restoreAria = React.useRef(null);
13
+ const setRef = React.useCallback((node) => {
14
14
  if (!active) {
15
15
  return;
16
16
  }
@@ -45,7 +45,7 @@ function useFocusTrap(active = true) {
45
45
  ref.current = null;
46
46
  }
47
47
  }, [active]);
48
- react.useEffect(() => {
48
+ React.useEffect(() => {
49
49
  if (!active) {
50
50
  return void 0;
51
51
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
5
+ var React = require('react');
6
6
 
7
7
  function containsRelatedTarget(event) {
8
8
  if (event.currentTarget instanceof HTMLElement && event.relatedTarget instanceof HTMLElement) {
@@ -14,9 +14,9 @@ function useFocusWithin({
14
14
  onBlur,
15
15
  onFocus
16
16
  } = {}) {
17
- const ref = react.useRef();
18
- const [focused, _setFocused] = react.useState(false);
19
- const focusedRef = react.useRef(false);
17
+ const ref = React.useRef();
18
+ const [focused, _setFocused] = React.useState(false);
19
+ const focusedRef = React.useRef(false);
20
20
  const setFocused = (value) => {
21
21
  _setFocused(value);
22
22
  focusedRef.current = value;
@@ -33,7 +33,7 @@ function useFocusWithin({
33
33
  onBlur == null ? void 0 : onBlur(event);
34
34
  }
35
35
  };
36
- react.useEffect(() => {
36
+ React.useEffect(() => {
37
37
  if (ref.current) {
38
38
  ref.current.addEventListener("focusin", handleFocusIn);
39
39
  ref.current.addEventListener("focusout", handleFocusOut);
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
5
+ var React = require('react');
6
6
 
7
7
  const reducer = (value) => (value + 1) % 1e6;
8
8
  function useForceUpdate() {
9
- const [, update] = react.useReducer(reducer, 0);
9
+ const [, update] = React.useReducer(reducer, 0);
10
10
  return update;
11
11
  }
12
12
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
5
+ var React = require('react');
6
6
 
7
7
  function getFullscreenElement() {
8
8
  const _document = window.document;
@@ -43,30 +43,30 @@ function addEvents(element, {
43
43
  };
44
44
  }
45
45
  function useFullscreen() {
46
- const [fullscreen, setFullscreen] = react.useState(false);
47
- const _ref = react.useRef();
48
- const handleFullscreenChange = react.useCallback((event) => {
46
+ const [fullscreen, setFullscreen] = React.useState(false);
47
+ const _ref = React.useRef();
48
+ const handleFullscreenChange = React.useCallback((event) => {
49
49
  setFullscreen(event.target === getFullscreenElement());
50
50
  }, [setFullscreen]);
51
- const handleFullscreenError = react.useCallback((event) => {
51
+ const handleFullscreenError = React.useCallback((event) => {
52
52
  setFullscreen(false);
53
53
  console.error(`[@mantine/hooks] use-fullscreen: Error attempting full-screen mode method: ${event} (${event.target})`);
54
54
  }, [setFullscreen]);
55
- const toggle = react.useCallback(async () => {
55
+ const toggle = React.useCallback(async () => {
56
56
  if (!getFullscreenElement()) {
57
57
  await enterFullScreen(_ref.current);
58
58
  } else {
59
59
  await exitFullscreen();
60
60
  }
61
61
  }, []);
62
- const ref = react.useCallback((element) => {
62
+ const ref = React.useCallback((element) => {
63
63
  if (element === null) {
64
64
  _ref.current = window.document.documentElement;
65
65
  } else {
66
66
  _ref.current = element;
67
67
  }
68
68
  }, []);
69
- react.useEffect(() => {
69
+ React.useEffect(() => {
70
70
  if (!_ref.current && window.document) {
71
71
  _ref.current = window.document.documentElement;
72
72
  return addEvents(_ref.current, {
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
5
+ var React = require('react');
6
6
  var useWindowEvent = require('../use-window-event/use-window-event.js');
7
7
 
8
8
  function useHash() {
9
- const [hash, setHashValue] = react.useState(typeof window !== "undefined" ? window.location.hash : "");
9
+ const [hash, setHashValue] = React.useState(typeof window !== "undefined" ? window.location.hash : "");
10
10
  const setHash = (value) => {
11
11
  window.location.hash = value;
12
12
  setHashValue(value);
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
5
+ var React = require('react');
6
6
  var parseHotkey = require('./parse-hotkey.js');
7
7
 
8
8
  function shouldFireEvent(event) {
@@ -12,7 +12,7 @@ function shouldFireEvent(event) {
12
12
  return true;
13
13
  }
14
14
  function useHotkeys(hotkeys) {
15
- react.useEffect(() => {
15
+ React.useEffect(() => {
16
16
  const keydownListener = (event) => {
17
17
  hotkeys.forEach(([hotkey, handler]) => {
18
18
  if (parseHotkey.getHotkeyMatcher(hotkey)(event) && shouldFireEvent(event)) {
@@ -2,14 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
5
+ var React = require('react');
6
6
 
7
7
  function useHover() {
8
- const [hovered, setHovered] = react.useState(false);
9
- const ref = react.useRef(null);
10
- const onMouseEnter = react.useCallback(() => setHovered(true), []);
11
- const onMouseLeave = react.useCallback(() => setHovered(false), []);
12
- react.useEffect(() => {
8
+ const [hovered, setHovered] = React.useState(false);
9
+ const ref = React.useRef(null);
10
+ const onMouseEnter = React.useCallback(() => setHovered(true), []);
11
+ const onMouseLeave = React.useCallback(() => setHovered(false), []);
12
+ React.useEffect(() => {
13
13
  if (ref.current) {
14
14
  ref.current.addEventListener("mouseenter", onMouseEnter);
15
15
  ref.current.addEventListener("mouseleave", onMouseLeave);
@@ -2,12 +2,28 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
6
- var randomId = require('../utils/random-id/random-id.js');
5
+ var React = require('react');
7
6
 
8
- function useId(id, generateId = randomId.randomId) {
9
- const generatedId = react.useRef(generateId());
10
- return id || generatedId.current;
7
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
8
+
9
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
10
+
11
+ const randomId = () => `mantine-${Math.random().toString(36).slice(2, 11)}`;
12
+ const useIsomorphicEffect = typeof document !== "undefined" ? React.useLayoutEffect : React.useEffect;
13
+ const useReactId = React__default["useId".toString()] || (() => void 0);
14
+ function useClientId() {
15
+ const [uuid, setUuid] = React.useState("");
16
+ useIsomorphicEffect(() => {
17
+ setUuid(randomId());
18
+ }, []);
19
+ return uuid;
20
+ }
21
+ function getReactId() {
22
+ const id = useReactId();
23
+ return id ? `mantine-${id.replaceAll(":", "")}` : "";
24
+ }
25
+ function useId(staticId) {
26
+ return typeof staticId === "string" ? staticId : getReactId() || useClientId();
11
27
  }
12
28
 
13
29
  exports.useId = useId;
@@ -1 +1 @@
1
- {"version":3,"file":"use-id.js","sources":["../../src/use-id/use-id.ts"],"sourcesContent":["import { useRef } from 'react';\nimport { randomId } from '../utils';\n\nexport function useId(id?: string, generateId: () => string = randomId) {\n const generatedId = useRef(generateId());\n return id || generatedId.current;\n}\n"],"names":["randomId","useRef"],"mappings":";;;;;;;AAEO,SAAS,KAAK,CAAC,EAAE,EAAE,UAAU,GAAGA,iBAAQ,EAAE;AACjD,EAAE,MAAM,WAAW,GAAGC,YAAM,CAAC,UAAU,EAAE,CAAC,CAAC;AAC3C,EAAE,OAAO,EAAE,IAAI,WAAW,CAAC,OAAO,CAAC;AACnC;;;;"}
1
+ {"version":3,"file":"use-id.js","sources":["../../src/use-id/use-id.ts"],"sourcesContent":["import React, { useState, useEffect, useLayoutEffect } from 'react';\n\nconst randomId = () => `mantine-${Math.random().toString(36).slice(2, 11)}`;\n\nconst useIsomorphicEffect = typeof document !== 'undefined' ? useLayoutEffect : useEffect;\n\nconst useReactId: () => string | undefined =\n (React as any)['useId'.toString()] || (() => undefined);\n\nfunction useClientId() {\n const [uuid, setUuid] = useState('');\n\n useIsomorphicEffect(() => {\n setUuid(randomId());\n }, []);\n\n return uuid;\n}\n\nfunction getReactId() {\n const id = useReactId();\n return id ? `mantine-${id.replaceAll(':', '')}` : '';\n}\n\nexport function useId(staticId?: string) {\n return typeof staticId === 'string' ? staticId : getReactId() || useClientId();\n}\n"],"names":["useLayoutEffect","useEffect","React","useState"],"mappings":";;;;;;;;;;AACA,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAC5E,MAAM,mBAAmB,GAAG,OAAO,QAAQ,KAAK,WAAW,GAAGA,qBAAe,GAAGC,eAAS,CAAC;AAC1F,MAAM,UAAU,GAAGC,cAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,MAAM,KAAK,CAAC,CAAC,CAAC;AAC/D,SAAS,WAAW,GAAG;AACvB,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAGC,cAAQ,CAAC,EAAE,CAAC,CAAC;AACvC,EAAE,mBAAmB,CAAC,MAAM;AAC5B,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;AACxB,GAAG,EAAE,EAAE,CAAC,CAAC;AACT,EAAE,OAAO,IAAI,CAAC;AACd,CAAC;AACD,SAAS,UAAU,GAAG;AACtB,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE,CAAC;AAC1B,EAAE,OAAO,EAAE,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;AACvD,CAAC;AACM,SAAS,KAAK,CAAC,QAAQ,EAAE;AAChC,EAAE,OAAO,OAAO,QAAQ,KAAK,QAAQ,GAAG,QAAQ,GAAG,UAAU,EAAE,IAAI,WAAW,EAAE,CAAC;AACjF;;;;"}
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
5
+ var React = require('react');
6
6
 
7
7
  var __defProp = Object.defineProperty;
8
8
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
@@ -27,9 +27,9 @@ const DEFAULT_OPTIONS = {
27
27
  };
28
28
  function useIdle(timeout, options) {
29
29
  const { events, initialState } = __spreadValues(__spreadValues({}, DEFAULT_OPTIONS), options);
30
- const [idle, setIdle] = react.useState(initialState);
31
- const timer = react.useRef();
32
- react.useEffect(() => {
30
+ const [idle, setIdle] = React.useState(initialState);
31
+ const timer = React.useRef();
32
+ React.useEffect(() => {
33
33
  const handleEvents = () => {
34
34
  setIdle(false);
35
35
  if (timer.current) {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
5
+ var React = require('react');
6
6
 
7
7
  function getInputOnChange(setValue) {
8
8
  return (val) => {
@@ -23,7 +23,7 @@ function getInputOnChange(setValue) {
23
23
  };
24
24
  }
25
25
  function useInputState(initialState) {
26
- const [value, setValue] = react.useState(initialState);
26
+ const [value, setValue] = React.useState(initialState);
27
27
  return [value, getInputOnChange(setValue)];
28
28
  }
29
29
 
@@ -2,12 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
5
+ var React = require('react');
6
6
 
7
7
  function useIntersection(options) {
8
- const [entry, setEntry] = react.useState(null);
9
- const observer = react.useRef();
10
- const ref = react.useCallback((element) => {
8
+ const [entry, setEntry] = React.useState(null);
9
+ const observer = React.useRef();
10
+ const ref = React.useCallback((element) => {
11
11
  if (observer.current) {
12
12
  observer.current.disconnect();
13
13
  observer.current = null;
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
5
+ var React = require('react');
6
6
 
7
7
  function useInterval(fn, interval) {
8
- const [active, setActive] = react.useState(false);
9
- const intervalRef = react.useRef();
8
+ const [active, setActive] = React.useState(false);
9
+ const intervalRef = React.useRef();
10
10
  const start = () => {
11
11
  if (!active) {
12
12
  setActive(true);
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
5
+ var React = require('react');
6
6
 
7
- const useIsomorphicEffect = typeof document !== "undefined" ? react.useLayoutEffect : react.useEffect;
7
+ const useIsomorphicEffect = typeof document !== "undefined" ? React.useLayoutEffect : React.useEffect;
8
8
 
9
9
  exports.useIsomorphicEffect = useIsomorphicEffect;
10
10
  //# sourceMappingURL=use-isomorphic-effect.js.map
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
5
+ var React = require('react');
6
6
 
7
7
  var __defProp = Object.defineProperty;
8
8
  var __defProps = Object.defineProperties;
@@ -24,7 +24,7 @@ var __spreadValues = (a, b) => {
24
24
  };
25
25
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26
26
  function useListState(initialValue = []) {
27
- const [state, setState] = react.useState(initialValue);
27
+ const [state, setState] = React.useState(initialValue);
28
28
  const append = (...items) => setState((current) => [...current, ...items]);
29
29
  const prepend = (...items) => setState((current) => [...items, ...current]);
30
30
  const insert = (index, ...items) => setState((current) => [...current.slice(0, index), ...items, ...current.slice(index)]);
@@ -1 +1 @@
1
- {"version":3,"file":"use-list-state.js","sources":["../../src/use-list-state/use-list-state.ts"],"sourcesContent":["import React, { useState } from 'react';\n\nexport interface UseListStateHandler<T> {\n setState: React.Dispatch<React.SetStateAction<T[]>>;\n append: (...items: T[]) => void;\n prepend: (...items: T[]) => void;\n insert: (index: number, ...items: T[]) => void;\n pop: () => void;\n shift: () => void;\n apply: (fn: (item: T, index?: number) => T) => void;\n applyWhere: (\n condition: (item: T, index: number) => boolean,\n fn: (item: T, index?: number) => T\n ) => void;\n remove: (...indices: number[]) => void;\n reorder: ({ from, to }: { from: number; to: number }) => void;\n setItem: (index: number, item: T) => void;\n setItemProp: <K extends keyof T, U extends T[K]>(index: number, prop: K, value: U) => void;\n}\n\nexport type UseListState<T> = [T[], UseListStateHandler<T>];\n\nexport function useListState<T>(initialValue: T[] = []): UseListState<T> {\n const [state, setState] = useState(initialValue);\n\n const append = (...items: T[]) => setState((current) => [...current, ...items]);\n const prepend = (...items: T[]) => setState((current) => [...items, ...current]);\n\n const insert = (index: number, ...items: T[]) =>\n setState((current) => [...current.slice(0, index), ...items, ...current.slice(index)]);\n\n const apply = (fn: (item: T, index?: number) => T) =>\n setState((current) => current.map((item, index) => fn(item, index)));\n\n const remove = (...indices: number[]) =>\n setState((current) => current.filter((_, index) => !indices.includes(index)));\n\n const pop = () =>\n setState((current) => {\n const cloned = [...current];\n cloned.pop();\n return cloned;\n });\n\n const shift = () =>\n setState((current) => {\n const cloned = [...current];\n cloned.shift();\n return cloned;\n });\n\n const reorder = ({ from, to }: { from: number; to: number }) =>\n setState((current) => {\n const cloned = [...current];\n const item = current[from];\n\n cloned.splice(from, 1);\n cloned.splice(to, 0, item);\n\n return cloned;\n });\n\n const setItem = (index: number, item: T) =>\n setState((current) => {\n const cloned = [...current];\n cloned[index] = item;\n return cloned;\n });\n\n const setItemProp = <K extends keyof T, U extends T[K]>(index: number, prop: K, value: U) =>\n setState((current) => {\n const cloned = [...current];\n cloned[index] = { ...cloned[index], [prop]: value };\n return cloned;\n });\n\n const applyWhere = (\n condition: (item: T, index: number) => boolean,\n fn: (item: T, index?: number) => T\n ) =>\n setState((current) =>\n current.map((item, index) => (condition(item, index) ? fn(item, index) : item))\n );\n\n return [\n state,\n {\n setState,\n append,\n prepend,\n insert,\n pop,\n shift,\n apply,\n applyWhere,\n remove,\n reorder,\n setItem,\n setItemProp,\n },\n ];\n}\n"],"names":["useState"],"mappings":";;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,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d,MAAM,MAAM;AACZ,MAAM,OAAO;AACb,MAAM,MAAM;AACZ,MAAM,GAAG;AACT,MAAM,KAAK;AACX,MAAM,KAAK;AACX,MAAM,UAAU;AAChB,MAAM,MAAM;AACZ,MAAM,OAAO;AACb,MAAM,OAAO;AACb,MAAM,WAAW;AACjB,KAAK;AACL,GAAG,CAAC;AACJ;;;;"}
1
+ {"version":3,"file":"use-list-state.js","sources":["../../src/use-list-state/use-list-state.ts"],"sourcesContent":["import React, { useState } from 'react';\n\nexport interface UseListStateHandlers<T> {\n setState: React.Dispatch<React.SetStateAction<T[]>>;\n append: (...items: T[]) => void;\n prepend: (...items: T[]) => void;\n insert: (index: number, ...items: T[]) => void;\n pop: () => void;\n shift: () => void;\n apply: (fn: (item: T, index?: number) => T) => void;\n applyWhere: (\n condition: (item: T, index: number) => boolean,\n fn: (item: T, index?: number) => T\n ) => void;\n remove: (...indices: number[]) => void;\n reorder: ({ from, to }: { from: number; to: number }) => void;\n setItem: (index: number, item: T) => void;\n setItemProp: <K extends keyof T, U extends T[K]>(index: number, prop: K, value: U) => void;\n}\n\nexport type UseListState<T> = [T[], UseListStateHandlers<T>];\n\nexport function useListState<T>(initialValue: T[] = []): UseListState<T> {\n const [state, setState] = useState(initialValue);\n\n const append = (...items: T[]) => setState((current) => [...current, ...items]);\n const prepend = (...items: T[]) => setState((current) => [...items, ...current]);\n\n const insert = (index: number, ...items: T[]) =>\n setState((current) => [...current.slice(0, index), ...items, ...current.slice(index)]);\n\n const apply = (fn: (item: T, index?: number) => T) =>\n setState((current) => current.map((item, index) => fn(item, index)));\n\n const remove = (...indices: number[]) =>\n setState((current) => current.filter((_, index) => !indices.includes(index)));\n\n const pop = () =>\n setState((current) => {\n const cloned = [...current];\n cloned.pop();\n return cloned;\n });\n\n const shift = () =>\n setState((current) => {\n const cloned = [...current];\n cloned.shift();\n return cloned;\n });\n\n const reorder = ({ from, to }: { from: number; to: number }) =>\n setState((current) => {\n const cloned = [...current];\n const item = current[from];\n\n cloned.splice(from, 1);\n cloned.splice(to, 0, item);\n\n return cloned;\n });\n\n const setItem = (index: number, item: T) =>\n setState((current) => {\n const cloned = [...current];\n cloned[index] = item;\n return cloned;\n });\n\n const setItemProp = <K extends keyof T, U extends T[K]>(index: number, prop: K, value: U) =>\n setState((current) => {\n const cloned = [...current];\n cloned[index] = { ...cloned[index], [prop]: value };\n return cloned;\n });\n\n const applyWhere = (\n condition: (item: T, index: number) => boolean,\n fn: (item: T, index?: number) => T\n ) =>\n setState((current) =>\n current.map((item, index) => (condition(item, index) ? fn(item, index) : item))\n );\n\n return [\n state,\n {\n setState,\n append,\n prepend,\n insert,\n pop,\n shift,\n apply,\n applyWhere,\n remove,\n reorder,\n setItem,\n setItemProp,\n },\n ];\n}\n"],"names":["useState"],"mappings":";;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAA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@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
5
+ var React = require('react');
6
6
  var useWindowEvent = require('../use-window-event/use-window-event.js');
7
7
 
8
8
  function serializeJSON(value) {
@@ -27,8 +27,8 @@ function useLocalStorage({
27
27
  serialize = serializeJSON
28
28
  }) {
29
29
  var _a;
30
- const [value, setValue] = react.useState(typeof window !== "undefined" && "localStorage" in window && !getInitialValueInEffect ? deserialize((_a = window.localStorage.getItem(key)) != null ? _a : void 0) : defaultValue != null ? defaultValue : "");
31
- const setLocalStorageValue = react.useCallback((val) => {
30
+ const [value, setValue] = React.useState(typeof window !== "undefined" && "localStorage" in window && !getInitialValueInEffect ? deserialize((_a = window.localStorage.getItem(key)) != null ? _a : void 0) : defaultValue != null ? defaultValue : "");
31
+ const setLocalStorageValue = React.useCallback((val) => {
32
32
  if (val instanceof Function) {
33
33
  setValue((current) => {
34
34
  const result = val(current);
@@ -53,12 +53,12 @@ function useLocalStorage({
53
53
  setValue(event.detail.value);
54
54
  }
55
55
  });
56
- react.useEffect(() => {
56
+ React.useEffect(() => {
57
57
  if (defaultValue !== void 0 && value === void 0) {
58
58
  setLocalStorageValue(defaultValue);
59
59
  }
60
60
  }, [defaultValue, value, setLocalStorageValue]);
61
- react.useEffect(() => {
61
+ React.useEffect(() => {
62
62
  var _a2;
63
63
  if (getInitialValueInEffect) {
64
64
  setValue(deserialize((_a2 = window.localStorage.getItem(key)) != null ? _a2 : void 0) || (defaultValue != null ? defaultValue : ""));
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
5
+ var React = require('react');
6
6
  var useDidUpdate = require('../use-did-update/use-did-update.js');
7
7
 
8
8
  function useLogger(componentName, props) {
9
- react.useEffect(() => {
9
+ React.useEffect(() => {
10
10
  console.log(`${componentName} mounted`, ...props);
11
11
  return () => console.log(`${componentName} unmounted`);
12
12
  }, []);
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
5
+ var React = require('react');
6
6
 
7
7
  function attachMediaListener(query, callback) {
8
8
  try {
@@ -23,9 +23,9 @@ function getInitialValue(query, initialValue) {
23
23
  return false;
24
24
  }
25
25
  function useMediaQuery(query, initialValue) {
26
- const [matches, setMatches] = react.useState(getInitialValue(query, initialValue));
27
- const queryRef = react.useRef();
28
- react.useEffect(() => {
26
+ const [matches, setMatches] = React.useState(getInitialValue(query, initialValue));
27
+ const queryRef = React.useRef();
28
+ React.useEffect(() => {
29
29
  if ("matchMedia" in window) {
30
30
  queryRef.current = window.matchMedia(query);
31
31
  setMatches(queryRef.current.matches);