The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore(design-system): sandwiched admonition (#43120)
Danny Whiteb09b569a5924
diff --git a/apps/design-system/README.md b/apps/design-system/README.mdindex 06296fb3f4b..4708b9866f5 100644--- a/apps/design-system/README.md+++ b/apps/design-system/README.md@@ -55,7 +55,7 @@ The design system _references_ components rather than housing them. That’s an- [`packages/ui`](https://github.com/supabase/supabase/tree/master/packages/ui): basic UI components- [`packages/ui-patterns`](https://github.com/supabase/supabase/tree/master/packages/ui-patterns): components which are built using NPM libraries or amalgamations of components from `patterns/ui`-With that out of the way, there are several parts of this design system that need to be manually updated after components have been added or removed (from documentation). These include:+There are several parts of this design system that need to be manually updated after components have been added or removed (from documentation). These include:- `config/docs.ts`: list of components in the sidebar- `content/docs`: the actual component documentation@@ -64,7 +64,7 @@ With that out of the way, there are several parts of this design system that nee- `registry/charts.ts`: list of chart components- `registry/default/example/*`: the actual example components-You will probably need to rebuild the design system’s registry after making new additions. You can do that via:+You will need to rebuild the design system’s registry after making new additions:```bashcd apps/design-systemdiff --git a/apps/design-system/__registry__/default/block/chart-bar-interactive.tsx b/apps/design-system/__registry__/default/block/chart-bar-interactive.tsxindex 34374419f59..655787cda64 100644--- a/apps/design-system/__registry__/default/block/chart-bar-interactive.tsx+++ b/apps/design-system/__registry__/default/block/chart-bar-interactive.tsx@@ -2,9 +2,17 @@import * as React from 'react'import { Bar, BarChart, CartesianGrid, XAxis } from 'recharts'--import { Card, CardContent, CardDescription, CardHeader, CardTitle } from 'ui'-import { ChartConfig, ChartContainer, ChartTooltip, ChartTooltipContent } from 'ui'+import {+ Card,+ CardContent,+ CardDescription,+ CardHeader,+ CardTitle,+ ChartConfig,+ ChartContainer,+ ChartTooltip,+ ChartTooltipContent,+} from 'ui'export const description = 'An interactive bar chart'diff --git a/apps/design-system/__registry__/default/block/chart-composed-actions.tsx b/apps/design-system/__registry__/default/block/chart-composed-actions.tsxindex f6eac7312b2..ee4212e416e 100644--- a/apps/design-system/__registry__/default/block/chart-composed-actions.tsx+++ b/apps/design-system/__registry__/default/block/chart-composed-actions.tsx@@ -1,19 +1,19 @@'use client'+import { BarChart2, ExternalLink, LineChart } from 'lucide-react'+import { useEffect, useState } from 'react'import {Chart,ChartActions,+ ChartBar,ChartCard,ChartContent,- ChartHeader,- ChartTitle,ChartEmptyState,- ChartLoadingState,- ChartBar,+ ChartHeader,ChartLine,+ ChartLoadingState,+ ChartTitle,} from 'ui-patterns/Chart'-import { BarChart2, ExternalLink, LineChart } from 'lucide-react'-import { useState, useEffect } from 'react'export default function ChartComposedActions() {const [isLoading, setIsLoading] = useState(true)diff --git a/apps/design-system/__registry__/default/block/chart-composed-basic.tsx b/apps/design-system/__registry__/default/block/chart-composed-basic.tsxindex d9457c3d308..607363710eb 100644--- a/apps/design-system/__registry__/default/block/chart-composed-basic.tsx+++ b/apps/design-system/__registry__/default/block/chart-composed-basic.tsx@@ -1,19 +1,19 @@'use client'+import { BarChart2, ExternalLink } from 'lucide-react'+import { useEffect, useState } from 'react'import {Chart,ChartActions,+ ChartBar,ChartCard,ChartContent,- ChartHeader,- ChartTitle,ChartEmptyState,- ChartLoadingState,- ChartBar,+ ChartHeader,ChartLine,+ ChartLoadingState,+ ChartTitle,} from 'ui-patterns/Chart'-import { BarChart2, ExternalLink } from 'lucide-react'-import { useState, useEffect } from 'react'export default function ComposedChartBasic() {const [isLoading, setIsLoading] = useState(true)diff --git a/apps/design-system/__registry__/default/block/chart-composed-demo.tsx b/apps/design-system/__registry__/default/block/chart-composed-demo.tsxindex c734900d395..88b131af925 100644--- a/apps/design-system/__registry__/default/block/chart-composed-demo.tsx+++ b/apps/design-system/__registry__/default/block/chart-composed-demo.tsx@@ -1,17 +1,17 @@'use client'+import { BarChart2 } from 'lucide-react'+import { useEffect, useState } from 'react'import {Chart,ChartCard,ChartContent,- ChartHeader,ChartEmptyState,+ ChartHeader,ChartLoadingState,ChartMetric,} from 'ui-patterns/Chart'-import { BarChart2 } from 'lucide-react'import { LogsBarChart } from 'ui-patterns/LogsBarChart'-import { useState, useEffect } from 'react'export default function ComposedChartDemo() {const [isLoading, setIsLoading] = useState(true)diff --git a/apps/design-system/__registry__/default/block/chart-composed-metrics.tsx b/apps/design-system/__registry__/default/block/chart-composed-metrics.tsxindex 0c876d7e589..361c35a9a45 100644--- a/apps/design-system/__registry__/default/block/chart-composed-metrics.tsx+++ b/apps/design-system/__registry__/default/block/chart-composed-metrics.tsx@@ -1,17 +1,17 @@'use client'+import { ExternalLink } from 'lucide-react'+import { useEffect, useState } from 'react'+import { Skeleton } from 'ui'import {Chart,- ChartCard,- ChartHeader,ChartActions,+ ChartCard,ChartContent,+ ChartHeader,ChartMetric,ChartSparkline,} from 'ui-patterns/Chart'-import { ExternalLink } from 'lucide-react'-import { useState, useEffect } from 'react'-import { Skeleton } from 'ui'export default function ChartComposedMetrics() {const [data, setData] = useState<Array<{ value: number; timestamp: string }>>([])diff --git a/apps/design-system/__registry__/default/block/chart-composed-states.tsx b/apps/design-system/__registry__/default/block/chart-composed-states.tsxindex 4e5aa5d8bd5..c4e25d545c2 100644--- a/apps/design-system/__registry__/default/block/chart-composed-states.tsx+++ b/apps/design-system/__registry__/default/block/chart-composed-states.tsx@@ -1,18 +1,18 @@'use client'import { BarChart2, ExternalLink } from 'lucide-react'+import { Badge } from 'ui'import {Chart,- ChartCard,- ChartHeader,- ChartTitle,ChartActions,+ ChartCard,ChartContent,+ ChartDisabledState,ChartEmptyState,+ ChartHeader,ChartLoadingState,- ChartDisabledState,+ ChartTitle,} from 'ui-patterns/Chart'-import { Badge } from 'ui'export default function ChartComposedStates() {const actions = [diff --git a/apps/design-system/__registry__/default/block/chart-composed-table.tsx b/apps/design-system/__registry__/default/block/chart-composed-table.tsxindex 303114447e9..a8089ed1f57 100644--- a/apps/design-system/__registry__/default/block/chart-composed-table.tsx+++ b/apps/design-system/__registry__/default/block/chart-composed-table.tsx@@ -1,21 +1,21 @@'use client'+import { format } from 'date-fns'+import { BarChart2, ExternalLink } from 'lucide-react'+import { useEffect, useState } from 'react'+import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from 'ui'import {Chart,ChartActions,+ ChartBar,ChartCard,ChartContent,- ChartHeader,- ChartTitle,ChartEmptyState,- ChartLoadingState,- ChartBar,ChartFooter,+ ChartHeader,+ ChartLoadingState,+ ChartTitle,} from 'ui-patterns/Chart'-import { BarChart2, ExternalLink } from 'lucide-react'-import { useState, useEffect } from 'react'-import { Table, TableHead, TableBody, TableRow, TableCell, TableHeader } from 'ui'-import { format } from 'date-fns'export default function ChartComposedTable() {const [isLoading, setIsLoading] = useState(true)diff --git a/apps/design-system/__registry__/index.tsx b/apps/design-system/__registry__/index.tsxindex f8f80ed90d4..a4e25e570bf 100644--- a/apps/design-system/__registry__/index.tsx+++ b/apps/design-system/__registry__/index.tsx@@ -137,6 +137,17 @@ export const Index: Record<string, any> = {subcategory: "undefined",chunks: []},+ "admonition-sandwiched": {+ name: "admonition-sandwiched",+ type: "components:example",+ registryDependencies: ["admonition"],+ component: React.lazy(() => import("@/registry/default/example/admonition-sandwiched")),+ source: "",+ files: ["registry/default/example/admonition-sandwiched.tsx"],+ category: "undefined",+ subcategory: "undefined",+ chunks: []+ },"alert-demo": {name: "alert-demo",type: "components:example",diff --git a/apps/design-system/content/docs/copywriting.mdx b/apps/design-system/content/docs/copywriting.mdxindex 751cf4e0497..4709faa48fe 100644--- a/apps/design-system/content/docs/copywriting.mdx+++ b/apps/design-system/content/docs/copywriting.mdx@@ -125,7 +125,19 @@ Supabase UI copy is:## Navigation and headings-### Use sentence case+### Use title case for page titles and global navigation++Use title case for page names in the main nav and document titles (e.g. "Database Settings", "Project Settings"). This distinguishes the page as a destination from section labels and in-page headings, which use sentence case.++### Use declarative page descriptions++Use a fragment with no trailing period, and prefer declarative over instructional. Describe what the page covers, not what the user should do.++| Good | Bad |+| ---------------------------------------------------------- | ---------------------------------------------------------------------- |+| "General configuration, domains, ownership, and lifecycle" | "Configure general options, domains, transfers, and project lifecycle" |++### Use sentence case for section labels and headings| Bad | Good || ----------------------- | ----------------------- |@@ -216,7 +228,8 @@ Supabase UI copy is:## Capitalization-- **Sentence case** for all UI text (buttons, labels, headings)+- **Sentence case** for all UI text (buttons, labels, section headings)+- **Title case** for page names in navigation- **Product names:** Database, Auth, Storage, Edge Functions, Realtime, Vector- **Postgres**, not PostgreSQL- **Supabase** (capitalize except in code)diff --git a/apps/design-system/content/docs/fragments/admonition.mdx b/apps/design-system/content/docs/fragments/admonition.mdxindex d186a3b28cb..d9c0e89a4a9 100644--- a/apps/design-system/content/docs/fragments/admonition.mdx+++ b/apps/design-system/content/docs/fragments/admonition.mdx@@ -42,8 +42,6 @@ Only ever use the `primary` (green) button `type` on a `default` Admonition. Eve## Examples-### With actions-<ComponentPreviewname="admonition-demo"className="[&_.preview>[data-orientation=vertical]]:sm:max-w-[70%]"@@ -51,15 +49,13 @@ Only ever use the `primary` (green) button `type` on a `default` Admonition. Eve## Responsive-{' '}+Resize your browser to see the button(s) change `layout` based on the Admonition’s width.<ComponentPreviewname="admonition-responsive"className="[&_.preview>[data-orientation=vertical]]:sm:max-w-[70%]"/>-Reize your browser to see the button(s) change `layout` based on the Admonition’s width.-When `layout="responsive"`, the Alert root gets `@container` so the Admonition is the container-query context. The Admonition stays `vertical` when it’s narrow and switches to `horizontal` when its own width reaches the `@md` container breakpoint, independent of page width.### Warning@@ -82,3 +78,14 @@ AlertError for example rolls up consistent error handling and support contact mename="admonition-destructive"className="[&_.preview>[data-orientation=vertical]]:sm:max-w-[70%]"/>++### Sandwiched++Some [Card](../components/card) or [Dialog](../components/dialog) instances may need to include callout information in-between core content. Admonition can be used ‘full-bleed’ in these cases by removing borders and radii.++<ComponentPreview+ name="admonition-sandwiched"+ className="[&_.preview>[data-orientation=vertical]]:sm:max-w-[70%]"+/>++Depending on the context, you may want to reset borders on the Admonition itself rather than the surrounding elements. The above Admonition is `type` `"warning"` with stark yellow borders which we want to emphasize.diff --git a/apps/design-system/registry/default/example/admonition-sandwiched.tsx b/apps/design-system/registry/default/example/admonition-sandwiched.tsxnew file mode 100644index 00000000000..34dec85eeb8--- /dev/null+++ b/apps/design-system/registry/default/example/admonition-sandwiched.tsx@@ -0,0 +1,29 @@+import { Button, Card, CardContent, CardHeader, CardTitle } from 'ui'+import { Admonition } from 'ui-patterns/admonition'++export default function AdmonitionDemo() {+ return (+ <Card>+ <CardHeader className="border-b-0">+ <CardTitle>Card with Admonition</CardTitle>+ </CardHeader>+ <Admonition+ type="warning"+ layout="horizontal"+ title="Sandwiched Admonition"+ description="This Admonition is sandwiched between other content in a Card component. Note how the top border and all radii are reset."+ className="mb-0 rounded-none border-x-0"+ />+ <CardContent>+ <p className="text-foreground-light text-sm">+ This is the subsequent content of this Card.+ </p>+ </CardContent>+ <CardContent>+ <p className="text-foreground-light text-sm">+ It might be disabled due some condition that the Admonition above explains.+ </p>+ </CardContent>+ </Card>+ )+}diff --git a/apps/design-system/registry/examples.ts b/apps/design-system/registry/examples.tsindex bffcbedee62..905e07d95cf 100644--- a/apps/design-system/registry/examples.ts+++ b/apps/design-system/registry/examples.ts@@ -37,6 +37,12 @@ export const examples: Registry = [registryDependencies: ['admonition'],files: ['example/admonition-destructive.tsx'],},+ {+ name: 'admonition-sandwiched',+ type: 'components:example',+ registryDependencies: ['admonition'],+ files: ['example/admonition-sandwiched.tsx'],+ },{name: 'alert-demo',type: 'components:example',