@marimo-team/islands 0.22.5-dev13 → 0.22.5-dev15

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
@@ -28187,53 +28187,68 @@ Database schema: ${c}`), (_a4 = r2.aiFix) == null ? void 0 : _a4.setAiCompletion
28187
28187
  }
28188
28188
  }
28189
28189
  var TOP_K_ROWS = 30;
28190
- const DataTableColumnHeader = ({ column: e, header: r, justify: c, className: d, calculateTopKRows: f, table: h }) => {
28190
+ const DataTableColumnHeader = ({ column: e, header: r, subheader: c, className: d, calculateTopKRows: f, table: h }) => {
28191
28191
  let [_, v] = (0, import_react.useState)(false), { locale: y } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
28192
28192
  if (!r) return null;
28193
- if (!e.getCanSort() && !e.getCanFilter()) return (0, import_jsx_runtime.jsx)("div", {
28193
+ if (!e.getCanSort() && !e.getCanFilter()) return (0, import_jsx_runtime.jsxs)("div", {
28194
28194
  className: cn(d),
28195
- children: r
28195
+ children: [
28196
+ r,
28197
+ c
28198
+ ]
28196
28199
  });
28197
- let S = e.getFilterValue() !== void 0, w = !e.getIsSorted() && !S;
28200
+ let S = e.getFilterValue() !== void 0;
28198
28201
  return (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
28199
28202
  children: [
28200
- (0, import_jsx_runtime.jsxs)(DropdownMenu, {
28201
- modal: false,
28203
+ (0, import_jsx_runtime.jsxs)("div", {
28204
+ className: cn("group flex flex-col my-1 w-full select-none", d),
28202
28205
  children: [
28203
- (0, import_jsx_runtime.jsx)(DropdownMenuTrigger, {
28204
- asChild: true,
28205
- children: (0, import_jsx_runtime.jsxs)("div", {
28206
- className: cn("group flex items-center my-1 space-between w-full select-none gap-2 border hover:border-border border-transparent hover:bg-(--slate-3) data-[state=open]:bg-(--slate-3) data-[state=open]:border-border rounded px-1 -mx-1", c === "right" && "flex-row-reverse", d),
28207
- "data-testid": "data-table-sort-button",
28208
- children: [
28209
- (0, import_jsx_runtime.jsx)("span", {
28210
- className: "flex-1",
28211
- children: r
28212
- }),
28213
- (0, import_jsx_runtime.jsx)("span", {
28214
- className: cn("h-5 py-1 px-1", w && "invisible group-hover:visible data-[state=open]:visible"),
28215
- children: renderSortFilterIcon(e)
28216
- })
28217
- ]
28218
- })
28219
- }),
28220
- (0, import_jsx_runtime.jsxs)(DropdownMenuContent, {
28221
- align: "start",
28206
+ (0, import_jsx_runtime.jsxs)("div", {
28207
+ className: "flex items-center gap-1",
28222
28208
  children: [
28223
- renderDataType(e),
28224
- renderSorts(e, h),
28225
- renderCopyColumn(e),
28226
- renderColumnPinning(e),
28227
- renderColumnWrapping(e),
28228
- renderFormatOptions(e, y),
28229
- (0, import_jsx_runtime.jsx)(DropdownMenuSeparator, {}),
28230
- renderMenuItemFilter(e),
28231
- renderFilterByValues(e, v),
28232
- S && (0, import_jsx_runtime.jsx)(ClearFilterMenuItem, {
28209
+ (0, import_jsx_runtime.jsx)("span", {
28210
+ children: r
28211
+ }),
28212
+ e.getCanSort() && (0, import_jsx_runtime.jsx)(SortButton, {
28233
28213
  column: e
28214
+ }),
28215
+ (0, import_jsx_runtime.jsxs)(DropdownMenu, {
28216
+ modal: false,
28217
+ children: [
28218
+ (0, import_jsx_runtime.jsx)(DropdownMenuTrigger, {
28219
+ asChild: true,
28220
+ children: (0, import_jsx_runtime.jsx)("button", {
28221
+ type: "button",
28222
+ className: "inline-flex items-center justify-center h-5 w-5 rounded hover:bg-(--slate-4) text-muted-foreground opacity-0 group-hover:opacity-100 focus:opacity-100 group-focus-within:opacity-100 data-[state=open]:opacity-100 data-[state=open]:text-accent-foreground",
28223
+ "aria-label": "Column options",
28224
+ "data-testid": "data-table-column-menu-button",
28225
+ children: (0, import_jsx_runtime.jsx)(Ellipsis, {
28226
+ className: "h-3.5 w-3.5"
28227
+ })
28228
+ })
28229
+ }),
28230
+ (0, import_jsx_runtime.jsxs)(DropdownMenuContent, {
28231
+ align: "start",
28232
+ children: [
28233
+ renderDataType(e),
28234
+ renderSorts(e, h),
28235
+ renderCopyColumn(e),
28236
+ renderColumnPinning(e),
28237
+ renderColumnWrapping(e),
28238
+ renderFormatOptions(e, y),
28239
+ (0, import_jsx_runtime.jsx)(DropdownMenuSeparator, {}),
28240
+ renderMenuItemFilter(e),
28241
+ renderFilterByValues(e, v),
28242
+ S && (0, import_jsx_runtime.jsx)(ClearFilterMenuItem, {
28243
+ column: e
28244
+ })
28245
+ ]
28246
+ })
28247
+ ]
28234
28248
  })
28235
28249
  ]
28236
- })
28250
+ }),
28251
+ c
28237
28252
  ]
28238
28253
  }),
28239
28254
  _ && (0, import_jsx_runtime.jsx)(PopoverFilterByValues, {
@@ -28244,6 +28259,19 @@ Database schema: ${c}`), (_a4 = r2.aiFix) == null ? void 0 : _a4.setAiCompletion
28244
28259
  ]
