react-live-data-table 1.0.5 → 1.0.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-live-data-table",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Your React component package with Tailwind",
5
5
  "main": "src/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -15,6 +15,7 @@ function ReactDataTable({
15
15
  staticData = null,
16
16
  emptyText,
17
17
  rowHeights = 40,
18
+ checkboxStyle,
18
19
  headerProps = {} // Added default value
19
20
  }) {
20
21
  const tableContainerRef = React.useRef(null);
@@ -159,6 +160,24 @@ function ReactDataTable({
159
160
 
160
161
  const flatData = data.pages.flatMap(page => page.data);
161
162
 
163
+ const checkBoxStyle = checkboxStyle ? checkboxStyle : {
164
+ cursor: 'pointer',
165
+ background: 'rgb(249, 250, 251)',
166
+ height: '18px',
167
+ width: '18px',
168
+ display: 'flex',
169
+ alignItems: 'center',
170
+ justifyContent: 'center',
171
+ borderRadius: '4px',
172
+ border: '1px solid rgb(204, 204, 204)',
173
+ fontSize: '12px',
174
+ color: 'rgb(0, 122, 179)',
175
+ position: 'absolute',
176
+ top: '50%',
177
+ left: '50%',
178
+ transform: 'translate(-50%, -50%)'
179
+ };
180
+
162
181
  const checkboxColumn = {
163
182
  id: 'select',
164
183
  size: 50,
@@ -167,6 +186,7 @@ function ReactDataTable({
167
186
  header: ({ data }) => (
168
187
  <div className="flex items-center justify-center h-[40px]">
169
188
  <input
189
+ id={data.id}
170
190
  type="checkbox"
171
191
  checked={Object.keys(selectedRows).length > 0 && data.every(row => selectedRows[row.id])}
172
192
  onChange={(e) => handleSelectAll(e.target.checked, flatData)}
@@ -176,9 +196,11 @@ function ReactDataTable({
176
196
  cell: ({ row }) => (
177
197
  <div className="flex items-center justify-center h-[40px]">
178
198
  <input
199
+ style={checkBoxStyle}
179
200
  type="checkbox"
180
201
  checked={!!selectedRows[row.id]}
181
- onChange={(e) => handleSelectRow(e.target.checked, row, flatData)}
202
+ onClick={(e) => e.stopPropagation()}
203
+ onChange={(e) => { e.stopPropagation(); handleSelectRow(e.target.checked, row, flatData) }}
182
204
  />
183
205
  </div>
184
206
  ),
@@ -190,16 +212,21 @@ function ReactDataTable({
190
212
  <div className="bg-white relative w-full">
191
213
  {loading && (
192
214
  <div className="absolute inset-0 bg-white/50 z-20 flex items-center justify-center">
193
- <div className={`flex items-center justify-center`}>
194
- <div role="status" className="relative">
195
215
  <svg
196
- className={`animate-spin w-6 h-6}`}
216
+ style={{
217
+ animation: 'spin 1s linear infinite',
218
+ width: '24px',
219
+ height: '24px'
220
+ }}
197
221
  viewBox="0 0 24 24"
198
222
  fill="none"
199
223
  xmlns="http://www.w3.org/2000/svg"
200
224
  >
225
+ <style>
226
+ {`@keyframes spin {from {transform: rotate(0deg)} to {transform: rotate(360deg)}}`}
227
+ </style>
201
228
  <circle
202
- className="opacity-25"
229
+ style={{ opacity: 0.25 }}
203
230
  cx="12"
204
231
  cy="12"
205
232
  r="10"
@@ -207,14 +234,12 @@ function ReactDataTable({
207
234
  strokeWidth="4"
208
235
  />
209
236
  <path
210
- className="opacity-75"
237
+ style={{ opacity: 0.75 }}
211
238
  fill="currentColor"
212
239
  d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
213
240
  />
214
241
  </svg>
215
- <span className="sr-only">Loading...</span>
216
- </div>
217
- </div>
242
+
218
243
  </div>
219
244
  )}
220
245