pixelize-design-library 2.3.5 → 2.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.
@@ -43,6 +43,42 @@ var __importStar = (this && this.__importStar) || (function () {
43
43
  return result;
44
44
  };
45
45
  })();
46
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
47
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
48
+ return new (P || (P = Promise))(function (resolve, reject) {
49
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
50
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
51
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
52
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
53
+ });
54
+ };
55
+ var __generator = (this && this.__generator) || function (thisArg, body) {
56
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
57
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
58
+ function verb(n) { return function (v) { return step([n, v]); }; }
59
+ function step(op) {
60
+ if (f) throw new TypeError("Generator is already executing.");
61
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
62
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
63
+ if (y = 0, t) op = [op[0] & 2, t.value];
64
+ switch (op[0]) {
65
+ case 0: case 1: t = op; break;
66
+ case 4: _.label++; return { value: op[1], done: false };
67
+ case 5: _.label++; y = op[1]; op = [0]; continue;
68
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
69
+ default:
70
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
71
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
72
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
73
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
74
+ if (t[2]) _.ops.pop();
75
+ _.trys.pop(); continue;
76
+ }
77
+ op = body.call(thisArg, _);
78
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
79
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
80
+ }
81
+ };
46
82
  var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
47
83
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
48
84
  if (ar || !(i in from)) {
@@ -79,6 +115,7 @@ var ToolTip_1 = __importDefault(require("../ToolTip/ToolTip"));
79
115
  var lucide_react_1 = require("lucide-react");
80
116
  var MotionBox = (0, framer_motion_1.motion)(react_2.Box);
81
117
  function Table(_a) {
118
+ var _this = this;
82
119
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16;
83
120
  var data = _a.data, columns = _a.columns, onSelection = _a.onSelection, isLoading = _a.isLoading, _17 = _a.isCheckbox, isCheckbox = _17 === void 0 ? false : _17, headerBgColor = _a.headerBgColor, freezedBgColor = _a.freezedBgColor, headerTextColor = _a.headerTextColor, freezedTextColor = _a.freezedTextColor, tableBorderColor = _a.tableBorderColor, _18 = _a.noBorders, noBorders = _18 === void 0 ? false : _18, _19 = _a.isPagination, isPagination = _19 === void 0 ? true : _19, onRowClick = _a.onRowClick, selections = _a.selections, _20 = _a.isActionFreeze, isActionFreeze = _20 === void 0 ? true : _20, _21 = _a.preferences, preferences = _21 === void 0 ? {
84
121
  url: "",
@@ -111,16 +148,17 @@ function Table(_a) {
111
148
  authToken: preferences.token,
112
149
  orgId: preferences.orgId,
113
150
  }).savePreferences;
151
+ var _36 = (0, react_1.useState)(false), isRefreshing = _36[0], setIsRefreshing = _36[1];
114
152
  var isTableLoading = (0, react_1.useMemo)(function () {
115
- return loading || isLoading;
116
- }, [loading, isLoading]);
153
+ return loading || isLoading || isRefreshing;
154
+ }, [loading, isLoading, isRefreshing]);
117
155
  var tablePreferences = (0, react_1.useMemo)(function () {
118
156
  if (tablePreferencesData === null || tablePreferencesData === void 0 ? void 0 : tablePreferencesData.length) {
119
157
  return tablePreferencesData[0].json;
120
158
  }
121
159
  return {};
122
160
  }, [tablePreferencesData]);
