react-resource-ui 0.1.0 → 0.1.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/README.md +98 -61
  2. package/package.json +5 -6
package/README.md CHANGED
@@ -1,73 +1,110 @@
1
- # React + TypeScript + Vite
1
+ # React Resource UI
2
2
 
3
- This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
3
+ A data orchestration layer for React focused on pagination and list-based UI patterns.
4
4
 
5
- Currently, two official plugins are available:
5
+ npm: https://www.npmjs.com/package/react-resource-ui
6
6
 
7
- - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs)
8
- - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
7
+ ---
9
8
 
10
- ## React Compiler
9
+ ## Overview
11
10
 
12
- The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
11
+ React Resource UI provides a unified abstraction for handling data fetching, pagination, and virtualization in React applications.
13
12
 
14
- ## Expanding the ESLint configuration
13
+ It simplifies common UI patterns such as tables and lists by removing the need to rewrite logic when switching between pagination strategies.
15
14
 
16
- If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
15
+ ---
17
16
 
18
- ```js
19
- export default defineConfig([
20
- globalIgnores(['dist']),
21
- {
22
- files: ['**/*.{ts,tsx}'],
23
- extends: [
24
- // Other configs...
17
+ ## Installation
25
18
 
26
- // Remove tseslint.configs.recommended and replace with this
27
- tseslint.configs.recommendedTypeChecked,
28
- // Alternatively, use this for stricter rules
29
- tseslint.configs.strictTypeChecked,
30
- // Optionally, add this for stylistic rules
31
- tseslint.configs.stylisticTypeChecked,
19
+ npm install react-resource-ui
32
20
 
33
- // Other configs...
34
- ],
35
- languageOptions: {
36
- parserOptions: {
37
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
38
- tsconfigRootDir: import.meta.dirname,
39
- },
40
- // other options...
21
+ ---
22
+
23
+ ## Basic Usage
24
+
25
+ import { useResource } from "react-resource-ui";
26
+
27
+ function App() {
28
+ const { data, loading, error, page, setPage } = useResource({
29
+ source: async ({ page = 1, pageSize = 10 }) => {
30
+ const skip = (page - 1) * pageSize;
31
+ const res = await fetch(
32
+ `https://dummyjson.com/todos?limit=${pageSize}&skip=${skip}`
33
+ );
34
+ const json = await res.json();
35
+ return json.todos;
36
+ },
37
+
38
+ pagination: {
39
+ type: "page",
40
+ pageSize: 20,
41
41
  },
42
- },
43
- ])
44
- ```
45
-
46
- You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
47
-
48
- ```js
49
- // eslint.config.js
50
- import reactX from 'eslint-plugin-react-x'
51
- import reactDom from 'eslint-plugin-react-dom'
52
-
53
- export default defineConfig([
54
- globalIgnores(['dist']),
55
- {
56
- files: ['**/*.{ts,tsx}'],
57
- extends: [
58
- // Other configs...
59
- // Enable lint rules for React
60
- reactX.configs['recommended-typescript'],
61
- // Enable lint rules for React DOM
62
- reactDom.configs.recommended,
63
- ],
64
- languageOptions: {
65
- parserOptions: {
66
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
67
- tsconfigRootDir: import.meta.dirname,
68
- },
69
- // other options...
42
+
43
+ virtualization: {
44
+ enabled: true,
45
+ itemHeight: 40,
46
+ containerHeight: 400,
70
47
  },
71
- },
72
- ])
73
- ```
48
+ });
49
+
50
+ return null;
51
+ }
52
+
53
+ ---
54
+
55
+ ## Pagination Modes
56
+
57
+ The same logic can be reused across different pagination strategies by updating configuration only.
58
+
59
+ Page-based:
60
+ pagination: { type: "page" }
61
+
62
+ Load more:
63
+ pagination: { type: "loadmore" }
64
+
65
+ Infinite scroll:
66
+ pagination: { type: "infinite" }
67
+
68
+ ---
69
+
70
+ ## Features
71
+
72
+ - Unified API for multiple pagination strategies
73
+ - Built-in virtualization support
74
+ - Works with async functions, URLs, or static data sources
75
+ - Request deduplication using request tracking
76
+ - Lightweight page-based caching
77
+ - Designed for table and list UIs
78
+
79
+ ---
80
+
81
+ ## Design Goals
82
+
83
+ - Reduce UI-specific data handling complexity
84
+ - Avoid rewriting logic when changing pagination behavior
85
+ - Provide a higher-level abstraction over common data-fetching patterns
86
+ - Keep configuration simple and predictable
87
+
88
+ ---
89
+
90
+ ## Status
91
+
92
+ Version: 0.1.0
93
+
94
+ This is an early release focused on core functionality.
95
+ Additional testing and edge case handling are in progress.
96
+
97
+ ---
98
+
99
+ ## Roadmap
100
+
101
+ - Sorting and filtering support
102
+ - Form integration
103
+ - Improved caching strategies
104
+ - Developer tooling and debug utilities
105
+
106
+ ---
107
+
108
+ ## Author
109
+
110
+ Kalyan Mantha
package/package.json CHANGED
@@ -1,27 +1,26 @@
1
1
  {
2
2
  "name": "react-resource-ui",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A high-level data orchestration hook for React with pagination, caching, and virtualization",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
9
- "files": ["dist"],
9
+ "files": [
10
+ "dist"
11
+ ],
10
12
  "license": "MIT",
11
-
12
13
  "scripts": {
13
14
  "build": "tsup src/index.ts --format esm,cjs --dts"
14
15
  },
15
-
16
16
  "peerDependencies": {
17
17
  "react": "^18 || ^19",
18
18
  "react-dom": "^18 || ^19"
19
19
  },
20
-
21
20
  "devDependencies": {
22
21
  "@types/react": "^19.2.14",
23
22
  "@types/react-dom": "^19.2.3",
24
23
  "tsup": "^8.5.1",
25
24
  "typescript": "~5.9.3"
26
25
  }
27
- }
26
+ }