funuicss 3.3.4 → 3.3.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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.3.4",
2
+ "version": "3.3.6",
3
3
  "name": "funuicss",
4
4
  "description": "React and Next.js component UI Library for creating Easy and good looking websites with fewer lines of code. Elevate your web development experience with our cutting-edge React/Next.js component UI Library. Craft stunning websites effortlessly, boasting both seamless functionality and aesthetic appeal—all achieved with minimal lines of code. Unleash the power of simplicity and style in your projects!",
5
5
  "main": "index.js",
@@ -22,6 +22,11 @@ type TableProps = {
22
22
  body?: React.ReactNode;
23
23
  height?: number;
24
24
  pageSize?: number;
25
+ emptyResponse?: {
26
+ icon?: React.ReactNode;
27
+ title?: React.ReactNode;
28
+ subtitle: React.ReactNode;
29
+ };
25
30
  customColumns?: {
26
31
  title: string;
27
32
  render: (data: any) => React.ReactNode;
@@ -31,5 +36,5 @@ type TableProps = {
31
36
  };
32
37
  export default function Table({ children, funcss, bordered, noStripped, hoverable, title, showTotal, light, dark, head, body, data, isLoading, right, hideExport, height, pageSize, // Default page size,
33
38
  customColumns, filterableFields, // New prop
34
- ...rest }: TableProps): React.JSX.Element;
39
+ emptyResponse, ...rest }: TableProps): React.JSX.Element;
35
40
  export {};
package/ui/table/Table.js CHANGED
@@ -55,6 +55,15 @@ var __rest = (this && this.__rest) || function (s, e) {
55
55
  }
56
56
  return t;
57
57
  };
58
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
59
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
60
+ if (ar || !(i in from)) {
61
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
62
+ ar[i] = from[i];
63
+ }
64
+ }
65
+ return to.concat(ar || Array.prototype.slice.call(from));
66
+ };
58
67
  var __importDefault = (this && this.__importDefault) || function (mod) {
59
68
  return (mod && mod.__esModule) ? mod : { "default": mod };
60
69
  };
@@ -73,11 +82,13 @@ var Circle_1 = __importDefault(require("../specials/Circle"));
73
82
  var Text_1 = __importDefault(require("../text/Text"));
74
83
  var react_easy_export_1 = require("react-easy-export");
75
84
  var View_1 = __importDefault(require("../view/View"));
