@mantine/hooks 3.6.0 → 3.6.4

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.
@@ -6,7 +6,7 @@ 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(null);
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);
@@ -1 +1 @@
1
- {"version":3,"file":"use-hash.js","sources":["../../src/use-hash/use-hash.ts"],"sourcesContent":["import { useState } from 'react';\nimport { useWindowEvent } from '../use-window-event/use-window-event';\n\nexport function useHash(): readonly [string | null, (hash: string) => void] {\n const [hash, setHashValue] = useState<string>(null);\n\n const setHash = (value: string) => {\n window.location.hash = value;\n setHashValue(value);\n };\n\n useWindowEvent('hashchange', () => {\n setHashValue(window.location.hash);\n });\n\n return [hash, setHash] as const;\n}\n"],"names":["useState","useWindowEvent"],"mappings":";;;;;;;AAEO,SAAS,OAAO,GAAG;AAC1B,EAAE,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,GAAGA,cAAQ,CAAC,IAAI,CAAC,CAAC;AAC9C,EAAE,MAAM,OAAO,GAAG,CAAC,KAAK,KAAK;AAC7B,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,KAAK,CAAC;AACjC,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC;AACxB,GAAG,CAAC;AACJ,EAAEC,6BAAc,CAAC,YAAY,EAAE,MAAM;AACrC,IAAI,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACvC,GAAG,CAAC,CAAC;AACL,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACzB;;;;"}
1
+ {"version":3,"file":"use-hash.js","sources":["../../src/use-hash/use-hash.ts"],"sourcesContent":["import { useState } from 'react';\nimport { useWindowEvent } from '../use-window-event/use-window-event';\n\nexport function useHash() {\n const [hash, setHashValue] = useState<string>(\n typeof window !== 'undefined' ? window.location.hash : ''\n );\n\n const setHash = (value: string) => {\n window.location.hash = value;\n setHashValue(value);\n };\n\n useWindowEvent('hashchange', () => {\n setHashValue(window.location.hash);\n });\n\n return [hash, setHash] as const;\n}\n"],"names":["useState","useWindowEvent"],"mappings":";;;;;;;AAEO,SAAS,OAAO,GAAG;AAC1B,EAAE,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,GAAGA,cAAQ,CAAC,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;AACnG,EAAE,MAAM,OAAO,GAAG,CAAC,KAAK,KAAK;AAC7B,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,KAAK,CAAC;AACjC,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC;AACxB,GAAG,CAAC;AACJ,EAAEC,6BAAc,CAAC,YAAY,EAAE,MAAM;AACrC,IAAI,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACvC,GAAG,CAAC,CAAC;AACL,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACzB;;;;"}
@@ -2,7 +2,7 @@ import { useState } from 'react';
2
2
  import { useWindowEvent } from '../use-window-event/use-window-event.js';
3
3
 
4
4
  function useHash() {
5
- const [hash, setHashValue] = useState(null);
5
+ const [hash, setHashValue] = useState(typeof window !== "undefined" ? window.location.hash : "");
6
6
  const setHash = (value) => {
7
7
  window.location.hash = value;
8
8
  setHashValue(value);
@@ -1 +1 @@
1
- {"version":3,"file":"use-hash.js","sources":["../../src/use-hash/use-hash.ts"],"sourcesContent":["import { useState } from 'react';\nimport { useWindowEvent } from '../use-window-event/use-window-event';\n\nexport function useHash(): readonly [string | null, (hash: string) => void] {\n const [hash, setHashValue] = useState<string>(null);\n\n const setHash = (value: string) => {\n window.location.hash = value;\n setHashValue(value);\n };\n\n useWindowEvent('hashchange', () => {\n setHashValue(window.location.hash);\n });\n\n return [hash, setHash] as const;\n}\n"],"names":[],"mappings":";;;AAEO,SAAS,OAAO,GAAG;AAC1B,EAAE,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC9C,EAAE,MAAM,OAAO,GAAG,CAAC,KAAK,KAAK;AAC7B,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,KAAK,CAAC;AACjC,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC;AACxB,GAAG,CAAC;AACJ,EAAE,cAAc,CAAC,YAAY,EAAE,MAAM;AACrC,IAAI,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACvC,GAAG,CAAC,CAAC;AACL,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACzB;;;;"}
1
+ {"version":3,"file":"use-hash.js","sources":["../../src/use-hash/use-hash.ts"],"sourcesContent":["import { useState } from 'react';\nimport { useWindowEvent } from '../use-window-event/use-window-event';\n\nexport function useHash() {\n const [hash, setHashValue] = useState<string>(\n typeof window !== 'undefined' ? window.location.hash : ''\n );\n\n const setHash = (value: string) => {\n window.location.hash = value;\n setHashValue(value);\n };\n\n useWindowEvent('hashchange', () => {\n setHashValue(window.location.hash);\n });\n\n return [hash, setHash] as const;\n}\n"],"names":[],"mappings":";;;AAEO,SAAS,OAAO,GAAG;AAC1B,EAAE,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;AACnG,EAAE,MAAM,OAAO,GAAG,CAAC,KAAK,KAAK;AAC7B,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,KAAK,CAAC;AACjC,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC;AACxB,GAAG,CAAC;AACJ,EAAE,cAAc,CAAC,YAAY,EAAE,MAAM;AACrC,IAAI,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACvC,GAAG,CAAC,CAAC;AACL,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACzB;;;;"}
@@ -1,2 +1,2 @@
1
- export declare function useHash(): readonly [string | null, (hash: string) => void];
1
+ export declare function useHash(): readonly [string, (value: string) => void];
2
2
  //# sourceMappingURL=use-hash.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-hash.d.ts","sourceRoot":"","sources":["../../src/use-hash/use-hash.ts"],"names":[],"mappings":"AAGA,wBAAgB,OAAO,IAAI,SAAS,CAAC,MAAM,GAAG,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC,CAa1E"}
1
+ {"version":3,"file":"use-hash.d.ts","sourceRoot":"","sources":["../../src/use-hash/use-hash.ts"],"names":[],"mappings":"AAGA,wBAAgB,OAAO,8BAKG,MAAM,WAU/B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mantine/hooks",
3
- "version": "3.6.0",
3
+ "version": "3.6.4",
4
4
  "main": "cjs/index.js",
5
5
  "module": "esm/index.js",
6
6
  "types": "lib/index.d.ts",