@marimo-team/islands 0.20.5-dev4 → 0.20.5-dev5

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/main.js CHANGED
@@ -59258,6 +59258,7 @@ Defaulting to \`null\`.`;
59258
59258
  description: "message" in e ? e.message : String(e)
59259
59259
  }), e;
59260
59260
  }
59261
+ var MAX_PAGES_BEFORE_CLAMPING = 100;
59261
59262
  const DataTablePagination = ({ table: e, selection: r, onSelectAllRowsChange: c, totalColumns: d, tableLoading: f, showPageSizeSelector: _ }) => {
59262
59263
  let { locale: v } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7(), y = () => {
59263
59264
  let { rowSelection: f2, cellSelection: _2 } = e.getState(), y2 = Object.keys(f2).length, S2 = e.getIsAllPageRowsSelected(), w2 = e.getRowCount(), E2 = y2 === w2, O2 = r === "single-cell" || r === "multi-cell";
@@ -59514,29 +59515,33 @@ Defaulting to \`null\`.`;
59514
59515
  children: r2.page
59515
59516
  }, r2.page))
59516
59517
  }),
59517
- (0, import_jsx_runtime.jsx)(DropdownMenuSeparator, {}),
59518
- (0, import_jsx_runtime.jsxs)("div", {
59519
- className: "px-2 pt-0.5 shrink-0",
59520
- onKeyDown: (e2) => e2.stopPropagation(),
59518
+ r > MAX_PAGES_BEFORE_CLAMPING && (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
59521
59519
  children: [
59522
- (0, import_jsx_runtime.jsx)("label", {
59523
- htmlFor: y,
59524
- className: "text-xs text-muted-foreground block mb-1",
59525
- children: "Jump to page"
59526
- }),
59527
- (0, import_jsx_runtime.jsx)(Input, {
59528
- id: y,
59529
- type: "number",
59530
- min: 1,
59531
- max: r,
59532
- placeholder: `1-${r}`,
59533
- value: _,
59534
- onChange: (e2) => v(e2.target.value),
59535
- onKeyDown: (e2) => {
59536
- e2.key === "Enter" && w(), e2.stopPropagation();
59537
- },
59538
- className: "h-6 text-xs",
59539
- "data-testid": "page-jump-input"
59520
+ (0, import_jsx_runtime.jsx)(DropdownMenuSeparator, {}),
59521
+ (0, import_jsx_runtime.jsxs)("div", {
59522
+ className: "px-2 pt-0.5 shrink-0",
59523
+ onKeyDown: (e2) => e2.stopPropagation(),
59524
+ children: [
59525
+ (0, import_jsx_runtime.jsx)("label", {
59526
+ htmlFor: y,
59527
+ className: "text-xs text-muted-foreground block mb-1",
59528
+ children: "Jump to page"
59529
+ }),
59530
+ (0, import_jsx_runtime.jsx)(Input, {
59531
+ id: y,
59532
+ type: "number",
59533
+ min: 1,
59534
+ max: r,
59535
+ placeholder: `1-${r}`,
59536
+ value: _,
59537
+ onChange: (e2) => v(e2.target.value),
59538
+ onKeyDown: (e2) => {
59539
+ e2.key === "Enter" && w(), e2.stopPropagation();
59540
+ },
59541
+ className: "h-6 text-xs",
59542
+ "data-testid": "page-jump-input"
59543
+ })
59544
+ ]
59540
59545
  })
59541
59546
  ]
59542
59547
  })
@@ -59546,7 +59551,7 @@ Defaulting to \`null\`.`;
59546
59551
  });
59547
59552
  };
59548
59553
  function getPageRanges(e, r) {
59549
- if (r <= 100) return range_default(r).map((e2) => ({
59554
+ if (r <= MAX_PAGES_BEFORE_CLAMPING) return range_default(r).map((e2) => ({
59550
59555
  type: "page",
59551
59556
  page: e2 + 1
59552
59557
  }));
@@ -70397,7 +70402,7 @@ Image URL: ${r.imageUrl}`)), contextToXml({
70397
70402
  return Logger.warn("Failed to get version from mount config"), null;
70398
70403
  }
70399
70404
  }
70400
- const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.20.5-dev4"), showCodeInRunModeAtom = atom(true);
70405
+ const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.20.5-dev5"), showCodeInRunModeAtom = atom(true);
70401
70406
  atom(null);
70402
70407
  var import_compiler_runtime$88 = require_compiler_runtime();
70403
70408
  function useKeydownOnElement(e, r) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.20.5-dev4",
3
+ "version": "0.20.5-dev5",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -37,6 +37,8 @@ import {
37
37
  } from "../ui/select";
38
38
  import type { DataTableSelection, PageRange } from "./types";
39
39
 
40
+ const MAX_PAGES_BEFORE_CLAMPING = 100;
41
+
40
42
  interface DataTablePaginationProps<TData> {
41
43
  table: Table<TData>;
42
44
  selection?: DataTableSelection;
@@ -325,35 +327,39 @@ export const PageSelector = ({
325
327
  ),
326
328
  )}
327
329
  </div>
328
- <DropdownMenuSeparator />
329
- <div
330
- className="px-2 pt-0.5 shrink-0"
331
- onKeyDown={(e) => e.stopPropagation()}
332
- >
333
- <label
334
- htmlFor={jumpInputId}
335
- className="text-xs text-muted-foreground block mb-1"
336
- >
337
- Jump to page
338
- </label>
339
- <Input
340
- id={jumpInputId}
341
- type="number"
342
- min={1}
343
- max={totalPages}
344
- placeholder={`1-${totalPages}`}
345
- value={jumpValue}
346
- onChange={(e) => setJumpValue(e.target.value)}
347
- onKeyDown={(e) => {
348
- if (e.key === "Enter") {
349
- handleJump();
350
- }
351
- e.stopPropagation();
352
- }}
353
- className="h-6 text-xs"
354
- data-testid="page-jump-input"
355
- />
356
- </div>
330
+ {totalPages > MAX_PAGES_BEFORE_CLAMPING && (
331
+ <>
332
+ <DropdownMenuSeparator />
333
+ <div
334
+ className="px-2 pt-0.5 shrink-0"
335
+ onKeyDown={(e) => e.stopPropagation()}
336
+ >
337
+ <label
338
+ htmlFor={jumpInputId}
339
+ className="text-xs text-muted-foreground block mb-1"
340
+ >
341
+ Jump to page
342
+ </label>
343
+ <Input
344
+ id={jumpInputId}
345
+ type="number"
346
+ min={1}
347
+ max={totalPages}
348
+ placeholder={`1-${totalPages}`}
349
+ value={jumpValue}
350
+ onChange={(e) => setJumpValue(e.target.value)}
351
+ onKeyDown={(e) => {
352
+ if (e.key === "Enter") {
353
+ handleJump();
354
+ }
355
+ e.stopPropagation();
356
+ }}
357
+ className="h-6 text-xs"
358
+ data-testid="page-jump-input"
359
+ />
360
+ </div>
361
+ </>
362
+ )}
357
363
  </DropdownMenuContent>
358
364
  </DropdownMenu>
359
365
  );
@@ -363,7 +369,7 @@ export function getPageRanges(
363
369
  currentPage: number,
364
370
  totalPages: number,
365
371
  ): PageRange[] {
366
- if (totalPages <= 100) {
372
+ if (totalPages <= MAX_PAGES_BEFORE_CLAMPING) {
367
373
  return range(totalPages).map((i) => ({ type: "page", page: i + 1 }));
368
374
  }
369
375