@seedgrid/fe-components 2026.7.5 → 2026.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/i18n/en-US.d.ts.map +1 -1
- package/dist/i18n/en-US.js +8 -2
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +8 -2
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +8 -2
- package/dist/i18n/pt-BR.d.ts.map +1 -1
- package/dist/i18n/pt-BR.js +8 -2
- package/dist/i18n/pt-PT.d.ts.map +1 -1
- package/dist/i18n/pt-PT.js +8 -2
- package/dist/inputs/SgDatatable.d.ts.map +1 -1
- package/dist/inputs/SgDatatable.js +81 -16
- package/dist/sandbox.cjs +28 -28
- package/package.json +1 -1
package/dist/i18n/en-US.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en-US.d.ts","sourceRoot":"","sources":["../../src/i18n/en-US.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"en-US.d.ts","sourceRoot":"","sources":["../../src/i18n/en-US.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAsNhC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
package/dist/i18n/en-US.js
CHANGED
|
@@ -112,8 +112,14 @@ const enUS = {
|
|
|
112
112
|
"components.datatable.loading": "Loading data...",
|
|
113
113
|
"components.datatable.globalFilterPlaceholder": "Search in all columns",
|
|
114
114
|
"components.datatable.clearFilters": "Clear filters",
|
|
115
|
-
"components.datatable.
|
|
116
|
-
"components.datatable.
|
|
115
|
+
"components.datatable.pagination": "Pagination",
|
|
116
|
+
"components.datatable.first": "First page",
|
|
117
|
+
"components.datatable.prev": "Previous page",
|
|
118
|
+
"components.datatable.next": "Next page",
|
|
119
|
+
"components.datatable.last": "Last page",
|
|
120
|
+
"components.datatable.jumpBackward": "Jump back",
|
|
121
|
+
"components.datatable.jumpForward": "Jump forward",
|
|
122
|
+
"components.datatable.page": "Page {page}",
|
|
117
123
|
"components.datatable.rowsPerPage": "Rows per page",
|
|
118
124
|
"components.datatable.pageReport": "{first} - {last} of {total}",
|
|
119
125
|
"components.datatable.columnFilterPlaceholder": "Filter {column}",
|
package/dist/i18n/es.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"es.d.ts","sourceRoot":"","sources":["../../src/i18n/es.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"es.d.ts","sourceRoot":"","sources":["../../src/i18n/es.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAsN9B,CAAC;AAEF,eAAe,EAAE,CAAC"}
|
package/dist/i18n/es.js
CHANGED
|
@@ -112,8 +112,14 @@ const es = {
|
|
|
112
112
|
"components.datatable.loading": "Cargando datos...",
|
|
113
113
|
"components.datatable.globalFilterPlaceholder": "Buscar en todas las columnas",
|
|
114
114
|
"components.datatable.clearFilters": "Limpiar filtros",
|
|
115
|
-
"components.datatable.
|
|
116
|
-
"components.datatable.
|
|
115
|
+
"components.datatable.pagination": "Paginacion",
|
|
116
|
+
"components.datatable.first": "Primera pagina",
|
|
117
|
+
"components.datatable.prev": "Pagina anterior",
|
|
118
|
+
"components.datatable.next": "Pagina siguiente",
|
|
119
|
+
"components.datatable.last": "Ultima pagina",
|
|
120
|
+
"components.datatable.jumpBackward": "Retroceder varias paginas",
|
|
121
|
+
"components.datatable.jumpForward": "Avanzar varias paginas",
|
|
122
|
+
"components.datatable.page": "Pagina {page}",
|
|
117
123
|
"components.datatable.rowsPerPage": "Filas por pagina",
|
|
118
124
|
"components.datatable.pageReport": "{first} - {last} de {total}",
|
|
119
125
|
"components.datatable.columnFilterPlaceholder": "Filtrar {column}",
|
package/dist/i18n/fr.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fr.d.ts","sourceRoot":"","sources":["../../src/i18n/fr.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"fr.d.ts","sourceRoot":"","sources":["../../src/i18n/fr.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAsN9B,CAAC;AAEF,eAAe,EAAE,CAAC"}
|
package/dist/i18n/fr.js
CHANGED
|
@@ -112,8 +112,14 @@ const fr = {
|
|
|
112
112
|
"components.datatable.loading": "Chargement des donn?es...",
|
|
113
113
|
"components.datatable.globalFilterPlaceholder": "Rechercher dans toutes les colonnes",
|
|
114
114
|
"components.datatable.clearFilters": "Effacer les filtres",
|
|
115
|
-
"components.datatable.
|
|
116
|
-
"components.datatable.
|
|
115
|
+
"components.datatable.pagination": "Pagination",
|
|
116
|
+
"components.datatable.first": "Premiere page",
|
|
117
|
+
"components.datatable.prev": "Page precedente",
|
|
118
|
+
"components.datatable.next": "Page suivante",
|
|
119
|
+
"components.datatable.last": "Derniere page",
|
|
120
|
+
"components.datatable.jumpBackward": "Reculer de plusieurs pages",
|
|
121
|
+
"components.datatable.jumpForward": "Avancer de plusieurs pages",
|
|
122
|
+
"components.datatable.page": "Page {page}",
|
|
117
123
|
"components.datatable.rowsPerPage": "Lignes par page",
|
|
118
124
|
"components.datatable.pageReport": "{first} - {last} sur {total}",
|
|
119
125
|
"components.datatable.columnFilterPlaceholder": "Filtrer {column}",
|
package/dist/i18n/pt-BR.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pt-BR.d.ts","sourceRoot":"","sources":["../../src/i18n/pt-BR.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"pt-BR.d.ts","sourceRoot":"","sources":["../../src/i18n/pt-BR.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAsNhC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
package/dist/i18n/pt-BR.js
CHANGED
|
@@ -112,8 +112,14 @@ const ptBR = {
|
|
|
112
112
|
"components.datatable.loading": "Carregando dados...",
|
|
113
113
|
"components.datatable.globalFilterPlaceholder": "Buscar em todas as colunas",
|
|
114
114
|
"components.datatable.clearFilters": "Limpar filtros",
|
|
115
|
-
"components.datatable.
|
|
116
|
-
"components.datatable.
|
|
115
|
+
"components.datatable.pagination": "Paginacao",
|
|
116
|
+
"components.datatable.first": "Primeira pagina",
|
|
117
|
+
"components.datatable.prev": "Pagina anterior",
|
|
118
|
+
"components.datatable.next": "Proxima pagina",
|
|
119
|
+
"components.datatable.last": "Ultima pagina",
|
|
120
|
+
"components.datatable.jumpBackward": "Voltar varias paginas",
|
|
121
|
+
"components.datatable.jumpForward": "Avancar varias paginas",
|
|
122
|
+
"components.datatable.page": "Pagina {page}",
|
|
117
123
|
"components.datatable.rowsPerPage": "Linhas por pagina",
|
|
118
124
|
"components.datatable.pageReport": "{first} - {last} de {total}",
|
|
119
125
|
"components.datatable.columnFilterPlaceholder": "Filtrar {column}",
|
package/dist/i18n/pt-PT.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pt-PT.d.ts","sourceRoot":"","sources":["../../src/i18n/pt-PT.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"pt-PT.d.ts","sourceRoot":"","sources":["../../src/i18n/pt-PT.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAsNhC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
package/dist/i18n/pt-PT.js
CHANGED
|
@@ -112,8 +112,14 @@ const ptPT = {
|
|
|
112
112
|
"components.datatable.loading": "A carregar dados...",
|
|
113
113
|
"components.datatable.globalFilterPlaceholder": "Pesquisar em todas as colunas",
|
|
114
114
|
"components.datatable.clearFilters": "Limpar filtros",
|
|
115
|
-
"components.datatable.
|
|
116
|
-
"components.datatable.
|
|
115
|
+
"components.datatable.pagination": "Paginacao",
|
|
116
|
+
"components.datatable.first": "Primeira pagina",
|
|
117
|
+
"components.datatable.prev": "Pagina anterior",
|
|
118
|
+
"components.datatable.next": "Pagina seguinte",
|
|
119
|
+
"components.datatable.last": "Ultima pagina",
|
|
120
|
+
"components.datatable.jumpBackward": "Recuar varias paginas",
|
|
121
|
+
"components.datatable.jumpForward": "Avancar varias paginas",
|
|
122
|
+
"components.datatable.page": "Pagina {page}",
|
|
117
123
|
"components.datatable.rowsPerPage": "Linhas por pagina",
|
|
118
124
|
"components.datatable.pageReport": "{first} - {last} de {total}",
|
|
119
125
|
"components.datatable.columnFilterPlaceholder": "Filtrar {column}",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgDatatable.d.ts","sourceRoot":"","sources":["../../src/inputs/SgDatatable.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SgDatatable.d.ts","sourceRoot":"","sources":["../../src/inputs/SgDatatable.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGxE,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAErD,MAAM,MAAM,oBAAoB,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,C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jsxs } from "react/jsx-runtime";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { createPortal } from "react-dom";
|
|
5
|
-
import { Check, GripVertical, SlidersHorizontal } from "lucide-react";
|
|
5
|
+
import { Check, ChevronFirst, ChevronLast, ChevronLeft, ChevronRight, GripVertical, MoreHorizontal, SlidersHorizontal } from "lucide-react";
|
|
6
6
|
import { SgButton } from "../buttons/SgButton";
|
|
7
7
|
import { useHasSgEnvironmentProvider, useSgPersistence } from "../environment/SgEnvironmentProvider";
|
|
8
8
|
import { SgGroupBox } from "../layout/SgGroupBox";
|
|
@@ -87,23 +87,60 @@ function compareValues(a, b) {
|
|
|
87
87
|
function resolveMessage(translated, key, fallback) {
|
|
88
88
|
return translated === key ? fallback : translated;
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function pageRange(start, end) {
|
|
91
|
+
const tokens = [];
|
|
92
|
+
for (let page = start; page <= end; page += 1) {
|
|
93
|
+
tokens.push({ type: "page", page });
|
|
94
|
+
}
|
|
95
|
+
return tokens;
|
|
96
|
+
}
|
|
97
|
+
// Builds a paginator sequence with the first and last pages always anchored and
|
|
98
|
+
// clickable ellipsis tokens filling the gaps. `maxButtons` is the target number
|
|
99
|
+
// of numeric slots (responsive: e.g. 15/10/5); ellipsis clicks jump a whole
|
|
100
|
+
// window instead of a single page.
|
|
101
|
+
function buildPageTokens(currentPage, pageCount, maxButtons) {
|
|
91
102
|
if (pageCount <= 0)
|
|
92
103
|
return [];
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
104
|
+
const totalSlots = Math.max(5, maxButtons);
|
|
105
|
+
if (pageCount <= totalSlots)
|
|
106
|
+
return pageRange(1, pageCount);
|
|
107
|
+
const boundaryCount = 1;
|
|
108
|
+
const siblingCount = Math.max(1, Math.floor((totalSlots - 5) / 2));
|
|
109
|
+
const firstAnchor = boundaryCount; // page 1
|
|
110
|
+
const lastAnchor = pageCount - boundaryCount + 1; // last page
|
|
111
|
+
const siblingsStart = Math.max(Math.min(currentPage - siblingCount, pageCount - boundaryCount - siblingCount * 2 - 1), boundaryCount + 2);
|
|
112
|
+
const siblingsEnd = Math.min(Math.max(currentPage + siblingCount, boundaryCount + siblingCount * 2 + 2), lastAnchor - 2);
|
|
113
|
+
const tokens = pageRange(1, firstAnchor);
|
|
114
|
+
if (siblingsStart > boundaryCount + 2) {
|
|
115
|
+
tokens.push({
|
|
116
|
+
type: "ellipsis",
|
|
117
|
+
direction: "backward",
|
|
118
|
+
target: Math.max(firstAnchor + 1, siblingsStart - 1)
|
|
119
|
+
});
|
|
101
120
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
121
|
+
else if (boundaryCount + 1 < lastAnchor) {
|
|
122
|
+
tokens.push({ type: "page", page: boundaryCount + 1 });
|
|
123
|
+
}
|
|
124
|
+
tokens.push(...pageRange(siblingsStart, siblingsEnd));
|
|
125
|
+
if (siblingsEnd < lastAnchor - 2) {
|
|
126
|
+
tokens.push({
|
|
127
|
+
type: "ellipsis",
|
|
128
|
+
direction: "forward",
|
|
129
|
+
target: Math.min(lastAnchor - 1, siblingsEnd + 1)
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
else if (lastAnchor - 1 > firstAnchor) {
|
|
133
|
+
tokens.push({ type: "page", page: lastAnchor - 1 });
|
|
105
134
|
}
|
|
106
|
-
|
|
135
|
+
tokens.push(...pageRange(lastAnchor, pageCount));
|
|
136
|
+
return tokens;
|
|
137
|
+
}
|
|
138
|
+
function resolveMaxPageButtons(width) {
|
|
139
|
+
if (width >= 1024)
|
|
140
|
+
return 15;
|
|
141
|
+
if (width >= 640)
|
|
142
|
+
return 10;
|
|
143
|
+
return 5;
|
|
107
144
|
}
|
|
108
145
|
function getRowIdentity(rowData, dataKey) {
|
|
109
146
|
if (!dataKey)
|
|
@@ -415,7 +452,24 @@ function SgDatatableBase(props, imperativeRef) {
|
|
|
415
452
|
return sortedRows.slice(safeFirst, safeFirst + currentRows);
|
|
416
453
|
}, [paginator, lazy, sortedRows, safeFirst, currentRows]);
|
|
417
454
|
const currentPage = Math.floor(safeFirst / currentRows) + 1;
|
|
418
|
-
const
|
|
455
|
+
const paginatorRef = React.useRef(null);
|
|
456
|
+
const [maxPageButtons, setMaxPageButtons] = React.useState(5);
|
|
457
|
+
React.useEffect(() => {
|
|
458
|
+
if (!paginator)
|
|
459
|
+
return;
|
|
460
|
+
const element = paginatorRef.current;
|
|
461
|
+
if (!element || typeof ResizeObserver === "undefined")
|
|
462
|
+
return;
|
|
463
|
+
const observer = new ResizeObserver((entries) => {
|
|
464
|
+
for (const entry of entries) {
|
|
465
|
+
const next = resolveMaxPageButtons(entry.contentRect.width);
|
|
466
|
+
setMaxPageButtons((prev) => (prev === next ? prev : next));
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
observer.observe(element);
|
|
470
|
+
return () => observer.disconnect();
|
|
471
|
+
}, [paginator]);
|
|
472
|
+
const pageTokens = React.useMemo(() => buildPageTokens(currentPage, pageCount, maxPageButtons), [currentPage, pageCount, maxPageButtons]);
|
|
419
473
|
// `resolvedTotalRecords` and `onPage` change on every parent render (new fetch
|
|
420
474
|
// result / inline callback). Read them through refs so `commitPage` stays
|
|
421
475
|
// stable; otherwise the reconciliation effect below re-runs in a loop and
|
|
@@ -515,8 +569,12 @@ function SgDatatableBase(props, imperativeRef) {
|
|
|
515
569
|
const loadingLabel = t(i18n, "components.datatable.loading");
|
|
516
570
|
const globalFilterLabel = globalFilterPlaceholder ?? t(i18n, "components.datatable.globalFilterPlaceholder");
|
|
517
571
|
const clearFiltersLabel = t(i18n, "components.datatable.clearFilters");
|
|
572
|
+
const firstLabel = t(i18n, "components.datatable.first");
|
|
518
573
|
const prevLabel = t(i18n, "components.datatable.prev");
|
|
519
574
|
const nextLabel = t(i18n, "components.datatable.next");
|
|
575
|
+
const lastLabel = t(i18n, "components.datatable.last");
|
|
576
|
+
const jumpBackwardLabel = t(i18n, "components.datatable.jumpBackward");
|
|
577
|
+
const jumpForwardLabel = t(i18n, "components.datatable.jumpForward");
|
|
520
578
|
const rowsPerPageLabel = t(i18n, "components.datatable.rowsPerPage");
|
|
521
579
|
const pageReport = t(i18n, "components.datatable.pageReport", {
|
|
522
580
|
first: resolvedTotalRecords === 0 ? 0 : safeFirst + 1,
|
|
@@ -708,7 +766,14 @@ function SgDatatableBase(props, imperativeRef) {
|
|
|
708
766
|
})) }), hasFooter ? (_jsx("tfoot", { children: _jsx("tr", { className: "bg-[rgb(var(--sg-primary-50))]", children: visibleColumns.map((column, columnIndex) => {
|
|
709
767
|
const footerValue = typeof column.footer === "function" ? column.footer(sortedRows) : column.footer;
|
|
710
768
|
return (_jsx("td", { className: cn("px-3 py-2 font-semibold text-[rgb(var(--sg-text))]", resolveAlignmentClass(column.align), showGridlines ? "border-t border-r border-[rgb(var(--sg-border))] last:border-r-0" : "border-t border-[rgb(var(--sg-border))]", column.className), style: { width: toCssSize(column.width), minWidth: toCssSize(column.minWidth) }, children: footerValue ?? null }, `foot-${column.columnId ?? column.field ?? columnIndex}`));
|
|
711
|
-
}) }) })) : null] }) })] }), paginator ? (_jsxs("div", { className: "flex flex-wrap items-center gap-
|
|
769
|
+
}) }) })) : null] }) })] }), paginator ? (_jsxs("div", { ref: paginatorRef, className: "flex flex-wrap items-center gap-1.5", children: [_jsxs("nav", { "aria-label": t(i18n, "components.datatable.pagination"), className: "flex flex-wrap items-center gap-1.5", children: [_jsx(SgButton, { size: "sm", appearance: "outline", shape: "default", iconOnly: true, "aria-label": firstLabel, title: firstLabel, disabled: currentPage <= 1, onClick: () => goToPage(1), leftIcon: _jsx(ChevronFirst, { size: 16 }) }), _jsx(SgButton, { size: "sm", appearance: "outline", shape: "default", iconOnly: true, "aria-label": prevLabel, title: prevLabel, disabled: currentPage <= 1, onClick: () => goToPage(currentPage - 1), leftIcon: _jsx(ChevronLeft, { size: 16 }) }), pageTokens.map((token, tokenIndex) => {
|
|
770
|
+
if (token.type === "ellipsis") {
|
|
771
|
+
const ellipsisLabel = token.direction === "backward" ? jumpBackwardLabel : jumpForwardLabel;
|
|
772
|
+
return (_jsx(SgButton, { size: "sm", appearance: "ghost", shape: "default", iconOnly: true, "aria-label": ellipsisLabel, title: ellipsisLabel, onClick: () => goToPage(token.target), leftIcon: _jsx(MoreHorizontal, { size: 16 }) }, `ellipsis-${token.direction}-${tokenIndex}`));
|
|
773
|
+
}
|
|
774
|
+
const isCurrent = token.page === currentPage;
|
|
775
|
+
return (_jsx(SgButton, { size: "sm", appearance: isCurrent ? "solid" : "outline", "aria-label": t(i18n, "components.datatable.page", { page: token.page }), "aria-current": isCurrent ? "page" : undefined, onClick: () => goToPage(token.page), children: String(token.page) }, `page-${token.page}`));
|
|
776
|
+
}), _jsx(SgButton, { size: "sm", appearance: "outline", shape: "default", iconOnly: true, "aria-label": nextLabel, title: nextLabel, disabled: currentPage >= pageCount, onClick: () => goToPage(currentPage + 1), leftIcon: _jsx(ChevronRight, { size: 16 }) }), _jsx(SgButton, { size: "sm", appearance: "outline", shape: "default", iconOnly: true, "aria-label": lastLabel, title: lastLabel, disabled: currentPage >= pageCount, onClick: () => goToPage(pageCount), leftIcon: _jsx(ChevronLast, { size: 16 }) })] }), _jsx("span", { className: "min-w-[180px] text-xs text-[rgb(var(--sg-muted))] md:ml-auto", children: pageReport }), rowsPerPageOptions && rowsPerPageOptions.length > 0 ? (_jsxs("label", { className: "ml-auto inline-flex items-center gap-2 text-xs text-[rgb(var(--sg-muted))] md:ml-0", children: [_jsx("span", { children: rowsPerPageLabel }), _jsx("select", { value: currentRows, onChange: (event) => {
|
|
712
777
|
const nextRows = Number(event.target.value) || currentRows;
|
|
713
778
|
commitPage(0, nextRows);
|
|
714
779
|
}, className: "rounded-md border border-[rgb(var(--sg-border))] bg-[rgb(var(--sg-input-bg,var(--sg-surface)))] px-2 py-1 text-xs text-[rgb(var(--sg-input-fg,var(--sg-text)))]", children: rowsPerPageOptions.map((option) => (_jsx("option", { value: option, children: option }, option))) })] })) : null] })) : null] }) }) }));
|