@os-design/use-click-outside 1.0.34 → 1.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { type RefObject } from 'react';
2
- declare const useClickOutside: (target: Element | RefObject<Element>, listener: EventListener) => void;
2
+ declare const useClickOutside: (target: Element | RefObject<Element | null>, listener: EventListener) => void;
3
3
  export default useClickOutside;
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAkC,MAAM,OAAO,CAAC;AAEvE,QAAA,MAAM,eAAe,GACnB,QAAQ,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,EACpC,UAAU,aAAa,KACtB,IAoBF,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAkC,MAAM,OAAO,CAAC;AAEvE,QAAA,MAAM,eAAe,GACnB,QAAQ,OAAO,GAAG,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC,EAC3C,UAAU,aAAa,KACtB,IAoBF,CAAC;AAEF,eAAe,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import useEvent from '@os-design/use-event';
2
2
  import { useCallback, useEffect, useRef } from 'react';
3
3
  const useClickOutside = (target, listener) => {
4
- const listenerRef = useRef();
4
+ const listenerRef = useRef(undefined);
5
5
  useEffect(() => {
6
6
  listenerRef.current = listener;
7
7
  }, [listener]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@os-design/use-click-outside",
3
- "version": "1.0.34",
3
+ "version": "1.0.36",
4
4
  "license": "UNLICENSED",
5
5
  "repository": "git@gitlab.com:os-team/libs/os-design.git",
6
6
  "type": "module",
@@ -19,20 +19,20 @@
19
19
  ],
20
20
  "sideEffects": false,
21
21
  "scripts": {
22
- "clean": "rimraf dist",
22
+ "clean": "rm -r dist",
23
23
  "build:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts,.tsx --out-dir dist",
24
24
  "build:types": "tsc -p tsconfig.build.json --emitDeclarationOnly --declaration --declarationDir dist",
25
25
  "build": "yarn clean && npm-run-all 'build:*'",
26
- "ncu": "ncu -u '/^(?!(react|@types/react)$).*$/'"
26
+ "ncu": "ncu -u"
27
27
  },
28
28
  "publishConfig": {
29
29
  "access": "public"
30
30
  },
31
31
  "dependencies": {
32
- "@os-design/use-event": "^1.0.32"
32
+ "@os-design/use-event": "^1.0.34"
33
33
  },
34
34
  "peerDependencies": {
35
- "react": "18"
35
+ "react": "19"
36
36
  },
37
- "gitHead": "7a2aee283bdbdba8ba69a3212769ad321beaaed2"
37
+ "gitHead": "83ca5af2bb91d07d64440f87b7ab23f5100daa02"
38
38
  }
package/src/index.mdx CHANGED
@@ -1,4 +1,4 @@
1
- import { Meta } from '@storybook/blocks';
1
+ import { Meta } from '@storybook/addon-docs/blocks';
2
2
  import UseClickOutsideExample from './index.example';
3
3
 
4
4
  <Meta title='Utils/useClickOutside' />
package/src/index.ts CHANGED
@@ -2,10 +2,10 @@ import useEvent from '@os-design/use-event';
2
2
  import { type RefObject, useCallback, useEffect, useRef } from 'react';
3
3
 
4
4
  const useClickOutside = (
5
- target: Element | RefObject<Element>,
5
+ target: Element | RefObject<Element | null>,
6
6
  listener: EventListener
7
7
  ): void => {
8
- const listenerRef = useRef<EventListener>();
8
+ const listenerRef = useRef<EventListener>(undefined);
9
9
 
10
10
  useEffect(() => {
11
11
  listenerRef.current = listener;