tabulify 1.0.27 → 1.0.29
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.cjs.css +1 -1
- package/dist/index.cjs.js +21 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.css +1 -1
- package/dist/index.esm.js +21 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/types/hooks/useSortTable.d.ts +10 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/types/index.d.ts +3 -4
- package/package.json +1 -1
- package/dist/types/components/styles.d.ts +0 -2
package/dist/index.cjs.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
.tabulify-wrapper{transform:translate(0)}.tabulify-container{-webkit-overflow-scrolling:touch;overflow-x:auto;position:relative}.tabulify-container.has-scroll:after,.tabulify-container.has-scroll:before{bottom:0;content:"";display:block;pointer-events:none;position:fixed;top:0;width:6px;z-index:1}.tabulify-container:before{background:linear-gradient(90deg,rgba(0,0,0,.1),transparent);transition:background .3s ease}.tabulify-container:after{background:linear-gradient(270deg,rgba(0,0,0,.1),transparent);right:0;transition:background .3s ease}.tabulify-container.hide-left-shadow:before,.tabulify-container.hide-right-shadow:after{background:transparent}.tabulify-container .no-shadow{box-shadow:inset 0 0 0 0 rgba(0,0,0,.1)}.tabulify-table{border-collapse:separate;border-radius:8px 8px 0 0;border-spacing:0;min-width:100%;text-align:start;width:100%}.tabulify-table:after{background-image:linear-gradient(270deg,rgba(0,0,0,.1),transparent);right:0}.tabulify-head tr th{background:#fafafa;border-bottom:1px solid #f0f0f0;color:rgba(0,0,0,.88);font-weight:600;position:relative;text-align:start;transition:background .2s ease}.tabulify-body tr td{border-bottom:1px solid #f0f0f0;transition:background .2s,border-color .2s}.tabulify-body tr:hover{background:#fafafa}.tabulify-cell{align-items:center;display:flex;justify-content:space-between
|
1
|
+
.tabulify-wrapper{transform:translate(0)}.tabulify-container{-webkit-overflow-scrolling:touch;overflow-x:auto;position:relative}.tabulify-container.has-scroll:after,.tabulify-container.has-scroll:before{bottom:0;content:"";display:block;pointer-events:none;position:fixed;top:0;width:6px;z-index:1}.tabulify-container:before{background:linear-gradient(90deg,rgba(0,0,0,.1),transparent);transition:background .3s ease}.tabulify-container:after{background:linear-gradient(270deg,rgba(0,0,0,.1),transparent);right:0;transition:background .3s ease}.tabulify-container.hide-left-shadow:before,.tabulify-container.hide-right-shadow:after{background:transparent}.tabulify-container .no-shadow{box-shadow:inset 0 0 0 0 rgba(0,0,0,.1)}.tabulify-table{border-collapse:separate;border-radius:8px 8px 0 0;border-spacing:0;min-width:100%;text-align:start;width:100%}.tabulify-table:after{background-image:linear-gradient(270deg,rgba(0,0,0,.1),transparent);right:0}.tabulify-head tr th{background:#fafafa;border-bottom:1px solid #f0f0f0;color:rgba(0,0,0,.88);font-weight:600;position:relative;text-align:start;transition:background .2s ease}.tabulify-body tr td{border-bottom:1px solid #f0f0f0;transition:background .2s,border-color .2s}.tabulify-body tr:hover{background:#fafafa}.tabulify-cell{overflow-wrap:break-word;padding:16px;position:relative}.tabulify-head-cell-content-wrapper{align-items:center;display:flex;justify-content:space-between}.tabulify-head-cell-content-wrapper .icon-wrapper{align-items:center;display:flex;height:16px;justify-content:center;width:16px}.tabulify-pagination-wrapper{display:flex;gap:8px;justify-content:flex-end;margin-top:24px}.tabulify-pagination button{background-color:transparent;border:none;border-radius:4px;color:rgba(0,0,0,.88);padding:4px 12px}.tabulify-pagination button:hover{background:#fafafa;cursor:pointer}.tabulify-pagination button.active{border:1px solid}
|
package/dist/index.cjs.js
CHANGED
@@ -73,13 +73,13 @@ var Pagination = function (_a) {
|
|
73
73
|
};
|
74
74
|
|
75
75
|
var IconCartDown = function () {
|
76
|
-
return (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "
|
76
|
+
return (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", className: "icon-cart-down", "data-testid": "sort-asc" },
|
77
77
|
React.createElement("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
78
78
|
React.createElement("path", { d: "M18 9c.852 0 1.297 .986 .783 1.623l-.076 .084l-6 6a1 1 0 0 1 -1.32 .083l-.094 -.083l-6 -6l-.083 -.094l-.054 -.077l-.054 -.096l-.017 -.036l-.027 -.067l-.032 -.108l-.01 -.053l-.01 -.06l-.004 -.057v-.118l.005 -.058l.009 -.06l.01 -.052l.032 -.108l.027 -.067l.07 -.132l.065 -.09l.073 -.081l.094 -.083l.077 -.054l.096 -.054l.036 -.017l.067 -.027l.108 -.032l.053 -.01l.06 -.01l.057 -.004l12.059 -.002z" })));
|
79
79
|
};
|
80
80
|
|
81
81
|
var IconCartUp = function () {
|
82
|
-
return (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "
|
82
|
+
return (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", className: "icon-cart-up", "data-testid": "sort-desc" },
|
83
83
|
React.createElement("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
84
84
|
React.createElement("path", { d: "M11.293 7.293a1 1 0 0 1 1.32 -.083l.094 .083l6 6l.083 .094l.054 .077l.054 .096l.017 .036l.027 .067l.032 .108l.01 .053l.01 .06l.004 .057l.002 .059l-.002 .059l-.005 .058l-.009 .06l-.01 .052l-.032 .108l-.027 .067l-.07 .132l-.065 .09l-.073 .081l-.094 .083l-.077 .054l-.096 .054l-.036 .017l-.067 .027l-.108 .032l-.053 .01l-.06 .01l-.057 .004l-.059 .002h-12c-.852 0 -1.297 -.986 -.783 -1.623l.076 -.084l6 -6z" })));
|
85
85
|
};
|
@@ -145,12 +145,29 @@ var Table = function (_a) {
|
|
145
145
|
'tabulify-cell',
|
146
146
|
Boolean(sort) && 'has-hover',
|
147
147
|
]), key: getUniqueId(column.key), "data-testid": "table-head-th-".concat(String(column.key)), onClick: function () { return sort === null || sort === void 0 ? void 0 : sort.onSort(column.key); } },
|
148
|
-
React.createElement("div",
|
149
|
-
|
148
|
+
React.createElement("div", { className: "tabulify-head-cell-content-wrapper" },
|
149
|
+
React.createElement("div", null, column.title),
|
150
|
+
React.createElement("div", { className: "icon-wrapper" }, sort && (sort === null || sort === void 0 ? void 0 : sort.sortBy) === column.key && (React.createElement(SortIcon, { sortOrder: sort.sortOrder })))))); }))),
|
150
151
|
React.createElement("tbody", { className: "tabulify-body" }, paginatedData.map(function (record, index) { return (React.createElement("tr", { key: getUniqueId(record[dataIndex]), className: cx([Boolean(onRowClick) && 'has-hover']), "data-id": String(record[dataIndex]), onClick: function () { return onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(record[dataIndex]); } }, columns.map(function (column) { return (React.createElement("td", { className: "tabulify-cell", key: getUniqueId(column.key) }, column.render ? (column.render(record[column.key], record, index)) : (React.createElement(React.Fragment, null, "".concat(record[column.key]))))); }))); }))))),
|
151
152
|
pagination && (React.createElement("div", { className: "tabulify-pagination-wrapper" },
|
152
153
|
React.createElement(Pagination, { currentPage: currentPage, onPageChange: handlePageChange, pageSize: pageSize, total: pagination.total })))));
|
153
154
|
};
|
154
155
|
|
156
|
+
var useSortTable = function (_a) {
|
157
|
+
var defaultSort = _a.defaultSort;
|
158
|
+
var _b = React.useState(defaultSort), sortBy = _b[0], setSortby = _b[1];
|
159
|
+
var _c = React.useState('asc'), sortOrder = _c[0], setSortOrder = _c[1];
|
160
|
+
var handleSortBy = function (newSortBy) {
|
161
|
+
if (newSortBy === sortBy) {
|
162
|
+
setSortOrder(function (prev) { return (prev === 'asc' ? 'desc' : 'asc'); });
|
163
|
+
return;
|
164
|
+
}
|
165
|
+
setSortby(newSortBy);
|
166
|
+
setSortOrder('asc');
|
167
|
+
};
|
168
|
+
return { handleSortBy: handleSortBy, sortBy: sortBy, sortOrder: sortOrder };
|
169
|
+
};
|
170
|
+
|
155
171
|
exports.Table = Table;
|
172
|
+
exports.useSortTable = useSortTable;
|
156
173
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.cjs.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/utils/index.ts","../node_modules/tslib/tslib.es6.js","../src/components/Pagination/index.tsx","../src/components/SortIcon/IconCartDown.tsx","../src/components/SortIcon/IconCartUp.tsx","../src/components/SortIcon/index.tsx","../src/components/Table/index.tsx"],"sourcesContent":["import { SortOptions } from '../types';\n\nexport const getUniqueId = (prefix: unknown): string =>\n `${prefix ?? 'id'}-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;\n\nexport const cx = (classNames: (string | boolean)[]): string =>\n classNames.filter((i) => i).join(' ');\n\nexport const sortData = <T>({\n dataSource,\n sortBy,\n sortOrder = 'asc',\n}: SortOptions<T>): T[] => {\n if (!sortBy || !sortOrder) return dataSource;\n return dataSource.sort((a, b) => {\n const aValue = a[sortBy];\n const bValue = b[sortBy];\n\n // Handle null or undefined values\n if (aValue == null) return 1; // Push `null` or `undefined` to the end\n if (bValue == null) return -1;\n\n // Handle numbers\n if (typeof aValue === 'number' && typeof bValue === 'number') {\n return sortOrder === 'asc' ? aValue - bValue : bValue - aValue;\n }\n\n // Handle strings\n if (typeof aValue === 'string' && typeof bValue === 'string') {\n const comparison = aValue.localeCompare(bValue);\n return sortOrder === 'asc' ? comparison : -comparison;\n }\n\n // Default to no change for unsupported types\n return 0;\n });\n};\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n 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);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n 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;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n","import React from 'react';\n\ninterface PaginationProps {\n pageSize: number;\n total: number;\n currentPage: number;\n onPageChange: (page: number) => void;\n}\n\nconst Pagination: React.FC<PaginationProps> = ({\n pageSize,\n total,\n currentPage,\n onPageChange,\n}) => {\n const totalPages = Math.ceil(total / pageSize);\n\n return (\n <div className=\"tabulify-pagination\">\n {[...Array(totalPages)].map((_, i) => (\n <button\n key={i}\n className={currentPage === i + 1 ? 'active' : ''}\n onClick={() => onPageChange(i + 1)}\n >\n {i + 1}\n </button>\n ))}\n </div>\n );\n};\n\nexport default Pagination;\n","import React from 'react';\n\nexport const IconCartDown = () => {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n className=\"icon-cart-down\"\n data-testid=\"sort-asc\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M18 9c.852 0 1.297 .986 .783 1.623l-.076 .084l-6 6a1 1 0 0 1 -1.32 .083l-.094 -.083l-6 -6l-.083 -.094l-.054 -.077l-.054 -.096l-.017 -.036l-.027 -.067l-.032 -.108l-.01 -.053l-.01 -.06l-.004 -.057v-.118l.005 -.058l.009 -.06l.01 -.052l.032 -.108l.027 -.067l.07 -.132l.065 -.09l.073 -.081l.094 -.083l.077 -.054l.096 -.054l.036 -.017l.067 -.027l.108 -.032l.053 -.01l.06 -.01l.057 -.004l12.059 -.002z\" />\n </svg>\n );\n};\n","import React from 'react';\n\nexport const IconCartUp = () => {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n className=\"icon-cart-up\"\n data-testid=\"sort-desc\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M11.293 7.293a1 1 0 0 1 1.32 -.083l.094 .083l6 6l.083 .094l.054 .077l.054 .096l.017 .036l.027 .067l.032 .108l.01 .053l.01 .06l.004 .057l.002 .059l-.002 .059l-.005 .058l-.009 .06l-.01 .052l-.032 .108l-.027 .067l-.07 .132l-.065 .09l-.073 .081l-.094 .083l-.077 .054l-.096 .054l-.036 .017l-.067 .027l-.108 .032l-.053 .01l-.06 .01l-.057 .004l-.059 .002h-12c-.852 0 -1.297 -.986 -.783 -1.623l.076 -.084l6 -6z\" />\n </svg>\n );\n};\n","import React from 'react';\nimport { SortOrder } from '../../types';\nimport { IconCartDown } from './IconCartDown';\nimport { IconCartUp } from './IconCartUp';\n\ninterface Props {\n sortOrder: SortOrder;\n}\nexport const SortIcon: React.FC<Props> = ({ sortOrder }) => {\n if (sortOrder === 'asc') return <IconCartDown />;\n return <IconCartUp />;\n};\n","import React, { useEffect, useMemo, useRef, useState } from 'react';\nimport { TableProps } from '../../types';\nimport { cx, getUniqueId, sortData } from '../../utils';\nimport Pagination from '../Pagination';\nimport { SortIcon } from '../SortIcon';\n\n// Table Component\nconst Table = <T,>({\n columns,\n dataSource,\n rowSelection,\n pagination,\n dataIndex,\n className,\n width,\n testId,\n sort,\n onRowClick,\n}: TableProps<T>) => {\n const containerRef: React.Ref<HTMLDivElement> = useRef(null);\n\n const [isScrolledToEnd, setIsScrolledToEnd] = useState(false);\n const [isScrollStarted, setIsScrollStarted] = useState(false);\n\n const handleScroll = () => {\n const container = containerRef.current;\n if (container) {\n const isAtEnd =\n container.scrollLeft + container.clientWidth >= container.scrollWidth;\n setIsScrollStarted(container.scrollLeft > 0);\n setIsScrolledToEnd(isAtEnd);\n }\n };\n\n const [currentPage, setCurrentPage] = useState(pagination?.current || 1);\n\n const pageSize = pagination?.pageSize || dataSource.length;\n\n // Handle pagination\n const handlePageChange = (page: number) => {\n setCurrentPage(page);\n pagination?.onChange?.(page);\n };\n\n // Sorted Data\n const sortedData = sortData({\n dataSource,\n sortBy: sort?.sortBy,\n sortOrder: sort?.sortOrder,\n });\n\n // Paginate data\n const paginatedData = pagination\n ? sortedData.slice((currentPage - 1) * pageSize, currentPage * pageSize)\n : sortedData;\n\n useEffect(() => {\n const container = containerRef.current;\n if (container) {\n handleScroll(); // Initial check\n }\n }, []);\n\n return (\n <div className={className} data-testid={testId}>\n <div className=\"tabulify-wrapper\">\n <div\n className={cx([\n 'tabulify-container',\n width && 'has-scroll',\n isScrolledToEnd && 'hide-right-shadow',\n !isScrollStarted && 'hide-left-shadow',\n ])}\n ref={containerRef}\n onScroll={handleScroll}\n >\n <table className=\"tabulify-table\" style={{ width: width ?? '100%' }}>\n <thead className=\"tabulify-head\">\n <tr>\n {rowSelection && <th></th>}\n {columns.map((column) => (\n <th\n className={cx([\n 'tabulify-cell',\n Boolean(sort) && 'has-hover',\n ])}\n key={getUniqueId(column.key)}\n data-testid={`table-head-th-${String(column.key)}`}\n onClick={() => sort?.onSort(column.key)}\n >\n <div>{column.title}</div>\n {sort && sort?.sortBy === column.key && (\n <SortIcon sortOrder={sort.sortOrder} />\n )}\n </th>\n ))}\n </tr>\n </thead>\n <tbody className=\"tabulify-body\">\n {paginatedData.map((record, index) => (\n <tr\n key={getUniqueId(record[dataIndex])}\n className={cx([Boolean(onRowClick) && 'has-hover'])}\n data-id={String(record[dataIndex])}\n onClick={() => onRowClick?.(record[dataIndex])}\n >\n {columns.map((column) => (\n <td className=\"tabulify-cell\" key={getUniqueId(column.key)}>\n {column.render ? (\n column.render(record[column.key], record, index)\n ) : (\n <>{`${record[column.key]}`}</>\n )}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </div>\n {pagination && (\n <div className=\"tabulify-pagination-wrapper\">\n <Pagination\n currentPage={currentPage}\n onPageChange={handlePageChange}\n pageSize={pageSize}\n total={pagination.total}\n />\n </div>\n )}\n </div>\n );\n};\n\nexport default Table;\n"],"names":["useRef","useState","useEffect"],"mappings":";;;;AAEO,IAAM,WAAW,GAAG,UAAC,MAAe,EAAA;AACzC,IAAA,OAAA,EAAG,CAAA,MAAA,CAAA,MAAM,KAAN,IAAA,IAAA,MAAM,KAAN,KAAA,CAAA,GAAA,MAAM,GAAI,IAAI,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,IAAI,CAAC,GAAG,EAAE,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAE;AAA/E,CAA+E;AAE1E,IAAM,EAAE,GAAG,UAAC,UAAgC,EAAA;AACjD,IAAA,OAAA,UAAU,CAAC,MAAM,CAAC,UAAC,CAAC,EAAK,EAAA,OAAA,CAAC,CAAA,EAAA,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;AAArC,CAAqC;AAEhC,IAAM,QAAQ,GAAG,UAAI,EAIX,EAAA;QAHf,UAAU,GAAA,EAAA,CAAA,UAAA,EACV,MAAM,GAAA,EAAA,CAAA,MAAA,EACN,iBAAi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,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,EACvD,EAAA,MAAM,CAAC,MAAM,IACZ,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,KAEhD,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EAAG,EAAG,CAAA,MAAA,CAAA,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAE,CAAI,CAC/B,CACE,EACN,EAAA,CAAC,CACC,EACN,EAAA,CAAC,CACI,CACF,CACJ,CACF;AACL,QAAA,UAAU,KACT,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAC,6BAA6B,EAAA;YAC1C,KAAC,CAAA,aAAA,CAAA,UAAU,EACT,EAAA,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,gBAAgB,EAC9B,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,UAAU,CAAC,KAAK,GACvB,CACE,CACP,CACG;AAEV;;;;","x_google_ignoreList":[1]}
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/utils/index.ts","../node_modules/tslib/tslib.es6.js","../src/components/Pagination/index.tsx","../src/components/SortIcon/IconCartDown.tsx","../src/components/SortIcon/IconCartUp.tsx","../src/components/SortIcon/index.tsx","../src/components/Table/index.tsx","../src/hooks/useSortTable.ts"],"sourcesContent":["import { SortOptions } from '../types';\n\nexport const getUniqueId = (prefix: unknown): string =>\n `${prefix ?? 'id'}-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;\n\nexport const cx = (classNames: (string | boolean)[]): string =>\n classNames.filter((i) => i).join(' ');\n\nexport const sortData = <T>({\n dataSource,\n sortBy,\n sortOrder = 'asc',\n}: SortOptions<T>): T[] => {\n if (!sortBy || !sortOrder) return dataSource;\n return dataSource.sort((a, b) => {\n const aValue = a[sortBy];\n const bValue = b[sortBy];\n\n // Handle null or undefined values\n if (aValue == null) return 1; // Push `null` or `undefined` to the end\n if (bValue == null) return -1;\n\n // Handle numbers\n if (typeof aValue === 'number' && typeof bValue === 'number') {\n return sortOrder === 'asc' ? aValue - bValue : bValue - aValue;\n }\n\n // Handle strings\n if (typeof aValue === 'string' && typeof bValue === 'string') {\n const comparison = aValue.localeCompare(bValue);\n return sortOrder === 'asc' ? comparison : -comparison;\n }\n\n // Default to no change for unsupported types\n return 0;\n });\n};\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n 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);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n 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;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n","import React from 'react';\n\ninterface PaginationProps {\n pageSize: number;\n total: number;\n currentPage: number;\n onPageChange: (page: number) => void;\n}\n\nconst Pagination: React.FC<PaginationProps> = ({\n pageSize,\n total,\n currentPage,\n onPageChange,\n}) => {\n const totalPages = Math.ceil(total / pageSize);\n\n return (\n <div className=\"tabulify-pagination\">\n {[...Array(totalPages)].map((_, i) => (\n <button\n key={i}\n className={currentPage === i + 1 ? 'active' : ''}\n onClick={() => onPageChange(i + 1)}\n >\n {i + 1}\n </button>\n ))}\n </div>\n );\n};\n\nexport default Pagination;\n","import React from 'react';\n\nexport const IconCartDown = () => {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n className=\"icon-cart-down\"\n data-testid=\"sort-asc\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M18 9c.852 0 1.297 .986 .783 1.623l-.076 .084l-6 6a1 1 0 0 1 -1.32 .083l-.094 -.083l-6 -6l-.083 -.094l-.054 -.077l-.054 -.096l-.017 -.036l-.027 -.067l-.032 -.108l-.01 -.053l-.01 -.06l-.004 -.057v-.118l.005 -.058l.009 -.06l.01 -.052l.032 -.108l.027 -.067l.07 -.132l.065 -.09l.073 -.081l.094 -.083l.077 -.054l.096 -.054l.036 -.017l.067 -.027l.108 -.032l.053 -.01l.06 -.01l.057 -.004l12.059 -.002z\" />\n </svg>\n );\n};\n","import React from 'react';\n\nexport const IconCartUp = () => {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n className=\"icon-cart-up\"\n data-testid=\"sort-desc\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M11.293 7.293a1 1 0 0 1 1.32 -.083l.094 .083l6 6l.083 .094l.054 .077l.054 .096l.017 .036l.027 .067l.032 .108l.01 .053l.01 .06l.004 .057l.002 .059l-.002 .059l-.005 .058l-.009 .06l-.01 .052l-.032 .108l-.027 .067l-.07 .132l-.065 .09l-.073 .081l-.094 .083l-.077 .054l-.096 .054l-.036 .017l-.067 .027l-.108 .032l-.053 .01l-.06 .01l-.057 .004l-.059 .002h-12c-.852 0 -1.297 -.986 -.783 -1.623l.076 -.084l6 -6z\" />\n </svg>\n );\n};\n","import React from 'react';\nimport { SortOrder } from '../../types';\nimport { IconCartDown } from './IconCartDown';\nimport { IconCartUp } from './IconCartUp';\n\ninterface Props {\n sortOrder: SortOrder;\n}\nexport const SortIcon: React.FC<Props> = ({ sortOrder }) => {\n if (sortOrder === 'asc') return <IconCartDown />;\n return <IconCartUp />;\n};\n","import React, { useEffect, useRef, useState } from 'react';\nimport { TableProps } from '../../types';\nimport { cx, getUniqueId, sortData } from '../../utils';\nimport Pagination from '../Pagination';\nimport { SortIcon } from '../SortIcon';\n\n// Table Component\nconst Table = <T,>({\n columns,\n dataSource,\n rowSelection,\n pagination,\n dataIndex,\n className,\n width,\n testId,\n sort,\n onRowClick,\n}: TableProps<T>) => {\n const containerRef: React.Ref<HTMLDivElement> = useRef(null);\n\n const [isScrolledToEnd, setIsScrolledToEnd] = useState(false);\n const [isScrollStarted, setIsScrollStarted] = useState(false);\n\n const handleScroll = () => {\n const container = containerRef.current;\n if (container) {\n const isAtEnd =\n container.scrollLeft + container.clientWidth >= container.scrollWidth;\n setIsScrollStarted(container.scrollLeft > 0);\n setIsScrolledToEnd(isAtEnd);\n }\n };\n\n const [currentPage, setCurrentPage] = useState(pagination?.current || 1);\n\n const pageSize = pagination?.pageSize || dataSource.length;\n\n // Handle pagination\n const handlePageChange = (page: number) => {\n setCurrentPage(page);\n pagination?.onChange?.(page);\n };\n\n // Sorted Data\n const sortedData = sortData({\n dataSource,\n sortBy: sort?.sortBy,\n sortOrder: sort?.sortOrder,\n });\n\n // Paginate data\n const paginatedData = pagination\n ? sortedData.slice((currentPage - 1) * pageSize, currentPage * pageSize)\n : sortedData;\n\n useEffect(() => {\n const container = containerRef.current;\n if (container) {\n handleScroll(); // Initial check\n }\n }, []);\n\n return (\n <div className={className} data-testid={testId}>\n <div className=\"tabulify-wrapper\">\n <div\n className={cx([\n 'tabulify-container',\n width && 'has-scroll',\n isScrolledToEnd && 'hide-right-shadow',\n !isScrollStarted && 'hide-left-shadow',\n ])}\n ref={containerRef}\n onScroll={handleScroll}\n >\n <table className=\"tabulify-table\" style={{ width: width ?? '100%' }}>\n <thead className=\"tabulify-head\">\n <tr>\n {rowSelection && <th></th>}\n {columns.map((column) => (\n <th\n className={cx([\n 'tabulify-cell',\n Boolean(sort) && 'has-hover',\n ])}\n key={getUniqueId(column.key)}\n data-testid={`table-head-th-${String(column.key)}`}\n onClick={() => sort?.onSort(column.key)}\n >\n <div className=\"tabulify-head-cell-content-wrapper\">\n <div>{column.title}</div>\n <div className=\"icon-wrapper\">\n {sort && sort?.sortBy === column.key && (\n <SortIcon sortOrder={sort.sortOrder} />\n )}\n </div>\n </div>\n </th>\n ))}\n </tr>\n </thead>\n <tbody className=\"tabulify-body\">\n {paginatedData.map((record, index) => (\n <tr\n key={getUniqueId(record[dataIndex])}\n className={cx([Boolean(onRowClick) && 'has-hover'])}\n data-id={String(record[dataIndex])}\n onClick={() => onRowClick?.(record[dataIndex])}\n >\n {columns.map((column) => (\n <td className=\"tabulify-cell\" key={getUniqueId(column.key)}>\n {column.render ? (\n column.render(record[column.key], record, index)\n ) : (\n <>{`${record[column.key]}`}</>\n )}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </div>\n {pagination && (\n <div className=\"tabulify-pagination-wrapper\">\n <Pagination\n currentPage={currentPage}\n onPageChange={handlePageChange}\n pageSize={pageSize}\n total={pagination.total}\n />\n </div>\n )}\n </div>\n );\n};\n\nexport default Table;\n","import { useState } from 'react';\nimport { SortBy, SortOrder } from '../types';\n\ninterface Props<T> {\n defaultSort: SortBy<T>;\n}\nexport const useSortTable = <T>({ defaultSort }: Props<T>) => {\n const [sortBy, setSortby] = useState<SortBy<T>>(defaultSort);\n const [sortOrder, setSortOrder] = useState<SortOrder>('asc');\n\n const handleSortBy = (newSortBy: keyof T) => {\n if (newSortBy === sortBy) {\n setSortOrder((prev) => (prev === 'asc' ? 'desc' : 'asc'));\n return;\n }\n setSortby(newSortBy as SortBy<T>);\n setSortOrder('asc');\n };\n\n return { handleSortBy, sortBy, sortOrder };\n};\n"],"names":["useRef","useState","useEffect"],"mappings":";;;;AAEO,IAAM,WAAW,GAAG,UAAC,MAAe,EAAA;AACzC,IAAA,OAAA,EAAG,CAAA,MAAA,CAAA,MAAM,KAAN,IAAA,IAAA,MAAM,KAAN,KAAA,CAAA,GAAA,MAAM,GAAI,IAAI,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,IAAI,CAAC,GAAG,EAAE,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAE;AAA/E,CAA+E;AAE1E,IAAM,EAAE,GAAG,UAAC,UAAgC,EAAA;AACjD,IAAA,OAAA,UAAU,CAAC,MAAM,CAAC,UAAC,CAAC,EAAK,EAAA,OAAA,CAAC,CAAA,EAAA,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;AAArC,CAAqC;AAEhC,IAAM,QAAQ,GAAG,UAAI,EAIX,EAAA;QAHf,UAAU,GAAA,EAAA,CAAA,UAAA,EACV,MAAM,GAAA,EAAA,CAAA,MAAA,EACN,iBAAiB,EAAjB,SAAS,GAAG,EAAA,KAAA,KAAA,CAAA,GAAA,KAAK,GAAA,EAAA;AAEjB,IAAA,IAAI,CAAC,MAAM,IAAI,CAAC,SAAS;A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C,SAAsB,CAAC;QACjC,YAAY,CAAC,KAAK,CAAC;AACrB,KAAC;IAED,OAAO,EAAE,YAAY,EAAA,YAAA,EAAE,MAAM,QAAA,EAAE,SAAS,EAAA,SAAA,EAAE;AAC5C;;;;;","x_google_ignoreList":[1]}
|
package/dist/index.esm.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
.tabulify-wrapper{transform:translate(0)}.tabulify-container{-webkit-overflow-scrolling:touch;overflow-x:auto;position:relative}.tabulify-container.has-scroll:after,.tabulify-container.has-scroll:before{bottom:0;content:"";display:block;pointer-events:none;position:fixed;top:0;width:6px;z-index:1}.tabulify-container:before{background:linear-gradient(90deg,rgba(0,0,0,.1),transparent);transition:background .3s ease}.tabulify-container:after{background:linear-gradient(270deg,rgba(0,0,0,.1),transparent);right:0;transition:background .3s ease}.tabulify-container.hide-left-shadow:before,.tabulify-container.hide-right-shadow:after{background:transparent}.tabulify-container .no-shadow{box-shadow:inset 0 0 0 0 rgba(0,0,0,.1)}.tabulify-table{border-collapse:separate;border-radius:8px 8px 0 0;border-spacing:0;min-width:100%;text-align:start;width:100%}.tabulify-table:after{background-image:linear-gradient(270deg,rgba(0,0,0,.1),transparent);right:0}.tabulify-head tr th{background:#fafafa;border-bottom:1px solid #f0f0f0;color:rgba(0,0,0,.88);font-weight:600;position:relative;text-align:start;transition:background .2s ease}.tabulify-body tr td{border-bottom:1px solid #f0f0f0;transition:background .2s,border-color .2s}.tabulify-body tr:hover{background:#fafafa}.tabulify-cell{align-items:center;display:flex;justify-content:space-between
|
1
|
+
.tabulify-wrapper{transform:translate(0)}.tabulify-container{-webkit-overflow-scrolling:touch;overflow-x:auto;position:relative}.tabulify-container.has-scroll:after,.tabulify-container.has-scroll:before{bottom:0;content:"";display:block;pointer-events:none;position:fixed;top:0;width:6px;z-index:1}.tabulify-container:before{background:linear-gradient(90deg,rgba(0,0,0,.1),transparent);transition:background .3s ease}.tabulify-container:after{background:linear-gradient(270deg,rgba(0,0,0,.1),transparent);right:0;transition:background .3s ease}.tabulify-container.hide-left-shadow:before,.tabulify-container.hide-right-shadow:after{background:transparent}.tabulify-container .no-shadow{box-shadow:inset 0 0 0 0 rgba(0,0,0,.1)}.tabulify-table{border-collapse:separate;border-radius:8px 8px 0 0;border-spacing:0;min-width:100%;text-align:start;width:100%}.tabulify-table:after{background-image:linear-gradient(270deg,rgba(0,0,0,.1),transparent);right:0}.tabulify-head tr th{background:#fafafa;border-bottom:1px solid #f0f0f0;color:rgba(0,0,0,.88);font-weight:600;position:relative;text-align:start;transition:background .2s ease}.tabulify-body tr td{border-bottom:1px solid #f0f0f0;transition:background .2s,border-color .2s}.tabulify-body tr:hover{background:#fafafa}.tabulify-cell{overflow-wrap:break-word;padding:16px;position:relative}.tabulify-head-cell-content-wrapper{align-items:center;display:flex;justify-content:space-between}.tabulify-head-cell-content-wrapper .icon-wrapper{align-items:center;display:flex;height:16px;justify-content:center;width:16px}.tabulify-pagination-wrapper{display:flex;gap:8px;justify-content:flex-end;margin-top:24px}.tabulify-pagination button{background-color:transparent;border:none;border-radius:4px;color:rgba(0,0,0,.88);padding:4px 12px}.tabulify-pagination button:hover{background:#fafafa;cursor:pointer}.tabulify-pagination button.active{border:1px solid}
|
package/dist/index.esm.js
CHANGED
@@ -71,13 +71,13 @@ var Pagination = function (_a) {
|
|
71
71
|
};
|
72
72
|
|
73
73
|
var IconCartDown = function () {
|
74
|
-
return (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "
|
74
|
+
return (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", className: "icon-cart-down", "data-testid": "sort-asc" },
|
75
75
|
React.createElement("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
76
76
|
React.createElement("path", { d: "M18 9c.852 0 1.297 .986 .783 1.623l-.076 .084l-6 6a1 1 0 0 1 -1.32 .083l-.094 -.083l-6 -6l-.083 -.094l-.054 -.077l-.054 -.096l-.017 -.036l-.027 -.067l-.032 -.108l-.01 -.053l-.01 -.06l-.004 -.057v-.118l.005 -.058l.009 -.06l.01 -.052l.032 -.108l.027 -.067l.07 -.132l.065 -.09l.073 -.081l.094 -.083l.077 -.054l.096 -.054l.036 -.017l.067 -.027l.108 -.032l.053 -.01l.06 -.01l.057 -.004l12.059 -.002z" })));
|
77
77
|
};
|
78
78
|
|
79
79
|
var IconCartUp = function () {
|
80
|
-
return (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "
|
80
|
+
return (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", className: "icon-cart-up", "data-testid": "sort-desc" },
|
81
81
|
React.createElement("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
82
82
|
React.createElement("path", { d: "M11.293 7.293a1 1 0 0 1 1.32 -.083l.094 .083l6 6l.083 .094l.054 .077l.054 .096l.017 .036l.027 .067l.032 .108l.01 .053l.01 .06l.004 .057l.002 .059l-.002 .059l-.005 .058l-.009 .06l-.01 .052l-.032 .108l-.027 .067l-.07 .132l-.065 .09l-.073 .081l-.094 .083l-.077 .054l-.096 .054l-.036 .017l-.067 .027l-.108 .032l-.053 .01l-.06 .01l-.057 .004l-.059 .002h-12c-.852 0 -1.297 -.986 -.783 -1.623l.076 -.084l6 -6z" })));
|
83
83
|
};
|
@@ -143,12 +143,28 @@ var Table = function (_a) {
|
|
143
143
|
'tabulify-cell',
|
144
144
|
Boolean(sort) && 'has-hover',
|
145
145
|
]), key: getUniqueId(column.key), "data-testid": "table-head-th-".concat(String(column.key)), onClick: function () { return sort === null || sort === void 0 ? void 0 : sort.onSort(column.key); } },
|
146
|
-
React.createElement("div",
|
147
|
-
|
146
|
+
React.createElement("div", { className: "tabulify-head-cell-content-wrapper" },
|
147
|
+
React.createElement("div", null, column.title),
|
148
|
+
React.createElement("div", { className: "icon-wrapper" }, sort && (sort === null || sort === void 0 ? void 0 : sort.sortBy) === column.key && (React.createElement(SortIcon, { sortOrder: sort.sortOrder })))))); }))),
|
148
149
|
React.createElement("tbody", { className: "tabulify-body" }, paginatedData.map(function (record, index) { return (React.createElement("tr", { key: getUniqueId(record[dataIndex]), className: cx([Boolean(onRowClick) && 'has-hover']), "data-id": String(record[dataIndex]), onClick: function () { return onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(record[dataIndex]); } }, columns.map(function (column) { return (React.createElement("td", { className: "tabulify-cell", key: getUniqueId(column.key) }, column.render ? (column.render(record[column.key], record, index)) : (React.createElement(React.Fragment, null, "".concat(record[column.key]))))); }))); }))))),
|
149
150
|
pagination && (React.createElement("div", { className: "tabulify-pagination-wrapper" },
|
150
151
|
React.createElement(Pagination, { currentPage: currentPage, onPageChange: handlePageChange, pageSize: pageSize, total: pagination.total })))));
|
151
152
|
};
|
152
153
|
|
153
|
-
|
154
|
+
var useSortTable = function (_a) {
|
155
|
+
var defaultSort = _a.defaultSort;
|
156
|
+
var _b = useState(defaultSort), sortBy = _b[0], setSortby = _b[1];
|
157
|
+
var _c = useState('asc'), sortOrder = _c[0], setSortOrder = _c[1];
|
158
|
+
var handleSortBy = function (newSortBy) {
|
159
|
+
if (newSortBy === sortBy) {
|
160
|
+
setSortOrder(function (prev) { return (prev === 'asc' ? 'desc' : 'asc'); });
|
161
|
+
return;
|
162
|
+
}
|
163
|
+
setSortby(newSortBy);
|
164
|
+
setSortOrder('asc');
|
165
|
+
};
|
166
|
+
return { handleSortBy: handleSortBy, sortBy: sortBy, sortOrder: sortOrder };
|
167
|
+
};
|
168
|
+
|
169
|
+
export { Table, useSortTable };
|
154
170
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/utils/index.ts","../node_modules/tslib/tslib.es6.js","../src/components/Pagination/index.tsx","../src/components/SortIcon/IconCartDown.tsx","../src/components/SortIcon/IconCartUp.tsx","../src/components/SortIcon/index.tsx","../src/components/Table/index.tsx"],"sourcesContent":["import { SortOptions } from '../types';\n\nexport const getUniqueId = (prefix: unknown): string =>\n `${prefix ?? 'id'}-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;\n\nexport const cx = (classNames: (string | boolean)[]): string =>\n classNames.filter((i) => i).join(' ');\n\nexport const sortData = <T>({\n dataSource,\n sortBy,\n sortOrder = 'asc',\n}: SortOptions<T>): T[] => {\n if (!sortBy || !sortOrder) return dataSource;\n return dataSource.sort((a, b) => {\n const aValue = a[sortBy];\n const bValue = b[sortBy];\n\n // Handle null or undefined values\n if (aValue == null) return 1; // Push `null` or `undefined` to the end\n if (bValue == null) return -1;\n\n // Handle numbers\n if (typeof aValue === 'number' && typeof bValue === 'number') {\n return sortOrder === 'asc' ? aValue - bValue : bValue - aValue;\n }\n\n // Handle strings\n if (typeof aValue === 'string' && typeof bValue === 'string') {\n const comparison = aValue.localeCompare(bValue);\n return sortOrder === 'asc' ? comparison : -comparison;\n }\n\n // Default to no change for unsupported types\n return 0;\n });\n};\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n 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);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n 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;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n","import React from 'react';\n\ninterface PaginationProps {\n pageSize: number;\n total: number;\n currentPage: number;\n onPageChange: (page: number) => void;\n}\n\nconst Pagination: React.FC<PaginationProps> = ({\n pageSize,\n total,\n currentPage,\n onPageChange,\n}) => {\n const totalPages = Math.ceil(total / pageSize);\n\n return (\n <div className=\"tabulify-pagination\">\n {[...Array(totalPages)].map((_, i) => (\n <button\n key={i}\n className={currentPage === i + 1 ? 'active' : ''}\n onClick={() => onPageChange(i + 1)}\n >\n {i + 1}\n </button>\n ))}\n </div>\n );\n};\n\nexport default Pagination;\n","import React from 'react';\n\nexport const IconCartDown = () => {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n className=\"icon-cart-down\"\n data-testid=\"sort-asc\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M18 9c.852 0 1.297 .986 .783 1.623l-.076 .084l-6 6a1 1 0 0 1 -1.32 .083l-.094 -.083l-6 -6l-.083 -.094l-.054 -.077l-.054 -.096l-.017 -.036l-.027 -.067l-.032 -.108l-.01 -.053l-.01 -.06l-.004 -.057v-.118l.005 -.058l.009 -.06l.01 -.052l.032 -.108l.027 -.067l.07 -.132l.065 -.09l.073 -.081l.094 -.083l.077 -.054l.096 -.054l.036 -.017l.067 -.027l.108 -.032l.053 -.01l.06 -.01l.057 -.004l12.059 -.002z\" />\n </svg>\n );\n};\n","import React from 'react';\n\nexport const IconCartUp = () => {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n className=\"icon-cart-up\"\n data-testid=\"sort-desc\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M11.293 7.293a1 1 0 0 1 1.32 -.083l.094 .083l6 6l.083 .094l.054 .077l.054 .096l.017 .036l.027 .067l.032 .108l.01 .053l.01 .06l.004 .057l.002 .059l-.002 .059l-.005 .058l-.009 .06l-.01 .052l-.032 .108l-.027 .067l-.07 .132l-.065 .09l-.073 .081l-.094 .083l-.077 .054l-.096 .054l-.036 .017l-.067 .027l-.108 .032l-.053 .01l-.06 .01l-.057 .004l-.059 .002h-12c-.852 0 -1.297 -.986 -.783 -1.623l.076 -.084l6 -6z\" />\n </svg>\n );\n};\n","import React from 'react';\nimport { SortOrder } from '../../types';\nimport { IconCartDown } from './IconCartDown';\nimport { IconCartUp } from './IconCartUp';\n\ninterface Props {\n sortOrder: SortOrder;\n}\nexport const SortIcon: React.FC<Props> = ({ sortOrder }) => {\n if (sortOrder === 'asc') return <IconCartDown />;\n return <IconCartUp />;\n};\n","import React, { useEffect, useMemo, useRef, useState } from 'react';\nimport { TableProps } from '../../types';\nimport { cx, getUniqueId, sortData } from '../../utils';\nimport Pagination from '../Pagination';\nimport { SortIcon } from '../SortIcon';\n\n// Table Component\nconst Table = <T,>({\n columns,\n dataSource,\n rowSelection,\n pagination,\n dataIndex,\n className,\n width,\n testId,\n sort,\n onRowClick,\n}: TableProps<T>) => {\n const containerRef: React.Ref<HTMLDivElement> = useRef(null);\n\n const [isScrolledToEnd, setIsScrolledToEnd] = useState(false);\n const [isScrollStarted, setIsScrollStarted] = useState(false);\n\n const handleScroll = () => {\n const container = containerRef.current;\n if (container) {\n const isAtEnd =\n container.scrollLeft + container.clientWidth >= container.scrollWidth;\n setIsScrollStarted(container.scrollLeft > 0);\n setIsScrolledToEnd(isAtEnd);\n }\n };\n\n const [currentPage, setCurrentPage] = useState(pagination?.current || 1);\n\n const pageSize = pagination?.pageSize || dataSource.length;\n\n // Handle pagination\n const handlePageChange = (page: number) => {\n setCurrentPage(page);\n pagination?.onChange?.(page);\n };\n\n // Sorted Data\n const sortedData = sortData({\n dataSource,\n sortBy: sort?.sortBy,\n sortOrder: sort?.sortOrder,\n });\n\n // Paginate data\n const paginatedData = pagination\n ? sortedData.slice((currentPage - 1) * pageSize, currentPage * pageSize)\n : sortedData;\n\n useEffect(() => {\n const container = containerRef.current;\n if (container) {\n handleScroll(); // Initial check\n }\n }, []);\n\n return (\n <div className={className} data-testid={testId}>\n <div className=\"tabulify-wrapper\">\n <div\n className={cx([\n 'tabulify-container',\n width && 'has-scroll',\n isScrolledToEnd && 'hide-right-shadow',\n !isScrollStarted && 'hide-left-shadow',\n ])}\n ref={containerRef}\n onScroll={handleScroll}\n >\n <table className=\"tabulify-table\" style={{ width: width ?? '100%' }}>\n <thead className=\"tabulify-head\">\n <tr>\n {rowSelection && <th></th>}\n {columns.map((column) => (\n <th\n className={cx([\n 'tabulify-cell',\n Boolean(sort) && 'has-hover',\n ])}\n key={getUniqueId(column.key)}\n data-testid={`table-head-th-${String(column.key)}`}\n onClick={() => sort?.onSort(column.key)}\n >\n <div>{column.title}</div>\n {sort && sort?.sortBy === column.key && (\n <SortIcon sortOrder={sort.sortOrder} />\n )}\n </th>\n ))}\n </tr>\n </thead>\n <tbody className=\"tabulify-body\">\n {paginatedData.map((record, index) => (\n <tr\n key={getUniqueId(record[dataIndex])}\n className={cx([Boolean(onRowClick) && 'has-hover'])}\n data-id={String(record[dataIndex])}\n onClick={() => onRowClick?.(record[dataIndex])}\n >\n {columns.map((column) => (\n <td className=\"tabulify-cell\" key={getUniqueId(column.key)}>\n {column.render ? (\n column.render(record[column.key], record, index)\n ) : (\n <>{`${record[column.key]}`}</>\n )}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </div>\n {pagination && (\n <div className=\"tabulify-pagination-wrapper\">\n <Pagination\n currentPage={currentPage}\n onPageChange={handlePageChange}\n pageSize={pageSize}\n total={pagination.total}\n />\n </div>\n )}\n </div>\n );\n};\n\nexport default Table;\n"],"names":[],"mappings":";;AAEO,IAAM,WAAW,GAAG,UAAC,MAAe,EAAA;AACzC,IAAA,OAAA,EAAG,CAAA,MAAA,CAAA,MAAM,KAAN,IAAA,IAAA,MAAM,KAAN,KAAA,CAAA,GAAA,MAAM,GAAI,IAAI,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,IAAI,CAAC,GAAG,EAAE,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAE;AAA/E,CAA+E;AAE1E,IAAM,EAAE,GAAG,UAAC,UAAgC,EAAA;AACjD,IAAA,OAAA,UAAU,CAAC,MAAM,CAAC,UAAC,CAAC,EAAK,EAAA,OAAA,CAAC,CAAA,EAAA,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;AAArC,CAAqC;AAEhC,IAAM,QAAQ,GAAG,UAAI,EAIX,EAAA;QAHf,UAAU,GAAA,EAAA,CAAA,UAAA,EACV,MAAM,GAAA,EAAA,CAAA,MAAA,EACN,iBAAiB,EAAjB,SAAS,GAAG,EAAA,KAAA,KAAA,CAAA,GAAA,KAAK,GAAA,EAAA;AAEjB,IAAA,IAAI,CAAC,MAAM,IAAI,CAAC,SAAS;AAAE,QAAA,OAAO,UAAU;AAC5C,IAAA,OAAO,UAAU,CAAC,IAAI,CAAC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AA,KAAA,CAAA,QAAA,EAAA,IAAA,EAAG,EAAG,CAAA,MAAA,CAAA,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAE,CAAI,CAC/B,CACE,EACN,EAAA,CAAC,CACC,EACN,EAAA,CAAC,CACI,CACF,CACJ,CACF;AACL,QAAA,UAAU,KACT,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAC,6BAA6B,EAAA;YAC1C,KAAC,CAAA,aAAA,CAAA,UAAU,EACT,EAAA,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,gBAAgB,EAC9B,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,UAAU,CAAC,KAAK,GACvB,CACE,CACP,CACG;AAEV;;;;","x_google_ignoreList":[1]}
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/utils/index.ts","../node_modules/tslib/tslib.es6.js","../src/components/Pagination/index.tsx","../src/components/SortIcon/IconCartDown.tsx","../src/components/SortIcon/IconCartUp.tsx","../src/components/SortIcon/index.tsx","../src/components/Table/index.tsx","../src/hooks/useSortTable.ts"],"sourcesContent":["import { SortOptions } from '../types';\n\nexport const getUniqueId = (prefix: unknown): string =>\n `${prefix ?? 'id'}-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;\n\nexport const cx = (classNames: (string | boolean)[]): string =>\n classNames.filter((i) => i).join(' ');\n\nexport const sortData = <T>({\n dataSource,\n sortBy,\n sortOrder = 'asc',\n}: SortOptions<T>): T[] => {\n if (!sortBy || !sortOrder) return dataSource;\n return dataSource.sort((a, b) => {\n const aValue = a[sortBy];\n const bValue = b[sortBy];\n\n // Handle null or undefined values\n if (aValue == null) return 1; // Push `null` or `undefined` to the end\n if (bValue == null) return -1;\n\n // Handle numbers\n if (typeof aValue === 'number' && typeof bValue === 'number') {\n return sortOrder === 'asc' ? aValue - bValue : bValue - aValue;\n }\n\n // Handle strings\n if (typeof aValue === 'string' && typeof bValue === 'string') {\n const comparison = aValue.localeCompare(bValue);\n return sortOrder === 'asc' ? comparison : -comparison;\n }\n\n // Default to no change for unsupported types\n return 0;\n });\n};\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n 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);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n 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;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n","import React from 'react';\n\ninterface PaginationProps {\n pageSize: number;\n total: number;\n currentPage: number;\n onPageChange: (page: number) => void;\n}\n\nconst Pagination: React.FC<PaginationProps> = ({\n pageSize,\n total,\n currentPage,\n onPageChange,\n}) => {\n const totalPages = Math.ceil(total / pageSize);\n\n return (\n <div className=\"tabulify-pagination\">\n {[...Array(totalPages)].map((_, i) => (\n <button\n key={i}\n className={currentPage === i + 1 ? 'active' : ''}\n onClick={() => onPageChange(i + 1)}\n >\n {i + 1}\n </button>\n ))}\n </div>\n );\n};\n\nexport default Pagination;\n","import React from 'react';\n\nexport const IconCartDown = () => {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n className=\"icon-cart-down\"\n data-testid=\"sort-asc\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M18 9c.852 0 1.297 .986 .783 1.623l-.076 .084l-6 6a1 1 0 0 1 -1.32 .083l-.094 -.083l-6 -6l-.083 -.094l-.054 -.077l-.054 -.096l-.017 -.036l-.027 -.067l-.032 -.108l-.01 -.053l-.01 -.06l-.004 -.057v-.118l.005 -.058l.009 -.06l.01 -.052l.032 -.108l.027 -.067l.07 -.132l.065 -.09l.073 -.081l.094 -.083l.077 -.054l.096 -.054l.036 -.017l.067 -.027l.108 -.032l.053 -.01l.06 -.01l.057 -.004l12.059 -.002z\" />\n </svg>\n );\n};\n","import React from 'react';\n\nexport const IconCartUp = () => {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n className=\"icon-cart-up\"\n data-testid=\"sort-desc\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M11.293 7.293a1 1 0 0 1 1.32 -.083l.094 .083l6 6l.083 .094l.054 .077l.054 .096l.017 .036l.027 .067l.032 .108l.01 .053l.01 .06l.004 .057l.002 .059l-.002 .059l-.005 .058l-.009 .06l-.01 .052l-.032 .108l-.027 .067l-.07 .132l-.065 .09l-.073 .081l-.094 .083l-.077 .054l-.096 .054l-.036 .017l-.067 .027l-.108 .032l-.053 .01l-.06 .01l-.057 .004l-.059 .002h-12c-.852 0 -1.297 -.986 -.783 -1.623l.076 -.084l6 -6z\" />\n </svg>\n );\n};\n","import React from 'react';\nimport { SortOrder } from '../../types';\nimport { IconCartDown } from './IconCartDown';\nimport { IconCartUp } from './IconCartUp';\n\ninterface Props {\n sortOrder: SortOrder;\n}\nexport const SortIcon: React.FC<Props> = ({ sortOrder }) => {\n if (sortOrder === 'asc') return <IconCartDown />;\n return <IconCartUp />;\n};\n","import React, { useEffect, useRef, useState } from 'react';\nimport { TableProps } from '../../types';\nimport { cx, getUniqueId, sortData } from '../../utils';\nimport Pagination from '../Pagination';\nimport { SortIcon } from '../SortIcon';\n\n// Table Component\nconst Table = <T,>({\n columns,\n dataSource,\n rowSelection,\n pagination,\n dataIndex,\n className,\n width,\n testId,\n sort,\n onRowClick,\n}: TableProps<T>) => {\n const containerRef: React.Ref<HTMLDivElement> = useRef(null);\n\n const [isScrolledToEnd, setIsScrolledToEnd] = useState(false);\n const [isScrollStarted, setIsScrollStarted] = useState(false);\n\n const handleScroll = () => {\n const container = containerRef.current;\n if (container) {\n const isAtEnd =\n container.scrollLeft + container.clientWidth >= container.scrollWidth;\n setIsScrollStarted(container.scrollLeft > 0);\n setIsScrolledToEnd(isAtEnd);\n }\n };\n\n const [currentPage, setCurrentPage] = useState(pagination?.current || 1);\n\n const pageSize = pagination?.pageSize || dataSource.length;\n\n // Handle pagination\n const handlePageChange = (page: number) => {\n setCurrentPage(page);\n pagination?.onChange?.(page);\n };\n\n // Sorted Data\n const sortedData = sortData({\n dataSource,\n sortBy: sort?.sortBy,\n sortOrder: sort?.sortOrder,\n });\n\n // Paginate data\n const paginatedData = pagination\n ? sortedData.slice((currentPage - 1) * pageSize, currentPage * pageSize)\n : sortedData;\n\n useEffect(() => {\n const container = containerRef.current;\n if (container) {\n handleScroll(); // Initial check\n }\n }, []);\n\n return (\n <div className={className} data-testid={testId}>\n <div className=\"tabulify-wrapper\">\n <div\n className={cx([\n 'tabulify-container',\n width && 'has-scroll',\n isScrolledToEnd && 'hide-right-shadow',\n !isScrollStarted && 'hide-left-shadow',\n ])}\n ref={containerRef}\n onScroll={handleScroll}\n >\n <table className=\"tabulify-table\" style={{ width: width ?? '100%' }}>\n <thead className=\"tabulify-head\">\n <tr>\n {rowSelection && <th></th>}\n {columns.map((column) => (\n <th\n className={cx([\n 'tabulify-cell',\n Boolean(sort) && 'has-hover',\n ])}\n key={getUniqueId(column.key)}\n data-testid={`table-head-th-${String(column.key)}`}\n onClick={() => sort?.onSort(column.key)}\n >\n <div className=\"tabulify-head-cell-content-wrapper\">\n <div>{column.title}</div>\n <div className=\"icon-wrapper\">\n {sort && sort?.sortBy === column.key && (\n <SortIcon sortOrder={sort.sortOrder} />\n )}\n </div>\n </div>\n </th>\n ))}\n </tr>\n </thead>\n <tbody className=\"tabulify-body\">\n {paginatedData.map((record, index) => (\n <tr\n key={getUniqueId(record[dataIndex])}\n className={cx([Boolean(onRowClick) && 'has-hover'])}\n data-id={String(record[dataIndex])}\n onClick={() => onRowClick?.(record[dataIndex])}\n >\n {columns.map((column) => (\n <td className=\"tabulify-cell\" key={getUniqueId(column.key)}>\n {column.render ? (\n column.render(record[column.key], record, index)\n ) : (\n <>{`${record[column.key]}`}</>\n )}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </div>\n {pagination && (\n <div className=\"tabulify-pagination-wrapper\">\n <Pagination\n currentPage={currentPage}\n onPageChange={handlePageChange}\n pageSize={pageSize}\n total={pagination.total}\n />\n </div>\n )}\n </div>\n );\n};\n\nexport default Table;\n","import { useState } from 'react';\nimport { SortBy, SortOrder } from '../types';\n\ninterface Props<T> {\n defaultSort: SortBy<T>;\n}\nexport const useSortTable = <T>({ defaultSort }: Props<T>) => {\n const [sortBy, setSortby] = useState<SortBy<T>>(defaultSort);\n const [sortOrder, setSortOrder] = useState<SortOrder>('asc');\n\n const handleSortBy = (newSortBy: keyof T) => {\n if (newSortBy === sortBy) {\n setSortOrder((prev) => (prev === 'asc' ? 'desc' : 'asc'));\n return;\n }\n setSortby(newSortBy as SortBy<T>);\n setSortOrder('asc');\n };\n\n return { handleSortBy, sortBy, sortOrder };\n};\n"],"names":[],"mappings":";;AAEO,IAAM,WAAW,GAAG,UAAC,MAAe,EAAA;AACzC,IAAA,OAAA,EAAG,CAAA,MAAA,CAAA,MAAM,KAAN,IAAA,IAAA,MAAM,KAAN,KAAA,CAAA,GAAA,MAAM,GAAI,IAAI,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,IAAI,CAAC,GAAG,EAAE,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAE;AAA/E,CAA+E;AAE1E,IAAM,EAAE,GAAG,UAAC,UAAgC,EAAA;AACjD,IAAA,OAAA,UAAU,CAAC,MAAM,CAAC,UAAC,CAAC,EAAK,EAAA,OAAA,CAAC,CAAA,EAAA,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;AAArC,CAAqC;AAEhC,IAAM,QAAQ,GAAG,UAAI,EAIX,EAAA;QAHf,UAAU,GAAA,EAAA,CAAA,UAAA,EACV,MAAM,GAAA,EAAA,CAAA,MAAA,EACN,iBAAiB,EAAjB,SAAS,GAAG,EAAA,KAAA,KAAA,CAAA,GAAA,KAAK,GAAA,EAAA;AAEjB,IAAA,IAAI,CAAC,MAAM,IAAI,CAAC,SAAS;AAAE,QAAA,OAAO,UAAU;AAC5C,IAAA,OAAO,UAAU,CAAC,IAAI,CAAC,UAAC,CAAC,EAAE,CAAC,EAAA;AAC1B,QAAA,IAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;AACxB,QAAA,IAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;;QA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der } from '../types';
|
2
|
+
interface Props<T> {
|
3
|
+
defaultSort: SortBy<T>;
|
4
|
+
}
|
5
|
+
export declare const useSortTable: <T>({ defaultSort }: Props<T>) => {
|
6
|
+
handleSortBy: (newSortBy: keyof T) => void;
|
7
|
+
sortBy: SortBy<T>;
|
8
|
+
sortOrder: SortOrder;
|
9
|
+
};
|
10
|
+
export {};
|
package/dist/types/index.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import './styles.css';
|
2
2
|
export { default as Table } from './components/Table';
|
3
|
-
export type { TableProps, Column, Pagination, RowSelection } from './types';
|
3
|
+
export type { TableProps, Column, Pagination, RowSelection, SortOrder, SortBy, } from './types';
|
4
|
+
export { useSortTable } from './hooks/useSortTable';
|
4
5
|
export {};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
export type SortOrder = 'asc' | 'desc';
|
3
|
-
type
|
3
|
+
export type SortBy<T> = {
|
4
4
|
[K in keyof T]: T[K] extends number | string | null ? K : never;
|
5
5
|
}[keyof T];
|
6
6
|
export interface Column<T, K extends keyof T = keyof T> {
|
@@ -21,13 +21,13 @@ export interface Pagination {
|
|
21
21
|
onChange?: (page: number) => void;
|
22
22
|
}
|
23
23
|
export interface Sort<T> {
|
24
|
-
sortBy:
|
24
|
+
sortBy: SortBy<T>;
|
25
25
|
sortOrder: SortOrder;
|
26
26
|
onSort: (sortBy: keyof T) => void;
|
27
27
|
}
|
28
28
|
export interface SortOptions<T> {
|
29
29
|
dataSource: T[];
|
30
|
-
sortBy?:
|
30
|
+
sortBy?: SortBy<T>;
|
31
31
|
sortOrder?: SortOrder;
|
32
32
|
}
|
33
33
|
export interface TableProps<T> {
|
@@ -42,4 +42,3 @@ export interface TableProps<T> {
|
|
42
42
|
testId?: string;
|
43
43
|
onRowClick?: (id: T[keyof T]) => void;
|
44
44
|
}
|
45
|
-
export {};
|
package/package.json
CHANGED