@marimo-team/islands 0.23.10-dev14 → 0.23.10-dev16

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.10-dev14",
3
+ "version": "0.23.10-dev16",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -3,18 +3,15 @@
3
3
  import { CommandList } from "cmdk";
4
4
  import { atom, useAtom, useAtomValue, useSetAtom } from "jotai";
5
5
  import { atomWithStorage } from "jotai/utils";
6
- import {
7
- EyeIcon,
8
- EyeOffIcon,
9
- PlusIcon,
10
- PlusSquareIcon,
11
- XIcon,
12
- } from "lucide-react";
6
+ import { PlusIcon, PlusSquareIcon, XIcon } from "lucide-react";
13
7
  import React from "react";
14
8
  import { dbDisplayName } from "@/components/databases/display";
15
9
  import { EngineVariable } from "@/components/databases/engine-variable";
16
10
  import { DatabaseLogo } from "@/components/databases/icon";
17
- import { RefreshIconButton } from "@/components/editor/file-tree/tree-actions";
11
+ import {
12
+ RefreshIconButton,
13
+ VisibilityToggleButton,
14
+ } from "@/components/editor/file-tree/tree-actions";
18
15
  import { CopyClipboardIcon } from "@/components/icons/copy-icon";
19
16
  import { Button } from "@/components/ui/button";
20
17
  import { Command, CommandInput, CommandItem } from "@/components/ui/command";
@@ -286,27 +283,15 @@ export const DataSources: React.FC = () => {
286
283
  </button>
287
284
  )}
288
285
 
289
- <Tooltip
290
- content={
291
- hideEmpty
292
- ? "Show empty schemas and databases"
293
- : "Hide empty schemas and databases"
294
- }
295
- >
296
- <Button
297
- data-testid="datasources-hide-empty-button"
298
- variant="ghost"
299
- size="sm"
300
- className="px-2 rounded-none focus-visible:outline-hidden"
301
- onClick={() => setHideEmpty(!hideEmpty)}
302
- >
303
- {hideEmpty ? (
304
- <EyeOffIcon className="h-4 w-4" />
305
- ) : (
306
- <EyeIcon className="h-4 w-4" />
307
- )}
308
- </Button>
309
- </Tooltip>
286
+ <VisibilityToggleButton
287
+ data-testid="datasources-hide-empty-button"
288
+ isVisible={!hideEmpty}
289
+ onToggle={() => setHideEmpty(!hideEmpty)}
290
+ showTooltip="Show empty schemas and databases"
291
+ hideTooltip="Hide empty schemas and databases"
292
+ size="sm"
293
+ className="px-2 rounded-none focus-visible:outline-hidden"
294
+ />
310
295
 
311
296
  <AddConnectionDialog>
312
297
  <Button
@@ -51,6 +51,22 @@
51
51
  }
52
52
  }
53
53
 
54
+ a {
55
+ cursor: pointer;
56
+ text-decoration: inherit;
57
+
58
+ @apply text-link;
59
+ }
60
+
61
+ a:hover,
62
+ a:active {
63
+ text-decoration: underline;
64
+ }
65
+
66
+ a:visited {
67
+ @apply text-link-visited;
68
+ }
69
+
54
70
  code {
55
71
  @apply border px-1 rounded font-mono bg-[var(--slate-2)] text-sm mb-4 mt-2;
56
72
  }
