@neukoio/react-table 0.0.3 → 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.
Files changed (2) hide show
  1. package/README.md +72 -34
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
 
2
2
  # My React Table Package
3
3
 
4
- **`react-table-neuko-io`** is a lightweight, customizable, and reusable table component designed for React applications. Built with React and styled using Tailwind CSS, this package simplifies the creation of interactive and visually appealing tables.
4
+ **`@neukoio/react-table`** is a lightweight, customizable, and reusable table component designed for React applications. Built with React and styled using Tailwind CSS, this package simplifies the creation of interactive and visually appealing tables.
5
5
 
6
6
  ---
7
7
 
8
8
  ## 🚀 Features
9
9
 
10
- - 📦 **Reusable Components**: Includes `Table` and `Button` components out of the box.
10
+ - 📦 **Reusable Components**: Includes `Table` components out of the box.
11
11
  - 🎨 **Tailwind CSS Styling**: Fully styled and customizable using Tailwind CSS.
12
12
  - 🛠 **Ease of Use**: Simple API for quick integration.
13
13
  - ⚡ **Responsive Design**: Adapts seamlessly to all screen sizes.
@@ -19,7 +19,7 @@
19
19
  Install the package via npm:
20
20
 
21
21
  ```bash
22
- npm install react-table-neuko-io
22
+ npm install @neukoio/react-table
23
23
  ```
24
24
 
25
25
  ---
@@ -29,19 +29,72 @@ npm install react-table-neuko-io
29
29
  Here's a basic example of how to use the `react-table-neuko-io` package:
30
30
 
31
31
  ```jsx
32
- import React from "react";
33
- import { Table, Button } from "react-table-neuko-io";
34
-
35
- const App = () => {
36
- const data = [
37
- { name: "John Doe", email: "john@example.com", role: "Admin" },
38
- { name: "Jane Smith", email: "jane@example.com", role: "User" },
39
- ];
32
+ import React, { useState } from "react";
33
+ import { Table } from "@neukoio/react-table";
34
+
35
+ const App = () => {
36
+ const [data, setData] = useState(['']);
37
+ const [nextToken, setNextToken] = useState(1); // Token to check if more data is available
38
+ // Simulated function to load more data
39
+ const handleLoadMore = async () => {
40
+ // Simulating fetching data for the next "page"
41
+ const newEntries = //fetch the data here
42
+
43
+ // Update data and increment nextToken
44
+ setData((prevData) => [...prevData, ...newEntries]);
45
+ setNextToken(newEntries.length > 0 ? 'newToken' : null);
46
+ };
47
+
48
+ const columnDefs = {
49
+ default: [
50
+ {
51
+ accessorKey: 'row1',
52
+ name: 'Row 1',
53
+ style: 'px-3 py-3.5 text-left text-sm font-semibold text-gray-900',
54
+ row: (row) => {
55
+ return <td className="px-3 py-4 text-sm text-gray-500 leading-loose">
56
+ <p>{row.row1.email}</p>
57
+ <p>{row.row1.nophone}</p>
58
+ </td>
59
+ },
60
+ },
61
+ //you can add more the header for table based on you want
62
+ ],
63
+ sm: [
64
+ {
65
+ accessorKey: 'row1',
66
+ name: 'Row 1',
67
+ style: 'px-3 py-3.5 text-left text-xs font-semibold text-gray-900',
68
+ row: (row) => {
69
+ return <td className="px-3 py-4 text-xs text-gray-500 leading-loose">
70
+ <p>{row.row1.email}</p>
71
+ <p>{row.row1.nophone}</p>
72
+ </td>
73
+ },
74
+ },
75
+ //you can add more the header for table based on you want
76
+ ],
77
+ md: [
78
+ {
79
+ accessorKey: 'row1',
80
+ name: 'Row 1',
81
+ style: 'px-3 py-3.5 text-left text-xs font-semibold text-gray-900',
82
+ row: (row) => {
83
+ return <td className="px-3 py-4 text-xs text-gray-500">{row.row1.email}</td>
84
+ },
85
+ },
86
+ //you can add more the header for table based on you want
87
+ ],
88
+ }
40
89
 
41
90
  return (
42
91
  <div className="container mx-auto">
43
- <Table data={data} columns={["name", "email", "role"]} />
44
- <Button onClick={() => alert("Button clicked!")}>Click Me</Button>
92
+ <Table
93
+ data={data}
94
+ columnDefs={columnDefs}
95
+ isMoreData={nextToken !== null} // `true` if there's more data to load
96
+ onLoadMore={handleLoadMore} // Function to load more data
97
+ />
45
98
  </div>
46
99
  );
47
100
  };
@@ -73,28 +126,13 @@ react-table-neuko-io/
73
126
 
74
127
  ---
75
128
 
76
- ## 🧑‍💻 Development
77
-
78
- If you'd like to contribute or make changes to the package, follow these steps:
79
-
80
- 1. Clone the repository:
81
- ```bash
82
- git clone https://github.com/your-repo/react-table-neuko-io.git
83
- ```
84
-
85
- 2. Install dependencies:
86
- ```bash
87
- cd react-table-neuko-io
88
- npm install
89
- ```
129
+ ## 📜 License
90
130
 
91
- 3. Run the development server:
92
- ```bash
93
- npm start
94
- ```
131
+ This project is licensed under the **MIT License**. See the [LICENSE](./LICENSE) file for details.
95
132
 
96
133
  ---
134
+ ## 📋 Changelog
97
135
 
98
- ## 📜 License
99
-
100
- This project is licensed under the **MIT License**. See the [LICENSE](./LICENSE) file for details.
136
+ ### [1.0.0] - 2024-12-03
137
+ - Initial release of the package.
138
+ - Added basic table functionality with responsive columns.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neukoio/react-table",
3
- "version": "0.0.3",
3
+ "version": "1.0.0",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",