@mdspl/mds-shared-ui 0.4.5 โ†’ 0.4.6

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/README.md CHANGED
@@ -1,73 +1,286 @@
1
- # React + TypeScript + Vite
1
+ Below is a **clean, professional, OSS-ready README** for your table library.
2
+ No fluff, no cringe marketing โ€” just **clear value, real features, and real usage** based on **exactly what you built**.
2
3
 
3
- This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
+ You can copy-paste this directly as `README.md`.
4
5
 
5
- Currently, two official plugins are available:
6
+ ---
6
7
 
7
- - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
8
- - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
8
+ # ๐Ÿงฉ MDS DataTable
9
9
 
10
- ## React Compiler
10
+ A **headless-friendly, Chakra-styled, TanStack-powered data table** built for **real admin panels**, not toy demos.
11
11
 
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).
12
+ This table is designed for **production dashboards** where you need:
13
13
 
14
- ## Expanding the ESLint configuration
14
+ * stable layouts
15
+ * column control
16
+ * client/server pagination
17
+ * loading + skeleton states
18
+ * drag-reorderable headers
19
+ * zero dependency on heavy table engines
15
20
 
16
- If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
21
+ > Built with **React, Chakra UI, TanStack Store, DnD Kit**.
17
22
 
18
- ```js
19
- export default defineConfig([
20
- globalIgnores(['dist']),
21
- {
22
- files: ['**/*.{ts,tsx}'],
23
- extends: [
24
- // Other configs...
25
-
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,
32
-
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...
41
- },
42
- },
43
- ])
23
+ ---
24
+
25
+ ## โœจ Features
26
+
27
+ ### Core
28
+
29
+ * โœ… Fully typed (`<DataTable<T>>`)
30
+ * โœ… Client & server pagination
31
+ * โœ… Column sorting (asc / desc)
32
+ * โœ… Persistent column order (per table)
33
+ * โœ… Column visibility toggle
34
+ * โœ… Action column support
35
+ * โœ… Sticky headers
36
+ * โœ… Density control (`sm | md | lg`)
37
+
38
+ ### UX & States
39
+
40
+ * โœ… Centered loading spinner (table-safe)
41
+ * โœ… Skeleton rows (layout-accurate)
42
+ * โœ… Empty state handling
43
+ * โœ… No layout jump during loading
44
+ * โœ… Header always visible
45
+
46
+ ### Advanced
47
+
48
+ * ๐Ÿ” Drag & drop column reordering
49
+ * ๐Ÿ’พ Column order persisted via `localStorage`
50
+ * ๐Ÿง  Derived selectors (no duplicated logic)
51
+ * ๐Ÿงฑ Table-aware skeletons (not fake divs)
52
+ * โšก Powered by `@tanstack/store` (lightweight & fast)
53
+
54
+ ---
55
+
56
+ ## ๐Ÿงฑ Architecture
57
+
58
+ This table **does not rely on heavy table engines**.
59
+
60
+ Instead:
61
+
62
+ * **Store** โ†’ holds raw state
63
+ * **Selectors** โ†’ derive visible/sorted columns
64
+ * **Components** โ†’ render only what they should
65
+
66
+ This keeps:
67
+
68
+ * logic reusable
69
+ * rendering predictable
70
+ * performance stable on large datasets
71
+
72
+ ---
73
+
74
+ ## ๐Ÿ“ฆ Installation
75
+
76
+ ```bash
77
+ npm install @chakra-ui/react @tanstack/react-store @dnd-kit/core @dnd-kit/sortable
78
+ ```
79
+
80
+ > Chakra UI is required.
81
+ > This library is designed to **embrace Chakra**, not fight it.
82
+
83
+ ---
84
+
85
+ ## ๐Ÿš€ Basic Usage
86
+
87
+ ```tsx
88
+ <DataTable
89
+ tableId="users-table"
90
+ headers={headers}
91
+ data={data}
92
+ page={page}
93
+ pageSize={pageSize}
94
+ totalCount={data.length}
95
+ onPageChange={setPage}
96
+ onPageSizeChange={setPageSize}
97
+ />
98
+ ```
99
+
100
+ ---
101
+
102
+ ## ๐Ÿงฉ Column Definition
103
+
104
+ ```ts
105
+ const headers = [
106
+ { id: 'id', label: 'ID' },
107
+ { id: 'name', label: 'User Name', backgroundColor: 'orange.400' },
108
+ { id: 'email', label: 'Email' },
109
+ { id: 'role', label: 'Role' },
110
+ ];
44
111
  ```
45
112
 
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:
113
+ ### Supported column features
47
114
 
48
- ```js
49
- // eslint.config.js
50
- import reactX from 'eslint-plugin-react-x'
51
- import reactDom from 'eslint-plugin-react-dom'
115
+ * alignment
116
+ * background color
117
+ * custom formatters
118
+ * sortable toggle
119
+ * width control
52
120
 
