@facter/ds-core 1.7.3 → 1.7.4

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/index.d.mts CHANGED
@@ -619,6 +619,7 @@ declare function useDataTableDensity(): DensityContextValue;
619
619
  /**
620
620
  * Hook para paginação
621
621
  * Retorna informações de paginação memoizadas
622
+ * Re-renderiza quando pageIndex ou pageSize muda (via contexto)
622
623
  */
623
624
  declare function useDataTablePagination(): {
624
625
  pageIndex: number;
package/dist/index.d.ts CHANGED
@@ -619,6 +619,7 @@ declare function useDataTableDensity(): DensityContextValue;
619
619
  /**
620
620
  * Hook para paginação
621
621
  * Retorna informações de paginação memoizadas
622
+ * Re-renderiza quando pageIndex ou pageSize muda (via contexto)
622
623
  */
623
624
  declare function useDataTablePagination(): {
624
625
  pageIndex: number;
package/dist/index.js CHANGED
@@ -1199,7 +1199,9 @@ function useDataTableInternal({
1199
1199
  table,
1200
1200
  meta,
1201
1201
  density,
1202
- setDensity
1202
+ setDensity,
1203
+ pageIndex: pagination.pageIndex,
1204
+ pageSize: pagination.pageSize
1203
1205
  };
1204
1206
  }
1205
1207
  var DataTableInstanceContext = React49__namespace.createContext(null);
@@ -1208,12 +1210,16 @@ var DataTableMetaContext = React49__namespace.createContext(null);
1208
1210
  DataTableMetaContext.displayName = "DataTableMetaContext";
1209
1211
  var DataTableDensityContext = React49__namespace.createContext(null);
1210
1212
  DataTableDensityContext.displayName = "DataTableDensityContext";
1213
+ var DataTablePaginationContext = React49__namespace.createContext(null);
1214
+ DataTablePaginationContext.displayName = "DataTablePaginationContext";
1211
1215
  function DataTableProvider({
1212
1216
  children,
1213
1217
  table,
1214
1218
  meta,
1215
1219
  density,
1216
- setDensity
1220
+ setDensity,
1221
+ pageIndex,
1222
+ pageSize
1217
1223
  }) {
1218
1224
  const metaValue = React49__namespace.useMemo(
1219
1225
  () => meta,
@@ -1223,8 +1229,12 @@ function DataTableProvider({
1223
1229
  () => ({ density, setDensity }),
1224
1230
  [density, setDensity]
1225
1231
  );
1232
+ const paginationValue = React49__namespace.useMemo(
1233
+ () => ({ pageIndex, pageSize }),
1234
+ [pageIndex, pageSize]
1235
+ );
1226
1236
  const tableValue = table;
1227
- return /* @__PURE__ */ jsxRuntime.jsx(DataTableInstanceContext.Provider, { value: tableValue, children: /* @__PURE__ */ jsxRuntime.jsx(DataTableMetaContext.Provider, { value: metaValue, children: /* @__PURE__ */ jsxRuntime.jsx(DataTableDensityContext.Provider, { value: densityValue, children }) }) });
1237
+ return /* @__PURE__ */ jsxRuntime.jsx(DataTableInstanceContext.Provider, { value: tableValue, children: /* @__PURE__ */ jsxRuntime.jsx(DataTableMetaContext.Provider, { value: metaValue, children: /* @__PURE__ */ jsxRuntime.jsx(DataTableDensityContext.Provider, { value: densityValue, children: /* @__PURE__ */ jsxRuntime.jsx(DataTablePaginationContext.Provider, { value: paginationValue, children }) }) }) });
1228
1238
  }
1229
1239
  function useDataTable() {
1230
1240
  const context = React49__namespace.useContext(DataTableInstanceContext);
@@ -1267,9 +1277,18 @@ function useDataTableDensity() {
1267
1277
  }
1268
1278
  return context;
1269
1279
  }
1280
+ function useDataTablePaginationContext() {
1281
+ const context = React49__namespace.useContext(DataTablePaginationContext);
1282
+ if (!context) {
1283
+ throw new Error(
1284
+ "useDataTablePagination must be used within <DataTable>. Make sure your component is wrapped with DataTable."
1285
+ );
1286
+ }
1287
+ return context;
1288
+ }
1270
1289
  function useDataTablePagination() {
1271
1290
  const table = useDataTable();
1272
- const { pageIndex, pageSize } = table.getState().pagination;
1291
+ const { pageIndex, pageSize } = useDataTablePaginationContext();
1273
1292
  return React49__namespace.useMemo(() => {
1274
1293
  const pageCount = table.getPageCount();
1275
1294
  return {
@@ -1324,7 +1343,7 @@ function DataTableRoot({
1324
1343
  pageCount,
1325
1344
  className
1326
1345
  }) {
1327
- const { table, meta, density, setDensity } = useDataTableInternal({
1346
+ const { table, meta, density, setDensity, pageIndex, pageSize } = useDataTableInternal({
1328
1347
  data,
1329
1348
  columns,
1330
1349
  getRowId,
@@ -1338,6 +1357,8 @@ function DataTableRoot({
1338
1357
  meta,
1339
1358
  density,
1340
1359
  setDensity,
1360
+ pageIndex,
1361
+ pageSize,
1341
1362
  children: /* @__PURE__ */ jsxRuntime.jsx(
1342
1363
  "div",
1343
1364
  {