@saptanshuwanjari/react-component-library 0.1.0 → 0.1.8

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 CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Saptanshu Wanjari
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.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Saptanshu Wanjari
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 CHANGED
@@ -1,56 +1,56 @@
1
- # React Component Library
2
-
3
- A modern, lightweight React component library featuring robust DataTable and Form components built with the Compound Component pattern.
4
-
5
- ## Features
6
-
7
- - 🎯 **DataTable**: Powerful data table with sorting, filtering, and pagination
8
- - 📝 **Form**: Flexible form system with validation using react-hook-form and Zod
9
- - 🎨 **Styled with Tailwind CSS**: Fully customizable with Tailwind
10
- - 📦 **Tree-shakeable**: Only import what you need
11
- - 🔷 **TypeScript**: Full type safety
12
-
13
- ## Installation
14
-
15
- ```bash
16
- npm install @your-org/react-component-library
17
- ```
18
-
19
- ## Usage
20
-
21
- ```tsx
22
- import { Form, DataTable } from '@your-org/react-component-library';
23
-
24
- // Form example
25
- <Form.Root schema={mySchema} onSubmit={handleSubmit}>
26
- <Form.InputField name="email" label="Email" />
27
- <Form.Submit>Submit</Form.Submit>
28
- </Form.Root>
29
-
30
- // DataTable example
31
- <DataTable.Root data={data}>
32
- <DataTable.Header>
33
- <DataTable.Column>Name</DataTable.Column>
34
- </DataTable.Header>
35
- <DataTable.Body />
36
- </DataTable.Root>
37
- ```
38
-
39
- ## Development
40
-
41
- This library is built with `tsup` for fast bundling. The `example/` folder contains a Next.js app for testing components locally.
42
-
43
- ```bash
44
- # Install dependencies
45
- npm install
46
-
47
- # Start development mode
48
- npm run dev
49
-
50
- # Build for production
51
- npm run build
52
- ```
53
-
54
- ## License
55
-
56
- MIT
1
+ # React Component Library
2
+
3
+ A modern, lightweight React component library featuring robust DataTable and Form components built with the Compound Component pattern.
4
+
5
+ ## Features
6
+
7
+ - 🎯 **DataTable**: Powerful data table with sorting, filtering, and pagination
8
+ - 📝 **Form**: Flexible form system with validation using react-hook-form and Zod
9
+ - 🎨 **Styled with Tailwind CSS**: Fully customizable with Tailwind
10
+ - 📦 **Tree-shakeable**: Only import what you need
11
+ - 🔷 **TypeScript**: Full type safety
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ npm install @your-org/react-component-library
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ```tsx
22
+ import { Form, DataTable } from '@your-org/react-component-library';
23
+
24
+ // Form example
25
+ <Form.Root schema={mySchema} onSubmit={handleSubmit}>
26
+ <Form.InputField name="email" label="Email" />
27
+ <Form.Submit>Submit</Form.Submit>
28
+ </Form.Root>
29
+
30
+ // DataTable example
31
+ <DataTable.Root data={data}>
32
+ <DataTable.Header>
33
+ <DataTable.Column>Name</DataTable.Column>
34
+ </DataTable.Header>
35
+ <DataTable.Body />
36
+ </DataTable.Root>
37
+ ```
38
+
39
+ ## Development
40
+
41
+ This library is built with `tsup` for fast bundling. The `example/` folder contains a Next.js app for testing components locally.
42
+
43
+ ```bash
44
+ # Install dependencies
45
+ npm install
46
+
47
+ # Start development mode
48
+ npm run dev
49
+
50
+ # Build for production
51
+ npm run build
52
+ ```
53
+
54
+ ## License
55
+
56
+ MIT
package/dist/index.d.mts CHANGED
@@ -133,12 +133,17 @@ interface RootProps<TData, TValue> {
133
133
  data: TData[];
134
134
  filters?: FilterOption[];
135
135
  defaultViewMode?: ViewMode;
136
+ viewMode?: ViewMode;
137
+ onViewModeChange?: (mode: ViewMode) => void;
136
138
  defaultPageSize?: number;
137
139
  children: React.ReactNode;
138
140
  }
