A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
Update callout (#36)
Myles Scolnickb4dbb2fa67f3
diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.ymlindex 35ed2f8a83..2baf4878de 100644--- a/.github/workflows/playwright.yml+++ b/.github/workflows/playwright.yml@@ -94,7 +94,6 @@ jobs:# Beta: Don't fail the buildcontinue-on-error: truewith:- save-only: truebase-branch: mainsnapshot-path: frontend/e2e-tests/screenshotsdiff --git a/frontend/src/css/globals.css b/frontend/src/css/globals.cssindex 97f6fec957..1ffbaddfdf 100644--- a/frontend/src/css/globals.css+++ b/frontend/src/css/globals.css@@ -6,10 +6,14 @@@import url("@radix-ui/colors/lime-dark.css");@import url("@radix-ui/colors/red.css");@import url("@radix-ui/colors/red-dark.css");+@import url("@radix-ui/colors/sky.css");+@import url("@radix-ui/colors/sky-dark.css");@import url("@radix-ui/colors/slate.css");@import url("@radix-ui/colors/slate-dark.css");@import url("@radix-ui/colors/sage.css");@import url("@radix-ui/colors/sage-dark.css");+@import url("@radix-ui/colors/amber.css");+@import url("@radix-ui/colors/amber-dark.css");@import url("@radix-ui/colors/yellow.css");@import url("@radix-ui/colors/yellow-dark.css");@@ -73,14 +77,6 @@0 0px 4px 0px hsl(0deg 0% 75% / 5%);--shadow-xl: 8px 9px 4px 0px var(--base-shadow),0 0px 6px 0px hsl(0deg 0% 85% / 5%);- --callout-neutral-border: #a1a1a18f;- --callout-neutral-bg: #fff;- --callout-alert-border: #a573008f;- --callout-alert-bg: #af893105;- --callout-warn-border: #a527008f;- --callout-warn-bg: #a5270000;- --callout-success-border: #94d8ed;- --callout-success-bg: #94d8ed1c;}.dark {@@ -128,23 +124,6 @@/* cyan-7 */--accent: 192 56.6% 26.5%;-- /* cyan-11 */- --accent-foreground: 190 90% 54%;- --destructive: 0 63% 41%;- --destructive-foreground: 155 7% 93%;- --success: 130 100% 70%;- --success-foreground: 155 7% 93%;- --ring: 216 34% 17%;- --radius: 8px;- --callout-neutral-border: #5f5f5f8f;- --callout-neutral-bg: #2f2f2f;- --callout-alert-border: #ffaa008f;- --callout-alert-bg: #fa03;- --callout-warn-border: #ff55008f;- --callout-warn-bg: #f503;- --callout-success-border: #2ca4b6;- --callout-success-bg: #2ca4b633;}}diff --git a/frontend/src/editor/output/CalloutOutput.styles.ts b/frontend/src/editor/output/CalloutOutput.styles.tsindex c875330d1a..42af157e98 100644--- a/frontend/src/editor/output/CalloutOutput.styles.ts+++ b/frontend/src/editor/output/CalloutOutput.styles.ts@@ -6,10 +6,13 @@ export const calloutStyles = cva({variants: {kind: {- neutral: `bg-calloutNeutralBg border-calloutNeutralBorder shadow-calloutNeutralBorder`,- alert: `bg-calloutAlertBg border-calloutAlertBorder shadow-calloutAlertBorder`,- warn: `bg-calloutWarnBg border-calloutWarnBorder shadow-calloutWarnBorder`,- success: `bg-calloutSuccessBg border-calloutSuccessBorder shadow-calloutSuccessBorder`,+ neutral: `border-[var(--slate-9)] shadow-[var(--slate-8)]`,+ // @deprecated, use danger instead+ alert: `bg-[var(--red-2)] border-[var(--red-9)] shadow-[var(--red-8)]`,+ info: `bg-[var(--sky-1)] border-[var(--sky-8)] shadow-[var(--sky-7)]`,+ danger: `bg-[var(--red-2)] border-[var(--red-9)] shadow-[var(--red-8)]`,+ warn: `bg-[var(--amber-2)] border-[var(--amber-9)] shadow-[var(--amber-8)]`,+ success: `bg-[var(--grass-2)] border-[var(--grass-9)] shadow-[var(--grass-8)]`,},},defaultVariants: {diff --git a/frontend/src/editor/output/CalloutOutput.tsx b/frontend/src/editor/output/CalloutOutput.tsxindex 92989ae1e9..67576fb95c 100644--- a/frontend/src/editor/output/CalloutOutput.tsx+++ b/frontend/src/editor/output/CalloutOutput.tsx@@ -2,10 +2,11 @@import { memo } from "react";import { HtmlOutput } from "./HtmlOutput";import { calloutStyles } from "./CalloutOutput.styles";+import { Intent } from "@/plugins/impl/common/intent";interface Props {html: string;- kind: "neutral" | "alert" | "warn" | "success";+ kind: Intent;}export const CalloutOutput: React.FC<Props> = memo(({ html, kind }) => {diff --git a/frontend/src/plugins/impl/common/intent.ts b/frontend/src/plugins/impl/common/intent.tsindex cbdb72301e..bba6b987c4 100644--- a/frontend/src/plugins/impl/common/intent.ts+++ b/frontend/src/plugins/impl/common/intent.ts@@ -2,7 +2,17 @@import { z } from "zod";-export type Intent = "neutral" | "success" | "warn" | "danger";+/**+ * 'alert' is deprecated. Use 'danger' instead.+ */+export type Intent =+ | "neutral"+ | "success"+ | "warn"+ | "danger"+ | "info"+ | "alert";export const zodIntent = z- .enum(["neutral", "success", "warn", "danger"])+ // 'alert' is deprecated. Use 'danger' instead.+ .enum(["neutral", "success", "warn", "danger", "info", "alert"]).default("neutral");diff --git a/frontend/src/plugins/layout/CalloutPlugin.tsx b/frontend/src/plugins/layout/CalloutPlugin.tsxindex ff5ab1e127..50eba4271e 100644--- a/frontend/src/plugins/layout/CalloutPlugin.tsx+++ b/frontend/src/plugins/layout/CalloutPlugin.tsx@@ -3,6 +3,7 @@import { z } from "zod";import { IStatelessPlugin, IStatelessPluginProps } from "../stateless-plugin";import { CalloutOutput } from "../../editor/output/CalloutOutput";+import { Intent, zodIntent } from "../impl/common/intent";interface Data {/**@@ -12,7 +13,7 @@ interface Data {/*** The kind of callout*/- kind: "neutral" | "alert" | "warn" | "success";+ kind: Intent;}export class CalloutPlugin implements IStatelessPlugin<Data> {@@ -20,7 +21,7 @@ export class CalloutPlugin implements IStatelessPlugin<Data> {validator = z.object({html: z.string(),- kind: z.enum(["neutral", "alert", "warn", "success"]),+ kind: zodIntent,});render({ data }: IStatelessPluginProps<Data>): JSX.Element {diff --git a/frontend/src/stories/callout.stories.mdx b/frontend/src/stories/callout.stories.mdxindex 000006aad3..1da36efe19 100644--- a/frontend/src/stories/callout.stories.mdx+++ b/frontend/src/stories/callout.stories.mdx@@ -7,34 +7,44 @@ import { Mail, Loader2 } from "lucide-react";# CalloutOutput-<Story name="Default">- <CalloutOutput html="<p>CalloutOutput with <strong>HTML</strong></p>" />-</Story>-<Story name="neutral"><CalloutOutput- html="<p>CalloutOutput with <strong>HTML</strong></p>"+ html="<p><b>NEUTRAL</b> CalloutOutput with <strong>HTML</strong></p>"kind="neutral"/></Story>+<Story name="info">+ <CalloutOutput+ html="<p><b>INFO</b> CalloutOutput with <strong>HTML</strong></p>"+ kind="info"+ />+</Story>+<Story name="alert"><CalloutOutput- html="<p>CalloutOutput with <strong>HTML</strong></p>"+ html="<p><b>ALERT</b> CalloutOutput with <strong>HTML</strong></p>"kind="alert"/></Story>+<Story name="danger">+ <CalloutOutput+ html="<p><b>DANGER</b> CalloutOutput with <strong>HTML</strong></p>"+ kind="danger"+ />+</Story>+<Story name="warn"><CalloutOutput- html="<p>CalloutOutput with <strong>HTML</strong></p>"+ html="<p><b>WARN</b> CalloutOutput with <strong>HTML</strong></p>"kind="warn"/></Story><Story name="success"><CalloutOutput- html="<p>CalloutOutput with <strong>HTML</strong></p>"+ html="<p><b>SUCCESS</b> CalloutOutput with <strong>HTML</strong></p>"kind="success"/></Story>diff --git a/frontend/tailwind.config.js b/frontend/tailwind.config.jsindex 0c4111ee20..80f0d6e4c7 100644--- a/frontend/tailwind.config.js+++ b/frontend/tailwind.config.js@@ -82,15 +82,6 @@ module.exports = {DEFAULT: "hsl(var(--card) / <alpha-value>)",foreground: "hsl(var(--card-foreground) / <alpha-value>)",},-- calloutNeutralBorder: "var(--callout-neutral-border)",- calloutNeutralBg: "var(--callout-neutral-bg)",- calloutAlertBorder: "var(--callout-alert-border)",- calloutAlertBg: "var(--callout-alert-bg)",- calloutWarnBorder: "var(--callout-warn-border)",- calloutWarnBg: "var(--callout-warn-bg)",- calloutSuccessBorder: "var(--callout-success-border)",- calloutSuccessBg: "var(--callout-success-bg)",},fontFamily: {prose: "var(--text-font)",diff --git a/marimo/_output/hypertext.py b/marimo/_output/hypertext.pyindex c000100ddf..2a948c1353 100644--- a/marimo/_output/hypertext.py+++ b/marimo/_output/hypertext.py@@ -153,7 +153,10 @@ class Html(MIME):@mddocdef callout(- self, kind: Literal["neutral", "alert", "warn", "success"] = "neutral"+ self,+ kind: Literal[+ "neutral", "danger", "warn", "success", "info"+ ] = "neutral",) -> Html:"""Create a callout containing this HTML element.diff --git a/marimo/_plugins/stateless/callout_output.py b/marimo/_plugins/stateless/callout_output.pyindex 313d54003f..83e7ba7f10 100644--- a/marimo/_plugins/stateless/callout_output.py+++ b/marimo/_plugins/stateless/callout_output.py@@ -12,7 +12,7 @@ from marimo._plugins.core.web_component import build_stateless_plugin@mddocdef callout(value: object,- kind: Literal["neutral", "alert", "warn", "success"] = "neutral",+ kind: Literal["neutral", "warn", "success", "info", "danger"] = "neutral",) -> Html:"""Build a callout output.