123
- var _36 = (0, useTable_1.default)({
161
+ var _37 = (0, useTable_1.default)({
124
162
  tableBorderColor: tableBorderColor,
125
163
  data: data,
126
164
  isPagination: isPagination,
@@ -134,17 +172,17 @@ function Table(_a) {
134
172
  isServerPagination: isServerPagination,
135
173
  onNoOfRowsPerPageChange: onNoOfRowsPerPageChange,
136
174
  defaultVisibleColumns: defaultVisibleColumns,
137
- }), tableData = _36.tableData, isContent = _36.isContent, isLink = _36.isLink, headerRefs = _36.headerRefs, columnWidths = _36.columnWidths, handleSort = _36.handleSort, handleCheckbox = _36.handleCheckbox, filteredData = _36.filteredData, startRow = _36.startRow, endRow = _36.endRow, selection = _36.selection, columnsSort = _36.columnsSort, currentPage = _36.currentPage, pages = _36.pages, rowsPerPage = _36.rowsPerPage, handlePageSizeChange = _36.handlePageSizeChange, setCurrentPage = _36.setCurrentPage, columnsList = _36.columnsList, handleColumnPreferences = _36.handleColumnPreferences, isSelecting = _36.isSelecting, selectAllRowsRef = _36.selectAllRowsRef;
175
+ }), tableData = _37.tableData, isContent = _37.isContent, isLink = _37.isLink, headerRefs = _37.headerRefs, columnWidths = _37.columnWidths, handleSort = _37.handleSort, handleCheckbox = _37.handleCheckbox, filteredData = _37.filteredData, startRow = _37.startRow, endRow = _37.endRow, selection = _37.selection, columnsSort = _37.columnsSort, currentPage = _37.currentPage, pages = _37.pages, rowsPerPage = _37.rowsPerPage, handlePageSizeChange = _37.handlePageSizeChange, setCurrentPage = _37.setCurrentPage, columnsList = _37.columnsList, handleColumnPreferences = _37.handleColumnPreferences, isSelecting = _37.isSelecting, selectAllRowsRef = _37.selectAllRowsRef;
138
176
  // Density + grouping are managed here so the Table Settings tabs can change +
139
177
  // persist them (seeded from the prop / saved preferences when they load).
140
- var _37 = (0, react_1.useState)(density), densityState = _37[0], setDensityState = _37[1];
178
+ var _38 = (0, react_1.useState)(density), densityState = _38[0], setDensityState = _38[1];
141
179
  // Grouping is chosen by the user in Table Settings > Group and persisted to
142
180
  // preferences (`json.groupBy`); there is no `groupBy` prop.
143
- var _38 = (0, react_1.useState)(undefined), groupByState = _38[0], setGroupByState = _38[1];
181
+ var _39 = (0, react_1.useState)(undefined), groupByState = _39[0], setGroupByState = _39[1];
144
182
  // Grouped "Load more" accumulates pages here so loading more ADDS rows to the
145
183
  // groups (server pagination replaces `data` each fetch). Reset on fresh loads
146
184
  // (search / filter / sort / page-size). Only used in grouped + groupLoadMore mode.
147
- var _39 = (0, react_1.useState)([]), accumulatedRows = _39[0], setAccumulatedRows = _39[1];
185
+ var _40 = (0, react_1.useState)([]), accumulatedRows = _40[0], setAccumulatedRows = _40[1];
148
186
  var pendingLoadMoreRef = (0, react_1.useRef)(false);
149
187
  // Pages loaded so far (1 = the initial page). The next page is derived from this
150
188
  // counter — NOT from the deduped row count — so overlapping rows across pages
@@ -436,8 +474,27 @@ function Table(_a) {
436
474
  react_1.default.createElement(react_2.Box, { display: "flex", justifyContent: "flex-end", cursor: "pointer", transition: "all 0.2s ease", color: theme.colors.text[500], _hover: {
437
475
  color: theme.colors.primary[500],
438
476
  transform: "scale(1.1)"
439
- }, onClick: onRefresh },
440
- react_1.default.createElement(lucide_react_1.RefreshCw, { size: 16, className: isLoading ? "animate-spin" : "" }))))),
477
+ }, onClick: function () { return __awaiter(_this, void 0, void 0, function () {
478
+ return __generator(this, function (_a) {
479
+ switch (_a.label) {
480
+ case 0:
481
+ if (!!isRefreshing) return [3 /*break*/, 4];
482
+ setIsRefreshing(true);
483
+ _a.label = 1;
484
+ case 1:
485
+ _a.trys.push([1, , 3, 4]);
486
+ return [4 /*yield*/, onRefresh()];
487
+ case 2:
488
+ _a.sent();
489
+ return [3 /*break*/, 4];
490
+ case 3:
491
+ setIsRefreshing(false);
492
+ return [7 /*endfinally*/];
493
+ case 4: return [2 /*return*/];
494
+ }
495
+ });
496
+ }); } },
497
+ react_1.default.createElement(lucide_react_1.RefreshCw, { size: 16, className: isRefreshing ? "animate-spin" : "" }))))),
441
498
  headerActions && (react_1.default.createElement(react_1.default.Fragment, null,
442
499
  react_1.default.createElement(Divider_1.default, null),
443
500
  react_1.default.createElement(HeaderActions_1.default, { actions: headerActions, selections: selection }))),