28245
28260
  });
28246
28261
  };
28262
+ var SortButton = ({ column: e }) => {
28263
+ let r = e.getIsSorted();
28264
+ return (0, import_jsx_runtime.jsx)("button", {
28265
+ type: "button",
28266
+ onClick: (c) => {
28267
+ c.stopPropagation(), r ? r === "asc" ? e.toggleSorting(true, true) : e.clearSorting() : e.toggleSorting(false, true);
28268
+ },
28269
+ className: cn("inline-flex items-center justify-center h-5 w-5 rounded hover:bg-(--slate-4)", r ? "text-accent-foreground" : "text-muted-foreground opacity-0 group-hover:opacity-100 focus:opacity-100 group-focus-within:opacity-100"),
28270
+ "aria-label": r === "asc" ? "Sorted ascending, click to sort descending" : r === "desc" ? "Sorted descending, click to clear sort" : "Sort column ascending",
28271
+ "data-testid": "data-table-sort-button",
28272
+ children: renderSortFilterIcon(e)
28273
+ });
28274
+ };
28247
28275
  function renderMenuItemFilter(e) {
28248
28276
  var _a3;
28249
28277
  if (!e.getCanFilter()) return null;
@@ -30301,30 +30329,24 @@ Database schema: ${c}`), (_a4 = r2.aiFix) == null ? void 0 : _a4.setAiCompletion
30301
30329
  ]
30302
30330
  })
30303
30331
  ]
30304
- }) : null, O2 = M(e2), I2 = (0, import_jsx_runtime.jsxs)("div", {
30305
- className: cn("flex flex-col", O2 === "center" && "items-center", O2 === "right" && "items-end"),
30306
- children: [
30307
- (0, import_jsx_runtime.jsx)("span", {
30308
- className: cn("font-bold", S2 && "underline decoration-dotted"),
30309
- children: e2 === "" ? " " : e2
30310
- }),
30311
- E2
30312
- ]
30313
- }), z2 = (0, import_jsx_runtime.jsx)(DataTableColumnHeader, {
30332
+ }) : null, O2 = (0, import_jsx_runtime.jsx)("span", {
30333
+ className: cn("font-bold", S2 && "underline decoration-dotted"),
30334
+ children: e2 === "" ? " " : e2
30335
+ }), M2 = (0, import_jsx_runtime.jsx)(DataTableColumnHeader, {
30314
30336
  header: S2 ? (0, import_jsx_runtime.jsx)(Tooltip, {
30315
30337
  content: S2,
30316
30338
  delayDuration: 300,
30317
- children: I2
30318
- }) : I2,
30339
+ children: O2
30340
+ }) : O2,
30341
+ subheader: E2,
30319
30342
  column: r2,
30320
- justify: O2,
30321
30343
  calculateTopKRows: y,
30322
30344
  table: c3
30323
30345
  });
30324
- return w.has(e2) ? z2 : (0, import_jsx_runtime.jsxs)("div", {
30325
- className: cn("flex flex-col h-full pt-0.5 pb-3 justify-between items-start", O2 === "center" && "items-center", O2 === "right" && "items-end"),
30346
+ return w.has(e2) ? M2 : (0, import_jsx_runtime.jsxs)("div", {
30347
+ className: cn("flex flex-col h-full pt-0.5 pb-3 justify-between items-start"),
30326
30348
  children: [
30327
- z2,
30349
+ M2,
30328
30350
  (0, import_jsx_runtime.jsx)(TableColumnSummary, {
30329
30351
  columnId: e2
30330
30352
  })
@@ -30342,7 +30364,13 @@ Database schema: ${c}`), (_a4 = r2.aiFix) == null ? void 0 : _a4.setAiCompletion
30342
30364
  renderValue: d2,
