@unbxd-ui/unbxd-react-components 0.2.145-beta.5 → 0.2.145-beta.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.
Files changed (37) hide show
  1. package/README.md +1 -1
  2. package/components/Form/SearchableDropdown.js +1 -1
  3. package/components/Form/formCore.css +1 -1
  4. package/components/Form/stories/Checkbox.stories.js +7 -0
  5. package/components/Form/stories/Dropdown.stories.js +1 -0
  6. package/components/Form/stories/Input.stories.js +3 -0
  7. package/components/Form/stories/RangeSlider.stories.js +2 -1
  8. package/components/Form/stories/ServerPaginatedDropdown.stories.js +10 -15
  9. package/components/Form/stories/Toggle.stories.js +1 -0
  10. package/components/Form/variables.css +0 -0
  11. package/components/InlineModal/inlineModalCore.css +1 -1
  12. package/components/Modal/Modal.stories.js +7 -25
  13. package/components/Modal/modalCore.css +1 -1
  14. package/components/NotificationComponent/NotificationComponent.stories.js +2 -1
  15. package/components/ProgressBar/progressBarCore.css +1 -1
  16. package/components/Table/BaseTable.js +84 -353
  17. package/components/Table/Table.js +5 -357
  18. package/components/Table/Table.stories.js +898 -0
  19. package/components/Table/TableChild.js +372 -0
  20. package/components/Table/TableConstants.js +15 -0
  21. package/components/Table/hooks/usePrevious.js +14 -0
  22. package/components/Table/index.js +13 -0
  23. package/components/Table/tableCore.css +1 -1
  24. package/components/TableOld/BaseTable.js +373 -0
  25. package/components/TableOld/PaginationComponent.js +86 -0
  26. package/components/TableOld/TableOld.js +367 -0
  27. package/components/TableOld/index.js +15 -0
  28. package/components/Tooltip/Tooltip.js +219 -80
  29. package/components/Tooltip/Tooltip.stories.js +205 -34
  30. package/components/Tooltip/tooltipCore.css +1 -1
  31. package/components/Tooltip/tooltipTheme.css +1 -1
  32. package/components/core.css +2 -2
  33. package/components/core.scss +14 -0
  34. package/components/index.js +7 -0
  35. package/components/theme.css +2 -2
  36. package/index.js +6 -0
  37. package/package.json +8 -2