@@ -450,7 +507,7 @@ function Table(_a) {
450
507
  react_1.default.createElement(Pagination_1.default, { columns: columns, currentPage: currentPage, setCurrentPage: setCurrentPage, rowsPerPage: rowsPerPage, pages: pages, paginationText: tablePaginationText, handlePageSizeChange: handlePageSizeChange, dataLength: tableData.length, isServerPagination: isServerPagination, paginationSelectOptions: paginationSelectOptions, isVisiblity: true }))),
451
508
  (isPagination || isServerPagination) && !isGrouped && !canInfinite && isCompactHeader && tableData.length > 0 && (react_1.default.createElement(react_2.Popover, { placement: "bottom-end" },
452
509
  react_1.default.createElement(react_2.PopoverTrigger, null,
453
- react_1.default.createElement(ToolTip_1.default, { label: "Pagination", placement: "top", openDelay: 300 },
510
+ react_1.default.createElement(ToolTip_1.default, { label: "Pagination", placement: "top" },
454
511
  react_1.default.createElement(react_2.IconButton, { "aria-label": "More", size: "sm", variant: "ghost", icon: react_1.default.createElement(lucide_react_1.EllipsisVertical, { size: 18 }), color: (_1 = (_0 = theme.colors) === null || _0 === void 0 ? void 0 : _0.text) === null || _1 === void 0 ? void 0 : _1[500], _hover: {
455
512
  color: (_3 = (_2 = theme.colors) === null || _2 === void 0 ? void 0 : _2.primary) === null || _3 === void 0 ? void 0 : _3[500]
456
513
  } }))),
@@ -59,19 +59,19 @@ var Pagination = react_1.default.memo(function (_a) {
59
59
  !paginationSelectOptions && dataLength < 100 ? react_1.default.createElement("option", { value: 0 }) : null,
60
60
  computedOptions.map(function (size, index) { return (react_1.default.createElement("option", { key: index, value: size }, String(size))); }))),
61
61
  dataLength > 0 && (react_1.default.createElement(react_2.Flex, { w: "100%" },
62
- react_1.default.createElement(ToolTip_1.default, { label: "First", placement: "top", openDelay: 300 },
62
+ react_1.default.createElement(ToolTip_1.default, { label: "First", placement: "top" },
63
63
  react_1.default.createElement(react_2.IconButton, { "aria-label": "first-page", color: isLeftDisabled ? theme.colors.gray[400] : theme.colors.text[500], rounded: "full", variant: isLeftDisabled ? "plain" : "ghost", onClick: function () { return setCurrentPage(0); }, _hover: !isLeftDisabled ? { color: theme.colors.primary[500] } : {} },
64
64
  react_1.default.createElement(lucide_react_1.ChevronsLeft, null))),
65
- react_1.default.createElement(ToolTip_1.default, { label: "Previous", placement: "top", openDelay: 300 },
65
+ react_1.default.createElement(ToolTip_1.default, { label: "Previous", placement: "top" },
66
66
  react_1.default.createElement(react_2.IconButton, { "aria-label": "previous-page", color: isLeftDisabled ? theme.colors.gray[400] : theme.colors.text[500], rounded: "full", variant: isLeftDisabled ? "plain" : "ghost", onClick: function () { return currentPage > 0 && setCurrentPage(currentPage - 1); }, _hover: !isLeftDisabled ? { color: theme.colors.primary[500] } : {} },
67
67
  react_1.default.createElement(lucide_react_1.ChevronLeft, null))),
68
68
  react_1.default.createElement(react_2.Text, { mt: 3, fontSize: 12, whiteSpace: "nowrap", color: theme.colors.text[500] }, paginationText),
69
- react_1.default.createElement(ToolTip_1.default, { label: "Next", placement: "top", openDelay: 300 },
69
+ react_1.default.createElement(ToolTip_1.default, { label: "Next", placement: "top" },
70
70
  react_1.default.createElement(react_2.IconButton, { "aria-label": "next-page", color: isRightDisabled ? theme.colors.gray[400] : theme.colors.text[500], rounded: "full", variant: isRightDisabled ? "plain" : "ghost", onClick: function () {
71
71
  return currentPage < pages - 1 && setCurrentPage(currentPage + 1);
72
72
  }, _hover: !isRightDisabled ? { color: theme.colors.primary[500] } : {} },
73
73
  react_1.default.createElement(lucide_react_1.ChevronRight, null))),
74
- react_1.default.createElement(ToolTip_1.default, { label: "Last", placement: "top", openDelay: 300 },
74
+ react_1.default.createElement(ToolTip_1.default, { label: "Last", placement: "top" },
75
75
  react_1.default.createElement(react_2.IconButton, { "aria-label": "last-page", color: isRightDisabled ? theme.colors.gray[400] : theme.colors.text[500], rounded: "full", variant: isRightDisabled ? "plain" : "ghost", onClick: function () { return setCurrentPage(pages - 1); }, _hover: !isRightDisabled ? { color: theme.colors.primary[500] } : {} },
76
76
  react_1.default.createElement(lucide_react_1.ChevronsRight, null)))))));
77
77
  });
@@ -65,7 +65,7 @@ var TableSearch = function (_a) {
65
65
  handleDebounce(value);
66
66
  };
67
67
  return (react_1.default.createElement(react_2.Box, { display: "flex", alignItems: "center", gap: "2" },
68
- !showInput && (react_1.default.createElement(ToolTip_1.default, { label: "Search", placement: "top", openDelay: 300 },
68
+ !showInput && (react_1.default.createElement(ToolTip_1.default, { label: "Search", placement: "top" },
69
69
  react_1.default.createElement(react_2.Icon, { as: lucide_react_1.Search, transform: "scaleX(-1)", cursor: "pointer", boxSize: 5, color: (_b = colors === null || colors === void 0 ? void 0 : colors.text) === null || _b === void 0 ? void 0 : _b[500], onClick: handleSearchClick, _hover: { color: (_c = colors === null || colors === void 0 ? void 0 : colors.primary) === null || _c === void 0 ? void 0 : _c[500] } }))),
70
70
  showInput ? (react_1.default.createElement(react_2.InputGroup, { maxW: "12.5rem", transition: "all 0.3s ease" },
71
71
  react_1.default.createElement(react_2.Input, { placeholder: "Search...", value: query, onChange: handleInputChange, size: "sm", borderRadius: "md", borderColor: (_d = colors === null || colors === void 0 ? void 0 : colors.border) === null || _d === void 0 ? void 0 : _d[500], _focus: { borderColor: (_e = colors === null || colors === void 0 ? void 0 : colors.primary) === null || _e === void 0 ? void 0 : _e[500] }, autoFocus: true }),
@@ -104,7 +104,7 @@ var TableSettings = function (_a) {
104
104
  _hover: { color: (_e = (_d = theme.colors) === null || _d === void 0 ? void 0 : _d.text) === null || _e === void 0 ? void 0 : _e[600] },
105
105
  };
106
106
  return (react_2.default.createElement(react_1.Box, null,
107
- react_2.default.createElement(ToolTip_1.default, { label: "Table Settings", placement: "top", openDelay: 300 },
107
+ react_2.default.createElement(ToolTip_1.default, { label: "Table Settings", placement: "top" },
108
108
  react_2.default.createElement(react_1.Box, { display: "flex", justifyContent: "flex-end", cursor: "pointer", transition: "all 0.2s ease", color: (_g = (_f = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _f === void 0 ? void 0 : _f.text) === null || _g === void 0 ? void 0 : _g[500], _hover: {
109
109
  transform: "scale(1.1)",
110
110
  color: (_j = (_h = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _h === void 0 ? void 0 : _h.primary) === null || _j === void 0 ? void 0 : _j[500]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixelize-design-library",
3
- "version": "2.3.5",
3
+ "version": "2.3.6",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",