@purr-core/hooks.focus-with-callback 0.0.6 → 0.0.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purr-core/hooks.focus-with-callback",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -31,6 +31,8 @@
31
31
  "scripts": {
32
32
  "dev": "vite build --watch",
33
33
  "build": "tsc && vite build",
34
+ "build:vite": "tsc && vite build",
35
+ "build:tsup": "tsup",
34
36
  "lint": "eslint . --ext ts,tsx --max-warnings 0"
35
37
  }
36
38
  }
package/dist/_hook.d.ts DELETED
@@ -1,14 +0,0 @@
1
- import { FocusEvent, FocusEventHandler } from 'react';
2
-
3
- export interface IFocusWithCallback {
4
- onFocus: FocusEventHandler<HTMLElement> | undefined;
5
- onBlur: FocusEventHandler<HTMLElement> | undefined;
6
- focused?: boolean;
7
- disabled?: boolean;
8
- }
9
- declare const useFocusWithCallback: ({ onFocus, onBlur, focused, disabled, }: IFocusWithCallback) => {
10
- captureOnFocus: (e: FocusEvent<HTMLElement, Element>) => void;
11
- captureOnBlur: (e: FocusEvent<HTMLElement, Element>) => void;
12
- isFocused: boolean;
13
- };
14
- export default useFocusWithCallback;
package/dist/index.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";const a=require("react"),p=({onFocus:t,onBlur:e,focused:u=!1,disabled:s=!1})=>{const[f,r]=a.useState(u),i=a.useCallback(c=>{s||(t==null||t(c),r(!0))},[s,t]),k=a.useCallback(c=>{s||(e==null||e(c),r(!1))},[s,e]);return{captureOnFocus:i,captureOnBlur:k,isFocused:f}};module.exports=p;
package/dist/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export { default } from './_hook';
package/dist/index.js DELETED
@@ -1,27 +0,0 @@
1
- import { useState as k, useCallback as c } from "react";
2
- const C = ({
3
- onFocus: t,
4
- onBlur: e,
5
- focused: f = !1,
6
- disabled: a = !1
7
- }) => {
8
- const [u, r] = k(f), p = c(
9
- (s) => {
10
- a || (t == null || t(s), r(!0));
11
- },
12
- [a, t]
13
- ), i = c(
14
- (s) => {
15
- a || (e == null || e(s), r(!1));
16
- },
17
- [a, e]
18
- );
19
- return {
20
- captureOnFocus: p,
21
- captureOnBlur: i,
22
- isFocused: u
23
- };
24
- };
25
- export {
26
- C as default
27
- };