@marimo-team/islands 0.23.12-dev7 → 0.23.12-dev9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.23.12-dev7",
3
+ "version": "0.23.12-dev9",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -21,7 +21,6 @@ import {
21
21
  Files,
22
22
  FileTextIcon,
23
23
  FolderDownIcon,
24
- GithubIcon,
25
24
  GlobeIcon,
26
25
  HardDrive,
27
26
  Home,
@@ -39,7 +38,6 @@ import {
39
38
  SparklesIcon,
40
39
  Undo2Icon,
41
40
  XCircleIcon,
42
- YoutubeIcon,
43
41
  ZapIcon,
44
42
  } from "lucide-react";
45
43
  import {
@@ -47,7 +45,9 @@ import {
47
45
  useOpenSettingsToTab,
48
46
  } from "@/components/app-config/state";
49
47
  import { MarkdownIcon } from "@/components/editor/cell/code/icons";
48
+ import { GitHubIcon } from "@/components/icons/github";
50
49
  import { MarimoPlusIcon } from "@/components/icons/marimo-icons";
50
+ import { YouTubeIcon } from "@/components/icons/youtube";
51
51
  import { useImperativeModal } from "@/components/modal/ImperativeModal";
52
52
  import { renderShortcut } from "@/components/shortcuts/renderShortcut";
53
53
  import { PairWithAgentModal } from "@/components/editor/actions/pair-with-agent-modal";
@@ -655,7 +655,7 @@ export function useNotebookActions() {
655
655
  },
656
656
  },
657
657
  {
658
- icon: <GithubIcon size={14} strokeWidth={1.5} />,
658
+ icon: <GitHubIcon className="h-3.5 w-3.5" />,
659
659
  label: "GitHub",
660
660
  handle: () => {
661
661
  window.open(Constants.githubPage, "_blank");
@@ -669,7 +669,7 @@ export function useNotebookActions() {
669
669
  },
670
670
  },
671
671
  {
672
- icon: <YoutubeIcon size={14} strokeWidth={1.5} />,
672
+ icon: <YouTubeIcon className="h-3.5 w-3.5" />,
673
673
  label: "YouTube",
674
674
  handle: () => {
675
675
  window.open(Constants.youtube, "_blank");
@@ -9,7 +9,6 @@ import {
9
9
  DatabaseIcon,
10
10
  FileIcon,
11
11
  FileTextIcon,
12
- GithubIcon,
13
12
  GraduationCapIcon,
14
13
  GridIcon,
15
14
  LayoutIcon,
@@ -17,10 +16,11 @@ import {
17
16
  MessagesSquareIcon,
18
17
  OrbitIcon,
19
18
  PackageIcon,
20
- YoutubeIcon,
21
19
  } from "lucide-react";
22
20
  import type React from "react";
23
21
  import { MarkdownIcon } from "@/components/editor/cell/code/icons";
22
+ import { GitHubIcon } from "@/components/icons/github";
23
+ import { YouTubeIcon } from "@/components/icons/youtube";
24
24
  import { Button } from "@/components/ui/button";
25
25
  import {
26
26
  DropdownMenu,
@@ -130,7 +130,7 @@ const RESOURCES = [
130
130
  {
131
131
  title: "GitHub",
132
132
  description: "View source code, report issues, or contribute",
133
- icon: GithubIcon,
133
+ icon: GitHubIcon,
134
134
  url: Constants.githubPage,
135
135
  },
136
136
  {
@@ -148,7 +148,7 @@ const RESOURCES = [
148
148
  {
149
149
  title: "YouTube",
150
150
  description: "Watch tutorials and demos",
151
- icon: YoutubeIcon,
151
+ icon: YouTubeIcon,
152
152
  url: Constants.youtube,
153
153
  },
154
154
  {
@@ -0,0 +1,21 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+ import type { SVGProps } from "react";
3
+
4
+ // Artwork from Simple Icons (https://simpleicons.org/?q=github), licensed CC0 1.0.
5
+ // The GitHub name and logo are trademarks of GitHub, Inc.
6
+ export const GitHubIcon = (props: SVGProps<SVGSVGElement>) => {
7
+ return (
8
+ <svg
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ width="1em"
11
+ height="1em"
12
+ viewBox="0 0 24 24"
13
+ fill="currentColor"
14
+ aria-hidden="true"
15
+ focusable="false"
16
+ {...props}
17
+ >
18
+ <path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" />
19
+ </svg>
20
+ );
21
+ };
@@ -0,0 +1,21 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+ import type { SVGProps } from "react";
3
+
4
+ // Artwork from Simple Icons (https://simpleicons.org/?q=youtube), licensed CC0 1.0.
5
+ // The YouTube name and logo are trademarks of Google LLC.
6
+ export const YouTubeIcon = (props: SVGProps<SVGSVGElement>) => {
7
+ return (
8
+ <svg
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ width="1em"
11
+ height="1em"
12
+ viewBox="0 0 24 24"
13
+ fill="currentColor"
14
+ aria-hidden="true"
15
+ focusable="false"
16
+ {...props}
17
+ >
18
+ <path d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z" />
19
+ </svg>
20
+ );
21
+ };
@@ -6,14 +6,10 @@ import AzureIcon from "@marimo-team/llm-info/icons/azure.svg?inline";
6
6
  import CloudflareIcon from "@marimo-team/llm-info/icons/cloudflare.svg?inline";
7
7
  import CoreweaveIcon from "@marimo-team/llm-info/icons/coreweave.svg?inline";
8
8
  import CoreweaveDarkIcon from "@marimo-team/llm-info/icons/coreweave-dark.svg?inline";
9
- import {
10
- DatabaseZapIcon,
11
- GithubIcon,
12
- GlobeIcon,
13
- HardDriveIcon,
14
- } from "lucide-react";
9
+ import { DatabaseZapIcon, GlobeIcon, HardDriveIcon } from "lucide-react";
15
10
  import GoogleCloudIcon from "@/components/databases/icons/google-cloud-storage.svg?inline";
16
11
  import GoogleDriveIcon from "@/components/databases/icons/google-drive.svg?inline";
12
+ import { GitHubIcon } from "@/components/icons/github";
17
13
  import type { KnownStorageProtocol } from "@/core/storage/types";
18
14
  import { useTheme } from "@/theme/useTheme";
19
15
  import { cn } from "@/utils/cn";
@@ -32,7 +28,7 @@ const PROTOCOL_ICONS: Record<KnownStorageProtocol, IconEntry> = {
32
28
  file: HardDriveIcon,
33
29
  "in-memory": DatabaseZapIcon,
34
30
  gdrive: { src: GoogleDriveIcon },
35
- github: GithubIcon,
31
+ github: GitHubIcon,
36
32
  };
37
33
 
38
34
  export const ProtocolIcon: React.FC<{
@@ -1,7 +1,7 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
 
3
3
  import { type LucideIcon, CornerLeftUp } from "lucide-react";
4
- import { type JSX, useEffect, useState } from "react";
4
+ import { type JSX, useEffect, useLayoutEffect, useRef, useState } from "react";
5
5
  import { z } from "zod";
6
6
  import {
7
7
  FILE_ICON as FILE_TYPE_ICONS,
@@ -129,6 +129,7 @@ interface FileBrowserProps extends Data, PluginFunctions {
129
129
  }
130
130
 
131
131
  interface CheckboxOrIconProps {
132
+ name: string;
132
133
  isSelected: boolean;
133
134
  canSelect: boolean;
134
135
  Icon: LucideIcon;
@@ -136,6 +137,7 @@ interface CheckboxOrIconProps {
136
137
  }
137
138
 
138
139
  function CheckboxOrIcon({
140
+ name,
139
141
  isSelected,
140
142
  canSelect,
141
143
  Icon,
@@ -146,17 +148,21 @@ function CheckboxOrIcon({
146
148
  <>
147
149
  <Checkbox
148
150
  checked={isSelected}
151
+ aria-label={`Select ${name}`}
152
+ tabIndex={-1}
149
153
  onClick={(e) => {
150
154
  onSelect();
151
155
  e.stopPropagation();
152
156
  }}
153
- className={cn({ "hidden group-hover:flex": !isSelected })}
157
+ className={cn({
158
+ "hidden group-hover:flex group-focus:flex": !isSelected,
159
+ })}
154
160
  />
155
161
  <Icon
156
162
  size={16}
157
163
  className={cn("mr-2", {
158
164
  hidden: isSelected,
159
- "group-hover:hidden": !isSelected,
165
+ "group-hover:hidden group-focus:hidden": !isSelected,
160
166
  })}
161
167
  />
162
168
  </>
@@ -165,6 +171,18 @@ function CheckboxOrIcon({
165
171
  return <Icon size={16} className="mr-2" />;
166
172
  }
167
173
 
174
+ interface RowModel {
175
+ key: string;
176
+ name: string;
177
+ Icon: LucideIcon;
178
+ isSelected: boolean;
179
+ canSelect: boolean;
180
+ /** Enter and mouse-click action. */
181
+ onPrimary: () => void;
182
+ /** Space action; null when the row has nothing to toggle. */
183
+ onToggleSelect: (() => void) | null;
184
+ }
185
+
168
186
  /**
169
187
  * File browser component.
170
188
  *
@@ -184,6 +202,13 @@ export const FileBrowser = ({
184
202
  const [path, setPath] = useInternalStateWithSync(initialPath);
185
203
  const [isUpdatingPath, setIsUpdatingPath] = useState(false);
186
204
  const [showLoadingOverlay, setShowLoadingOverlay] = useState(false);
205
+ const [activeIndex, setActiveIndex] = useState(0);
206
+ const rowRefs = useRef<(HTMLTableRowElement | null)[]>([]);
207
+ const gridRef = useRef<HTMLTableElement | null>(null);
208
+ // Set when navigation is triggered from within the grid, so focus can follow
209
+ // to the parent row after the new listing renders instead of falling to the
210
+ // body when the previously focused row unmounts.
211
+ const refocusParentRef = useRef(false);
187
212
 
188
213
  // HACK: use the random-id of the host element to force a re-render
189
214
  // when the random-id changes, this means the cell was re-rendered
@@ -210,6 +235,22 @@ export const FileBrowser = ({
210
235
  };
211
236
  }, [isPending]);
212
237
 
238
+ // Reset the roving tabindex whenever the listing reloads (a new path or a
239
+ // same-path refresh) so activeIndex never points past the current rows.
240
+ const listingKey = `${path}::${randomId}`;
241
+ const [prevListingKey, setPrevListingKey] = useState(listingKey);
242
+ if (prevListingKey !== listingKey) {
243
+ setPrevListingKey(listingKey);
244
+ setActiveIndex(0);
245
+ }
246
+
247
+ useLayoutEffect(() => {
248
+ if (refocusParentRef.current) {
249
+ refocusParentRef.current = false;
250
+ rowRefs.current[0]?.focus();
251
+ }
252
+ }, [listingKey]);
253
+
213
254
  const files = data?.files ?? [];
214
255
  const selectedPaths = new Set(value.map((x) => x.path));
215
256
  const canSelectDirectories =
@@ -269,6 +310,8 @@ export const FileBrowser = ({
269
310
  return;
270
311
  }
271
312
 
313
+ refocusParentRef.current =
314
+ gridRef.current?.contains(document.activeElement) ?? false;
272
315
  setPath(newPath);
273
316
  setIsUpdatingPath(false);
274
317
  }
@@ -333,78 +376,90 @@ export const FileBrowser = ({
333
376
  setValue([...value, ...filesInView]);
334
377
  }
335
378
 
336
- // Create rows for directories and files
337
- const fileRows: React.ReactNode[] = [];
338
-
339
- // Parent directory ".." row button
340
- fileRows.push(
341
- <TableRow
342
- className="hover:bg-accent select-none"
343
- key={"Parent directory"}
344
- onClick={() => setNewPath(PARENT_DIRECTORY)}
345
- >
346
- <TableCell className="w-[50px] pl-4">
347
- <CornerLeftUp size={16} />
348
- </TableCell>
349
- <TableCell>{PARENT_DIRECTORY}</TableCell>
350
- </TableRow>,
351
- );
379
+ const rowModels: RowModel[] = [
380
+ {
381
+ key: "parent",
382
+ name: PARENT_DIRECTORY,
383
+ Icon: CornerLeftUp,
384
+ isSelected: false,
385
+ canSelect: false,
386
+ onPrimary: () => setNewPath(PARENT_DIRECTORY),
387
+ onToggleSelect: null,
388
+ },
389
+ ...files.map((file): RowModel => {
390
+ let filePath = file.path;
391
+ if (filePath.startsWith("//")) {
392
+ filePath = filePath.slice(1) as FilePath;
393
+ }
352
394
 
353
- for (const file of files) {
354
- let filePath = file.path;
395
+ const canSelect =
396
+ (canSelectDirectories && file.is_directory) ||
397
+ (canSelectFiles && !file.is_directory);
398
+ const isSelected = selectedPaths.has(filePath);
399
+ const fileType: FileType = file.is_directory
400
+ ? "directory"
401
+ : guessFileType(file.name);
402
+
403
+ const toggle = () =>
404
+ handleSelection({
405
+ path: filePath,
406
+ name: file.name,
407
+ isDirectory: file.is_directory,
408
+ });
409
+
410
+ return {
411
+ key: file.id,
412
+ name: file.name,
413
+ Icon: FILE_TYPE_ICONS[fileType],
414
+ isSelected,
415
+ canSelect,
416
+ onPrimary: file.is_directory
417
+ ? () => setNewPath(filePath)
418
+ : canSelect
419
+ ? toggle
420
+ : () => {},
421
+ onToggleSelect: canSelect ? toggle : null,
422
+ };
423
+ }),
424
+ ];
355
425
 
356
- if (filePath.startsWith("//")) {
357
- filePath = filePath.slice(1) as FilePath;
358
- }
426
+ function focusRow(index: number) {
427
+ setActiveIndex(index);
428
+ rowRefs.current[index]?.focus();
429
+ }
359
430
 
360
- // Click handler
361
- const handleClick = file.is_directory
362
- ? ({ path }: { path: string }) => setNewPath(path)
363
- : handleSelection;
364
-
365
- // Icon
366
- const fileType: FileType = file.is_directory
367
- ? "directory"
368
- : guessFileType(file.name);
369
-
370
- const Icon = FILE_TYPE_ICONS[fileType];
371
-
372
- const isSelected = selectedPaths.has(filePath);
373
-
374
- fileRows.push(
375
- <TableRow
376
- key={file.id}
377
- className={cn("hover:bg-accent group select-none", {
378
- "bg-primary/25 hover:bg-primary/35": isSelected,
379
- })}
380
- onClick={() =>
381
- handleClick({
382
- path: filePath,
383
- name: file.name,
384
- isDirectory: file.is_directory,
385
- })
386
- }
387
- >
388
- <TableCell className="w-[50px] pl-4">
389
- <CheckboxOrIcon
390
- isSelected={isSelected}
391
- canSelect={
392
- (canSelectDirectories && file.is_directory) ||
393
- (canSelectFiles && !file.is_directory)
394
- }
395
- Icon={Icon}
396
- onSelect={() =>
397
- handleSelection({
398
- path: filePath,
399
- name: file.name,
400
- isDirectory: file.is_directory,
401
- })
402
- }
403
- />
404
- </TableCell>
405
- <TableCell>{file.name}</TableCell>
406
- </TableRow>,
407
- );
431
+ function handleRowKeyDown(
432
+ e: React.KeyboardEvent<HTMLTableRowElement>,
433
+ index: number,
434
+ ) {
435
+ const lastIndex = rowModels.length - 1;
436
+ switch (e.key) {
437
+ case "ArrowDown":
438
+ e.preventDefault();
439
+ focusRow(Math.min(index + 1, lastIndex));
440
+ break;
441
+ case "ArrowUp":
442
+ e.preventDefault();
443
+ focusRow(Math.max(index - 1, 0));
444
+ break;
445
+ case "Home":
446
+ e.preventDefault();
447
+ focusRow(0);
448
+ break;
449
+ case "End":
450
+ e.preventDefault();
451
+ focusRow(lastIndex);
452
+ break;
453
+ case "Enter":
454
+ e.preventDefault();
455
+ rowModels[index].onPrimary();
456
+ break;
457
+ // Space is select-only; preventDefault stops the list from scrolling.
458
+ case " ":
459
+ e.preventDefault();
460
+ rowModels[index].onToggleSelect?.();
461
+ break;
462
+ }
408
463
  }
409
464
 
410
465
  // Get list of parent directories.
@@ -490,8 +545,44 @@ export const FileBrowser = ({
490
545
  <span>Listing files...</span>
491
546
  </div>
492
547
  )}
493
- <Table className="cursor-pointer table-fixed">
494
- <TableBody>{fileRows}</TableBody>
548
+ <Table
549
+ ref={gridRef}
550
+ className="cursor-pointer table-fixed"
551
+ role="grid"
552
+ aria-label="File browser"
553
+ aria-multiselectable={multiple}
554
+ >
555
+ <TableBody>
556
+ {rowModels.map((row, index) => (
557
+ <TableRow
558
+ key={row.key}
559
+ role="row"
560
+ ref={(el) => {
561
+ rowRefs.current[index] = el;
562
+ }}
563
+ tabIndex={index === activeIndex ? 0 : -1}
564
+ onFocus={() => setActiveIndex(index)}
565
+ onKeyDown={(e) => handleRowKeyDown(e, index)}
566
+ className={cn(
567
+ "hover:bg-accent group select-none focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-inset",
568
+ { "bg-primary/25 hover:bg-primary/35": row.isSelected },
569
+ )}
570
+ aria-selected={row.canSelect ? row.isSelected : undefined}
571
+ onClick={row.onPrimary}
572
+ >
573
+ <TableCell role="gridcell" className="w-[50px] pl-4">
574
+ <CheckboxOrIcon
575
+ name={row.name}
576
+ isSelected={row.isSelected}
577
+ canSelect={row.canSelect}
578
+ Icon={row.Icon}
579
+ onSelect={() => row.onToggleSelect?.()}
580
+ />
581
+ </TableCell>
582
+ <TableCell role="gridcell">{row.name}</TableCell>
583
+ </TableRow>
584
+ ))}
585
+ </TableBody>
495
586
  </Table>
496
587
  </div>
497
588
  <div className="mt-4">