gridular 1.0.3 → 1.2.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 +68 -14
  2. package/package.json +2 -1
package/README.md CHANGED
@@ -9,6 +9,8 @@ Gridular is a flexible and customizable data grid component for React applicatio
9
9
  - **Pagination**: Navigate through large datasets with pagination controls.
10
10
  - **Row Selection**: Select rows for actions or data manipulation.
11
11
  - **Column Resizing**: Adjust column widths to fit your data needs.
12
+ - **Column Management**: Show/hide and reorder columns as needed.
13
+ - **Grid State Persistence**: Maintain column widths and ordering between sessions.
12
14
 
13
15
  ## Installation
14
16
 
@@ -18,8 +20,6 @@ To install Gridular, use npm or yarn:
18
20
  npm install gridular
19
21
  ```
20
22
 
21
- or
22
-
23
23
  ```bash
24
24
  yarn add gridular
25
25
  ```
@@ -28,19 +28,19 @@ yarn add gridular
28
28
 
29
29
  To use the DataGrid component, import it into your React component:
30
30
 
31
- ```tsx
32
- import { DataGrid } from 'gridular/components/data-grid';
31
+ ```typescript
32
+ import { DataGrid } from "gridular/components/data-grid";
33
33
 
34
34
  const MyComponent = () => {
35
35
  const columns = [
36
- { id: 'name', header: 'Name' },
37
- { id: 'age', header: 'Age' },
36
+ { id: "name", header: "Name" },
37
+ { id: "age", header: "Age" },
38
38
  // Add more columns as needed
39
39
  ];
40
40
 
41
41
  const data = [
42
- { id: 1, name: 'John Doe', age: 28 },
43
- { id: 2, name: 'Jane Smith', age: 34 },
42
+ { id: 1, name: "John Doe", age: 28 },
43
+ { id: 2, name: "Jane Smith", age: 34 },
44
44
  // Add more data as needed
45
45
  ];
46
46
 
@@ -57,16 +57,70 @@ const MyComponent = () => {
57
57
  - **TableCell**: Represents individual cells in the data grid.
58
58
  - **TableHeader**: Renders the header of the data grid.
59
59
  - **TableRow**: Represents individual rows in the data grid.
60
+ - **ColumnManager**: Manages column visibility and order.
60
61
 
61
62
  ## Custom Hooks
62
63
 
63
- Gridular also provides custom hooks for managing various functionalities:
64
+ Gridular provides custom hooks for managing various functionalities:
64
65
 
65
66
  - **useColumnResize**: For managing column resizing.
66
- - **useFiltering**: For managing filtering logic.
67
- - **usePagination**: For managing pagination logic.
68
- - **useRowSelection**: For managing row selection.
69
- - **useSorting**: For managing sorting logic.
67
+ - **useGridPersistence**: For persisting grid preferences like - \*\*column widths and order.
68
+
69
+ ## Utility Functions
70
+
71
+ Gridular provides several utility functions to help with styling and component customization:
72
+
73
+ ```typescript
74
+ cn(...inputs: ClassValue[])
75
+ ```
76
+
77
+ A utility function that combines multiple class names or conditional class expressions using clsx and tailwind-merge. This helps avoid className conflicts when using Tailwind CSS.
78
+
79
+ ```typescript
80
+ import { cn } from "gridular";
81
+
82
+ // Usage
83
+ <div
84
+ className={cn(
85
+ "base-class",
86
+ isActive && "active-class",
87
+ isFocused ? "focused-class" : "unfocused-class"
88
+ )}
89
+ >
90
+ Content
91
+ </div>;
92
+ ```
93
+
94
+ ```typescript
95
+ mergeStyles(tssStyles, tailwindClasses);
96
+ ```
97
+
98
+ Combines TSS-React style objects with Tailwind CSS classes, making it easier to integrate both styling approaches.
99
+
100
+ ```typescript
101
+ import { mergeStyles } from "gridular";
102
+
103
+ // Usage
104
+ const styles = mergeStyles(
105
+ { color: "#000", backgroundColor: "#fff" },
106
+ "p-4 rounded-md hover:bg-gray-100"
107
+ );
108
+
109
+ <div {...styles}>Content</div>;
110
+ ```
111
+
112
+ ## Parameters:
113
+
114
+ -- tssStyles: A TSS-React style object (CSSObject)
115
+ -- tailwindClasses: A string or array of strings containing -- Tailwind class names Returns an object with merged styles that can be spread into React components.
116
+
117
+ ## Theming
118
+
119
+ Gridular includes a built-in theme provider that allows you to customize the appearance of your data grids:
120
+
121
+ -- ThemeProvider: Context provider for styling your data grids.
122
+ -- ThemeSwitcher: Component for toggling between light and dark themes.
123
+ -- ThemeWrapper: Utility component for wrapping your components with theme context.
70
124
 
71
125
  ## Contributing
72
126
 
@@ -74,4 +128,4 @@ Contributions are welcome! Please open an issue or submit a pull request for any
74
128
 
75
129
  ## License
76
130
 
77
- This project is licensed under the MIT License. See the LICENSE file for details.
131
+ This project is licensed under the MIT License. See the LICENSE file for details.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gridular",
3
- "version": "1.0.3",
3
+ "version": "1.2.0",
4
4
  "description": "A customizable data grid component for React.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -49,6 +49,7 @@
49
49
  "@emotion/react": "^11.14.0",
50
50
  "@emotion/styled": "^11.14.0",
51
51
  "@mui/material": "^6.4.7",
52
+ "@radix-ui/react-context-menu": "^2.2.6",
52
53
  "@radix-ui/react-dropdown-menu": "^2.1.6",
53
54
  "@radix-ui/react-popover": "^1.1.6",
54
55
  "@radix-ui/react-select": "^2.1.6",