@@ -0,0 +1,898 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = exports.ServerSidePagination = exports.SelectableRows = exports.RefreshTable = exports.NoPagination = exports.NoDataDefault = exports.Default = exports.CustomStyling = exports.CustomNoDataComponent = exports.CustomColumnFormatting = exports.BottomPagination = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _Table = _interopRequireDefault(require("./Table"));
10
+ var _dataLoader = _interopRequireDefault(require("../../core/dataLoader"));
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
12
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
13
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
14
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
15
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
16
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
17
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
18
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
19
+ // Custom CheckBoxRow component for stories
20
+ var CustomCheckBoxRow = function CustomCheckBoxRow(_ref) {
21
+ var selected = _ref.selected,
22
+ onSelectionChange = _ref.onSelectionChange,
23
+ _ref$isCell = _ref.isCell,
24
+ isCell = _ref$isCell === void 0 ? false : _ref$isCell,
25
+ row = _ref.row;
26
+ var handleChange = function handleChange(e) {
27
+ if (isCell && row) {
28
+ onSelectionChange(row, e.target.checked);
29
+ } else {
30
+ onSelectionChange(null, e.target.checked);
31
+ }
32
+ };
33
+ return /*#__PURE__*/_react["default"].createElement("input", {
34
+ type: "checkbox",
35
+ checked: selected,
36
+ onChange: handleChange,
37
+ style: {
38
+ width: '16px',
39
+ height: '16px',
40
+ cursor: 'pointer',
41
+ accentColor: '#007bff'
42
+ }
43
+ });
44
+ };
45
+
46
+ // Set up request configurations for server-side examples
47
+ _dataLoader["default"].addRequestConfig('getUsers', {
48
+ url: 'https://jsonplaceholder.typicode.com/users',
49
+ method: 'GET'
50
+ });
51
+ _dataLoader["default"].addRequestConfig('getPosts', {
52
+ url: 'https://jsonplaceholder.typicode.com/posts',
53
+ method: 'GET'
54
+ });
55
+
56
+ // Sample data for stories
57
+ var sampleRecords = [{
58
+ id: 1,
59
+ name: 'John Doe',
60
+ email: 'john.doe@example.com',
61
+ age: 30,
62
+ department: 'Engineering',
63
+ salary: 75000
64
+ }, {
65
+ id: 2,
66
+ name: 'Jane Smith',
67
+ email: 'jane.smith@example.com',
68
+ age: 28,
69
+ department: 'Marketing',
70
+ salary: 65000
71
+ }, {
72
+ id: 3,
73
+ name: 'Bob Johnson',
74
+ email: 'bob.johnson@example.com',
75
+ age: 35,
76
+ department: 'Sales',
77
+ salary: 80000
78
+ }, {
79
+ id: 4,
80
+ name: 'Alice Brown',
81
+ email: 'alice.brown@example.com',
82
+ age: 32,
83
+ department: 'Engineering',
84
+ salary: 78000
85
+ }, {
86
+ id: 5,
87
+ name: 'Charlie Wilson',
88
+ email: 'charlie.wilson@example.com',
89
+ age: 29,
90
+ department: 'HR',
91
+ salary: 60000
92
+ }, {
93
+ id: 6,
94
+ name: 'Diana Davis',
95
+ email: 'diana.davis@example.com',
96
+ age: 31,
97
+ department: 'Marketing',
98
+ salary: 67000
99
+ }, {
100
+ id: 7,
101
+ name: 'Edward Miller',
102
+ email: 'edward.miller@example.com',
103
+ age: 33,
104
+ department: 'Sales',
105
+ salary: 82000
106
+ }, {
107
+ id: 8,
108
+ name: 'Fiona Garcia',
109
+ email: 'fiona.garcia@example.com',
110
+ age: 27,
111
+ department: 'Engineering',
112
+ salary: 72000
113
+ }, {
114
+ id: 9,
115
+ name: 'George Martinez',
116
+ email: 'george.martinez@example.com',
117
+ age: 34,
118
+ department: 'HR',
119
+ salary: 62000
120
+ }, {
121
+ id: 10,
122
+ name: 'Helen Taylor',
123
+ email: 'helen.taylor@example.com',
124
+ age: 30,
125
+ department: 'Marketing',
126
+ salary: 68000
127
+ }, {
128
+ id: 11,
129
+ name: 'Isaac Thompson',
130
+ email: 'isaac.thompson@example.com',
131
+ age: 36,
132
+ department: 'Engineering',
133
+ salary: 79000
134
+ }, {
135
+ id: 12,
136
+ name: 'Julia White',
137
+ email: 'julia.white@example.com',
138
+ age: 26,
139
+ department: 'HR',
140
+ salary: 61000
141
+ }, {
142
+ id: 13,
143
+ name: 'Kevin Harris',
144
+ email: 'kevin.harris@example.com',
145
+ age: 38,
146
+ department: 'Sales',
147
+ salary: 85000
148
+ }, {
149
+ id: 14,
150
+ name: 'Laura Lewis',
151
+ email: 'laura.lewis@example.com',
152
+ age: 29,
153
+ department: 'Marketing',
154
+ salary: 66000
155
+ }, {
156
+ id: 15,
157
+ name: 'Michael Young',
158
+ email: 'michael.young@example.com',
159
+ age: 40,
160
+ department: 'Engineering',
161
+ salary: 88000
162
+ }, {
163
+ id: 16,
164
+ name: 'Natalie Hall',
165
+ email: 'natalie.hall@example.com',
166
+ age: 31,
167
+ department: 'HR',
168
+ salary: 63000
169
+ }, {
170
+ id: 17,
171
+ name: 'Oliver Allen',
172
+ email: 'oliver.allen@example.com',
173
+ age: 28,
174
+ department: 'Sales',
175
+ salary: 81000
176
+ }, {
177
+ id: 18,
178
+ name: 'Patricia King',
179
+ email: 'patricia.king@example.com',
180
+ age: 33,
181
+ department: 'Marketing',
182
+ salary: 69000
183
+ }, {
184
+ id: 19,
185
+ name: 'Quentin Scott',
186
+ email: 'quentin.scott@example.com',
187
+ age: 35,
188
+ department: 'Engineering',
189
+ salary: 76000
190
+ }, {
191
+ id: 20,
192
+ name: 'Rachel Adams',
193
+ email: 'rachel.adams@example.com',
194
+ age: 30,
195
+ department: 'HR',
196
+ salary: 64000
197
+ }];
198
+
199
+ // Sample column configurations
200
+ var basicColumnConfigs = [{
201
+ name: 'Name',
202
+ selector: function selector(row) {
203
+ return row.name;
204
+ },
205
+ sortable: true,
206
+ cell: function cell(row) {
207
+ return /*#__PURE__*/_react["default"].createElement("div", {
208
+ className: "tbl-content"
209
+ }, row.name);
210
+ },
211
+ width: '200px'
212
+ }, {
213
+ name: 'Email',
214
+ selector: function selector(row) {
215
+ return row.email;
216
+ },
217
+ sortable: true,
218
+ cell: function cell(row) {
219
+ return /*#__PURE__*/_react["default"].createElement("div", {
220
+ className: "tbl-content"
221
+ }, row.email);
222
+ },
223
+ width: '250px'
224
+ }, {
225
+ name: 'Age',
226
+ selector: function selector(row) {
227
+ return row.age;
228
+ },
229
+ sortable: true,
230
+ cell: function cell(row) {
231
+ return /*#__PURE__*/_react["default"].createElement("div", {
232
+ className: "tbl-content"
233
+ }, row.age);
234
+ },
235
+ width: '100px'
236
+ }, {
237
+ name: 'Department',
238
+ selector: function selector(row) {
239
+ return row.department;
240
+ },
241
+ sortable: true,
242
+ cell: function cell(row) {
243
+ return /*#__PURE__*/_react["default"].createElement("div", {
244
+ className: "tbl-content"
245
+ }, row.department);
246
+ },
247
+ width: '150px'
248
+ }, {
249
+ name: 'Salary',
250
+ selector: function selector(row) {
251
+ return "$".concat(row.salary.toLocaleString());
252
+ },
253
+ sortable: true,
254
+ cell: function cell(row) {
255
+ return /*#__PURE__*/_react["default"].createElement("div", {
256
+ className: "tbl-content"
257
+ }, row.salary);
258
+ },
259
+ width: '120px'
260
+ }];
261
+ var postsColumnConfigs = [{
262
+ name: 'Post ID',
263
+ selector: function selector(row) {
264
+ return row.id;
265
+ },
266
+ sortable: true,
267
+ width: '100px'
268
+ }, {
269
+ name: 'Title',
270
+ selector: function selector(row) {
271
+ return row.title;
272
+ },
273
+ sortable: true,
274
+ width: '300px',
275
+ cell: function cell(row) {
276
+ return /*#__PURE__*/_react["default"].createElement("div", {
277
+ style: {
278
+ fontWeight: '500',
279
+ color: '#2c3e50',
280
+ lineHeight: '1.4'
281
+ }
282
+ }, row.title);
283
+ }
284
+ }, {
285
+ name: 'Body',
286
+ selector: function selector(row) {
287
+ return row.body;
288
+ },
289
+ sortable: true,
290
+ width: '400px',
291
+ cell: function cell(row) {
292
+ return /*#__PURE__*/_react["default"].createElement("div", {
293
+ style: {
294
+ color: '#666',
295
+ fontSize: '13px',
296
+ lineHeight: '1.3',
297
+ maxHeight: '60px',
298
+ overflow: 'hidden',
299
+ textOverflow: 'ellipsis'
300
+ }
301
+ }, row.body);
302
+ }
303
+ }, {
304
+ name: 'User ID',
305
+ selector: function selector(row) {
306
+ return row.userId;
307
+ },
308
+ sortable: true,
309
+ width: '100px',
310
+ cell: function cell(row) {
311
+ return /*#__PURE__*/_react["default"].createElement("span", {
312
+ style: {
313
+ padding: '4px 8px',
314
+ borderRadius: '12px',
315
+ fontSize: '12px',
316
+ fontWeight: '500',
317
+ backgroundColor: '#e3f2fd',
318
+ color: '#1976d2'
319
+ }
320
+ }, "User ", row.userId);
321
+ }
322
+ }];
323
+ var _default = exports["default"] = {
324
+ title: 'Components/Table',
325
+ component: _Table["default"],
326
+ parameters: {
327
+ layout: 'padded',
328
+ docs: {
329
+ description: {
330
+ component: 'A comprehensive table component that supports client-side and server-side pagination, sorting, searching, expandable rows, and more.'
331
+ }
332
+ }
333
+ },
334
+ tags: ['autodocs'],
335
+ argTypes: {
336
+ records: {
337
+ control: 'object',
338
+ description: 'Array of data records to display in the table'
339
+ },
340
+ columnConfigs: {
341
+ control: 'object',
342
+ description: 'Array of column configurations defining table structure'
343
+ },
344
+ paginationType: {
345
+ control: 'select',
346
+ options: ['', 'CLIENT', 'SERVER'],
347
+ description: 'Type of pagination to use (empty for no pagination)'
348
+ },
349
+ pagination: {
350
+ control: 'boolean',
351
+ description: 'Whether to show pagination controls'
352
+ },
353
+ expandableRows: {
354
+ control: 'boolean',
355
+ description: 'Whether rows can be expanded to show additional content'
356
+ },
357
+ selectableRows: {
358
+ control: 'boolean',
359
+ description: 'Whether rows can be selected with checkboxes'
360
+ },
361
+ showSelectableRows: {
362
+ control: 'boolean',
363
+ description: 'Whether to show selectable rows with checkboxes'
364
+ },
365
+ customClassName: {
366
+ control: 'text',
367
+ description: 'Additional CSS classes for styling'
368
+ },
369
+ noDataDescription: {
370
+ control: 'text',
371
+ description: 'Description text shown when no data is available'
372
+ },
373
+ noDataHeading: {
374
+ control: 'text',
375
+ description: 'Heading text shown when no data is available'
376
+ }
377
+ }
378
+ }; // Template for stories
379
+ var Template = function Template(args) {
380
+ return /*#__PURE__*/_react["default"].createElement(_Table["default"], args);
381
+ };
382
+
383
+ // Basic table with client-side pagination
384
+ var Default = exports.Default = Template.bind({});
385
+ Default.args = {
386
+ records: sampleRecords,
387
+ columnConfigs: basicColumnConfigs,
388
+ paginationType: 'CLIENT',
389
+ pagination: true,
390
+ customClassName: 'custom-table'
391
+ };
392
+
393
+ // Table without pagination
394
+ var NoPagination = exports.NoPagination = Template.bind({});
395
+ NoPagination.args = {
396
+ records: sampleRecords,
397
+ columnConfigs: basicColumnConfigs,
398
+ pagination: false,
399
+ customClassName: 'custom-table'
400
+ };
401
+
402
+ // Table with custom styling
403
+ var CustomStyling = exports.CustomStyling = Template.bind({});
404
+ CustomStyling.args = {
405
+ records: sampleRecords,
406
+ columnConfigs: basicColumnConfigs,
407
+ paginationType: 'CLIENT',
408
+ pagination: true,
409
+ customClassName: 'custom-table-styled'
410
+ };
411
+
412
+ // Table with no data
413
+ var NoDataDefault = exports.NoDataDefault = Template.bind({});
414
+ NoDataDefault.args = {
415
+ records: [],
416
+ columnConfigs: basicColumnConfigs,
417
+ paginationType: 'CLIENT',
418
+ pagination: true,
419
+ customClassName: 'custom-table'
420
+ };
421
+
422
+ // Table with custom no data component
423
+ var CustomNoDataComponent = exports.CustomNoDataComponent = function CustomNoDataComponent() {
424
+ var _useState = (0, _react.useState)(false),
425
+ _useState2 = _slicedToArray(_useState, 2),
426
+ hasData = _useState2[0],
427
+ setHasData = _useState2[1];
428
+ var CustomNoData = function CustomNoData(_ref2) {
429
+ var description = _ref2.description,
430
+ heading = _ref2.heading;
431
+ return /*#__PURE__*/_react["default"].createElement("div", {
432
+ style: {
433
+ padding: '40px 20px',
434
+ textAlign: 'center',
435
+ backgroundColor: '#f8f9fa',
436
+ borderRadius: '8px',
437
+ border: '2px dashed #dee2e6',
438
+ margin: '20px'
439
+ }
440
+ }, /*#__PURE__*/_react["default"].createElement("div", {
441
+ style: {
442
+ fontSize: '48px',
443
+ color: '#6c757d',
444
+ marginBottom: '16px'
445
+ }
446
+ }, "\uD83D\uDCCA"), /*#__PURE__*/_react["default"].createElement("div", {
447
+ style: {
448
+ fontSize: '20px',
449
+ fontWeight: 'bold',
450
+ color: '#495057',
451
+ marginBottom: '8px'
452
+ }
453
+ }, heading || 'No Data Available'), /*#__PURE__*/_react["default"].createElement("div", {
454
+ style: {
455
+ fontSize: '14px',
456
+ color: '#6c757d',
457
+ marginBottom: '20px',
458
+ lineHeight: '1.5'
459
+ }
460
+ }, description || 'There are no records to display at the moment.'), /*#__PURE__*/_react["default"].createElement("div", {
461
+ style: {
462
+ display: 'flex',
463
+ gap: '12px',
464
+ justifyContent: 'center',
465
+ flexWrap: 'wrap'
466
+ }
467
+ }));
468
+ };
469
+ var CustomNoDataWithIcon = function CustomNoDataWithIcon(_ref3) {
470
+ var description = _ref3.description,
471
+ heading = _ref3.heading;
472
+ return /*#__PURE__*/_react["default"].createElement("div", {
473
+ style: {
474
+ padding: '60px 20px',
475
+ textAlign: 'center',
476
+ background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
477
+ borderRadius: '12px',
478
+ color: 'white',
479
+ margin: '20px'
480
+ }
481
+ }, /*#__PURE__*/_react["default"].createElement("div", {
482
+ style: {
483
+ fontSize: '64px',
484
+ marginBottom: '16px'
485
+ }
486
+ }, "\uD83D\uDD0D"), /*#__PURE__*/_react["default"].createElement("div", {
487
+ style: {
488
+ fontSize: '24px',
489
+ fontWeight: 'bold',
490
+ marginBottom: '12px'
491
+ }
492
+ }, heading || 'No Results Found'), /*#__PURE__*/_react["default"].createElement("div", {
493
+ style: {
494
+ fontSize: '16px',
495
+ opacity: '0.9',
496
+ marginBottom: '24px',
497
+ lineHeight: '1.6'
498
+ }
499
+ }, description || 'We couldn\'t find any data matching your criteria.'), /*#__PURE__*/_react["default"].createElement("div", {
500
+ style: {
501
+ display: 'flex',
502
+ gap: '16px',
503
+ justifyContent: 'center',
504
+ flexWrap: 'wrap'
505
+ }
506
+ }, /*#__PURE__*/_react["default"].createElement("button", {
507
+ onClick: function onClick() {
508
+ return setHasData(true);
509
+ },
510
+ style: {
511
+ padding: '12px 24px',
512
+ backgroundColor: 'rgba(255, 255, 255, 0.2)',
513
+ color: 'white',
514
+ border: '2px solid rgba(255, 255, 255, 0.3)',
515
+ borderRadius: '8px',
516
+ cursor: 'pointer',
517
+ fontSize: '14px',
518
+ fontWeight: '500',
519
+ transition: 'all 0.3s ease'
520
+ },
521
+ onMouseOver: function onMouseOver(e) {
522
+ e.target.style.backgroundColor = 'rgba(255, 255, 255, 0.3)';
523
+ e.target.style.borderColor = 'rgba(255, 255, 255, 0.5)';
524
+ },
525
+ onMouseOut: function onMouseOut(e) {
526
+ e.target.style.backgroundColor = 'rgba(255, 255, 255, 0.2)';
527
+ e.target.style.borderColor = 'rgba(255, 255, 255, 0.3)';
528
+ }
529
+ }, "Try Again"), /*#__PURE__*/_react["default"].createElement("button", {
530
+ onClick: function onClick() {
531
+ return setHasData(false);
532
+ },
533
+ style: {
534
+ padding: '12px 24px',
535
+ backgroundColor: 'transparent',
536
+ color: 'white',
537
+ border: '2px solid rgba(255, 255, 255, 0.3)',
538
+ borderRadius: '8px',
539
+ cursor: 'pointer',
540
+ fontSize: '14px',
541
+ fontWeight: '500',
542
+ transition: 'all 0.3s ease'
543
+ },
544
+ onMouseOver: function onMouseOver(e) {
545
+ e.target.style.backgroundColor = 'rgba(255, 255, 255, 0.1)';
546
+ },
547
+ onMouseOut: function onMouseOut(e) {
548
+ e.target.style.backgroundColor = 'transparent';
549
+ }
550
+ }, "Clear")));
551
+ };
552
+ var CustomNoDataMinimal = function CustomNoDataMinimal(_ref4) {
553
+ var description = _ref4.description,
554
+ heading = _ref4.heading;
555
+ return /*#__PURE__*/_react["default"].createElement("div", {
556
+ style: {
557
+ padding: '80px 20px',
558
+ textAlign: 'center',
559
+ backgroundColor: '#ffffff',
560
+ borderRadius: '8px',
561
+ border: '1px solid #e9ecef',
562
+ margin: '20px'
563
+ }
564
+ }, /*#__PURE__*/_react["default"].createElement("div", {
565
+ style: {
566
+ width: '80px',
567
+ height: '80px',
568
+ margin: '0 auto 24px',
569
+ borderRadius: '50%',
570
+ backgroundColor: '#f8f9fa',
571
+ display: 'flex',
572
+ alignItems: 'center',
573
+ justifyContent: 'center',
574
+ fontSize: '32px',
575
+ color: '#adb5bd'
576
+ }
577
+ }, "\uD83D\uDCCB"), /*#__PURE__*/_react["default"].createElement("div", {
578
+ style: {
579
+ fontSize: '18px',
580
+ fontWeight: '600',
581
+ color: '#343a40',
582
+ marginBottom: '8px'
583
+ }
584
+ }, heading || 'Empty State'), /*#__PURE__*/_react["default"].createElement("div", {
585
+ style: {
586
+ fontSize: '14px',
587
+ color: '#6c757d',
588
+ marginBottom: '32px',
589
+ maxWidth: '300px',
590
+ marginLeft: 'auto',
591
+ marginRight: 'auto',
592
+ lineHeight: '1.5'
593
+ }
594
+ }, description || 'This table is currently empty. Add some data to get started.'), /*#__PURE__*/_react["default"].createElement("button", {
595
+ onClick: function onClick() {
596
+ return setHasData(true);
597
+ },
598
+ style: {
599
+ padding: '10px 20px',
600
+ backgroundColor: '#007bff',
601
+ color: 'white',
602
+ border: 'none',
603
+ borderRadius: '6px',
604
+ cursor: 'pointer',
605
+ fontSize: '14px',
606
+ fontWeight: '500',
607
+ transition: 'background-color 0.2s ease'
608
+ },
609
+ onMouseOver: function onMouseOver(e) {
610
+ e.target.style.backgroundColor = '#0056b3';
611
+ },
612
+ onMouseOut: function onMouseOut(e) {
613
+ e.target.style.backgroundColor = '#007bff';
614
+ }
615
+ }, "Add Sample Data"));
616
+ };
617
+ return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
618
+ style: {
619
+ marginBottom: '2rem'
620
+ }
621
+ }, /*#__PURE__*/_react["default"].createElement("div", {
622
+ style: {
623
+ marginTop: '1rem',
624
+ display: 'flex',
625
+ gap: '1rem',
626
+ flexWrap: 'wrap'
627
+ }
628
+ })), /*#__PURE__*/_react["default"].createElement("div", {
629
+ style: {
630
+ marginBottom: '3rem'
631
+ }
632
+ }, /*#__PURE__*/_react["default"].createElement("h4", {
633
+ style: {
634
+ marginBottom: '1rem',
635
+ color: '#495057'
636
+ }
637
+ }, "Custom No Data Component"), /*#__PURE__*/_react["default"].createElement(_Table["default"], {
638
+ records: hasData ? sampleRecords : [],
639
+ columnConfigs: basicColumnConfigs,
640
+ paginationType: "CLIENT",
641
+ pagination: true,
642
+ customClassName: "custom-table",
643
+ CustomNoDataComponent: CustomNoData
644
+ })));
645
+ };
646
+
647
+ // Interactive example with state management
648
+ var SelectableRows = exports.SelectableRows = function SelectableRows() {
649
+ var _useState3 = (0, _react.useState)([]),
650
+ _useState4 = _slicedToArray(_useState3, 2),
651
+ selectedRows = _useState4[0],
652
+ setSelectedRows = _useState4[1];
653
+ var handleSelectionChange = function handleSelectionChange(rows) {
654
+ setSelectedRows(rows);
655
+ console.log('Selected rows:', rows);
656
+ };
657
+
658
+ // Create a mock API response formatter for the sample data
659
+ var responseFormatter = function responseFormatter(response) {
660
+ return {
661
+ entries: response || [],
662
+ total: response ? 20 : 0
663
+ };
664
+ };
665
+ return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
666
+ style: {
667
+ marginBottom: '1rem'
668
+ }
669
+ }, /*#__PURE__*/_react["default"].createElement("h3", null, "Table with Selectable Rows"), /*#__PURE__*/_react["default"].createElement("p", null, "This table allows you to select rows using checkboxes with server-side implementation."), selectedRows.length > 0 && /*#__PURE__*/_react["default"].createElement("div", {
670
+ style: {
671
+ marginTop: '8px',
672
+ padding: '8px 12px',
673
+ backgroundColor: '#e3f2fd',
674
+ borderRadius: '4px',
675
+ fontSize: '14px'
676
+ }
677
+ }, "Selected: ", selectedRows.length, " row(s) with ids - ", selectedRows.map(function (row) {
678
+ return row.id;
679
+ }).join(', '))), /*#__PURE__*/_react["default"].createElement(_Table["default"], {
680
+ columnConfigs: postsColumnConfigs,
681
+ paginationType: "SERVER",
682
+ pagination: true,
683
+ showSelectableRows: true,
684
+ setSelectedRow: handleSelectionChange,
685
+ CheckBoxRow: CustomCheckBoxRow,
686
+ customClassName: "custom-table",
687
+ apiInfo: {
688
+ pageNoKey: '_page',
689
+ perPageKey: '_limit',
690
+ searchBy: 'q',
691
+ requestId: 'getPosts',
692
+ responseFormatter: responseFormatter,
693
+ requestParam: {
694
+ _page: 1,
695
+ _limit: 10,
696
+ q: ''
697
+ }
698
+ },
699
+ onApiError: function onApiError(error) {
700
+ return console.error('API Error:', error);
701
+ }
702
+ }));
703
+ };
704
+
705
+ // Table with custom column formatting
706
+ var CustomColumnFormatting = exports.CustomColumnFormatting = Template.bind({});
707
+ CustomColumnFormatting.args = {
708
+ records: sampleRecords,
709
+ columnConfigs: [{
710
+ name: 'Employee Name',
711
+ sortable: true,
712
+ cell: function cell(row) {
713
+ return /*#__PURE__*/_react["default"].createElement("div", {
714
+ style: {
715
+ display: 'flex',
716
+ alignItems: 'center',
717
+ gap: '8px'
718
+ },
719
+ className: "tbl-content"
720
+ }, /*#__PURE__*/_react["default"].createElement("div", {
721
+ style: {
722
+ width: '32px',
723
+ height: '32px',
724
+ borderRadius: '50%',
725
+ backgroundColor: '#007bff',
726
+ display: 'flex',
727
+ alignItems: 'center',
728
+ justifyContent: 'center',
729
+ color: 'white',
730
+ fontSize: '14px',
731
+ fontWeight: 'bold'
732
+ }
733
+ }, row.name.charAt(0)), /*#__PURE__*/_react["default"].createElement("span", null, row.name));
734
+ },
735
+ width: '200px'
736
+ }, {
737
+ name: 'Email',
738
+ selector: function selector(row) {
739
+ return row.email;
740
+ },
741
+ cell: function cell(row) {
742
+ return /*#__PURE__*/_react["default"].createElement("div", {
743
+ className: "tbl-content"
744
+ }, row.email);
745
+ },
746
+ sortable: true,
747
+ width: '250px'
748
+ }, {
749
+ name: 'Department',
750
+ selector: function selector(row) {
751
+ return row.department;
752
+ },
753
+ sortable: true,
754
+ cell: function cell(row) {
755
+ return /*#__PURE__*/_react["default"].createElement("span", {
756
+ style: {
757
+ padding: '4px 8px',
758
+ borderRadius: '12px',
759
+ fontSize: '12px',
760
+ fontWeight: '500',
761
+ backgroundColor: row.department === 'Engineering' ? '#e3f2fd' : row.department === 'Marketing' ? '#f3e5f5' : row.department === 'Sales' ? '#e8f5e8' : '#fff3e0',
762
+ color: row.department === 'Engineering' ? '#1976d2' : row.department === 'Marketing' ? '#7b1fa2' : row.department === 'Sales' ? '#388e3c' : '#f57c00'
763
+ },
764
+ className: "tbl-content"
765
+ }, row.department);
766
+ },
767
+ width: '150px'
768
+ }, {
769
+ name: 'Salary',
770
+ selector: function selector(row) {
771
+ return row.salary;
772
+ },
773
+ sortable: true,
774
+ cell: function cell(row) {
775
+ return /*#__PURE__*/_react["default"].createElement("span", {
776
+ style: {
777
+ fontWeight: 'bold',
778
+ color: row.salary > 75000 ? '#4caf50' : '#ff9800'
779
+ },
780
+ className: "tbl-content"
781
+ }, "$", row.salary.toLocaleString());
782
+ },
783
+ width: '120px'
784
+ }],
785
+ paginationType: 'CLIENT',
786
+ pagination: true,
787
+ customClassName: 'custom-table'
788
+ };
789
+
790
+ // Table with different pagination positions
791
+ var BottomPagination = exports.BottomPagination = Template.bind({});
792
+ BottomPagination.args = {
793
+ records: sampleRecords,
794
+ columnConfigs: basicColumnConfigs,
795
+ paginationType: 'CLIENT',
796
+ pagination: true,
797
+ customClassName: 'custom-table bottom-pagination'
798
+ };
799
+
800
+ // Server-side table with posts data
801
+ var ServerSidePagination = exports.ServerSidePagination = function ServerSidePagination() {
802
+ var _useState5 = (0, _react.useState)([]),
803
+ _useState6 = _slicedToArray(_useState5, 2),
804
+ selectedRows = _useState6[0],
805
+ setSelectedRows = _useState6[1];
806
+ var _useState7 = (0, _react.useState)(false),
807
+ _useState8 = _slicedToArray(_useState7, 2),
808
+ refreshTrigger = _useState8[0],
809
+ setRefreshTrigger = _useState8[1];
810
+ var responseFormatter = function responseFormatter(response) {
811
+ return {
812
+ entries: response || [],
813
+ total: response ? 30 : 0
814
+ };
815
+ };
816
+ var handleRefresh = function handleRefresh() {
817
+ setRefreshTrigger(!refreshTrigger);
818
+ };
819
+ return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
820
+ style: {
821
+ marginBottom: '1rem'
822
+ }
823
+ }, /*#__PURE__*/_react["default"].createElement("h3", null, "Server-Side Posts Table"), /*#__PURE__*/_react["default"].createElement("p", null, "This table fetches posts data from JSONPlaceholder API with custom formatting."), /*#__PURE__*/_react["default"].createElement("div", {
824
+ style: {
825
+ display: 'flex',
826
+ gap: '1rem',
827
+ alignItems: 'center',
828
+ marginTop: '8px'
829
+ }
830
+ }, selectedRows.length > 0 && /*#__PURE__*/_react["default"].createElement("span", {
831
+ style: {
832
+ fontSize: '14px',
833
+ color: '#666'
834
+ }
835
+ }, "Selected: ", selectedRows.length, " post(s)"))), /*#__PURE__*/_react["default"].createElement(_Table["default"], {
836
+ columnConfigs: postsColumnConfigs,
837
+ paginationType: "SERVER",
838
+ pagination: true,
839
+ showSelectableRows: true,
840
+ setSelectedRow: setSelectedRows,
841
+ CheckBoxRow: CustomCheckBoxRow,
842
+ refreshData: refreshTrigger,
843
+ customClassName: "custom-table",
844
+ apiInfo: {
845
+ pageNoKey: '_page',
846
+ perPageKey: '_limit',
847
+ searchBy: 'q',
848
+ requestId: 'getPosts',
849
+ responseFormatter: responseFormatter
850
+ },
851
+ onApiError: function onApiError(error) {
852
+ return console.error('API Error:', error);
853
+ }
854
+ }));
855
+ };
856
+
857
+ // Table with refresh functionality
858
+ var RefreshTable = exports.RefreshTable = function RefreshTable() {
859
+ var _useState9 = (0, _react.useState)(sampleRecords),
860
+ _useState0 = _slicedToArray(_useState9, 2),
861
+ data = _useState0[0],
862
+ setData = _useState0[1];
863
+ var _useState1 = (0, _react.useState)(0),
864
+ _useState10 = _slicedToArray(_useState1, 2),
865
+ refreshCount = _useState10[0],
866
+ setRefreshCount = _useState10[1];
867
+ var handleRefresh = function handleRefresh() {
868
+ setRefreshCount(function (prev) {
869
+ return prev + 1;
870
+ });
871
+ // Simulate data refresh
872
+ setData([].concat(sampleRecords).sort(function () {
873
+ return Math.random() - 0.5;
874
+ }));
875
+ };
876
+ return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
877
+ style: {
878
+ marginBottom: '1rem'
879
+ }
880
+ }, /*#__PURE__*/_react["default"].createElement("button", {
881
+ onClick: handleRefresh,
882
+ style: {
883
+ padding: '8px 16px',
884
+ backgroundColor: '#28a745',
885
+ color: 'white',
886
+ border: 'none',
887
+ borderRadius: '4px',
888
+ cursor: 'pointer'
889
+ }
890
+ }, "Refresh Data (Refresh Count: ", refreshCount, ")")), /*#__PURE__*/_react["default"].createElement(_Table["default"], {
891
+ records: data,
892
+ columnConfigs: basicColumnConfigs,
893
+ paginationType: "CLIENT",
894
+ pagination: true,
895
+ refreshData: refreshCount,
896
+ customClassName: "custom-table"
897
+ }));
898
+ };