@@ -9,8 +9,6 @@ import {
9
9
  CopyMinusIcon,
10
10
  DownloadIcon,
11
11
  ExternalLinkIcon,
12
- EyeIcon,
13
- EyeOffIcon,
14
12
  FilePlus2Icon,
15
13
  FolderPlusIcon,
16
14
  ListTreeIcon,
@@ -43,6 +41,7 @@ import {
43
41
  MENU_ITEM_ICON_CLASS,
44
42
  RefreshIconButton,
45
43
  TreeChevron,
44
+ VisibilityToggleButton,
46
45
  } from "@/components/editor/file-tree/tree-actions";
47
46
  import { MarimoIcon, MarimoPlusIcon } from "@/components/icons/marimo-icons";
48
47
  import { Spinner } from "@/components/icons/spinner";
@@ -338,22 +337,13 @@ const Toolbar = ({
338
337
  data-testid="file-explorer-refresh-button"
339
338
  onClick={onRefresh}
340
339
  />
341
- <Tooltip
342
- content={showHiddenFiles ? "Hide hidden files" : "Show hidden files"}
343
- >
344
- <Button
345
- data-testid="file-explorer-hidden-files-button"
346
- onClick={onHidden}
347
- variant="text"
348
- size="xs"
349
- >
350
- {showHiddenFiles ? (
351
- <EyeIcon size={16} className="text-primary" />
352
- ) : (
353
- <EyeOffIcon size={16} />
354
- )}
355
- </Button>
356
- </Tooltip>
340
+ <VisibilityToggleButton
341
+ data-testid="file-explorer-hidden-files-button"
342
+ isVisible={showHiddenFiles}
343
+ onToggle={onHidden}
344
+ showTooltip="Show hidden files"
345
+ hideTooltip="Hide hidden files"
346
+ />
357
347
  <Tooltip content="Collapse all folders">
358
348
  <Button
359
349
  data-testid="file-explorer-collapse-button"
@@ -2,11 +2,13 @@
2
2
 
3
3
  import {
4
4
  ChevronRightIcon,
5
+ EyeIcon,
6
+ EyeOffIcon,
5
7
  MoreVerticalIcon,
6
8
  RefreshCwIcon,
7
9
  } from "lucide-react";
8
10
  import React, { useCallback, useState } from "react";
9
- import { Button } from "@/components/ui/button";
11
+ import { Button, type ButtonProps } from "@/components/ui/button";
10
12
  import { Tooltip } from "@/components/ui/tooltip";
11
13
  import { cn } from "@/utils/cn";
12
14
 
@@ -73,6 +75,51 @@ export const RefreshIconButton: React.FC<{
73
75
  return <Tooltip content={tooltip}>{button}</Tooltip>;
74
76
  };
75
77
 
78
+ /**
79
+ * Toggle button that switches between an eye (visible) and crossed-out eye
80
+ * (hidden) icon. Used to show/hide optional items in toolbars, e.g. hidden
81
+ * files in the file explorer or empty schemas in the data sources panel.
82
+ */
83
+ export const VisibilityToggleButton: React.FC<{
84
+ /** Whether the optional items are currently visible. */
85
+ isVisible: boolean;
86
+ onToggle: () => void;
87
+ /** Tooltip shown while items are hidden (clicking will show them). */
88
+ showTooltip: string;
89
+ /** Tooltip shown while items are visible (clicking will hide them). */
90
+ hideTooltip: string;
91
+ size?: ButtonProps["size"];
92
+ className?: string;
93
+ iconClassName?: string;
94
+ "data-testid"?: string;
95
+ }> = ({
96
+ isVisible,
97
+ onToggle,
98
+ showTooltip,
99
+ hideTooltip,
100
+ size = "xs",
101
+ className,
102
+ iconClassName,
103
+ "data-testid": dataTestId,
104
+ }) => {
105
+ const Icon = isVisible ? EyeIcon : EyeOffIcon;
106
+ return (
107
+ <Tooltip content={isVisible ? hideTooltip : showTooltip}>
108
+ <Button
109
+ data-testid={dataTestId}
110
+ variant="text"
111
+ size={size}
112
+ className={className}
113
+ onClick={onToggle}
114
+ >
115
+ <Icon
116
+ className={cn("h-4 w-4", isVisible && "text-primary", iconClassName)}
117
+ />
118
+ </Button>
119
+ </Tooltip>
120
+ );
121
+ };
122
+
76
123
  /**
77
124
  * Three-dot menu trigger that fades in on row hover.
78
125
  * Must be inside a `group` container.