30343
30365
  getValue: f2,
30344
30366
  selectCell: v2,
30345
- cellStyles: getCellStyleClass(y2, S2, O2, E2, I2 === "number" || I2 === "integer")
30367
+ cellStyles: getCellStyleClass({
30368
+ justify: y2,
30369
+ wrapped: S2,
30370
+ canSelectCell: O2,
30371
+ isSelected: E2,
30372
+ isNumeric: I2 === "number" || I2 === "integer"
30373
+ })
30346
30374
  });
30347
30375
  return w.has(e2) ? (0, import_jsx_runtime.jsx)("b", {
30348
30376
  children: z2
@@ -30443,7 +30471,7 @@ Database schema: ${c}`), (_a4 = r2.aiFix) == null ? void 0 : _a4.setAiCompletion
30443
30471
  return;
30444
30472
  }
30445
30473
  }
30446
- function getCellStyleClass(e, r, c, d, f) {
30474
+ function getCellStyleClass({ justify: e = "left", wrapped: r, canSelectCell: c, isSelected: d, isNumeric: f = false }) {
30447
30475
  return cn(c && "cursor-pointer", d && "relative before:absolute before:inset-0 before:bg-(--blue-3) before:rounded before:-z-10 before:mx-[-4px] before:my-[-2px]", "w-full", "text-left", "truncate", f && "tabular-nums", e === "center" && "text-center", e === "right" && "text-right", r && "whitespace-pre-wrap min-w-[200px] break-words");
30448
30476
  }
30449
30477
  function renderAny(e) {
@@ -33856,7 +33884,7 @@ Database schema: ${c}`), (_a4 = r2.aiFix) == null ? void 0 : _a4.setAiCompletion
33856
33884
  let c = (r2) => r2.map((r3) => r3.headers.map((r4) => {
33857
33885
  let { className: c2, style: d } = getPinningStyles(r4.column);
33858
33886
  return (0, import_jsx_runtime.jsx)(TableHead, {
33859
- className: cn("h-auto min-h-10 whitespace-pre align-top", c2),
33887
+ className: cn("h-auto min-h-10 whitespace-pre align-top border-r border-r-border/75", c2),
33860
33888
  style: d,
33861
33889
  ref: (c3) => {
33862
33890
  columnSizingHandler({
@@ -33874,7 +33902,12 @@ Database schema: ${c}`), (_a4 = r2.aiFix) == null ? void 0 : _a4.setAiCompletion
33874
33902
  children: [
33875
33903
  c(e.getLeftHeaderGroups()),
33876
33904
  c(e.getCenterHeaderGroups()),
33877
- c(e.getRightHeaderGroups())
33905
+ c(e.getRightHeaderGroups()),
33906
+ e.getAllColumns().length <= 4 && (0, import_jsx_runtime.jsx)("th", {
33907
+ className: "w-full border-0",
33908
+ "aria-hidden": "true",
33909
+ role: "presentation"
33910
+ })
33878
33911
  ]
33879
33912
  })
33880
33913
  });
@@ -33918,7 +33951,7 @@ Database schema: ${c}`), (_a4 = r2.aiFix) == null ? void 0 : _a4.setAiCompletion
33918
33951
  tabIndex: 0,
33919
33952
  ...getCellDomProps(e3.id),
33920
33953
  key: e3.id,
33921
- className: cn("whitespace-pre truncate max-w-[300px] outline-hidden", e3.column.getColumnWrapping && ((_d3 = (_c3 = e3.column).getColumnWrapping) == null ? void 0 : _d3.call(_c3)) === "wrap" && "whitespace-pre-wrap min-w-[200px]", "px-1.5 py-[0.18rem]", r2),
33954
+ className: cn("whitespace-pre truncate max-w-[300px] outline-hidden border-r border-r-border/75", e3.column.getColumnWrapping && ((_d3 = (_c3 = e3.column).getColumnWrapping) == null ? void 0 : _d3.call(_c3)) === "wrap" && "whitespace-pre-wrap min-w-[200px]", "px-1.5 py-[0.18rem]", r2),
33922
33955
  style: d2,
33923
33956
  title: f2,
33924
33957
  onMouseDown: (r3) => E(r3, e3),
@@ -33939,23 +33972,28 @@ Database schema: ${c}`), (_a4 = r2.aiFix) == null ? void 0 : _a4.setAiCompletion
33939
33972
  }
33940
33973
  }, e9 = e.getState().cellHoverTemplate || null, t9 = (e2) => {
33941
33974
  var _a3;
33942
- let r2 = c ? (d == null ? void 0 : d(e2.original, e2.index)) ?? e2.index : void 0, h2 = c && f === r2, _2;
33943
- return e9 && (_2 = Z7(e9, ((_a3 = e2.getVisibleCells) == null ? void 0 : _a3.call(e2)) ?? [
33975
+ let h2 = c ? (d == null ? void 0 : d(e2.original, e2.index)) ?? e2.index : void 0, _2 = c && f === h2, v2;
33976
+ return e9 && (v2 = Z7(e9, ((_a3 = e2.getVisibleCells) == null ? void 0 : _a3.call(e2)) ?? [
33944
33977
  ...e2.getLeftVisibleCells(),
33945
33978
  ...e2.getCenterVisibleCells(),
33946
33979
  ...e2.getRightVisibleCells()
33947
33980
  ])), (0, import_jsx_runtime.jsxs)(TableRow, {
33948
33981
  "data-state": e2.getIsSelected() && "selected",
33949
- title: _2,
33950
- className: cn("border-t h-6", c && "cursor-pointer", h2 && "bg-(--blue-3) hover:bg-(--blue-3) data-[state=selected]:bg-(--blue-4)"),
33982
+ title: v2,
33983
+ className: cn("border-t h-6", c && "cursor-pointer", _2 && "bg-(--blue-3) hover:bg-(--blue-3) data-[state=selected]:bg-(--blue-4)"),
33951
33984
  onClick: () => $7(e2),
33952
33985
  children: [
33953
33986
  Q7(e2.getLeftVisibleCells()),
33954
33987
  Q7(e2.getCenterVisibleCells()),
33955
- Q7(e2.getRightVisibleCells())
33988
+ Q7(e2.getRightVisibleCells()),
33989
+ r.length <= 4 && (0, import_jsx_runtime.jsx)("td", {
33990
+ className: "border-0",
33991
+ "aria-hidden": "true",
33992
+ role: "presentation"
33993
+ })
33956
33994
  ]
33957
33995
  }, e2.id);
33958
- };
33996
+ }, n9 = r.length <= 4, r9 = r.length + (n9 ? 1 : 0);
33959
33997
  return (0, import_jsx_runtime.jsx)(DataTableContextMenu, {
33960
33998
  tableBody: (0, import_jsx_runtime.jsx)(TableBody, {
33961
33999
  onKeyDown: I,
@@ -33964,13 +34002,13 @@ Database schema: ${c}`), (_a4 = r2.aiFix) == null ? void 0 : _a4.setAiCompletion
33964
34002
  var _a3, _b3;
33965
34003
  if (_.length === 0) return (0, import_jsx_runtime.jsx)(TableRow, {
33966
34004
  children: (0, import_jsx_runtime.jsx)(TableCell, {
33967
- colSpan: r.length,
34005
+ colSpan: r9,
33968
34006
  className: "h-24 text-center",
33969
34007
  children: "No results."
33970
34008
  })
33971
34009
  });
33972
34010
  if (h) {
33973
- let e2 = w.getVirtualItems(), c2 = w.getTotalSize();
34011
+ let e2 = w.getVirtualItems(), r2 = w.getTotalSize();
33974
34012
  return (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
33975
34013
  children: [
33976
34014
  ((_a3 = e2[0]) == null ? void 0 : _a3.start) > 0 && (0, import_jsx_runtime.jsx)("tr", {
@@ -33979,17 +34017,17 @@ Database schema: ${c}`), (_a4 = r2.aiFix) == null ? void 0 : _a4.setAiCompletion
33979
34017
  height: e2[0].start
33980
34018
  },
33981
34019
  children: (0, import_jsx_runtime.jsx)("td", {
33982
- colSpan: r.length
34020
+ colSpan: r9
33983
34021
  })
33984
34022
  }),
33985
34023
  e2.map((e3) => t9(_[e3.index])),
33986
34024
  e2.length > 0 && (0, import_jsx_runtime.jsx)("tr", {
33987
34025
  "data-virtual-spacer": "",
33988
34026
  style: {
33989
- height: c2 - (((_b3 = e2.at(-1)) == null ? void 0 : _b3.end) ?? c2)
34027
+ height: r2 - (((_b3 = e2.at(-1)) == null ? void 0 : _b3.end) ?? r2)
33990
34028
  },
33991
34029
  children: (0, import_jsx_runtime.jsx)("td", {
33992
- colSpan: r.length
34030
+ colSpan: r9
33993
34031
  })
33994
34032
  })
33995
34033
  ]
@@ -34961,7 +34999,7 @@ Database schema: ${c}`), (_a4 = r2.aiFix) == null ? void 0 : _a4.setAiCompletion
34961
34999
  downloadAs: Q7
34962
35000
  }),
34963
35001
  (0, import_jsx_runtime.jsxs)(Table, {
34964
- className: "relative",
35002
+ className: cn("relative", d.length <= 4 ? "w-auto" : "w-full"),
34965
35003
  ref: M9,
34966
35004
  children: [
34967
35005
  C9 && (0, import_jsx_runtime.jsx)("thead", {
@@ -65595,7 +65633,7 @@ ${c}
65595
65633
  return Logger.warn("Failed to get version from mount config"), null;
65596
65634
  }
65597
65635
  }
65598
- const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.22.5-dev13"), showCodeInRunModeAtom = atom(true);
65636
+ const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.22.5-dev15"), showCodeInRunModeAtom = atom(true);
65599
65637
  atom(null);
65600
65638
  var VIRTUAL_FILE_REGEX = /\/@file\/([^\s"&'/]+)\.([\dA-Za-z]+)/g, VirtualFileTracker = class e {
65601
65639
  constructor() {