@zal-kit/react 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 posme-id
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # @zal-kit/react
2
+
3
+ A collection of useful React hooks for modern web applications.
4
+
5
+ ## Requirements
6
+
7
+ This package requires the following peer dependencies:
8
+
9
+ - `react` >= 16.8.0
10
+ - `react-dom` >= 16.8.0
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @zal-kit/react
16
+ # or
17
+ yarn add @zal-kit/react
18
+ # or
19
+ pnpm add @zal-kit/react
20
+ ```
21
+
22
+ ## Hooks
23
+
24
+ ### `useToggle`
25
+
26
+ A simple hook for managing boolean state with a toggle function.
27
+
28
+ ```typescript
29
+ import { useToggle } from '@zal-kit/react';
30
+
31
+ function MyComponent() {
32
+ const [isOpen, toggle, setIsOpen] = useToggle(false);
33
+
34
+ return (
35
+ <div>
36
+ <button onClick={toggle}>Toggle</button>
37
+ <button onClick={() => setIsOpen(true)}>Open</button>
38
+ {isOpen && <div>Content</div>}
39
+ </div>
40
+ );
41
+ }
42
+ ```
43
+
44
+ **API:**
45
+ - `initialValue` (boolean, optional): Initial state value (default: `false`)
46
+ - Returns: `[state, toggle, setState]`
47
+ - `state`: Current boolean value
48
+ - `toggle`: Function to toggle the state
49
+ - `setState`: Function to set state directly
50
+
51
+ ## TypeScript
52
+
53
+ This package is written in TypeScript and includes type definitions.
54
+
55
+ ## License
56
+
57
+ MIT
58
+
59
+ ## Contributing
60
+
61
+ Contributions are welcome! Please feel free to submit a Pull Request.
62
+
63
+ ## Publishing
64
+
65
+ To publish a new version:
66
+
67
+ ```bash
68
+ # Update version
69
+ npm version patch # or minor, major
70
+
71
+ # Publish to npm
72
+ npm publish
73
+ ```
@@ -0,0 +1,2 @@
1
+ export declare const useToggle: (initialValue?: boolean) => readonly [boolean, () => void, import("react").Dispatch<import("react").SetStateAction<boolean>>];
2
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/hooks/common.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,GAAI,sBAAoB,sGAQ7C,CAAC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useToggle = void 0;
4
+ const react_1 = require("react");
5
+ const useToggle = (initialValue = false) => {
6
+ const [state, setState] = (0, react_1.useState)(initialValue);
7
+ const toggle = () => {
8
+ setState((prev) => !prev);
9
+ };
10
+ return [state, toggle, setState];
11
+ };
12
+ exports.useToggle = useToggle;
13
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/hooks/common.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AAE1B,MAAM,SAAS,GAAG,CAAC,YAAY,GAAG,KAAK,EAAE,EAAE;IAChD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAC,YAAY,CAAC,CAAC;IAEjD,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC;IAEF,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAU,CAAC;AAC5C,CAAC,CAAC;AARW,QAAA,SAAS,aAQpB"}
@@ -0,0 +1,2 @@
1
+ export * from "./common";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./common"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB"}
@@ -0,0 +1,2 @@
1
+ export * from './hooks';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./hooks"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB"}
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@zal-kit/react",
3
+ "version": "1.0.0",
4
+ "description": "A collection of useful React hooks for modern web applications",
5
+ "author": "zidanez",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/zal-kit/react.git"
10
+ },
11
+ "homepage": "https://github.com/zal-kit/react#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/zal-kit/react/issues"
14
+ },
15
+ "keywords": [
16
+ "react",
17
+ "hooks",
18
+ "useToggle",
19
+ "typescript"
20
+ ],
21
+ "main": "./dist/index.js",
22
+ "types": "./dist/index.d.ts",
23
+ "exports": {
24
+ ".": {
25
+ "types": "./dist/index.d.ts",
26
+ "require": "./dist/index.js",
27
+ "import": "./dist/index.js"
28
+ }
29
+ },
30
+ "files": [
31
+ "dist",
32
+ "README.md",
33
+ "LICENSE"
34
+ ],
35
+ "scripts": {
36
+ "build": "npm run clean && tsc",
37
+ "prepublishOnly": "npm run build",
38
+ "lint": "eslint src --ext .ts,.tsx",
39
+ "test": "echo \"No tests yet\"",
40
+ "clean": "rm -rf dist"
41
+ },
42
+ "peerDependencies": {
43
+ "react": ">=16.8.0",
44
+ "react-dom": ">=16.8.0"
45
+ },
46
+ "devDependencies": {
47
+ "@types/react": "^19.2.10",
48
+ "react": "^19.2.1",
49
+ "react-dom": "^19.2.1",
50
+ "typescript": "^5.9.3"
51
+ },
52
+ "publishConfig": {
53
+ "access": "public"
54
+ },
55
+ "engines": {
56
+ "node": ">=14.0.0"
57
+ }
58
+ }