Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix(studio): polish extension installation dialogs (#51463)

Danny White325a5a0da761
diff --git a/apps/design-system/config/docs.ts b/apps/design-system/config/docs.ts
index 4ad98ae7c13..ee67195a54a 100644
--- a/apps/design-system/config/docs.ts
+++ b/apps/design-system/config/docs.ts
@@ -127,11 +127,6 @@ export const docsConfig: DocsConfig = {
href: '/docs/fragments/admonition',
items: [],
},
- {
- title: 'Collapsible Alert',
- href: '/docs/fragments/collapsible-alert',
- items: [],
- },
{
title: 'Collapsible Card Section',
href: '/docs/fragments/collapsible-card-section',
diff --git a/apps/design-system/content/docs/components/alert.mdx b/apps/design-system/content/docs/components/alert.mdx
index f688e7e79c4..d522e8c45fa 100644
--- a/apps/design-system/content/docs/components/alert.mdx
+++ b/apps/design-system/content/docs/components/alert.mdx
@@ -11,7 +11,7 @@ Alert is the low-level shadcn primitive that forms the foundation for [Admonitio
Examples where Alert may be appropriate include bespoke icons, custom internal layouts, or wrapper components that need direct access to `alertVariants`.
-Use [Collapsible Alert](../fragments/collapsible-alert) when a callout also needs expandable detail. Use [Collapsible](./collapsible) only for generic disclosure behaviour that is not itself an alert.
+Compose Alert with [Collapsible](./collapsible) when a callout needs expandable detail. Use [DialogDisclosure](./dialog#optional-details) for optional details in a dialog.
<ComponentPreview name="alert-demo" peekCode wide />
diff --git a/apps/design-system/content/docs/components/collapsible.mdx b/apps/design-system/content/docs/components/collapsible.mdx
index 3b6b31bd1ff..bbe61f9ddb2 100644
--- a/apps/design-system/content/docs/components/collapsible.mdx
+++ b/apps/design-system/content/docs/components/collapsible.mdx
@@ -6,7 +6,7 @@ component: true
Collapsible is a low-level primitive for revealing and hiding related content. Use it when a component needs custom trigger or content composition.
-Use Collapsible for generic disclosure behaviour: rows, sections, menus, tool details, and custom layouts. Use [Collapsible Alert](../fragments/collapsible-alert) instead when the disclosure is an alert-styled callout that should keep standard alert padding, variants, trigger styling, and toggle treatment.
+Use Collapsible for generic disclosure behavior: rows, sections, menus, tool details, and custom layouts. Use [DialogDisclosure](./dialog#optional-details) for optional details in a dialog.
<ComponentPreview name="collapsible-demo" peekCode wide />
diff --git a/apps/design-system/content/docs/components/dialog.mdx b/apps/design-system/content/docs/components/dialog.mdx
index 3dffe213230..e95002e1b28 100644
--- a/apps/design-system/content/docs/components/dialog.mdx
+++ b/apps/design-system/content/docs/components/dialog.mdx
@@ -65,6 +65,14 @@ import {
## Examples
+### Optional details
+
+Use `DialogDisclosure` to reveal optional help or context inside a dialog. Put the trigger in the dialog body above the footer, and add a section separator when the disclosure follows other content. Keep the primary action visible while the details are open or closed.
+
+`Collapsible` provides the open and closed state. `DialogDisclosure` adds the trigger and content presentation used in dialogs. Use `Accordion` when several related sections each need a heading and expandable content.
+
+<ComponentPreview name="dialog-disclosure-demo" peekCode wide />
+
### Custom close button
<ComponentPreview name="dialog-close-button" />
diff --git a/apps/design-system/content/docs/fragments/admonition.mdx b/apps/design-system/content/docs/fragments/admonition.mdx
index 8e5752ca4b2..087ca0ed3bd 100644
--- a/apps/design-system/content/docs/fragments/admonition.mdx
+++ b/apps/design-system/content/docs/fragments/admonition.mdx
@@ -15,7 +15,7 @@ Admonition provides the standard product callout pattern for situations that req
Use Admonition instead of the low-level [Alert](../components/alert) primitive unless you specifically need custom composition. If in doubt, stick with Admonition.
-Use [Collapsible Alert](./collapsible-alert) when the callout needs to remain visible while optional detail can be expanded. Use [Collapsible](../components/collapsible) for generic disclosure behaviour that is not itself a callout.
+Use [Collapsible](../components/collapsible) for custom expandable content. Use [DialogDisclosure](../components/dialog#optional-details) for optional details in a dialog.
Use `title` for the heading slot when the callout needs its own heading. `title` is optional: short callouts may use `description` without a title when nearby content already provides enough context.
diff --git a/apps/design-system/content/docs/fragments/collapsible-alert.mdx b/apps/design-system/content/docs/fragments/collapsible-alert.mdx
deleted file mode 100644
index 5cae9a4934f..00000000000
--- a/apps/design-system/content/docs/fragments/collapsible-alert.mdx
+++ /dev/null
@@ -1,43 +0,0 @@
----
-title: Collapsible Alert
-description: An alert-styled block with a collapsible content section, toggled by an icon button.
-fragment: true
----
-
-Collapsible Alert combines an Alert-style container with a collapsible content section. Use it when the callout itself needs to stay visible while optional detail can be expanded.
-
-Use Collapsible Alert when the disclosure is itself a callout. It owns the alert styling, padding, trigger treatment, and toggle button. Use [Collapsible](../components/collapsible) instead when you only need generic reveal and hide behaviour and the surrounding layout is not an alert.
-
-For non-expandable product callouts, use [Admonition](./admonition). Use the low-level [Alert](../components/alert) primitive only when a wrapper or bespoke composition needs direct control over the alert structure.
-
-<ComponentPreview name="collapsible-alert-demo" peekCode wide />
-
-## Usage
-
-```tsx
-import { CollapsibleAlert } from 'ui-patterns/collapsible-alert'
-```
-
-```tsx
-<CollapsibleAlert trigger="Need help?">
- <p>Content revealed when expanded.</p>
-</CollapsibleAlert>
-```
-
-### Default open
-
-```tsx
-<CollapsibleAlert trigger="Details" defaultOpen>
- <p>This section is expanded by default.</p>
-</CollapsibleAlert>
-```
-
-### Variants
-
-Supports the same `variant` prop as Alert: `default`, `destructive`, and `warning`.
-
-```tsx
-<CollapsibleAlert trigger="Warning" variant="warning">
- <p>Something needs attention.</p>
-</CollapsibleAlert>
-```
diff --git a/apps/design-system/registry/default/example/collapsible-alert-demo.tsx b/apps/design-system/registry/default/example/collapsible-alert-demo.tsx
deleted file mode 100644
index 96cb3e30324..00000000000
--- a/apps/design-system/registry/default/example/collapsible-alert-demo.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import { CollapsibleAlert } from 'ui-patterns/collapsible-alert'
-
-export default function CollapsibleAlertDemo() {
- return (
- <CollapsibleAlert trigger="Need help?">
- <p className="text-sm text-foreground-light">
- Try a different browser or disable extensions that block network requests.
- </p>
- </CollapsibleAlert>
- )
-}
diff --git a/apps/design-system/registry/default/example/dialog-disclosure-demo.tsx b/apps/design-system/registry/default/example/dialog-disclosure-demo.tsx
new file mode 100644
index 00000000000..a69bd06fbed
--- /dev/null
+++ b/apps/design-system/registry/default/example/dialog-disclosure-demo.tsx
@@ -0,0 +1,64 @@
+import {
+ Button,
+ Dialog,
+ DialogClose,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogSection,
+ DialogSectionSeparator,
+ DialogTitle,
+ DialogTrigger,
+} from 'ui'
+import {
+ DialogDisclosure,
+ DialogDisclosureContent,
+ DialogDisclosureTrigger,
+} from 'ui-patterns/DialogDisclosure'
+
+export default function DialogDisclosureDemo() {
+ return (
+ <Dialog>
+ <DialogTrigger asChild>
+ <Button>Export results</Button>
+ </DialogTrigger>
+ <DialogContent size="small">
+ <DialogHeader>
+ <DialogTitle>Export results</DialogTitle>
+ </DialogHeader>
+ <DialogSectionSeparator />
+ <DialogSection>
+ <p className="text-sm text-foreground-light">
+ All 250 rows will be downloaded as a CSV file.
+ </p>
+ </DialogSection>
+ <DialogSectionSeparator />
+ <DialogDisclosure>
+ <DialogDisclosureTrigger className="px-4 py-4 md:px-5">
+ What’s included
+ </DialogDisclosureTrigger>
+ <DialogDisclosureContent>
+ <DialogSection className="pt-1 text-sm text-foreground-light space-y-3">
+ <p>The file includes column names in the first row, followed by the query results.</p>
+ <ul className="list-disc pl-5 space-y-1">
+ <li>Columns keep the same order as the results table.</li>
+ <li>Empty fields represent null values.</li>
+ <li>Values containing commas or line breaks are enclosed in double quotes.</li>
+ </ul>
+ <p>Open the file in a spreadsheet or import it into another tool.</p>
+ </DialogSection>
+ </DialogDisclosureContent>
+ </DialogDisclosure>
+ <DialogFooter>
+ <DialogClose asChild>
+ <Button>Cancel</Button>
+ </DialogClose>
+ <DialogClose asChild>
+ <Button variant="primary">Download CSV</Button>
+ </DialogClose>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ )
+}
diff --git a/apps/design-system/registry/examples.ts b/apps/design-system/registry/examples.ts
index dc2f26e11be..39a2d0bb327 100644
--- a/apps/design-system/registry/examples.ts
+++ b/apps/design-system/registry/examples.ts
@@ -67,12 +67,6 @@ export const examples: Registry = [
registryDependencies: ['alert'],
files: ['example/alert-demo.tsx'],
},
- {
- name: 'collapsible-alert-demo',
- type: 'components:example',
- registryDependencies: ['collapsible-alert'],
- files: ['example/collapsible-alert-demo.tsx'],
- },
{
name: 'collapsible-card-section-demo',
type: 'components:example',
@@ -551,6 +545,12 @@ export const examples: Registry = [
registryDependencies: ['dialog'],
files: ['example/dialog-demo.tsx'],
},
+ {
+ name: 'dialog-disclosure-demo',
+ type: 'components:example',
+ registryDependencies: ['dialog', 'collapsible', 'button'],
+ files: ['example/dialog-disclosure-demo.tsx'],
+ },
{
name: 'dialog-close-button',
type: 'components:example',
diff --git a/apps/docs/content/guides/database/extensions/postgis.mdx b/apps/docs/content/guides/database/extensions/postgis.mdx
index 68d781622ec..d05232ca547 100644
--- a/apps/docs/content/guides/database/extensions/postgis.mdx
+++ b/apps/docs/content/guides/database/extensions/postgis.mdx
@@ -29,7 +29,7 @@ You can get started with PostGIS by enabling the PostGIS extension in your Supab
1. Go to the [Database](/dashboard/project/_/database/tables) page in the Dashboard.
2. Click on **Extensions** in the sidebar.
3. Search for `postgis` and enable the extension.
-4. In the confirmation prompt select "Create a new schema" and name it `gis` for example.
+4. In the confirmation dialog, review the default `extensions` schema and click **Enable**.
</TabPanel>
<TabPanel id="sql" label="SQL">
diff --git a/apps/studio/components/interfaces/Database/Extensions/EnableExtensionModal.tsx b/apps/studio/components/interfaces/Database/Extensions/EnableExtensionModal.tsx
index 9bc089786e8..d8456a139a8 100644
--- a/apps/studio/components/interfaces/Database/Extensions/EnableExtensionModal.tsx
+++ b/apps/studio/components/interfaces/Database/Extensions/EnableExtensionModal.tsx
@@ -1,12 +1,10 @@
+import { ident, safeSql } from '@supabase/pg-meta'
import { toast } from 'sonner'
import {
Button,
Card,
CardContent,
cn,
- Collapsible,
- CollapsibleContent,
- CollapsibleTrigger,
Dialog,
DialogContent,
DialogFooter,
@@ -17,9 +15,13 @@ import {
} from 'ui'
import { Admonition } from 'ui-patterns/Admonition'
import { CodeBlock } from 'ui-patterns/CodeBlock'
+import {
+ DialogDisclosure,
+ DialogDisclosureContent,
+ DialogDisclosureTrigger,
+} from 'ui-patterns/DialogDisclosure'
import { DocsButton } from '@/components/ui/DocsButton'
-import { InlineLinkClassName } from '@/components/ui/InlineLink'
import { useDatabaseExtensionEnableMutation } from '@/data/database-extensions/database-extension-enable-mutation'
import { type DatabaseExtension } from '@/data/database-extensions/database-extensions-query'
import { useIsOrioleDb, useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
@@ -45,6 +47,7 @@ export const EnableExtensionModal = ({
// [Joshen] Hard-coding pg_cron here as this is enforced on our end (Not via pg_available_extension_versions)
const defaultSchema =
extension.name === 'pg_cron' ? 'pg_catalog' : extension.default_version_schema
+ const hasFixedSchema = defaultSchema != null
const { mutate: enableExtension, isPending: isEnabling } = useDatabaseExtensionEnableMutation({
onSuccess: () => {
@@ -76,9 +79,9 @@ export const EnableExtensionModal = ({
if (!open) onCancel()
}}
>
- <DialogContent size="small" aria-describedby={undefined}>
+ <DialogContent size="small" className="min-w-0 overflow-hidden" aria-describedby={undefined}>
<DialogHeader>
- <DialogTitle>Confirm to enable {extension.name}</DialogTitle>
+ <DialogTitle>Enable {extension.name}</DialogTitle>
</DialogHeader>
<DialogSectionSeparator />
@@ -99,58 +102,67 @@ export const EnableExtensionModal = ({
<DialogSection className="flex flex-col gap-y-4">
<p className="text-sm text-foreground-light">
- The following database extension will be enabled
+ {hasFixedSchema
+ ? 'This extension must be installed in the schema below.'
+ : 'This extension will be installed in the schema below.'}
</p>
<Card>
<CardContent className="divide-y text-sm p-0">
- <div className="flex items-center justify-between px-4 py-2">
+ <div className="flex items-center justify-between px-3 py-2.5">
<p className="text-foreground-lighter">Extension</p>
- <p className="text-foreground">{extension.name}</p>
+ <code className="text-code-inline">{extension.name}</code>
</div>
- <div className="flex items-center justify-between px-4 py-2">
+ <div className="flex items-center justify-between px-3 py-2.5">
<p className="text-foreground-lighter">Schema</p>
- <p data-testid="enable-extension-schema" className="text-foreground">
+ <code data-testid="enable-extension-schema" className="text-code-inline">
{defaultSchema ?? 'extensions'}
- </p>
+ </code>
</div>
</CardContent>
</Card>
-
- <Collapsible>
- <CollapsibleTrigger
- className={cn(
- InlineLinkClassName,
- 'text-xs text-foreground-lighter data-open:text-foreground-light'
- )}
- >
- Need to install this in a different schema?
- </CollapsibleTrigger>
- <CollapsibleContent className="[overflow-y:clip] data-closed:animate-collapsible-up data-open:animate-collapsible-down">
- <div className="my-2 text-xs text-foreground-light flex flex-col gap-y-1">
- <p>
- Installing in the extensions schema is highly recommended since some extensions
- are hard to move after installation.
- </p>
- <p>To use a different schema, run this in the SQL Editor:</p>
- </div>
- <CodeBlock
- language="pgsql"
- hideLineNumbers
- wrapperClassName={cn('[&_pre]:px-3 [&_pre]:py-3')}
- className="[&_code]:text-xs"
- value={`create extension if not exists ${extension.name} schema target_schema;`}
- />
- </CollapsibleContent>
- </Collapsible>
</DialogSection>
+ {!hasFixedSchema && (
+ <>
+ <DialogSectionSeparator />
+ <DialogDisclosure>
+ <DialogDisclosureTrigger className="py-4 px-4 md:px-5">
+ <span>Install in a different schema</span>
+ </DialogDisclosureTrigger>
+ <DialogDisclosureContent>
+ <DialogSection className="pt-1 min-w-0 flex flex-col gap-y-3">
+ <div className="text-sm text-foreground-light flex flex-col gap-y-3">
+ <p>
+ We recommend using the <code className="text-code-inline">extensions</code>{' '}
+ schema to keep extension objects separate from your own tables.
+ </p>
+ <p>
+ To use another schema, run the following in the SQL Editor. Replace{' '}
+ <code className="text-code-inline">target_schema</code> with an existing
+ schema name.
+ </p>
+ </div>
+ <CodeBlock
+ language="pgsql"
+ hideLineNumbers
+ wrapLongLines
+ wrapperClassName={cn('min-w-0 max-w-full [&_pre]:px-3 [&_pre]:py-3')}
+ className="[&_code]:text-xs"
+ value={safeSql`create extension if not exists ${ident(extension.name)} schema target_schema;`}
+ />
+ </DialogSection>
+ </DialogDisclosureContent>
+ </DialogDisclosure>
+ </>
+ )}
+
<DialogFooter>
<Button disabled={isEnabling} onClick={() => onCancel()}>
Cancel
</Button>
<Button variant="primary" loading={isEnabling} onClick={() => onConfirmEnable()}>
- Enable extension
+ Enable
</Button>
</DialogFooter>
</DialogContent>
diff --git a/apps/studio/components/interfaces/Settings/API/HardenAPIModal.tsx b/apps/studio/components/interfaces/Settings/API/HardenAPIModal.tsx
index e958a7e69b0..128ea3d804a 100644
--- a/apps/studio/components/interfaces/Settings/API/HardenAPIModal.tsx
+++ b/apps/studio/components/interfaces/Settings/API/HardenAPIModal.tsx
@@ -1,12 +1,9 @@
-import { Check, ChevronDown } from 'lucide-react'
+import { Check } from 'lucide-react'
import { toast } from 'sonner'
import {
Alert,
AlertDescription,
AlertTitle,
- Collapsible,
- CollapsibleContent,
- CollapsibleTrigger,
Dialog,
DialogContent,
DialogDescription,
@@ -17,6 +14,11 @@ import {
WarningIcon,
} from 'ui'
import { CodeBlock } from 'ui-patterns/CodeBlock'
+import {
+ DialogDisclosure,
+ DialogDisclosureContent,
+ DialogDisclosureTrigger,
+} from 'ui-patterns/DialogDisclosure'
import { ButtonTooltip } from '@/components/ui/ButtonTooltip'
import { DocsButton } from '@/components/ui/DocsButton'
@@ -129,21 +131,18 @@ export const HardenAPIModal = ({ visible, onClose }: HardenAPIModalProps) => {
<DialogSectionSeparator />
- <Collapsible>
- <CollapsibleTrigger className="py-4 px-5 w-full flex items-center justify-between text-sm">
- <p>
- 1. Create a custom <code className="text-code-inline">api</code> schema and expose it
- </p>
- {hasAPISchema && isAPISchemaExposed ? (
- <Check size={16} className="text-primary" />
- ) : (
- <ChevronDown
- size={16}
- className="transition data-open-parent:rotate-180 data-closed-parent:rotate-0"
- />
- )}
- </CollapsibleTrigger>
- <CollapsibleContent className="text-sm text-foreground-light flex flex-col gap-y-4">
+ <DialogDisclosure>
+ <DialogDisclosureTrigger
+ className="py-4 px-5"
+ icon={
+ hasAPISchema && isAPISchemaExposed ? (
+ <Check size={16} className="text-primary" />
+ ) : undefined
+ }
+ >
+ 1. Create a custom <code className="text-code-inline">api</code> schema and expose it
+ </DialogDisclosureTrigger>
+ <DialogDisclosureContent className="text-sm text-foreground-light flex flex-col gap-y-4">
<p className="mx-5">
Click the button below to create a new schema named{' '}
<code className="text-code-inline">api</code> and grant the{' '}
@@ -207,27 +206,20 @@ export const HardenAPIModal = ({ visible, onClose }: HardenAPIModalProps) => {
{`grant select on table api.<your_table> to anon;\ngrant select, insert, update, delete on table api.<your_table> to authenticated;`}
</CodeBlock>
</div>
- </CollapsibleContent>
- </Collapsible>
+ </DialogDisclosureContent>
+ </DialogDisclosure>
<DialogSectionSeparator />
- <Collapsible>
- <CollapsibleTrigger className="py-4 px-5 w-full flex items-center justify-between text-sm">
- <p>
- 2. Remove the <code className="text-code-inline">public</code> schema from the exposed
- schemas
- </p>
- {!isPublicSchemaExposed ? (
- <Check size={16} className="text-primary" />
- ) : (
- <ChevronDown
- size={16}
- className="transition data-open-parent:rotate-180 data-closed-parent:rotate-0"
- />
- )}
- </CollapsibleTrigger>
- <CollapsibleContent className="text-sm text-foreground-light">
+ <DialogDisclosure>
+ <DialogDisclosureTrigger
+ className="py-4 px-5"
+ icon={!isPublicSchemaExposed ? <Check size={16} className="text-primary" /> : undefined}
+ >
+ 2. Remove the <code className="text-code-inline">public</code> schema from the exposed
+ schemas
+ </DialogDisclosureTrigger>
+ <DialogDisclosureContent className="text-sm text-foreground-light">
<div className="px-5 pb-4 flex flex-col gap-y-4">
<Alert variant="warning">
<WarningIcon />
@@ -262,8 +254,8 @@ export const HardenAPIModal = ({ visible, onClose }: HardenAPIModalProps) => {
Remove public schema from exposed schemas
</ButtonTooltip>
</div>
- </CollapsibleContent>
- </Collapsible>
+ </DialogDisclosureContent>
+ </DialogDisclosure>
</DialogContent>
</Dialog>
)
diff --git a/apps/studio/components/interfaces/SignIn/SessionTimeoutModal.tsx b/apps/studio/components/interfaces/SignIn/SessionTimeoutModal.tsx
index 89cf1b1b073..805af55ce7f 100644
--- a/apps/studio/components/interfaces/SignIn/SessionTimeoutModal.tsx
+++ b/apps/studio/components/interfaces/SignIn/SessionTimeoutModal.tsx
@@ -12,8 +12,14 @@ import {
AlertDialogHeader,
AlertDialogTitle,
Button,
+ DialogSection,
+ DialogSectionSeparator,
} from 'ui'
-import { CollapsibleAlert } from 'ui-patterns/collapsible-alert'
+import {
+ DialogDisclosure,
+ DialogDisclosureContent,
+ DialogDisclosureTrigger,
+} from 'ui-patterns/DialogDisclosure'
import { SupportLink } from '../Support/SupportLink'
import { InlineLink, InlineLinkClassName } from '@/components/ui/InlineLink'
@@ -54,45 +60,47 @@ export const SessionTimeoutModal = ({
<AlertDialogContent size="small">
<AlertDialogHeader>
<AlertDialogTitle>Session expired</AlertDialogTitle>
- <AlertDialogDescription asChild>
- <div className="space-y-4">
- <p>Please sign in again to continue.</p>
- <CollapsibleAlert trigger="Having trouble?">
- <div className="space-y-3 text-foreground-light">
- <p>
- Try a different browser or disable extensions that block network requests. If
- the problem persists:
- </p>
- <Button size="tiny" onClick={handleClearStorage}>
- Clear site data and reload
- </Button>
- <p>
- Still stuck?{' '}
- <SupportLink
- className={InlineLinkClassName}
- queryParams={{
- subject: 'Session expired',
- category: SupportCategories.LOGIN_ISSUES,
- ...(supportContext?.projectRef && {
- projectRef: supportContext.projectRef,
- }),
- ...(supportContext?.orgSlug && { orgSlug: supportContext.orgSlug }),
- }}
- onClick={onClose}
- >
- Contact support
- </SupportLink>{' '}
- and include a{' '}
- <InlineLink href="https://github.com/orgs/supabase/discussions/36540">
- HAR file
- </InlineLink>{' '}
- from your session to help us investigate.
- </p>
- </div>
- </CollapsibleAlert>
- </div>
- </AlertDialogDescription>
+ <AlertDialogDescription>Please sign in again to continue.</AlertDialogDescription>
</AlertDialogHeader>
+ <DialogSectionSeparator />
+ <DialogDisclosure>
+ <DialogDisclosureTrigger className="py-4 px-5">Having trouble?</DialogDisclosureTrigger>
+ <DialogDisclosureContent>
+ <DialogSection className="px-5 pt-1 text-sm">
+ <div className="space-y-3 text-foreground-light">
+ <p>
+ Try a different browser or disable extensions that block network requests. If the
+ problem persists:
+ </p>
+ <Button size="tiny" onClick={handleClearStorage}>
+ Clear site data and reload
+ </Button>
+ <p>
+ Still stuck?{' '}
+ <SupportLink
+ className={InlineLinkClassName}
+ queryParams={{
+ subject: 'Session expired',
+ category: SupportCategories.LOGIN_ISSUES,
+ ...(supportContext?.projectRef && {
+ projectRef: supportContext.projectRef,
+ }),
+ ...(supportContext?.orgSlug && { orgSlug: supportContext.orgSlug }),
+ }}
+ onClick={onClose}
+ >
+ Contact support
+ </SupportLink>{' '}
+ and include a{' '}
+ <InlineLink href="https://github.com/orgs/supabase/discussions/36540">
+ HAR file
+ </InlineLink>{' '}
+ from your session to help us investigate.
+ </p>
+ </div>
+ </DialogSection>
+ </DialogDisclosureContent>
+ </DialogDisclosure>
<AlertDialogFooter>
<AlertDialogCancel>Close</AlertDialogCancel>
<AlertDialogAction onClick={redirectToSignIn}>Sign in again</AlertDialogAction>
diff --git a/e2e/studio/features/database.spec.ts b/e2e/studio/features/database.spec.ts
index 8a056f397c2..32913206ffa 100644
--- a/e2e/studio/features/database.spec.ts
+++ b/e2e/studio/features/database.spec.ts
@@ -900,7 +900,7 @@ test.describe('Database Extensions', () => {
const dialog = page.getByRole('dialog')
await expect(dialog, 'Enable extension dialog should be visible').toBeVisible()
await expect(
- dialog.getByText(`Confirm to enable ${EXTENSION_NAME}`),
+ dialog.getByRole('heading', { name: `Enable ${EXTENSION_NAME}`, exact: true }),
'Dialog title should match extension name'
).toBeVisible()
await expect(
@@ -915,7 +915,7 @@ test.describe('Database Extensions', () => {
ref,
'query?key=database-extensions'
)
- await dialog.getByRole('button', { name: 'Enable extension' }).click()
+ await dialog.getByRole('button', { name: 'Enable', exact: true }).click()
await enableWait
await refetchWait
diff --git a/packages/config/typography.css b/packages/config/typography.css
index bf85aef7b7a..7c67d8a4eb2 100644
--- a/packages/config/typography.css
+++ b/packages/config/typography.css
@@ -47,7 +47,7 @@
/* Pair with `code` elements for semantic consistency, e.g. <code className="text-code-inline"> */
@utility text-code-inline {
- @apply break-all text-xs tracking-tight bg-surface-200 border border-muted rounded-md px-1 py-0.5 text-foreground font-medium;
+ @apply break-all text-xs tracking-tight bg-surface-200 border border-muted rounded-sm px-1 py-0.25 text-foreground font-medium;
}
@layer base {
diff --git a/packages/ui-patterns/package.json b/packages/ui-patterns/package.json
index 0ac7fca083a..47ad8e52f2b 100644
--- a/packages/ui-patterns/package.json
+++ b/packages/ui-patterns/package.json
@@ -298,6 +298,10 @@
"import": "./src/DatePicker/index.ts",
"types": "./src/DatePicker/index.ts"
},
+ "./DialogDisclosure": {
+ "import": "./src/DialogDisclosure.tsx",
+ "types": "./src/DialogDisclosure.tsx"
+ },
"./Dialogs/ConfirmationModal": {
"import": "./src/Dialogs/ConfirmationModal.tsx",
"types": "./src/Dialogs/ConfirmationModal.tsx"
@@ -702,10 +706,6 @@
"import": "./src/TweetCard/index.tsx",
"types": "./src/TweetCard/index.tsx"
},
- "./collapsible-alert": {
- "import": "./src/collapsible-alert.tsx",
- "types": "./src/collapsible-alert.tsx"
- },
"./consent": {
"import": "./src/consent.tsx",
"types": "./src/consent.tsx"
diff --git a/packages/ui-patterns/src/DialogDisclosure.tsx b/packages/ui-patterns/src/DialogDisclosure.tsx
new file mode 100644
index 00000000000..fb69dd93c33
--- /dev/null
+++ b/packages/ui-patterns/src/DialogDisclosure.tsx
@@ -0,0 +1,47 @@
+import { ChevronDown } from 'lucide-react'
+import type { ComponentProps, ReactNode } from 'react'
+import { cn, Collapsible, CollapsibleContent, CollapsibleTrigger } from 'ui'
+
+type DialogDisclosureTriggerProps = ComponentProps<typeof CollapsibleTrigger> & {
+ icon?: ReactNode
+}
+
+export const DialogDisclosure: typeof Collapsible = Collapsible
+
+export const DialogDisclosureTrigger = ({
+ children,
+ className,
+ icon,
+ ...props
+}: DialogDisclosureTriggerProps) => (
+ <CollapsibleTrigger
+ className={cn(
+ 'group/trigger flex w-full cursor-pointer items-center justify-between gap-2 text-left text-sm text-foreground-light transition-colors hover:bg-muted hover:text-foreground motion-reduce:transition-none',
+ className
+ )}
+ {...props}
+ >
+ <span>{children}</span>
+ <span aria-hidden="true" className="shrink-0">
+ {icon ?? (
+ <ChevronDown
+ size={16}
+ className="transition-transform group-data-open/trigger:rotate-180 motion-reduce:transition-none"
+ />
+ )}
+ </span>
+ </CollapsibleTrigger>
+)
+
+export const DialogDisclosureContent = ({
+ className,
+ ...props
+}: ComponentProps<typeof CollapsibleContent>) => (
+ <CollapsibleContent
+ className={cn(
+ '[overflow-y:clip] data-closed:animate-collapsible-up data-open:animate-collapsible-down motion-reduce:animate-none',
+ className
+ )}
+ {...props}
+ />
+)
diff --git a/packages/ui-patterns/src/collapsible-alert.tsx b/packages/ui-patterns/src/collapsible-alert.tsx
deleted file mode 100644
index b83b8bc27d0..00000000000
--- a/packages/ui-patterns/src/collapsible-alert.tsx
+++ /dev/null
@@ -1,46 +0,0 @@
-'use client'
-
-import { type VariantProps } from 'class-variance-authority'
-import { ChevronDown } from 'lucide-react'
-import * as React from 'react'
-import { alertVariants, Button, cn, Collapsible, CollapsibleContent, CollapsibleTrigger } from 'ui'
-
-export interface CollapsibleAlertProps
- extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'>, VariantProps<typeof alertVariants> {
- trigger: React.ReactNode
- defaultOpen?: boolean
-}
-
-const CollapsibleAlert = React.forwardRef<HTMLDivElement, CollapsibleAlertProps>(
- ({ className, variant = 'default', trigger, defaultOpen, children, ...props }, ref) => (
- <div
- ref={ref}
- className={cn(
- alertVariants({ variant }),
- // Override default padding to be tighter
- 'p-3',
- className
- )}
- {...props}
- >
- <Collapsible defaultOpen={defaultOpen}>
- <div className="flex items-center justify-between gap-2">
- <span className="font-medium">{trigger}</span>
- <CollapsibleTrigger asChild>
- <Button
- variant="outline"
- size="tiny"
- className={cn('px-0! w-[26px]', '[&[data-state=open]_svg]:rotate-180')}
- aria-label="Toggle"
- icon={<ChevronDown className="transition-transform duration-200" />}
- />
- </CollapsibleTrigger>
- </div>
- <CollapsibleContent className="pt-3">{children}</CollapsibleContent>
- </Collapsible>
- </div>
- )
-)
-CollapsibleAlert.displayName = 'CollapsibleAlert'
-
-export { CollapsibleAlert }
diff --git a/packages/ui/src/components/shadcn/ui/alert-dialog.tsx b/packages/ui/src/components/shadcn/ui/alert-dialog.tsx
index e02c894c259..b18691c9e7a 100644
--- a/packages/ui/src/components/shadcn/ui/alert-dialog.tsx
+++ b/packages/ui/src/components/shadcn/ui/alert-dialog.tsx
@@ -215,7 +215,7 @@ const AlertDialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDiv
<div
data-slot="alert-dialog-footer"
className={cn(
- 'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 border-t py-3 px-5 [[data-slot=alert-dialog-body]:has(>[role=alert])+&]:border-t-0',
+ 'flex flex-col-reverse gap-y-2 sm:flex-row sm:justify-end sm:space-x-2 border-t py-3 px-5 [[data-slot=alert-dialog-body]:has(>[role=alert])+&]:border-t-0',
className
)}
{...props}
@@ -373,11 +373,7 @@ const AlertDialogCancel = React.forwardRef<
return (
<AlertDialogPrimitive.Cancel
ref={ref}
- className={cn(
- buttonVariants({ variant: 'default', size: 'tiny' }),
- 'mt-2 sm:mt-0',
- className
- )}
+ className={cn(buttonVariants({ variant: 'default', size: 'tiny' }), className)}
disabled={disabled || alertDialogContext?.loading}
{...props}
/>
diff --git a/packages/ui/src/components/shadcn/ui/dialog.tsx b/packages/ui/src/components/shadcn/ui/dialog.tsx
index 226ef4b0003..f5aab7d251d 100644
--- a/packages/ui/src/components/shadcn/ui/dialog.tsx
+++ b/packages/ui/src/components/shadcn/ui/dialog.tsx
@@ -153,7 +153,7 @@ const DialogFooter = React.forwardRef<
<div
ref={ref}
className={cn(
- 'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2',
+ 'flex flex-col-reverse gap-y-2 sm:flex-row sm:justify-end sm:space-x-2',
'border-t',
DialogPaddingVariants({ padding }),
className
@@ -193,11 +193,13 @@ DialogDescription.displayName = DialogPrimitive.Description.displayName
const DialogClose = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Close>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>
->(({ className, children, ...props }, ref) => (
+>(({ className, children, asChild, ...props }, ref) => (
<DialogPrimitive.Close
ref={ref}
+ asChild={asChild}
className={cn(
- 'opacity-70 transition-opacity hover:opacity-100 focus-ring disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-foreground-muted',
+ !asChild &&
+ 'opacity-70 transition-opacity hover:opacity-100 focus-ring disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-foreground-muted',
className
)}
{...props}