53
- export default defineConfig([
54
- globalIgnores(['dist']),
121
+ ---
122
+
123
+ ## โš™๏ธ Actions Column
124
+
125
+ ```tsx
126
+ actions={[
55
127
  {
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...
70
- },
128
+ icon: <Edit size={14} />,
129
+ label: 'Edit',
130
+ onClick: (row) => console.log(row),
131
+ colorScheme: 'blue',
71
132
  },
72
- ])
133
+ {
134
+ icon: <Trash size={14} />,
135
+ label: 'Delete',
136
+ onClick: () => setOpen(true),
137
+ colorScheme: 'red',
138
+ },
139
+ ]}
140
+ ```
141
+
142
+ โœ” Sticky
143
+ โœ” Optional
144
+ โœ” Fully configurable
145
+
146
+ ---
147
+
148
+ ## โณ Loading States
149
+
150
+ ### Blocking loading (spinner)
151
+
152
+ ```tsx
153
+ <DataTable
154
+ loading
155
+ loadingChildren={<Spinner size="sm" />}
156
+ />
73
157
  ```
158
+
159
+ * Spinner is **perfectly centered**
160
+ * Header remains visible
161
+ * Pagination remains stable
162
+
163
+ ---
164
+
165
+ ### Skeleton loading (background fetch)
166
+
167
+ ```tsx
168
+ <DataTable
169
+ skeletonLoading
170
+ />
171
+ ```
172
+
173
+ * Skeleton rows align with real columns
174
+ * Uses `<Table.Row>` / `<Table.Cell>`
175
+ * No layout mismatch
176
+
177
+ ---
178
+
179
+ ## ๐Ÿ“ญ Empty State
180
+
181
+ ```tsx
182
+ <DataTable
183
+ data={[]}
184
+ emptyMessage="No records found"
185
+ />
186
+ ```
187
+
188
+ Centered, accessible, and table-safe.
189
+
190
+ ---
191
+
192
+ ## ๐Ÿ”„ Pagination Modes
193
+
194
+ ### Client-side
195
+
196
+ ```ts
197
+ paginationMode="client"
198
+ ```
199
+
200
+ ### Server-side
201
+
202
+ ```ts
203
+ paginationMode="server"
204
+ ```
205
+
206
+ You fully control data fetching.
207
+
208
+ ---
209
+
210
+ ## ๐Ÿง  Filters Integration (Optional)
211
+
212
+ The table plays nicely with external toolbars:
213
+
214
+ * reorderable filters
215
+ * saved presets
216
+ * controlled visibility
217
+ * size-aware layout
218
+
219
+ Example shown using `FiltersToolBar`.
220
+
221
+ ---
222
+
223
+ ## ๐Ÿงช Types (Fully Typed)
224
+
225
+ ```ts
226
+ DataTableProps<T>
227
+ Column<T>
228
+ DataTableAction<T>
229
+ ActionHeaderProps
230
+ ```
231
+
232
+ Everything is typed.
233
+ No `any` leaks.
234
+ No guessing.
235
+
236
+ ---
237
+
238
+ ## ๐ŸŽฏ Design Philosophy
239
+
240
+ This table is built for:
241
+
242
+ * admin panels
243
+ * analytics dashboards
244
+ * internal tools
245
+ * B2B SaaS products
246
+
247
+ **Not** for:
248
+
249
+ * marketing pages
250
+ * static lists
251
+ * low-control UI kits
252
+
253
+ ---
254
+
255
+ ## ๐Ÿ›ฃ Roadmap
256
+
257
+ * [ ] Column resizing
258
+ * [ ] Row selection
259
+ * [ ] Virtualized rows
260
+ * [ ] Export (CSV / Excel)
261
+ * [ ] Preset column layouts
262
+ * [ ] Server-side sorting helpers
263
+
264
+ ---
265
+
266
+ ## ๐Ÿง‘โ€๐Ÿ’ป Author
267
+
268
+ Built by **Raj Purkait**
269
+ Full-stack engineer focused on **performance-first UI systems**.
270
+
271
+ ---
272
+
273
+ ## ๐Ÿ“„ License
274
+
275
+ MIT โ€” free, open-source, forever.
276
+
277
+ ---
278
+
279
+ If you want, next I can:
280
+
281
+ * tighten this README for npm
282
+ * add architecture diagrams
283
+ * write contribution guidelines
284
+ * extract this into a mono-repo-ready package
285
+
286
+ Just say the word.