139
- declare function Root<TData, TValue>({ columns, data, filters, defaultViewMode, defaultPageSize, children, }: RootProps<TData, TValue>): react_jsx_runtime.JSX.Element;
141
+ declare function Root<TData, TValue>({ columns, data, filters, defaultViewMode, viewMode: controlledViewMode, onViewModeChange: controlledOnViewModeChange, defaultPageSize, children, }: RootProps<TData, TValue>): react_jsx_runtime.JSX.Element;
140
142
 
141
- declare function Toolbar(): react_jsx_runtime.JSX.Element;
143
+ interface ToolbarProps {
144
+ viewOptions?: React.ReactNode;
145
+ }
146
+ declare function Toolbar({ viewOptions }?: ToolbarProps): react_jsx_runtime.JSX.Element;
142
147
 
143
148
  interface ContentProps {
144
149
  renderCard?: (item: any, index: number) => React.ReactNode;
@@ -158,12 +163,19 @@ declare function GridView<TData = any>({ renderCard, columns, gap }: GridViewPro
158
163
 
159
164
  declare function Pagination(): react_jsx_runtime.JSX.Element;
160
165
 
166
+ interface ViewOptionsProps {
167
+ viewMode?: ViewMode;
168
+ onViewModeChange?: (mode: ViewMode) => void;
169
+ }
170
+ declare function ViewOptions({ viewMode: propViewMode, onViewModeChange: propOnViewModeChange }: ViewOptionsProps): react_jsx_runtime.JSX.Element;
171
+
161
172
  declare const DataTable: typeof Root & {
162
173
  Toolbar: typeof Toolbar;
163
174
  Content: typeof Content;
164
175
  TableView: typeof TableView;
165
176
  GridView: typeof GridView;
166
177
  Pagination: typeof Pagination;
178
+ ViewOptions: typeof ViewOptions;
167
179
  };
168
180
 
169
181
  declare function cn(...inputs: ClassValue[]): string;
package/dist/index.d.ts CHANGED
@@ -133,12 +133,17 @@ interface RootProps<TData, TValue> {
133
133
  data: TData[];
134
134
  filters?: FilterOption[];
135
135
  defaultViewMode?: ViewMode;
136
+ viewMode?: ViewMode;
137
+ onViewModeChange?: (mode: ViewMode) => void;
136
138
  defaultPageSize?: number;
137
139
  children: React.ReactNode;
138
140
  }
139
- declare function Root<TData, TValue>({ columns, data, filters, defaultViewMode, defaultPageSize, children, }: RootProps<TData, TValue>): react_jsx_runtime.JSX.Element;
141
+ declare function Root<TData, TValue>({ columns, data, filters, defaultViewMode, viewMode: controlledViewMode, onViewModeChange: controlledOnViewModeChange, defaultPageSize, children, }: RootProps<TData, TValue>): react_jsx_runtime.JSX.Element;
140
142
 
141
- declare function Toolbar(): react_jsx_runtime.JSX.Element;
143
+ interface ToolbarProps {
144
+ viewOptions?: React.ReactNode;
145
+ }
146
+ declare function Toolbar({ viewOptions }?: ToolbarProps): react_jsx_runtime.JSX.Element;
142
147
 
143
148
  interface ContentProps {
144
149
  renderCard?: (item: any, index: number) => React.ReactNode;
@@ -158,12 +163,19 @@ declare function GridView<TData = any>({ renderCard, columns, gap }: GridViewPro
158
163
 
159
164
  declare function Pagination(): react_jsx_runtime.JSX.Element;
160
165
 
166
+ interface ViewOptionsProps {
167
+ viewMode?: ViewMode;
168
+ onViewModeChange?: (mode: ViewMode) => void;
169
+ }
170
+ declare function ViewOptions({ viewMode: propViewMode, onViewModeChange: propOnViewModeChange }: ViewOptionsProps): react_jsx_runtime.JSX.Element;
171
+
161
172
  declare const DataTable: typeof Root & {
162
173
  Toolbar: typeof Toolbar;
163
174
  Content: typeof Content;
164
175
  TableView: typeof TableView;
165
176
  GridView: typeof GridView;
166
177
  Pagination: typeof Pagination;
178
+ ViewOptions: typeof ViewOptions;
167
179
  };
168
180
 
169
181
  declare function cn(...inputs: ClassValue[]): string;