@forgedevstack/grid-table 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +16 -5
- package/dist/grid-table.css +1 -0
- package/dist/index.js +98 -113
- package/dist/index.mjs +98 -113
- package/package.json +9 -6
- package/src/grid-table.scss +26 -0
package/dist/index.mjs
CHANGED
|
@@ -1082,7 +1082,7 @@ function FilterPopup({
|
|
|
1082
1082
|
"div",
|
|
1083
1083
|
{
|
|
1084
1084
|
ref: popupRef,
|
|
1085
|
-
className: `filter-popup
|
|
1085
|
+
className: `filter-popup ${className}`,
|
|
1086
1086
|
style: {
|
|
1087
1087
|
top: (_a = position == null ? void 0 : position.top) != null ? _a : "100%",
|
|
1088
1088
|
left: (_b = position == null ? void 0 : position.left) != null ? _b : 0,
|
|
@@ -1090,44 +1090,44 @@ function FilterPopup({
|
|
|
1090
1090
|
...style
|
|
1091
1091
|
},
|
|
1092
1092
|
children: [
|
|
1093
|
-
/* @__PURE__ */ jsx2("div", { className: "filter-popup-header
|
|
1094
|
-
/* @__PURE__ */ jsx2("span", { className: "
|
|
1093
|
+
/* @__PURE__ */ jsx2("div", { className: "filter-popup-header", children: /* @__PURE__ */ jsxs("div", { className: "header-content", children: [
|
|
1094
|
+
/* @__PURE__ */ jsx2("span", { className: "header-title", children: columnHeader }),
|
|
1095
1095
|
/* @__PURE__ */ jsx2(
|
|
1096
1096
|
"button",
|
|
1097
1097
|
{
|
|
1098
1098
|
onClick: onClose,
|
|
1099
|
-
className: "
|
|
1099
|
+
className: "header-close",
|
|
1100
1100
|
"aria-label": "Close",
|
|
1101
|
-
children: /* @__PURE__ */ jsx2("svg", { className: "
|
|
1101
|
+
children: /* @__PURE__ */ jsx2("svg", { className: "icon-md", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx2("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
|
1102
1102
|
}
|
|
1103
1103
|
)
|
|
1104
1104
|
] }) }),
|
|
1105
|
-
/* @__PURE__ */ jsx2("div", { className: "filter-popup-body
|
|
1105
|
+
/* @__PURE__ */ jsx2("div", { className: "filter-popup-body", children: filterType === "select" && filterOptions ? /* @__PURE__ */ jsxs(
|
|
1106
1106
|
"select",
|
|
1107
1107
|
{
|
|
1108
1108
|
value: String(value),
|
|
1109
1109
|
onChange: (e) => setValue(e.target.value),
|
|
1110
|
-
className: "w-full px-3 py-2 text-sm rounded
|
|
1110
|
+
className: "w-full px-3 py-2 text-sm rounded",
|
|
1111
1111
|
children: [
|
|
1112
1112
|
/* @__PURE__ */ jsx2("option", { value: "", children: "Select..." }),
|
|
1113
1113
|
filterOptions.map((opt) => /* @__PURE__ */ jsx2("option", { value: String(opt.value), children: opt.label }, String(opt.value)))
|
|
1114
1114
|
]
|
|
1115
1115
|
}
|
|
1116
1116
|
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1117
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
1118
|
-
/* @__PURE__ */ jsx2("label", {
|
|
1117
|
+
/* @__PURE__ */ jsxs("div", { className: "filter-field", children: [
|
|
1118
|
+
/* @__PURE__ */ jsx2("label", { children: "Operator" }),
|
|
1119
1119
|
/* @__PURE__ */ jsx2(
|
|
1120
1120
|
"select",
|
|
1121
1121
|
{
|
|
1122
1122
|
value: operator,
|
|
1123
1123
|
onChange: (e) => setOperator(e.target.value),
|
|
1124
|
-
className: "w-full px-3 py-2 text-sm rounded
|
|
1124
|
+
className: "w-full px-3 py-2 text-sm rounded",
|
|
1125
1125
|
children: operators.map((op) => /* @__PURE__ */ jsx2("option", { value: op, children: OPERATOR_LABELS[op] }, op))
|
|
1126
1126
|
}
|
|
1127
1127
|
)
|
|
1128
1128
|
] }),
|
|
1129
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
1130
|
-
/* @__PURE__ */ jsx2("label", {
|
|
1129
|
+
/* @__PURE__ */ jsxs("div", { className: "filter-field", children: [
|
|
1130
|
+
/* @__PURE__ */ jsx2("label", { children: "Value" }),
|
|
1131
1131
|
/* @__PURE__ */ jsx2(
|
|
1132
1132
|
"input",
|
|
1133
1133
|
{
|
|
@@ -1136,18 +1136,18 @@ function FilterPopup({
|
|
|
1136
1136
|
onChange: (e) => setValue(e.target.value),
|
|
1137
1137
|
onKeyDown: handleKeyDown,
|
|
1138
1138
|
placeholder: `Filter ${columnHeader}...`,
|
|
1139
|
-
className: "w-full px-3 py-2 text-sm rounded
|
|
1139
|
+
className: "w-full px-3 py-2 text-sm rounded",
|
|
1140
1140
|
autoFocus: true
|
|
1141
1141
|
}
|
|
1142
1142
|
)
|
|
1143
1143
|
] })
|
|
1144
1144
|
] }) }),
|
|
1145
|
-
/* @__PURE__ */ jsxs("div", { className: "filter-popup-footer
|
|
1145
|
+
/* @__PURE__ */ jsxs("div", { className: "filter-popup-footer", children: [
|
|
1146
1146
|
/* @__PURE__ */ jsx2(
|
|
1147
1147
|
"button",
|
|
1148
1148
|
{
|
|
1149
1149
|
onClick: handleClear,
|
|
1150
|
-
className: "
|
|
1150
|
+
className: "filter-clear",
|
|
1151
1151
|
children: translations.clearFilter
|
|
1152
1152
|
}
|
|
1153
1153
|
),
|
|
@@ -1155,7 +1155,7 @@ function FilterPopup({
|
|
|
1155
1155
|
"button",
|
|
1156
1156
|
{
|
|
1157
1157
|
onClick: handleApply,
|
|
1158
|
-
className: "
|
|
1158
|
+
className: "filter-apply",
|
|
1159
1159
|
children: translations.apply
|
|
1160
1160
|
}
|
|
1161
1161
|
)
|
|
@@ -1170,7 +1170,7 @@ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
|
1170
1170
|
var FilterIcon = ({ active = false }) => /* @__PURE__ */ jsx3(
|
|
1171
1171
|
"svg",
|
|
1172
1172
|
{
|
|
1173
|
-
className: `
|
|
1173
|
+
className: `icon-sm ${active ? "text-accent-primary" : "text-theme-muted"}`,
|
|
1174
1174
|
fill: "none",
|
|
1175
1175
|
viewBox: "0 0 24 24",
|
|
1176
1176
|
stroke: "currentColor",
|
|
@@ -1188,7 +1188,7 @@ var FilterIcon = ({ active = false }) => /* @__PURE__ */ jsx3(
|
|
|
1188
1188
|
var SortIcon = ({ direction }) => /* @__PURE__ */ jsx3(
|
|
1189
1189
|
"svg",
|
|
1190
1190
|
{
|
|
1191
|
-
className: `
|
|
1191
|
+
className: `icon-sm ${direction ? "text-accent-primary" : "text-theme-muted"}`,
|
|
1192
1192
|
fill: "none",
|
|
1193
1193
|
viewBox: "0 0 24 24",
|
|
1194
1194
|
stroke: "currentColor",
|
|
@@ -1245,36 +1245,23 @@ function HeaderCell({
|
|
|
1245
1245
|
const cellClasses = useMemo8(() => {
|
|
1246
1246
|
const classes = [
|
|
1247
1247
|
"grid-header-cell",
|
|
1248
|
-
"relative",
|
|
1249
|
-
"flex",
|
|
1250
|
-
"items-center",
|
|
1251
|
-
"gap-2",
|
|
1252
|
-
"px-4",
|
|
1253
|
-
"py-3",
|
|
1254
|
-
"font-medium",
|
|
1255
|
-
"text-sm",
|
|
1256
|
-
"text-theme-secondary",
|
|
1257
|
-
"select-none",
|
|
1258
|
-
"border-b",
|
|
1259
|
-
"border-theme-border",
|
|
1260
|
-
"transition-colors",
|
|
1261
1248
|
ALIGN_CLASSES[column.align || "left"]
|
|
1262
1249
|
];
|
|
1263
1250
|
if (isSortable) {
|
|
1264
|
-
classes.push("cursor-pointer"
|
|
1251
|
+
classes.push("cursor-pointer");
|
|
1265
1252
|
}
|
|
1266
1253
|
if (isDragging) {
|
|
1267
1254
|
classes.push("opacity-50");
|
|
1268
1255
|
}
|
|
1269
1256
|
if (isDragOver) {
|
|
1270
|
-
classes.push("bg-accent-primary/10"
|
|
1257
|
+
classes.push("bg-accent-primary/10");
|
|
1271
1258
|
}
|
|
1272
1259
|
return classes.join(" ");
|
|
1273
1260
|
}, [column.align, isSortable, isDragging, isDragOver]);
|
|
1274
1261
|
return /* @__PURE__ */ jsxs2(
|
|
1275
1262
|
"div",
|
|
1276
1263
|
{
|
|
1277
|
-
className: `${cellClasses} ${column.headerClassName || ""} ${column.sticky ?
|
|
1264
|
+
className: `${cellClasses} ${column.headerClassName || ""} ${column.sticky ? `sticky-${column.sticky}` : ""}`,
|
|
1278
1265
|
style: {
|
|
1279
1266
|
width: columnState.width,
|
|
1280
1267
|
minWidth: column.minWidth || MIN_COLUMN_WIDTH,
|
|
@@ -1293,8 +1280,8 @@ function HeaderCell({
|
|
|
1293
1280
|
onClick: handleClick,
|
|
1294
1281
|
...isDraggable ? { ...dragHandleProps, ...dropTargetProps } : {},
|
|
1295
1282
|
children: [
|
|
1296
|
-
/* @__PURE__ */ jsx3("span", { className: "grid-header-content
|
|
1297
|
-
isSortable && /* @__PURE__ */ jsxs2("span", { className: "grid-header-sort
|
|
1283
|
+
/* @__PURE__ */ jsx3("span", { className: "grid-header-content", children: headerContent }),
|
|
1284
|
+
isSortable && /* @__PURE__ */ jsxs2("span", { className: "grid-header-sort", children: [
|
|
1298
1285
|
/* @__PURE__ */ jsx3(SortIcon, { direction: sortDirection != null ? sortDirection : null }),
|
|
1299
1286
|
isMultiSort && sortIndex !== void 0 && sortIndex >= 0 && sortDirection && /* @__PURE__ */ jsx3("span", { className: "text-xs text-theme-muted", children: sortIndex + 1 })
|
|
1300
1287
|
] }),
|
|
@@ -1302,7 +1289,7 @@ function HeaderCell({
|
|
|
1302
1289
|
"button",
|
|
1303
1290
|
{
|
|
1304
1291
|
onClick: handleFilterClick,
|
|
1305
|
-
className: "grid-header-filter
|
|
1292
|
+
className: "grid-header-filter",
|
|
1306
1293
|
"aria-label": "Filter column",
|
|
1307
1294
|
children: /* @__PURE__ */ jsx3(FilterIcon, { active: hasFilter })
|
|
1308
1295
|
}
|
|
@@ -1310,7 +1297,7 @@ function HeaderCell({
|
|
|
1310
1297
|
isResizable && /* @__PURE__ */ jsx3(
|
|
1311
1298
|
"div",
|
|
1312
1299
|
{
|
|
1313
|
-
className: "grid-header-resize
|
|
1300
|
+
className: "grid-header-resize",
|
|
1314
1301
|
onMouseDown: onResizeStart,
|
|
1315
1302
|
onClick: (e) => e.stopPropagation()
|
|
1316
1303
|
}
|
|
@@ -1401,7 +1388,7 @@ function GridHeader({
|
|
|
1401
1388
|
return classes.join(" ");
|
|
1402
1389
|
}, [sticky]);
|
|
1403
1390
|
return /* @__PURE__ */ jsxs2("div", { className: `${headerClasses} ${className}`, style, role: "row", children: [
|
|
1404
|
-
enableSelection && /* @__PURE__ */ jsx3("div", { className: "grid-header-select
|
|
1391
|
+
enableSelection && /* @__PURE__ */ jsx3("div", { className: "grid-header-select", children: /* @__PURE__ */ jsx3(
|
|
1405
1392
|
"input",
|
|
1406
1393
|
{
|
|
1407
1394
|
type: "checkbox",
|
|
@@ -1410,7 +1397,7 @@ function GridHeader({
|
|
|
1410
1397
|
if (el) el.indeterminate = someSelected && !allSelected;
|
|
1411
1398
|
},
|
|
1412
1399
|
onChange: onSelectAll,
|
|
1413
|
-
className: "
|
|
1400
|
+
className: "grid-header-checkbox",
|
|
1414
1401
|
"aria-label": "Select all rows"
|
|
1415
1402
|
}
|
|
1416
1403
|
) }),
|
|
@@ -1427,7 +1414,7 @@ function GridHeader({
|
|
|
1427
1414
|
const hasFilter = state.filters.some((f) => f.columnId === col.id);
|
|
1428
1415
|
const existingFilter = state.filters.find((f) => f.columnId === col.id);
|
|
1429
1416
|
const headerText = typeof col.header === "string" ? col.header : col.id;
|
|
1430
|
-
return /* @__PURE__ */ jsxs2("div", { className: "relative", children: [
|
|
1417
|
+
return /* @__PURE__ */ jsxs2("div", { className: "relative", style: { position: "relative" }, children: [
|
|
1431
1418
|
/* @__PURE__ */ jsx3(
|
|
1432
1419
|
HeaderCell,
|
|
1433
1420
|
{
|
|
@@ -1547,17 +1534,15 @@ function GridCell({
|
|
|
1547
1534
|
return baseStyle;
|
|
1548
1535
|
}, [style, width, sticky, stickyOffset]);
|
|
1549
1536
|
const alignClass = ALIGN_CLASSES2[align];
|
|
1550
|
-
const
|
|
1537
|
+
const stickyClass = sticky ? `sticky-${sticky}` : "";
|
|
1551
1538
|
return /* @__PURE__ */ jsxs3(
|
|
1552
1539
|
"div",
|
|
1553
1540
|
{
|
|
1554
1541
|
className: `
|
|
1555
1542
|
grid-cell
|
|
1556
|
-
px-4 py-3
|
|
1557
|
-
flex items-center
|
|
1558
1543
|
${alignClass}
|
|
1559
|
-
${
|
|
1560
|
-
${onClick ? "cursor-pointer
|
|
1544
|
+
${stickyClass}
|
|
1545
|
+
${onClick ? "cursor-pointer" : ""}
|
|
1561
1546
|
${column.cellClassName || ""}
|
|
1562
1547
|
${className}
|
|
1563
1548
|
`.trim(),
|
|
@@ -1565,7 +1550,7 @@ function GridCell({
|
|
|
1565
1550
|
role: "cell",
|
|
1566
1551
|
onClick: onClick ? handleClick : void 0,
|
|
1567
1552
|
children: [
|
|
1568
|
-
showLabel && labelText && /* @__PURE__ */ jsxs3("span", { className: "grid-cell-label
|
|
1553
|
+
showLabel && labelText && /* @__PURE__ */ jsxs3("span", { className: "grid-cell-label", children: [
|
|
1569
1554
|
labelText,
|
|
1570
1555
|
":"
|
|
1571
1556
|
] }),
|
|
@@ -1688,23 +1673,23 @@ function GridRow({
|
|
|
1688
1673
|
onMouseEnter: () => setIsHovered(true),
|
|
1689
1674
|
onMouseLeave: () => setIsHovered(false),
|
|
1690
1675
|
children: [
|
|
1691
|
-
enableSelection && /* @__PURE__ */ jsx5("div", { className: "grid-row-select
|
|
1676
|
+
enableSelection && /* @__PURE__ */ jsx5("div", { className: "grid-row-select", children: /* @__PURE__ */ jsx5(
|
|
1692
1677
|
"input",
|
|
1693
1678
|
{
|
|
1694
1679
|
type: "checkbox",
|
|
1695
1680
|
checked: isSelected,
|
|
1696
1681
|
onChange: handleSelectChange,
|
|
1697
1682
|
disabled: isDisabled,
|
|
1698
|
-
className: "
|
|
1683
|
+
className: "grid-row-checkbox",
|
|
1699
1684
|
"aria-label": "Select row"
|
|
1700
1685
|
}
|
|
1701
1686
|
) }),
|
|
1702
|
-
enableExpansion && renderExpansion && /* @__PURE__ */ jsx5("div", { className: "grid-row-expand
|
|
1687
|
+
enableExpansion && renderExpansion && /* @__PURE__ */ jsx5("div", { className: "grid-row-expand", children: /* @__PURE__ */ jsx5(
|
|
1703
1688
|
"button",
|
|
1704
1689
|
{
|
|
1705
1690
|
onClick: handleExpandToggle,
|
|
1706
1691
|
disabled: isDisabled,
|
|
1707
|
-
className: "
|
|
1692
|
+
className: "grid-row-expand-button",
|
|
1708
1693
|
"aria-label": isExpanded ? "Collapse row" : "Expand row",
|
|
1709
1694
|
"aria-expanded": isExpanded,
|
|
1710
1695
|
children: /* @__PURE__ */ jsx5(
|
|
@@ -1750,7 +1735,7 @@ function GridRow({
|
|
|
1750
1735
|
align: col.align,
|
|
1751
1736
|
showLabel: isMobile && showMobileLabels && col.showLabelOnMobile !== false,
|
|
1752
1737
|
labelText: typeof col.header === "string" ? col.header : col.id,
|
|
1753
|
-
className: isMobile ? "w-full
|
|
1738
|
+
className: isMobile ? "w-full-sm flex-shrink-0" : "flex-shrink-0",
|
|
1754
1739
|
sticky: col.sticky,
|
|
1755
1740
|
stickyOffset,
|
|
1756
1741
|
onClick: onCellClick
|
|
@@ -1761,7 +1746,7 @@ function GridRow({
|
|
|
1761
1746
|
]
|
|
1762
1747
|
}
|
|
1763
1748
|
),
|
|
1764
|
-
isExpanded && renderExpansion && /* @__PURE__ */ jsx5("div", { className: "grid-row-expansion
|
|
1749
|
+
isExpanded && renderExpansion && /* @__PURE__ */ jsx5("div", { className: "grid-row-expansion", children: renderExpansion(row) })
|
|
1765
1750
|
] });
|
|
1766
1751
|
}
|
|
1767
1752
|
|
|
@@ -1926,13 +1911,13 @@ function Pagination({
|
|
|
1926
1911
|
return /* @__PURE__ */ jsxs5(
|
|
1927
1912
|
"div",
|
|
1928
1913
|
{
|
|
1929
|
-
className: `grid-pagination
|
|
1914
|
+
className: `grid-pagination ${className}`,
|
|
1930
1915
|
style,
|
|
1931
1916
|
role: "navigation",
|
|
1932
1917
|
"aria-label": "Pagination",
|
|
1933
1918
|
children: [
|
|
1934
|
-
/* @__PURE__ */ jsxs5("div", { className: "grid-pagination-info
|
|
1935
|
-
/* @__PURE__ */ jsxs5("div", { className: "grid-pagination-range
|
|
1919
|
+
/* @__PURE__ */ jsxs5("div", { className: "grid-pagination-info", children: [
|
|
1920
|
+
/* @__PURE__ */ jsxs5("div", { className: "grid-pagination-range", children: [
|
|
1936
1921
|
startItem,
|
|
1937
1922
|
"-",
|
|
1938
1923
|
endItem,
|
|
@@ -1941,8 +1926,8 @@ function Pagination({
|
|
|
1941
1926
|
" ",
|
|
1942
1927
|
totalItems
|
|
1943
1928
|
] }),
|
|
1944
|
-
/* @__PURE__ */ jsxs5("div", { className: "grid-pagination-size
|
|
1945
|
-
/* @__PURE__ */ jsxs5("label", { htmlFor: "page-size",
|
|
1929
|
+
/* @__PURE__ */ jsxs5("div", { className: "grid-pagination-size", children: [
|
|
1930
|
+
/* @__PURE__ */ jsxs5("label", { htmlFor: "page-size", children: [
|
|
1946
1931
|
translations.rowsPerPage,
|
|
1947
1932
|
":"
|
|
1948
1933
|
] }),
|
|
@@ -1952,19 +1937,19 @@ function Pagination({
|
|
|
1952
1937
|
id: "page-size",
|
|
1953
1938
|
value: pageSize,
|
|
1954
1939
|
onChange: handlePageSizeChange,
|
|
1955
|
-
className: "px-2 py-1 text-sm rounded
|
|
1940
|
+
className: "px-2 py-1 text-sm rounded",
|
|
1956
1941
|
children: pageSizeOptions.map((size) => /* @__PURE__ */ jsx7("option", { value: size, children: size }, size))
|
|
1957
1942
|
}
|
|
1958
1943
|
)
|
|
1959
1944
|
] })
|
|
1960
1945
|
] }),
|
|
1961
|
-
/* @__PURE__ */ jsxs5("div", { className: "grid-pagination-controls
|
|
1946
|
+
/* @__PURE__ */ jsxs5("div", { className: "grid-pagination-controls", children: [
|
|
1962
1947
|
showFirstLast && /* @__PURE__ */ jsx7(
|
|
1963
1948
|
"button",
|
|
1964
1949
|
{
|
|
1965
1950
|
onClick: handleFirstPage,
|
|
1966
1951
|
disabled: !canGoPrevious,
|
|
1967
|
-
className: "p-2 rounded
|
|
1952
|
+
className: "p-2 rounded text-theme-secondary",
|
|
1968
1953
|
"aria-label": translations.first,
|
|
1969
1954
|
children: "<<"
|
|
1970
1955
|
}
|
|
@@ -1974,17 +1959,17 @@ function Pagination({
|
|
|
1974
1959
|
{
|
|
1975
1960
|
onClick: handlePreviousPage,
|
|
1976
1961
|
disabled: !canGoPrevious,
|
|
1977
|
-
className: "p-2 rounded
|
|
1962
|
+
className: "p-2 rounded text-theme-secondary",
|
|
1978
1963
|
"aria-label": translations.previous,
|
|
1979
1964
|
children: "<"
|
|
1980
1965
|
}
|
|
1981
1966
|
),
|
|
1982
|
-
showPageNumbers && /* @__PURE__ */ jsx7("div", { className: "grid-pagination-pages
|
|
1967
|
+
showPageNumbers && /* @__PURE__ */ jsx7("div", { className: "grid-pagination-pages", children: pageNumbers.map(
|
|
1983
1968
|
(pageNum, index) => pageNum === "ellipsis" ? /* @__PURE__ */ jsx7("span", { className: "px-2 text-theme-muted", children: "..." }, `ellipsis-${index}`) : /* @__PURE__ */ jsx7(
|
|
1984
1969
|
"button",
|
|
1985
1970
|
{
|
|
1986
1971
|
onClick: () => onPageChange(pageNum),
|
|
1987
|
-
className: `min-w-[32px] h-8 px-2 rounded text-sm
|
|
1972
|
+
className: `min-w-[32px] h-8 px-2 rounded text-sm ${pageNum === page ? "active" : ""}`,
|
|
1988
1973
|
"aria-current": pageNum === page ? "page" : void 0,
|
|
1989
1974
|
children: pageNum
|
|
1990
1975
|
},
|
|
@@ -1996,7 +1981,7 @@ function Pagination({
|
|
|
1996
1981
|
{
|
|
1997
1982
|
onClick: handleNextPage,
|
|
1998
1983
|
disabled: !canGoNext,
|
|
1999
|
-
className: "p-2 rounded
|
|
1984
|
+
className: "p-2 rounded text-theme-secondary",
|
|
2000
1985
|
"aria-label": translations.next,
|
|
2001
1986
|
children: ">"
|
|
2002
1987
|
}
|
|
@@ -2006,7 +1991,7 @@ function Pagination({
|
|
|
2006
1991
|
{
|
|
2007
1992
|
onClick: handleLastPage,
|
|
2008
1993
|
disabled: !canGoNext,
|
|
2009
|
-
className: "p-2 rounded
|
|
1994
|
+
className: "p-2 rounded text-theme-secondary",
|
|
2010
1995
|
"aria-label": translations.last,
|
|
2011
1996
|
children: ">>"
|
|
2012
1997
|
}
|
|
@@ -2029,7 +2014,7 @@ function SkeletonCell({ width = DEFAULT_COLUMN_WIDTH, height = 16, animate = tru
|
|
|
2029
2014
|
children: /* @__PURE__ */ jsx8(
|
|
2030
2015
|
"div",
|
|
2031
2016
|
{
|
|
2032
|
-
className: `rounded
|
|
2017
|
+
className: `rounded ${animate ? "animate-pulse" : ""}`,
|
|
2033
2018
|
style: { height: `${height}px`, width: "80%" }
|
|
2034
2019
|
}
|
|
2035
2020
|
)
|
|
@@ -2037,7 +2022,7 @@ function SkeletonCell({ width = DEFAULT_COLUMN_WIDTH, height = 16, animate = tru
|
|
|
2037
2022
|
);
|
|
2038
2023
|
}
|
|
2039
2024
|
function SkeletonRow({ columns, columnWidths, height = 16, animate = true }) {
|
|
2040
|
-
return /* @__PURE__ */ jsx8("div", { className: "grid-skeleton-row
|
|
2025
|
+
return /* @__PURE__ */ jsx8("div", { className: "grid-skeleton-row", children: Array.from({ length: columns }).map((_, index) => {
|
|
2041
2026
|
var _a;
|
|
2042
2027
|
return /* @__PURE__ */ jsx8(
|
|
2043
2028
|
SkeletonCell,
|
|
@@ -2061,7 +2046,7 @@ function Skeleton({
|
|
|
2061
2046
|
animate = true
|
|
2062
2047
|
}) {
|
|
2063
2048
|
return /* @__PURE__ */ jsxs6("div", { className: `grid-skeleton ${className}`, style, role: "status", "aria-label": "Loading", children: [
|
|
2064
|
-
showHeader && /* @__PURE__ */ jsx8("div", { className: "grid-skeleton-header
|
|
2049
|
+
showHeader && /* @__PURE__ */ jsx8("div", { className: "grid-skeleton-header", children: Array.from({ length: columns }).map((_, index) => {
|
|
2065
2050
|
var _a;
|
|
2066
2051
|
return /* @__PURE__ */ jsx8(
|
|
2067
2052
|
"div",
|
|
@@ -2071,7 +2056,7 @@ function Skeleton({
|
|
|
2071
2056
|
children: /* @__PURE__ */ jsx8(
|
|
2072
2057
|
"div",
|
|
2073
2058
|
{
|
|
2074
|
-
className: `rounded
|
|
2059
|
+
className: `rounded ${animate ? "animate-pulse" : ""}`,
|
|
2075
2060
|
style: { height: "12px", width: "60%" }
|
|
2076
2061
|
}
|
|
2077
2062
|
)
|
|
@@ -2109,15 +2094,15 @@ function EmptyState({
|
|
|
2109
2094
|
return /* @__PURE__ */ jsxs7(
|
|
2110
2095
|
"div",
|
|
2111
2096
|
{
|
|
2112
|
-
className: `grid-empty-state
|
|
2097
|
+
className: `grid-empty-state ${className}`,
|
|
2113
2098
|
style,
|
|
2114
2099
|
role: "status",
|
|
2115
2100
|
children: [
|
|
2116
|
-
icon && /* @__PURE__ */ jsx9("div", { className: "grid-empty-icon
|
|
2117
|
-
!icon && /* @__PURE__ */ jsx9("div", { className: "grid-empty-icon
|
|
2101
|
+
icon && /* @__PURE__ */ jsx9("div", { className: "grid-empty-icon", children: icon }),
|
|
2102
|
+
!icon && /* @__PURE__ */ jsx9("div", { className: "grid-empty-icon", children: /* @__PURE__ */ jsx9(
|
|
2118
2103
|
"svg",
|
|
2119
2104
|
{
|
|
2120
|
-
className: "
|
|
2105
|
+
className: "icon-lg",
|
|
2121
2106
|
fill: "none",
|
|
2122
2107
|
viewBox: "0 0 24 24",
|
|
2123
2108
|
stroke: "currentColor",
|
|
@@ -2132,8 +2117,8 @@ function EmptyState({
|
|
|
2132
2117
|
)
|
|
2133
2118
|
}
|
|
2134
2119
|
) }),
|
|
2135
|
-
/* @__PURE__ */ jsx9("h3", { className: "grid-empty-title
|
|
2136
|
-
displayDescription && /* @__PURE__ */ jsx9("p", { className: "grid-empty-description
|
|
2120
|
+
/* @__PURE__ */ jsx9("h3", { className: "grid-empty-title", children: displayTitle }),
|
|
2121
|
+
displayDescription && /* @__PURE__ */ jsx9("p", { className: "grid-empty-description", children: displayDescription }),
|
|
2137
2122
|
action && /* @__PURE__ */ jsx9("div", { className: "grid-empty-action", children: action })
|
|
2138
2123
|
]
|
|
2139
2124
|
}
|
|
@@ -2144,13 +2129,13 @@ function EmptyState({
|
|
|
2144
2129
|
import { useEffect as useEffect4, useCallback as useCallback12 } from "react";
|
|
2145
2130
|
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2146
2131
|
function DrawerHeader({ title, onClose }) {
|
|
2147
|
-
return /* @__PURE__ */ jsxs8("div", { className: "drawer-header
|
|
2148
|
-
/* @__PURE__ */ jsx10("h3", {
|
|
2132
|
+
return /* @__PURE__ */ jsxs8("div", { className: "drawer-header", children: [
|
|
2133
|
+
/* @__PURE__ */ jsx10("h3", { children: title }),
|
|
2149
2134
|
/* @__PURE__ */ jsx10(
|
|
2150
2135
|
"button",
|
|
2151
2136
|
{
|
|
2152
2137
|
onClick: onClose,
|
|
2153
|
-
className: "p-2 rounded
|
|
2138
|
+
className: "p-2 rounded",
|
|
2154
2139
|
"aria-label": "Close",
|
|
2155
2140
|
children: "X"
|
|
2156
2141
|
}
|
|
@@ -2163,8 +2148,8 @@ function FilterContent() {
|
|
|
2163
2148
|
const handleClearAll = useCallback12(() => {
|
|
2164
2149
|
actions.clearFilters();
|
|
2165
2150
|
}, [actions]);
|
|
2166
|
-
return /* @__PURE__ */ jsxs8("div", { className: "drawer-filter-content
|
|
2167
|
-
/* @__PURE__ */ jsxs8("div", {
|
|
2151
|
+
return /* @__PURE__ */ jsxs8("div", { className: "drawer-filter-content", children: [
|
|
2152
|
+
/* @__PURE__ */ jsxs8("div", { children: [
|
|
2168
2153
|
/* @__PURE__ */ jsxs8("span", { className: "text-sm text-theme-muted", children: [
|
|
2169
2154
|
filters.length,
|
|
2170
2155
|
" ",
|
|
@@ -2175,7 +2160,7 @@ function FilterContent() {
|
|
|
2175
2160
|
"button",
|
|
2176
2161
|
{
|
|
2177
2162
|
onClick: handleClearAll,
|
|
2178
|
-
className: "text-sm
|
|
2163
|
+
className: "text-sm",
|
|
2179
2164
|
children: translations.clearAll
|
|
2180
2165
|
}
|
|
2181
2166
|
)
|
|
@@ -2199,7 +2184,7 @@ function FilterContent() {
|
|
|
2199
2184
|
}
|
|
2200
2185
|
},
|
|
2201
2186
|
placeholder: `${translations.filter} ${headerText}...`,
|
|
2202
|
-
className: "w-full px-3 py-2 text-sm rounded
|
|
2187
|
+
className: "w-full px-3 py-2 text-sm rounded"
|
|
2203
2188
|
}
|
|
2204
2189
|
)
|
|
2205
2190
|
] }, col.id);
|
|
@@ -2212,8 +2197,8 @@ function SortContent() {
|
|
|
2212
2197
|
const handleClearAll = useCallback12(() => {
|
|
2213
2198
|
actions.clearSorting();
|
|
2214
2199
|
}, [actions]);
|
|
2215
|
-
return /* @__PURE__ */ jsxs8("div", { className: "drawer-sort-content
|
|
2216
|
-
/* @__PURE__ */ jsxs8("div", {
|
|
2200
|
+
return /* @__PURE__ */ jsxs8("div", { className: "drawer-sort-content", children: [
|
|
2201
|
+
/* @__PURE__ */ jsxs8("div", { children: [
|
|
2217
2202
|
/* @__PURE__ */ jsxs8("span", { className: "text-sm text-theme-muted", children: [
|
|
2218
2203
|
sorting.length,
|
|
2219
2204
|
" ",
|
|
@@ -2224,7 +2209,7 @@ function SortContent() {
|
|
|
2224
2209
|
"button",
|
|
2225
2210
|
{
|
|
2226
2211
|
onClick: handleClearAll,
|
|
2227
|
-
className: "text-sm
|
|
2212
|
+
className: "text-sm",
|
|
2228
2213
|
children: translations.clearAll
|
|
2229
2214
|
}
|
|
2230
2215
|
)
|
|
@@ -2236,7 +2221,7 @@ function SortContent() {
|
|
|
2236
2221
|
"button",
|
|
2237
2222
|
{
|
|
2238
2223
|
onClick: () => actions.toggleSorting(col.id),
|
|
2239
|
-
className: `w-full
|
|
2224
|
+
className: `w-full px-3 py-2 rounded ${sortItem ? "active" : ""}`,
|
|
2240
2225
|
children: [
|
|
2241
2226
|
/* @__PURE__ */ jsx10("span", { className: "text-sm text-theme-primary", children: headerText }),
|
|
2242
2227
|
/* @__PURE__ */ jsx10("span", { className: "text-xs text-theme-muted", children: (sortItem == null ? void 0 : sortItem.direction) === "asc" ? translations.sortAsc : (sortItem == null ? void 0 : sortItem.direction) === "desc" ? translations.sortDesc : "-" })
|
|
@@ -2250,14 +2235,14 @@ function SortContent() {
|
|
|
2250
2235
|
function ColumnsContent() {
|
|
2251
2236
|
const { state, actions } = useTableContext();
|
|
2252
2237
|
const { translations, columns, columnStates } = state;
|
|
2253
|
-
return /* @__PURE__ */ jsxs8("div", { className: "drawer-columns-content
|
|
2254
|
-
/* @__PURE__ */ jsxs8("div", {
|
|
2238
|
+
return /* @__PURE__ */ jsxs8("div", { className: "drawer-columns-content", children: [
|
|
2239
|
+
/* @__PURE__ */ jsxs8("div", { children: [
|
|
2255
2240
|
/* @__PURE__ */ jsx10("span", { className: "text-sm text-theme-muted", children: translations.showColumns }),
|
|
2256
2241
|
/* @__PURE__ */ jsx10(
|
|
2257
2242
|
"button",
|
|
2258
2243
|
{
|
|
2259
2244
|
onClick: actions.resetColumns,
|
|
2260
|
-
className: "text-sm
|
|
2245
|
+
className: "text-sm",
|
|
2261
2246
|
children: translations.resetColumns
|
|
2262
2247
|
}
|
|
2263
2248
|
)
|
|
@@ -2269,7 +2254,7 @@ function ColumnsContent() {
|
|
|
2269
2254
|
return /* @__PURE__ */ jsxs8(
|
|
2270
2255
|
"label",
|
|
2271
2256
|
{
|
|
2272
|
-
className: "
|
|
2257
|
+
className: "px-3 py-2 rounded cursor-pointer",
|
|
2273
2258
|
children: [
|
|
2274
2259
|
/* @__PURE__ */ jsx10(
|
|
2275
2260
|
"input",
|
|
@@ -2277,7 +2262,7 @@ function ColumnsContent() {
|
|
|
2277
2262
|
type: "checkbox",
|
|
2278
2263
|
checked: isVisible,
|
|
2279
2264
|
onChange: () => actions.toggleColumnVisibility(col.id),
|
|
2280
|
-
className: "w-4 h-4 rounded
|
|
2265
|
+
className: "w-4 h-4 rounded"
|
|
2281
2266
|
}
|
|
2282
2267
|
),
|
|
2283
2268
|
/* @__PURE__ */ jsx10("span", { className: "text-sm text-theme-primary", children: headerText })
|
|
@@ -2322,11 +2307,11 @@ function MobileDrawer({
|
|
|
2322
2307
|
if (!isOpen || !content) {
|
|
2323
2308
|
return null;
|
|
2324
2309
|
}
|
|
2325
|
-
return /* @__PURE__ */ jsxs8("div", { className: `mobile-drawer-container
|
|
2310
|
+
return /* @__PURE__ */ jsxs8("div", { className: `mobile-drawer-container ${className}`, style, children: [
|
|
2326
2311
|
/* @__PURE__ */ jsx10(
|
|
2327
2312
|
"div",
|
|
2328
2313
|
{
|
|
2329
|
-
className: "mobile-drawer-overlay
|
|
2314
|
+
className: "mobile-drawer-overlay",
|
|
2330
2315
|
style: {
|
|
2331
2316
|
opacity: DRAWER_OVERLAY_OPACITY,
|
|
2332
2317
|
transitionDuration: `${DRAWER_ANIMATION_DURATION}ms`
|
|
@@ -2338,7 +2323,7 @@ function MobileDrawer({
|
|
|
2338
2323
|
/* @__PURE__ */ jsxs8(
|
|
2339
2324
|
"div",
|
|
2340
2325
|
{
|
|
2341
|
-
className: "mobile-drawer
|
|
2326
|
+
className: "mobile-drawer",
|
|
2342
2327
|
style: {
|
|
2343
2328
|
transitionDuration: `${DRAWER_ANIMATION_DURATION}ms`
|
|
2344
2329
|
},
|
|
@@ -2347,7 +2332,7 @@ function MobileDrawer({
|
|
|
2347
2332
|
"aria-labelledby": "drawer-title",
|
|
2348
2333
|
children: [
|
|
2349
2334
|
/* @__PURE__ */ jsx10(DrawerHeader, { title: DRAWER_TITLES[content], onClose }),
|
|
2350
|
-
/* @__PURE__ */ jsxs8("div", { className: "drawer-content
|
|
2335
|
+
/* @__PURE__ */ jsxs8("div", { className: "drawer-content", children: [
|
|
2351
2336
|
content === "filter" && /* @__PURE__ */ jsx10(FilterContent, {}),
|
|
2352
2337
|
content === "sort" && /* @__PURE__ */ jsx10(SortContent, {}),
|
|
2353
2338
|
content === "columns" && /* @__PURE__ */ jsx10(ColumnsContent, {})
|
|
@@ -2469,7 +2454,7 @@ function GridTableContent({
|
|
|
2469
2454
|
"button",
|
|
2470
2455
|
{
|
|
2471
2456
|
onClick: onRetry,
|
|
2472
|
-
className: "px-4 py-2 bg-accent-primary text-white rounded hover:
|
|
2457
|
+
className: "px-4 py-2 bg-accent-primary text-white rounded hover:opacity-90 cursor-pointer",
|
|
2473
2458
|
children: state.translations.retry
|
|
2474
2459
|
}
|
|
2475
2460
|
)
|
|
@@ -2497,17 +2482,17 @@ function GridTableContent({
|
|
|
2497
2482
|
return /* @__PURE__ */ jsxs9(
|
|
2498
2483
|
"div",
|
|
2499
2484
|
{
|
|
2500
|
-
className: `grid-table
|
|
2485
|
+
className: `grid-table rounded-lg border overflow-hidden ${classNames.root || ""} ${className}`,
|
|
2501
2486
|
style: containerStyle,
|
|
2502
2487
|
role: "table",
|
|
2503
2488
|
children: [
|
|
2504
2489
|
renderHeader && /* @__PURE__ */ jsx11("div", { className: "grid-table-custom-header", children: renderHeader() }),
|
|
2505
|
-
showGlobalFilter && /* @__PURE__ */ jsxs9("div", { className: "grid-table-toolbar
|
|
2506
|
-
/* @__PURE__ */ jsxs9("div", { className: "
|
|
2490
|
+
showGlobalFilter && /* @__PURE__ */ jsxs9("div", { className: "grid-table-toolbar", children: [
|
|
2491
|
+
/* @__PURE__ */ jsxs9("div", { className: "toolbar-search-wrapper", children: [
|
|
2507
2492
|
/* @__PURE__ */ jsx11(
|
|
2508
2493
|
"svg",
|
|
2509
2494
|
{
|
|
2510
|
-
className: "
|
|
2495
|
+
className: "search-icon",
|
|
2511
2496
|
fill: "none",
|
|
2512
2497
|
viewBox: "0 0 24 24",
|
|
2513
2498
|
stroke: "currentColor",
|
|
@@ -2522,16 +2507,16 @@ function GridTableContent({
|
|
|
2522
2507
|
value: state.globalFilter,
|
|
2523
2508
|
onChange: (e) => actions.setGlobalFilter(e.target.value),
|
|
2524
2509
|
placeholder: state.translations.search,
|
|
2525
|
-
className: "w-full pl-10 pr-3 py-2 text-sm rounded
|
|
2510
|
+
className: "w-full pl-10 pr-3 py-2 text-sm rounded"
|
|
2526
2511
|
}
|
|
2527
2512
|
),
|
|
2528
2513
|
state.globalFilter && /* @__PURE__ */ jsx11(
|
|
2529
2514
|
"button",
|
|
2530
2515
|
{
|
|
2531
2516
|
onClick: () => actions.setGlobalFilter(""),
|
|
2532
|
-
className: "
|
|
2517
|
+
className: "clear-button",
|
|
2533
2518
|
"aria-label": "Clear search",
|
|
2534
|
-
children: /* @__PURE__ */ jsx11("svg", { className: "
|
|
2519
|
+
children: /* @__PURE__ */ jsx11("svg", { className: "icon-md", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ jsx11("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) })
|
|
2535
2520
|
}
|
|
2536
2521
|
)
|
|
2537
2522
|
] }),
|
|
@@ -2539,9 +2524,9 @@ function GridTableContent({
|
|
|
2539
2524
|
"button",
|
|
2540
2525
|
{
|
|
2541
2526
|
onClick: () => actions.clearFilters(),
|
|
2542
|
-
className: "
|
|
2527
|
+
className: "filter-badge",
|
|
2543
2528
|
children: [
|
|
2544
|
-
/* @__PURE__ */ jsx11("svg", { className: "
|
|
2529
|
+
/* @__PURE__ */ jsx11("svg", { className: "icon-md", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ jsx11("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) }),
|
|
2545
2530
|
/* @__PURE__ */ jsxs9("span", { children: [
|
|
2546
2531
|
state.filters.length,
|
|
2547
2532
|
" filter",
|
|
@@ -2550,32 +2535,32 @@ function GridTableContent({
|
|
|
2550
2535
|
]
|
|
2551
2536
|
}
|
|
2552
2537
|
),
|
|
2553
|
-
shouldShowMobileView && /* @__PURE__ */ jsxs9("div", { className: "
|
|
2538
|
+
shouldShowMobileView && /* @__PURE__ */ jsxs9("div", { className: "toolbar-actions", children: [
|
|
2554
2539
|
/* @__PURE__ */ jsx11(
|
|
2555
2540
|
"button",
|
|
2556
2541
|
{
|
|
2557
2542
|
onClick: () => actions.openMobileDrawer("filter"),
|
|
2558
|
-
className: "
|
|
2543
|
+
className: "toolbar-action-button",
|
|
2559
2544
|
"aria-label": state.translations.filter,
|
|
2560
|
-
children: /* @__PURE__ */ jsx11("svg", { className: "
|
|
2545
|
+
children: /* @__PURE__ */ jsx11("svg", { className: "icon-md", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ jsx11("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z" }) })
|
|
2561
2546
|
}
|
|
2562
2547
|
),
|
|
2563
2548
|
/* @__PURE__ */ jsx11(
|
|
2564
2549
|
"button",
|
|
2565
2550
|
{
|
|
2566
2551
|
onClick: () => actions.openMobileDrawer("sort"),
|
|
2567
|
-
className: "
|
|
2552
|
+
className: "toolbar-action-button",
|
|
2568
2553
|
"aria-label": state.translations.sort,
|
|
2569
|
-
children: /* @__PURE__ */ jsx11("svg", { className: "
|
|
2554
|
+
children: /* @__PURE__ */ jsx11("svg", { className: "icon-md", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ jsx11("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4" }) })
|
|
2570
2555
|
}
|
|
2571
2556
|
),
|
|
2572
2557
|
/* @__PURE__ */ jsx11(
|
|
2573
2558
|
"button",
|
|
2574
2559
|
{
|
|
2575
2560
|
onClick: () => actions.openMobileDrawer("columns"),
|
|
2576
|
-
className: "
|
|
2561
|
+
className: "toolbar-action-button",
|
|
2577
2562
|
"aria-label": state.translations.columns,
|
|
2578
|
-
children: /* @__PURE__ */ jsx11("svg", { className: "
|
|
2563
|
+
children: /* @__PURE__ */ jsx11("svg", { className: "icon-md", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ jsx11("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 17V7m0 10a2 2 0 01-2 2H5a2 2 0 01-2-2V7a2 2 0 012-2h2a2 2 0 012 2m0 10a2 2 0 002 2h2a2 2 0 002-2M9 7a2 2 0 012-2h2a2 2 0 012 2m0 10V7m0 10a2 2 0 002 2h2a2 2 0 002-2V7a2 2 0 00-2-2h-2a2 2 0 00-2 2" }) })
|
|
2579
2564
|
}
|
|
2580
2565
|
)
|
|
2581
2566
|
] })
|