85
+ var ScrollInView_1 = __importDefault(require("../ScrollInView/ScrollInView"));
86
+ var Select_1 = __importDefault(require("../select/Select"));
76
87
  function Table(_a) {
77
88
  var _b, _c;
78
89
  var children = _a.children, funcss = _a.funcss, bordered = _a.bordered, noStripped = _a.noStripped, hoverable = _a.hoverable, title = _a.title, showTotal = _a.showTotal, light = _a.light, dark = _a.dark, head = _a.head, body = _a.body, data = _a.data, _d = _a.isLoading, isLoading = _d === void 0 ? false : _d, right = _a.right, hideExport = _a.hideExport, height = _a.height, _e = _a.pageSize, pageSize = _e === void 0 ? data ? 10 : 0 : _e, // Default page size,
79
90
  customColumns = _a.customColumns, filterableFields = _a.filterableFields, // New prop
80
- rest = __rest(_a, ["children", "funcss", "bordered", "noStripped", "hoverable", "title", "showTotal", "light", "dark", "head", "body", "data", "isLoading", "right", "hideExport", "height", "pageSize", "customColumns", "filterableFields"]);
91
+ emptyResponse = _a.emptyResponse, rest = __rest(_a, ["children", "funcss", "bordered", "noStripped", "hoverable", "title", "showTotal", "light", "dark", "head", "body", "data", "isLoading", "right", "hideExport", "height", "pageSize", "customColumns", "filterableFields", "emptyResponse"]);
81
92
  // Check if data is null or undefined before accessing its properties
82
93
  // Replace this in your component
83
94
  var _f = (0, react_1.useState)(''), search = _f[0], setSearch = _f[1];
@@ -178,25 +189,31 @@ function Table(_a) {
178
189
  React.createElement("div", { className: "col width-200-max" },
179
190
  React.createElement(RowFlex_1.default, { gap: 0.7 },
180
191
  !selectedField &&
181
- React.createElement("select", { className: " input borderedInput roundEdgeSmall smallInput", value: selectedField || '', onChange: function (e) {
182
- handleFieldChange(e.target.value);
183
- } },
184
- React.createElement("option", { value: "" }, "\uD83D\uDD0D Filter"),
185
- React.createElement("option", { value: "" }, "All*"), filterableFields === null || filterableFields === void 0 ? void 0 :
186
- filterableFields.map(function (field) { return (React.createElement("option", { key: field, value: field }, field)); })),
187
- selectedField && (React.createElement("select", { className: " input borderedInput width-200-max roundEdgeSmall smallInput", value: selectedValue || '', onChange: function (e) {
188
- if (e.target.value === 'clear_all') {
192
+ React.createElement(Select_1.default, { value: selectedField || '', onChange: function (e) { return handleFieldChange(e); }, options: __spreadArray([
193
+ { text: '🔍 Filter', value: '' },
194
+ { text: 'All*', value: '' }
195
+ ], (filterableFields || []).map(function (field) { return ({
196
+ text: field,
197
+ value: field
198
+ }); }), true) }),
199
+ selectedField && (React.createElement(Select_1.default, { funcss: "width-200-max", value: selectedValue || '', onChange: function (e) {
200
+ if (e === 'clear_all') {
189
201
  setSelectedField('');
190
202
  }
191
203
  else {
192
- handleValueChange(e.target.value);
204
+ handleValueChange(e);
193
205
  handleChangePage(1);
194
206
  }
195
- } },
196
- React.createElement("option", { value: "" }, "All*"),
197
- uniqueValues.map(function (item) { return (React.createElement(React.Fragment, null, item &&
198
- React.createElement("option", { key: item, value: item }, item.toString()))); }),
199
- React.createElement("option", { value: "clear_all" }, "Clear")))))
207
+ }, options: __spreadArray(__spreadArray([
208
+ { text: 'All*', value: '' }
209
+ ], uniqueValues
210
+ .filter(Boolean) // remove null/undefined/empty
211
+ .map(function (item) { return ({
212
+ text: item.toString(),
213
+ value: item
214
+ }); }), true), [
215
+ { text: 'Clear', value: 'clear_all' }
216
+ ], false) }))))
200
217
  : '',
201
218
  React.createElement(React.Fragment, null,
202
219
  React.createElement(RowFlex_1.default, { gap: 0.5 },
@@ -227,13 +244,13 @@ function Table(_a) {
227
244
  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(function () { return (React.createElement(Row_1.default, { funcss: 'skeleton' })); }),
228
245
  children ? children : ''),
229
246
  (filteredData.length === 0 && !isLoading) &&
230
- React.createElement(View_1.default, { funcss: 'max-w-400 p-4 text-center center' },
231
- React.createElement("div", null,
232
- React.createElement(pi_1.PiEmpty, { size: 30, className: 'text-error' })),
233
- React.createElement("div", null,
234
- React.createElement(Text_1.default, { text: "No Record Found!", size: 'xl' })),
235
- React.createElement("div", null,
236
- React.createElement(Text_1.default, { text: "You can try reloading the page or check your query" })))),
247
+ React.createElement(ScrollInView_1.default, null,
248
+ React.createElement(View_1.default, { funcss: 'max-w-400 p-4 text-center center' },
249
+ React.createElement("div", null, (emptyResponse === null || emptyResponse === void 0 ? void 0 : emptyResponse.icon) || React.createElement(pi_1.PiEmpty, { size: 30, className: 'text-error' })),
250
+ React.createElement("div", null, (emptyResponse === null || emptyResponse === void 0 ? void 0 : emptyResponse.title) ||
251
+ React.createElement(Text_1.default, { text: "No Record Found!", size: 'xl' })),
252
+ React.createElement("div", null, (emptyResponse === null || emptyResponse === void 0 ? void 0 : emptyResponse.subtitle) ||
253
+ React.createElement(Text_1.default, { text: "You can try reloading the page or check your query" }))))),
237
254
  data &&
238
255
  React.createElement(React.Fragment, null, pageSize &&
239
256
  React.createElement(React.Fragment, null, filteredData.length > pageSize &&