@spelyco/react-lib 0.0.1-alpha → 0.0.1

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.
Files changed (2) hide show
  1. package/package.json +5 -12
  2. package/README.md +0 -103
package/package.json CHANGED
@@ -1,13 +1,8 @@
1
1
  {
2
2
  "name": "@spelyco/react-lib",
3
- "version": "0.0.1-alpha",
3
+ "version": "0.0.1",
4
4
  "description": "Shared React hooks and utilities for Spelyco UI packages",
5
- "keywords": [
6
- "react",
7
- "hooks",
8
- "utilities",
9
- "spelyco"
10
- ],
5
+ "keywords": ["react", "hooks", "utilities", "spelyco"],
11
6
  "license": "MIT",
12
7
  "main": "./dist/index.js",
13
8
  "module": "./dist/index.mjs",
@@ -19,9 +14,7 @@
19
14
  "require": "./dist/index.js"
20
15
  }
21
16
  },
22
- "files": [
23
- "dist"
24
- ],
17
+ "files": ["dist"],
25
18
  "scripts": {
26
19
  "build": "tsup",
27
20
  "dev": "tsup --watch",
@@ -35,7 +28,7 @@
35
28
  "react": ">=18"
36
29
  },
37
30
  "devDependencies": {
38
- "@spelyco/tsconfig": "*",
31
+ "@spelyco/tsconfig": "workspace:*",
39
32
  "@testing-library/react": "^16.1.0",
40
33
  "@types/react": "^19.2.14",
41
34
  "jsdom": "^29.0.1",
@@ -44,4 +37,4 @@
44
37
  "tsup": "^8.3.5",
45
38
  "vitest": "^4.1.1"
46
39
  }
47
- }
40
+ }
package/README.md DELETED
@@ -1,103 +0,0 @@
1
- # @spelyco/react-lib
2
-
3
- Shared React hooks and utilities for Spelyco UI packages. Framework-agnostic — works with both `@spelyco/react` and `@spelyco/react-native`.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- bun add @spelyco/react-lib
9
- ```
10
-
11
- ## Hooks
12
-
13
- ### useBoolean
14
-
15
- Manages a boolean state with stable action callbacks.
16
-
17
- ```tsx
18
- import { useBoolean } from "@spelyco/react-lib";
19
-
20
- function Modal() {
21
- const { value: isOpen, setTrue: open, setFalse: close, toggle } = useBoolean(false);
22
-
23
- return (
24
- <>
25
- <button onClick={open}>Open</button>
26
- {isOpen && <dialog onClose={close}>...</dialog>}
27
- </>
28
- );
29
- }
30
- ```
31
-
32
- **API**
33
-
34
- ```ts
35
- function useBoolean(initialValue?: boolean): {
36
- value: boolean;
37
- setTrue: () => void;
38
- setFalse: () => void;
39
- toggle: () => void;
40
- setValue: (value: boolean) => void;
41
- }
42
- ```
43
-
44
- ---
45
-
46
- ### useDebounce
47
-
48
- Delays updating a value until after a specified wait period. Useful for search inputs and API calls.
49
-
50
- ```tsx
51
- import { useDebounce } from "@spelyco/react-lib";
52
-
53
- function Search() {
54
- const [query, setQuery] = useState("");
55
- const debouncedQuery = useDebounce(query, 400);
56
-
57
- useEffect(() => {
58
- if (debouncedQuery) fetchResults(debouncedQuery);
59
- }, [debouncedQuery]);
60
-
61
- return <input onChange={(e) => setQuery(e.target.value)} />;
62
- }
63
- ```
64
-
65
- **API**
66
-
67
- ```ts
68
- function useDebounce<T>(value: T, delay?: number): T
69
- // delay defaults to 300ms
70
- ```
71
-
72
- ## Utils
73
-
74
- ### cn
75
-
76
- Merges class names, filtering out falsy values. Lightweight alternative to `clsx`.
77
-
78
- ```tsx
79
- import { cn } from "@spelyco/react-lib";
80
-
81
- cn("btn", isActive && "btn--active", undefined, "btn--lg");
82
- // → "btn btn--active btn--lg"
83
-
84
- cn(["base", ["nested", "classes"]]);
85
- // → "base nested classes"
86
- ```
87
-
88
- **API**
89
-
90
- ```ts
91
- function cn(...inputs: ClassValue[]): string
92
- // ClassValue = string | undefined | null | false | ClassValue[]
93
- ```
94
-
95
- ## Peer Dependencies
96
-
97
- | Package | Version |
98
- |---|---|
99
- | `react` | `>=18` |
100
-
101
- ## License
102
-
103
- MIT