@bbodek/hooks 0.0.8 → 0.0.10

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/README.md ADDED
@@ -0,0 +1 @@
1
+ # Bbodek Hooks
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- export { default as useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect";
2
- export { default as useForm } from "./useForm";
1
+ export { default as useForm } from './useForm';
2
+ export { default as useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export{default as useForm}from"./useForm/index.es.js";export{default as useIsomorphicLayoutEffect}from"./useIsomorphicLayoutEffect/index.es.js";
2
+ //# sourceMappingURL=index.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,3 +1,4 @@
1
1
  import { Props, UseFormReturnType } from './types';
2
2
  declare const useForm: <T extends object>({ initialValues, validate, }: Props<T>) => UseFormReturnType<T>;
3
3
  export default useForm;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useForm/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAiB,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAElE,QAAA,MAAM,OAAO,GAAI,CAAC,SAAS,MAAM,EAAE,8BAGhC,KAAK,CAAC,CAAC,CAAC,KAAG,iBAAiB,CAAC,CAAC,CA2ChC,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -0,0 +1,2 @@
1
+ import{useState as t}from"react";const e=({initialValues:e,validate:a})=>{const[n,s]=t(e),[o,r]=t({});return{values:n,setValues:t=>{const e="function"==typeof t?t(n):t;if(s(e),a){const t=a(e);r(t)}},errors:o,handleChange:t=>{const{name:o,value:i}=t.target;if(o in e&&(s({...n,[o]:i}),a)){const t=a({...n,[o]:i});r(t)}},setErrors:r}};export{e as default};
2
+ //# sourceMappingURL=index.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,4 +1,4 @@
1
- import { ChangeEvent, Dispatch, SetStateAction } from "react";
1
+ import { ChangeEvent, Dispatch, SetStateAction } from 'react';
2
2
  export type ValueKey<T> = keyof T & string;
3
3
  export type UseFormErrors = {
4
4
  [key: string]: string;
@@ -14,6 +14,7 @@ export interface UseFormReturnType<T> {
14
14
  values: T;
15
15
  setValues: Dispatch<SetStateAction<T>>;
16
16
  errors: UseFormErrors;
17
- handleChange: (event: UseFormHandleChangeParams["event"]) => void;
17
+ handleChange: (event: UseFormHandleChangeParams['event']) => void;
18
18
  setErrors: Dispatch<SetStateAction<UseFormErrors>>;
19
19
  }
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/useForm/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE9D,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM,CAAC;AAC3C,MAAM,MAAM,aAAa,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAEtD,MAAM,WAAW,KAAK,CAAC,CAAC;IACtB,aAAa,EAAE,CAAC,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,aAAa,CAAC;CACzC;AAED,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,WAAW,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,CAAC;CAC5D;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,MAAM,EAAE,CAAC,CAAC;IACV,SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;IACvC,MAAM,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE,CAAC,KAAK,EAAE,yBAAyB,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IAClE,SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,CAAC;CACpD"}
@@ -1,3 +1,4 @@
1
1
  import { useLayoutEffect } from 'react';
2
2
  declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
3
3
  export default useIsomorphicLayoutEffect;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useIsomorphicLayoutEffect/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,eAAe,EAAE,MAAM,OAAO,CAAC;AAEnD,QAAA,MAAM,yBAAyB,wBAC8B,CAAC;AAE9D,eAAe,yBAAyB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import{useLayoutEffect as e,useEffect as o}from"react";const t="undefined"!=typeof window?e:o;export{t as default};
2
+ //# sourceMappingURL=index.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,62 +1,53 @@
1
1
  {
2
2
  "name": "@bbodek/hooks",
3
- "version": "0.0.8",
4
- "type": "module",
5
- "files": [
6
- "dist"
7
- ],
8
- "main": "dist/dotoli-hooks.cjs.js",
9
- "module": "dist/dotoli-hooks.es.js",
10
- "types": "dist/index.d.ts",
3
+ "version": "0.0.10",
4
+ "license": "MIT",
5
+ "main": "./dist/index.es.js",
6
+ "module": "./dist/index.es.js",
7
+ "types": "./dist/index.d.ts",
11
8
  "exports": {
12
9
  ".": {
13
- "require": "./dist/dotoli-hooks.cjs.js",
14
- "import": "./dist/dotoli-hooks.es.js",
10
+ "import": "./dist/index.es.js",
15
11
  "types": "./dist/index.d.ts"
16
12
  }
17
13
  },
14
+ "files": [
15
+ "dist"
16
+ ],
18
17
  "scripts": {
19
- "dev": "vite",
20
- "build": "vite build && tsc --project tsconfig.build.json && tsc-alias -p tsconfig.build.json",
21
- "lint": "eslint .",
22
- "lint:fix": "eslint . --ext ts,tsx --report-unused-disable-directives --fix",
23
- "preview": "vite preview",
24
- "prettier": "prettier --write \"**/*.{js,jsx,ts,tsx,css,html}\""
25
- },
26
- "peerDependencies": {
27
- "@types/react": "18.2.0",
28
- "@types/react-dom": "18.2.0",
29
- "react": "18.2.0",
30
- "react-dom": "18.2.0"
18
+ "dev": "next dev",
19
+ "build": "rollup -c && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
20
+ "start": "next start",
21
+ "lint": "next lint"
31
22
  },
32
23
  "dependencies": {
33
- "react": "18.2.0",
34
- "react-dom": "18.2.0"
24
+ "next": "^15.3.1",
25
+ "react": "^19.1.0",
26
+ "react-dom": "^19.1.0"
27
+ },
28
+ "peerDependencies": {
29
+ "next": "^15.3.1",
30
+ "react": "^19.1.0",
31
+ "react-dom": "^19.1.0"
35
32
  },
36
33
  "devDependencies": {
37
34
  "@dotoli/eslint-config": "workspace:*",
38
35
  "@dotoli/prettier-config": "workspace:*",
39
36
  "@dotoli/typescript-config": "workspace:*",
40
- "@eslint/js": "^9.13.0",
41
- "@types/node": "^22.9.0",
42
- "@types/react": "18.3.1",
43
- "@types/react-dom": "18.3.1",
44
- "@typescript-eslint/parser": "^7.1.0",
45
- "@vitejs/plugin-react-swc": "^3.5.0",
46
- "eslint": "^9.13.0",
47
- "eslint-config-prettier": "^9.1.0",
48
- "eslint-plugin-prettier": "^5.2.1",
49
- "eslint-plugin-react": "^7.37.2",
50
- "eslint-plugin-react-hooks": "^5.0.0",
51
- "eslint-plugin-react-refresh": "^0.4.14",
52
- "globals": "^15.11.0",
53
- "typescript": "~5.6.2",
54
- "typescript-eslint": "^8.11.0",
55
- "vite": "^5.4.10",
56
- "vite-tsconfig-paths": "^5.1.1"
57
- },
58
- "overrides": {
59
- "@types/scheduler": "< 0.23.0"
37
+ "@eslint/eslintrc": "^3",
38
+ "@rollup/plugin-node-resolve": "^16.0.1",
39
+ "@rollup/plugin-terser": "^0.4.4",
40
+ "@types/node": "^20",
41
+ "@types/react": "^19",
42
+ "@types/react-dom": "^19",
43
+ "eslint": "^9",
44
+ "eslint-config-next": "15.3.1",
45
+ "rollup": "^4.40.2",
46
+ "rollup-plugin-peer-deps-external": "^2.2.4",
47
+ "rollup-plugin-typescript2": "^0.36.0",
48
+ "tsc-alias": "^1.8.16",
49
+ "tslib": "^2.8.1",
50
+ "typescript": "^5.8.3"
60
51
  },
61
52
  "prettier": "@dotoli/prettier-config"
62
53
  }
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),d=typeof window<"u"?n.useLayoutEffect:n.useEffect,y=({initialValues:c,validate:o})=>{const[s,a]=n.useState(c),[f,u]=n.useState({});return{values:s,setValues:t=>{const e=typeof t=="function"?t(s):t;if(a(e),o){const r=o(e);u(r)}},errors:f,handleChange:t=>{const{name:e,value:r}=t.target;if(e in c&&(a({...s,[e]:r}),o)){const i=o({...s,[e]:r});u(i)}},setErrors:u}};exports.useForm=y;exports.useIsomorphicLayoutEffect=d;
@@ -1,33 +0,0 @@
1
- import { useLayoutEffect as d, useEffect as p, useState as u } from "react";
2
- const y = typeof window < "u" ? d : p, g = ({
3
- initialValues: c,
4
- validate: e
5
- }) => {
6
- const [s, f] = u(c), [a, r] = u({});
7
- return {
8
- values: s,
9
- setValues: (o) => {
10
- const t = typeof o == "function" ? o(s) : o;
11
- if (f(t), e) {
12
- const n = e(t);
13
- r(n);
14
- }
15
- },
16
- errors: a,
17
- handleChange: (o) => {
18
- const { name: t, value: n } = o.target;
19
- if (t in c && (f({ ...s, [t]: n }), e)) {
20
- const i = e({
21
- ...s,
22
- [t]: n
23
- });
24
- r(i);
25
- }
26
- },
27
- setErrors: r
28
- };
29
- };
30
- export {
31
- g as useForm,
32
- y as useIsomorphicLayoutEffect
33
- };