Skip to content

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

chore(studio): improve alert composition and usage (#41147)

Danny White11dc1324aa4d
diff --git a/apps/design-system/__registry__/index.tsx b/apps/design-system/__registry__/index.tsx
index d5b4bf103ba..a98b01a6c46 100644
--- a/apps/design-system/__registry__/index.tsx
+++ b/apps/design-system/__registry__/index.tsx
@@ -148,17 +148,6 @@ export const Index: Record<string, any> = {
subcategory: "undefined",
chunks: []
},
- "alert-destructive": {
- name: "alert-destructive",
- type: "components:example",
- registryDependencies: ["alert"],
- component: React.lazy(() => import("@/registry/default/example/alert-destructive")),
- source: "",
- files: ["registry/default/example/alert-destructive.tsx"],
- category: "undefined",
- subcategory: "undefined",
- chunks: []
- },
"alert-dialog-demo": {
name: "alert-dialog-demo",
type: "components:example",
diff --git a/apps/design-system/components/side-navigation.tsx b/apps/design-system/components/side-navigation.tsx
index eaa3e89cc25..19b204be8d1 100644
--- a/apps/design-system/components/side-navigation.tsx
+++ b/apps/design-system/components/side-navigation.tsx
@@ -1,5 +1,5 @@
-import { docsConfig } from '@/config/docs'
import NavigationItem from '@/components/side-navigation-item'
+import { docsConfig } from '@/config/docs'
function SideNavigation() {
return (
@@ -9,7 +9,16 @@ function SideNavigation() {
<div className="font-mono uppercase text-xs text-foreground-lighter/75 mb-2 px-6 tracking-widest">
{section.title}
</div>
- {section.items.map((item, i) => (
+ {(section.sortOrder === 'alphabetical'
+ ? (() => {
+ const priorityItems = section.items.filter((item) => item.priority)
+ const regularItems = section.items
+ .filter((item) => !item.priority)
+ .sort((a, b) => a.title.localeCompare(b.title))
+ return [...priorityItems, ...regularItems]
+ })()
+ : section.items
+ ).map((item, i) => (
<NavigationItem item={item} key={`${item.href}-${i}`} />
))}
</div>
diff --git a/apps/design-system/config/docs.ts b/apps/design-system/config/docs.ts
index 5a9fc2cbb8c..2d5b6d2cd23 100644
--- a/apps/design-system/config/docs.ts
+++ b/apps/design-system/config/docs.ts
@@ -9,6 +9,7 @@ export const docsConfig: DocsConfig = {
sidebarNav: [
{
title: 'Getting Started',
+ sortOrder: 'manual',
items: [
{
title: 'Introduction',
@@ -49,11 +50,13 @@ export const docsConfig: DocsConfig = {
},
{
title: 'UI Patterns',
+ sortOrder: 'alphabetical',
items: [
{
title: 'Introduction',
- href: '/docs/ui-patterns/ui-pattern-components',
+ href: '/docs/ui-patterns/ui-patterns',
items: [],
+ priority: true,
},
{
title: 'Navigation',
@@ -79,11 +82,13 @@ export const docsConfig: DocsConfig = {
},
{
title: 'Fragment Components',
+ sortOrder: 'alphabetical',
items: [
{
title: 'Introduction',
href: '/docs/fragments/fragment-components',
items: [],
+ priority: true,
},
{
title: 'Admonition',
@@ -174,11 +179,13 @@ export const docsConfig: DocsConfig = {
},
{
title: 'Atom Components',
+ sortOrder: 'alphabetical',
items: [
{
title: 'Introduction',
href: '/docs/components/atom-components',
items: [],
+ priority: true,
},
{
title: 'Accordion',
diff --git a/apps/design-system/content/docs/components/alert.mdx b/apps/design-system/content/docs/components/alert.mdx
index 5923eaf90d9..3204cf452e8 100644
--- a/apps/design-system/content/docs/components/alert.mdx
+++ b/apps/design-system/content/docs/components/alert.mdx
@@ -7,47 +7,19 @@ source:
shadcn: true
---
-The primitive component that forms [Admonition](../fragments/admonition). Do not use this component unless you are intentionally deviating from our consistent callout pattern.
+Alert forms the core primitives for [Admonition](../fragments/admonition). Use the Admonition component unless you must deviate from our consistent patterns. Examples where Alert might make sense include:
-<ComponentPreview
- name="alert-demo"
- description="An alert with an icon, title and description. The title says 'Heads up!' and the description is 'You can add components to your app using the cli.'."
- peekCode
- wide
-/>
+- Bespoke icon requirement
+- Highly custom internal contents
-## Installation
-
-<Tabs defaultValue="cli">
+<ComponentPreview name="alert-demo" peekCode wide />
-<TabsList>
- <TabsTrigger value="cli">CLI</TabsTrigger>
- <TabsTrigger value="manual">Manual</TabsTrigger>
-</TabsList>
-<TabsContent value="cli">
+## Installation
```bash
npx shadcn-ui@latest add alert
```
-</TabsContent>
-
-<TabsContent value="manual">
-
-<Steps>
-
-<Step>Copy and paste the following code into your project.</Step>
-
-<ComponentSource name="alert" />
-
-<Step>Update the import paths to match your project setup.</Step>
-
-</Steps>
-
-</TabsContent>
-
-</Tabs>
-
## Usage
```tsx
@@ -63,19 +35,3 @@ import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'
</AlertDescription>
</Alert>
```
-
-## Examples
-
-### Default
-
-<ComponentPreview
- name="alert-demo"
- description="An alert with an icon, title and description. The title says 'Heads up!' and the description is 'You can add components to your app using the cli.'."
-/>
-
-### Destructive
-
-<ComponentPreview
- name="alert-destructive"
- description="An alert with a destructive variant. The title says 'Delete this item?' and the description is 'This action cannot be undone.'."
-/>
diff --git a/apps/design-system/content/docs/fragments/admonition.mdx b/apps/design-system/content/docs/fragments/admonition.mdx
index 5913866d970..0143008fcd9 100644
--- a/apps/design-system/content/docs/fragments/admonition.mdx
+++ b/apps/design-system/content/docs/fragments/admonition.mdx
@@ -4,7 +4,7 @@ description: Displays a callout for user attention.
fragment: true
---
-Admonition provides focus for situations that require a callout. Use this instead of [Alert](../components/alert) unless you specifically need the primitives.
+Admonition provides focus for situations that require a callout.
<ComponentPreview
name="admonition-demo"
@@ -13,6 +13,8 @@ Admonition provides focus for situations that require a callout. Use this instea
wide
/>
+Use Admonition instead of [Alert](../components/alert) unless you specifically need the primitives. If in doubt, stick with Admonition.
+
## Usage
```tsx
@@ -54,6 +56,13 @@ Only ever use the `primary` (green) button `type` on a `default` Admonition. Eve
className="[&_.preview>[data-orientation=vertical]]:sm:max-w-[70%]"
/>
+There are several components that wrap the `warning` Admonition type with reusable text or functionality. These include:
+
+- AlertError
+- NoPermission
+
+AlertError for example rolls up consistent error handling and support contact methods.
+
### Destructive
<ComponentPreview
diff --git a/apps/design-system/content/docs/ui-patterns/empty-states.mdx b/apps/design-system/content/docs/ui-patterns/empty-states.mdx
index 709a72fba93..851f3cbfa98 100644
--- a/apps/design-system/content/docs/ui-patterns/empty-states.mdx
+++ b/apps/design-system/content/docs/ui-patterns/empty-states.mdx
@@ -14,7 +14,7 @@ There are two ways an empty state may be displayed in cases where there is no da
### Initial state
-Perhaps the user has not yet created any data. The presentation of this empty state depends on the context of the list and the type of data it contains.
+Perhaps the user has not yet created any data. The presentation of this empty state depends on the context of the list and the type of data it contains. Be mindful of the journey to rendering an empty state and any possible layout shift along the way.
#### Presentational
@@ -22,7 +22,7 @@ The user may be learning about a feature for the first time, and could benefit f
<ComponentPreview name="empty-state-presentational-icon" peekCode wide />
-Remember to use active language in these cases. For example: “Create a vector bucket” instead of “No vector buckets found”. The latter is more appropriate in table-based presentations, as described below.
+Remember to use active language in presentational empty states. For example: “Create a vector bucket” instead of “No vector buckets found”. The latter is more appropriate in table-based presentations, as described below.
#### Informational
diff --git a/apps/design-system/content/docs/ui-patterns/ui-pattern-components.mdx b/apps/design-system/content/docs/ui-patterns/ui-patterns.mdx
similarity index 86%
rename from apps/design-system/content/docs/ui-patterns/ui-pattern-components.mdx
rename to apps/design-system/content/docs/ui-patterns/ui-patterns.mdx
index 0e5d924e0a9..51fd64b26fa 100644
--- a/apps/design-system/content/docs/ui-patterns/ui-pattern-components.mdx
+++ b/apps/design-system/content/docs/ui-patterns/ui-patterns.mdx
@@ -1,9 +1,9 @@
---
-title: UI Pattern components
-description: Higher-level design patterns that guide how to compose components together to solve common interface problems.
+title: UI patterns
+description: Higher-level guidance on how to compose components together to solve common interface problems.
---
-UI Patterns are reusable design solutions that combine multiple components from our design system to address common interface challenges. Unlike atom components (basic building blocks like buttons and inputs) or fragment components (pre-built composite components), UI patterns provide guidelines and best practices for structuring entire interface sections.
+UI patterns are reusable design solutions that combine multiple components from our design system to address common interface challenges. Unlike atom components (basic building blocks like buttons and inputs) or fragment components (pre-built composite components), UI patterns provide guidelines and best practices for structuring entire interface sections.
These patterns help ensure consistency across Supabase products by establishing standard approaches for:
diff --git a/apps/design-system/registry/default/example/admonition-demo.tsx b/apps/design-system/registry/default/example/admonition-demo.tsx
index f4e7ecc3a4d..75040b9fc63 100644
--- a/apps/design-system/registry/default/example/admonition-demo.tsx
+++ b/apps/design-system/registry/default/example/admonition-demo.tsx
@@ -1,4 +1,3 @@
-import Link from 'next/link'
import { Button } from 'ui'
import { Admonition } from 'ui-patterns/admonition'
@@ -7,20 +6,10 @@ export default function AdmonitionDemo() {
<Admonition
type="default"
layout="horizontal"
- className="mb-12 [&>div]:!translate-y-0"
title="OAuth Server is disabled"
description="Enable OAuth Server to make your project act as an identity provider for
third-party applications."
- actions={
- <Button asChild type="default">
- <Link
- href={`/`}
- onClick={(e) => e.preventDefault()} // Just for demo
- >
- OAuth Server Settings
- </Link>
- </Button>
- }
+ actions={<Button type="default">OAuth Server Settings</Button>}
/>
)
}
diff --git a/apps/design-system/registry/default/example/alert-demo.tsx b/apps/design-system/registry/default/example/alert-demo.tsx
index 311b4bc8d62..cbb9ce1b70e 100644
--- a/apps/design-system/registry/default/example/alert-demo.tsx
+++ b/apps/design-system/registry/default/example/alert-demo.tsx
@@ -1,14 +1,13 @@
import { Terminal } from 'lucide-react'
-
import { Alert_Shadcn_, AlertDescription_Shadcn_, AlertTitle_Shadcn_ } from 'ui'
export default function AlertDemo() {
return (
<Alert_Shadcn_>
- <Terminal className="h-4 w-4" />
+ <Terminal size={16} />
<AlertTitle_Shadcn_>Heads up!</AlertTitle_Shadcn_>
<AlertDescription_Shadcn_>
- You can add components to your app using the cli.
+ You can also add components to your app using the CLI.
</AlertDescription_Shadcn_>
</Alert_Shadcn_>
)
diff --git a/apps/design-system/registry/default/example/alert-destructive.tsx b/apps/design-system/registry/default/example/alert-destructive.tsx
deleted file mode 100644
index 67c3b747149..00000000000
--- a/apps/design-system/registry/default/example/alert-destructive.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-import { AlertCircle } from 'lucide-react'
-
-import { Alert_Shadcn_, AlertDescription_Shadcn_, AlertTitle_Shadcn_ } from 'ui'
-
-export default function AlertDestructive() {
- return (
- <Alert_Shadcn_ variant="destructive">
- <AlertCircle className="h-4 w-4" />
- <AlertTitle_Shadcn_>Error</AlertTitle_Shadcn_>
- <AlertDescription_Shadcn_>
- Your session has expired. Please log in again.
- </AlertDescription_Shadcn_>
- </Alert_Shadcn_>
- )
-}
diff --git a/apps/design-system/registry/examples.ts b/apps/design-system/registry/examples.ts
index b36700bca15..f3fcc100e0a 100644
--- a/apps/design-system/registry/examples.ts
+++ b/apps/design-system/registry/examples.ts
@@ -37,12 +37,6 @@ export const examples: Registry = [
registryDependencies: ['alert'],
files: ['example/alert-demo.tsx'],
},
- {
- name: 'alert-destructive',
- type: 'components:example',
- registryDependencies: ['alert'],
- files: ['example/alert-destructive.tsx'],
- },
{
name: 'alert-dialog-demo',
type: 'components:example',
diff --git a/apps/design-system/types/nav.ts b/apps/design-system/types/nav.ts
index 662ed86f112..bc1dca513d3 100644
--- a/apps/design-system/types/nav.ts
+++ b/apps/design-system/types/nav.ts
@@ -7,10 +7,12 @@ export interface NavItem {
external?: boolean
icon?: any // to do: clean up later | keyof typeof Icons
label?: string
+ priority?: boolean // If true, item appears first even when section is sorted alphabetically
}
export interface NavItemWithChildren extends NavItem {
items: NavItemWithChildren[]
+ sortOrder?: 'manual' | 'alphabetical' // Sidebar navigation sort order for top-level sections
}
export interface MainNavItem extends NavItem {}
diff --git a/apps/docs/features/docs/MdxBase.shared.tsx b/apps/docs/features/docs/MdxBase.shared.tsx
index 5826c493b38..94f8b90eda0 100644
--- a/apps/docs/features/docs/MdxBase.shared.tsx
+++ b/apps/docs/features/docs/MdxBase.shared.tsx
@@ -1,11 +1,11 @@
import { ArrowDown, Check, X } from 'lucide-react'
import Link from 'next/link'
import { Button, Image } from 'ui'
-import { Heading } from 'ui/src/components/CustomHTMLElements'
-import { Admonition } from 'ui-patterns/admonition'
+import { Admonition, type AdmonitionProps } from 'ui-patterns/admonition'
import { GlassPanel } from 'ui-patterns/GlassPanel'
import { IconPanel } from 'ui-patterns/IconPanel'
import SqlToRest from 'ui-patterns/SqlToRest'
+import { Heading } from 'ui/src/components/CustomHTMLElements'
import { AiPromptsIndex } from '~/app/guides/getting-started/ai-prompts/[slug]/AiPromptsIndex'
import { AppleSecretGenerator } from '~/components/AppleSecretGenerator'
import AuthProviders from '~/components/AuthProviders'
@@ -32,10 +32,15 @@ import { TabPanel, Tabs } from '~/features/ui/Tabs'
import { ErrorCodes } from '../ui/ErrorCodes'
import { McpConfigPanel } from '../ui/McpConfigPanel'
+// Wrap Admonition for Docs-specific styling (within MDX prose, requires a margin-bottom)
+const AdmonitionWithMargin = (props: AdmonitionProps) => {
+ return <Admonition {...props} className="mb-8" />
+}
+
const components = {
Accordion,
AccordionItem,
- Admonition,
+ Admonition: AdmonitionWithMargin,
AiPromptsIndex,
AuthSmsProviderConfig,
AppleSecretGenerator,
diff --git a/apps/studio/components/interfaces/Auth/AuditLogsForm.tsx b/apps/studio/components/interfaces/Auth/AuditLogsForm.tsx
index 2360c85a048..abbd5d5bb59 100644
--- a/apps/studio/components/interfaces/Auth/AuditLogsForm.tsx
+++ b/apps/studio/components/interfaces/Auth/AuditLogsForm.tsx
@@ -6,7 +6,7 @@ import { toast } from 'sonner'
import { boolean, object } from 'yup'
import { useParams } from 'common'
-import AlertError from 'components/ui/AlertError'
+import { AlertError } from 'components/ui/AlertError'
import { InlineLink } from 'components/ui/InlineLink'
import { useAuthConfigQuery } from 'data/auth/auth-config-query'
import { useAuthConfigUpdateMutation } from 'data/auth/auth-config-update-mutation'
@@ -171,20 +171,23 @@ export const AuditLogsForm = () => {
type="warning"
className="mt-4"
title="Disabling PostgreSQL storage will not automatically migrate or transfer existing audit log data"
- >
- <p className="!mb-0 !leading-normal prose text-foreground-light text-sm max-w-full">
- Future audit logs will only appear in the project's{' '}
- <InlineLink
- target="_blank"
- rel="noopener noreferrer"
- href={`/project/${projectRef}/logs/explorer?q=select%0A++cast(timestamp+as+datetime)+as+timestamp%2C%0A++event_message%2C+metadata+%0Afrom+auth_audit_logs+%0Alimit+10%0A`}
- >
- auth logs
- </InlineLink>
- . You are responsible for backing up, copying, or migrating existing data from
- the <code>{AUDIT_LOG_ENTRIES_TABLE}</code> table if needed.
- </p>
- </Admonition>
+ description={
+ <p>
+ Future audit logs will only appear in the project’s{' '}
+ <InlineLink
+ href={`/project/${projectRef}/logs/explorer?q=select%0A++cast(timestamp+as+datetime)+as+timestamp%2C%0A++event_message%2C+metadata+%0Afrom+auth_audit_logs+%0Alimit+10%0A`}
+ >
+ auth logs
+ </InlineLink>
+ . You are responsible for backing up, copying, or migrating existing data
+ from the{' '}
+ <code className="text-code-inline !break-keep">
+ {AUDIT_LOG_ENTRIES_TABLE}
+ </code>{' '}
+ table if needed.
+ </p>
+ }
+ />
)}
</CardContent>
diff --git a/apps/studio/components/interfaces/Auth/EmailTemplates/EmailTemplates.tsx b/apps/studio/components/interfaces/Auth/EmailTemplates/EmailTemplates.tsx
index 5d17b87701a..bcfc8abba9b 100644
--- a/apps/studio/components/interfaces/Auth/EmailTemplates/EmailTemplates.tsx
+++ b/apps/studio/components/interfaces/Auth/EmailTemplates/EmailTemplates.tsx
@@ -119,50 +119,46 @@ export const EmailTemplates = () => {
return (
<>
{isError && (
- <PageSection className="!pt-0">
+ <PageSection>
<PageSectionContent>
- <AlertError
- className="mt-12"
- error={authConfigError}
- subject="Failed to retrieve auth configuration"
- />
+ <AlertError error={authConfigError} subject="Failed to retrieve auth configuration" />
</PageSectionContent>
</PageSection>
)}
{isLoading && (
- <PageSection className="!pt-0">
+ <PageSection>
<PageSectionContent>
- <div className="w-[854px] mt-12">
- <GenericSkeletonLoader />
- </div>
+ <GenericSkeletonLoader />
</PageSectionContent>
</PageSection>
)}
{isSuccess && (
<>
- {builtInSMTP && (
- <Admonition
- type="warning"
- title="Set up custom SMTP"
- description={
- <p>
- You’re using the built-in email service. This service has rate limits and is not
- meant to be used for production apps.{' '}
- <InlineLink href={`${DOCS_URL}/guides/platform/going-into-prod#auth-rate-limits`}>
- Learn more
- </InlineLink>{' '}
- </p>
- }
- layout="horizontal"
- className="mt-12 mb-10"
- actions={
- <Button asChild type="default" className="mt-2">
- <Link href={`/project/${projectRef}/auth/smtp`}>Set up SMTP</Link>
- </Button>
- }
- />
- )}
- <PageSection className="!pt-0">
+ <PageSection>
+ {builtInSMTP && (
+ <Admonition
+ type="warning"
+ title="Set up custom SMTP"
+ description={
+ <p>
+ You’re using the built-in email service. This service has rate limits and is not
+ meant to be used for production apps.{' '}
+ <InlineLink
+ href={`${DOCS_URL}/guides/platform/going-into-prod#auth-rate-limits`}
+ >
+ Learn more
+ </InlineLink>{' '}
+ </p>
+ }
+ layout="horizontal"
+ className="mb-4"
+ actions={
+ <Button asChild type="default">
+ <Link href={`/project/${projectRef}/auth/smtp`}>Set up SMTP</Link>
+ </Button>
+ }
+ />
+ )}
<PageSectionMeta>
<PageSectionSummary>
<PageSectionTitle>Authentication</PageSectionTitle>
diff --git a/apps/studio/components/interfaces/Auth/OAuthApps/OAuthAppsList.tsx b/apps/studio/components/interfaces/Auth/OAuthApps/OAuthAppsList.tsx
index 9db1788627d..f1416275370 100644
--- a/apps/studio/components/interfaces/Auth/OAuthApps/OAuthAppsList.tsx
+++ b/apps/studio/components/interfaces/Auth/OAuthApps/OAuthAppsList.tsx
@@ -204,7 +204,7 @@ export const OAuthAppsList = () => {
<Admonition
type="default"
layout="horizontal"
- className="mb-8 [&>div]:!translate-y-0"
+ className="mb-8"
title="OAuth Server is disabled"
description="Enable OAuth Server to make your project act as an identity provider for third-party applications."
actions={
diff --git a/apps/studio/components/interfaces/Auth/Policies/PolicyTableRow/index.tsx b/apps/studio/components/interfaces/Auth/Policies/PolicyTableRow/index.tsx
index 8399c067741..585dbb3cf97 100644
--- a/apps/studio/components/interfaces/Auth/Policies/PolicyTableRow/index.tsx
+++ b/apps/studio/components/interfaces/Auth/Policies/PolicyTableRow/index.tsx
@@ -1,18 +1,13 @@
import type { PostgresPolicy } from '@supabase/postgres-meta'
import { noop } from 'lodash'
-import { memo, useCallback, useMemo, useRef } from 'react'
-import { toast } from 'sonner'
+import { memo, useMemo } from 'react'
import { useParams } from 'common'
import AlertError from 'components/ui/AlertError'
import { InlineLink } from 'components/ui/InlineLink'
import { useTablesRolesAccessQuery } from 'data/tables/tables-roles-access-query'
-import { useDatabasePolicyDeleteMutation } from 'data/database-policies/database-policy-delete-mutation'
-import { useQueryStateWithSelect, handleErrorOnDelete } from 'hooks/misc/useQueryStateWithSelect'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import {
- Alert_Shadcn_,
- AlertDescription_Shadcn_,
Card,
CardContent,
CardHeader,
@@ -24,7 +19,6 @@ import {
TableRow,
} from 'ui'
import { Admonition } from 'ui-patterns'
-import ConfirmModal from 'ui-patterns/Dialogs/ConfirmDialog'
import ShimmeringLoader from 'ui-patterns/ShimmeringLoader'
import { usePoliciesData } from '../PoliciesDataContext'
import { PolicyRow } from './PolicyRow'
@@ -109,25 +103,28 @@ const PolicyTableRowComponent = ({
<Admonition
showIcon={false}
type="warning"
- className="border-0 border-y rounded-none [&>div]:text-foreground-light h-[50px] py-0 flex items-center"
+ className="border-0 border-y rounded-none min-h-12 flex items-center"
>
- No data will be selectable via Supabase APIs as this schema is not exposed. You may
- configure this in your project's{' '}
- <InlineLink href={`/project/${ref}/settings/api`}>API settings</InlineLink>.
+ <p className="text-foreground-light">
+ No data will be selectable via Supabase APIs as this schema is not exposed. You may
+ configure this in your project’s{' '}
+ <InlineLink href={`/project/${ref}/settings/api`}>API settings</InlineLink>.
+ </p>
</Admonition>
)}
{(isPubliclyReadableWritable || rlsEnabledNoPolicies) && isTableExposedThroughAPI && (
- <Alert_Shadcn_
- className="border-0 rounded-none mb-0 border-y h-[50px] py-0 flex items-center"
- variant={isPubliclyReadableWritable ? 'warning' : 'default'}
+ <Admonition
+ showIcon={false}
+ type={isPubliclyReadableWritable ? 'warning' : 'default'}
+ className="border-0 border-y rounded-none min-h-12 flex items-center"
>
- <AlertDescription_Shadcn_>
+ <p>
{isPubliclyReadableWritable
- ? "Anyone with your project's anonymous key can read, modify, or delete your data."
+ ? 'Anyone with your project’s anonymous key can read, modify, or delete your data.'
: 'No data will be selectable via Supabase APIs because RLS is enabled but no policies have been created yet.'}
- </AlertDescription_Shadcn_>
- </Alert_Shadcn_>
+ </p>
+ </Admonition>
)}
{isPoliciesLoading && (
diff --git a/apps/studio/components/interfaces/Connect/DatabaseConnectionString.tsx b/apps/studio/components/interfaces/Connect/DatabaseConnectionString.tsx
index c979e203f4e..4708f10e0d7 100644
--- a/apps/studio/components/interfaces/Connect/DatabaseConnectionString.tsx
+++ b/apps/studio/components/interfaces/Connect/DatabaseConnectionString.tsx
@@ -1,5 +1,4 @@
import { BookOpen, ChevronDown, ExternalLink } from 'lucide-react'
-import Link from 'next/link'
import { parseAsString, useQueryState } from 'nuqs'
import { HTMLAttributes, ReactNode, useEffect, useMemo, useState } from 'react'
@@ -34,7 +33,6 @@ import {
Separator,
cn,
} from 'ui'
-import { Admonition } from 'ui-patterns'
import {
CONNECTION_PARAMETERS,
type ConnectionStringMethod,
@@ -524,50 +522,36 @@ export const DatabaseConnectionString = () => {
)}
{selectedMethod === 'session' && IS_PLATFORM && (
- <>
- {sharedPoolerPreferred && ipv4Addon && (
- <Admonition
- type="warning"
- title="Highly recommended to not use Session Pooler"
- className="[&>div]:gap-0 px-8 [&>svg]:left-7 border-0 border-b rounded-none border-border-muted !py-4"
- >
- <p className="text-sm text-foreground-lighter !mb-0">
- If you are using Session Pooler, we recommend switching to Direct
- Connection.
- </p>
- </Admonition>
+ <ConnectionPanel
+ type="session"
+ title={connectionStringMethodOptions.session.label}
+ contentType={contentType}
+ lang={lang}
+ badge="Shared Pooler"
+ fileTitle={fileTitle}
+ description={connectionStringMethodOptions.session.description}
+ connectionString={supavisorConnectionStrings['pooler'][selectedTab].replace(
+ '6543',
+ '5432'
)}
- <ConnectionPanel
- type="session"
- title={connectionStringMethodOptions.session.label}
- contentType={contentType}
- lang={lang}
- badge="Shared Pooler"
- fileTitle={fileTitle}
- description={connectionStringMethodOptions.session.description}
- connectionString={supavisorConnectionStrings['pooler'][selectedTab].replace(
- '6543',
- '5432'
- )}
- ipv4Status={{
- type: 'success',
- title: 'IPv4 compatible',
- description: 'Session pooler connections are IPv4 proxied for free',
- links: undefined,
- }}
- parameters={[
- { ...CONNECTION_PARAMETERS.host, value: sharedPoolerConfig?.db_host ?? '' },
- { ...CONNECTION_PARAMETERS.port, value: '5432' },
- {
- ...CONNECTION_PARAMETERS.database,
- value: sharedPoolerConfig?.db_name ?? '',
- },
- { ...CONNECTION_PARAMETERS.user, value: sharedPoolerConfig?.db_user ?? '' },
- { ...CONNECTION_PARAMETERS.pool_mode, value: 'session' },
- ]}
- onCopyCallback={() => handleCopy(selectedTab, 'session_pooler')}
- />
- </>
+ ipv4Status={{
+ type: 'success',
+ title: 'IPv4 compatible',
+ description: 'Session pooler connections are IPv4 proxied for free',
+ links: undefined,
+ }}
+ parameters={[
+ { ...CONNECTION_PARAMETERS.host, value: sharedPoolerConfig?.db_host ?? '' },
+ { ...CONNECTION_PARAMETERS.port, value: '5432' },
+ {
+ ...CONNECTION_PARAMETERS.database,
+ value: sharedPoolerConfig?.db_name ?? '',
+ },
+ { ...CONNECTION_PARAMETERS.user, value: sharedPoolerConfig?.db_user ?? '' },
+ { ...CONNECTION_PARAMETERS.pool_mode, value: 'session' },
+ ]}
+ onCopyCallback={() => handleCopy(selectedTab, 'session_pooler')}
+ />
)}
</div>
</div>
@@ -654,10 +638,18 @@ const ConnectionStringMethodSelectItem = ({
const badges: ReactNode[] = []
if (method !== 'direct') {
- badges.push(<Badge className="flex gap-x-1">Shared Pooler</Badge>)
+ badges.push(
+ <Badge key="direct" className="flex gap-x-1">
+ Shared Pooler
+ </Badge>
+ )
}
if (poolerBadge === 'Dedicated Pooler') {
- badges.push(<Badge className="flex gap-x-1">{poolerBadge}</Badge>)
+ badges.push(
+ <Badge key="dedicated" className="flex gap-x-1">
+ {poolerBadge}
+ </Badge>
+ )
}
return (
diff --git a/apps/studio/components/interfaces/Database/ProtectedSchemaWarning.tsx b/apps/studio/components/interfaces/Database/ProtectedSchemaWarning.tsx
index c00c13ad14f..a8efc3e0a8a 100644
--- a/apps/studio/components/interfaces/Database/ProtectedSchemaWarning.tsx
+++ b/apps/studio/components/interfaces/Database/ProtectedSchemaWarning.tsx
@@ -68,31 +68,37 @@ export const ProtectedSchemaWarning = ({
if (!isSchemaLocked) return null
+ const showLearnMoreDialog =
+ reason !== 'fdw' || (fdwType !== 'iceberg' && fdwType !== 's3_vectors')
+
return (
<Admonition
showIcon={size === 'sm' ? false : true}
+ layout={size === 'sm' ? 'vertical' : 'horizontal'}
type="note"
title={
size === 'sm' ? `Viewing protected schema` : `Viewing ${entity} from a protected schema`
}
- className="[&_p]:!m-0"
- >
- {reason === 'fdw' && fdwType === 'iceberg' ? (
- <p>
- The <code className="text-code-inline">{schema}</code> schema is used by Supabase to
- connect to analytics buckets and is read-only through the dashboard.
- </p>
- ) : reason === 'fdw' && fdwType === 's3_vectors' ? (
- <p>
- The <code className="text-code-inline">{schema}</code> schema is used by Supabase to
- connect to vector buckets and is read-only through the dashboard.
- </p>
- ) : (
- <>
- <p className="mb-2">
+ description={
+ reason === 'fdw' && fdwType === 'iceberg' ? (
+ <p>
+ The <code className="text-code-inline">{schema}</code> schema is used by Supabase to
+ connect to analytics buckets and is read-only through the dashboard.
+ </p>
+ ) : reason === 'fdw' && fdwType === 's3_vectors' ? (
+ <p>
+ The <code className="text-code-inline">{schema}</code> schema is used by Supabase to
+ connect to vector buckets and is read-only through the dashboard.
+ </p>
+ ) : (
+ <p>
The <code className="text-code-inline">{schema}</code> schema is managed by Supabase and
is read-only through the dashboard.
</p>
+ )
+ }
+ actions={
+ showLearnMoreDialog && (
<Dialog open={showModal} onOpenChange={setShowModal}>
<DialogTrigger asChild>
<Button type="default" size="tiny" onClick={() => setShowModal(true)}>
@@ -103,8 +109,8 @@ export const ProtectedSchemaWarning = ({
<ProtectedSchemaDialog onClose={() => setShowModal(false)} />
</DialogContent>
</Dialog>
- </>
- )}
- </Admonition>
+ )
+ }
+ />
)
}
diff --git a/apps/studio/components/interfaces/Database/RestoreToNewProject/RestoreToNewProject.tsx b/apps/studio/components/interfaces/Database/RestoreToNewProject/RestoreToNewProject.tsx
index 30b151161d5..db5b82c15bb 100644
--- a/apps/studio/components/interfaces/Database/RestoreToNewProject/RestoreToNewProject.tsx
+++ b/apps/studio/components/interfaces/Database/RestoreToNewProject/RestoreToNewProject.tsx
@@ -11,6 +11,7 @@ import { projectSpecToMonthlyPrice } from 'components/interfaces/Database/Backup
import { DiskType } from 'components/interfaces/DiskManagement/ui/DiskManagement.constants'
import { Markdown } from 'components/interfaces/Markdown'
import AlertError from 'components/ui/AlertError'
+import { InlineLink } from 'components/ui/InlineLink'
import NoPermission from 'components/ui/NoPermission'
import Panel from 'components/ui/Panel'
import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
@@ -165,13 +166,7 @@ export const RestoreToNewProject = () => {
description={
<>
Physical backups must be enabled to restore your database to a new project.{' '}
- <Link
- target="_blank"
- className="underline"
- href={`${DOCS_URL}/guides/platform/backups`}
- >
- Learn more
- </Link>
+ <InlineLink href={`${DOCS_URL}/guides/platform/backups`}>Learn more</InlineLink>
</>
}
/>
diff --git a/apps/studio/components/interfaces/SQLEditor/MonacoEditor.tsx b/apps/studio/components/interfaces/SQLEditor/MonacoEditor.tsx
index f973713cd99..11dcc2e67a1 100644
--- a/apps/studio/components/interfaces/SQLEditor/MonacoEditor.tsx
+++ b/apps/studio/components/interfaces/SQLEditor/MonacoEditor.tsx
@@ -221,9 +221,9 @@ const MonacoEditor = ({
{disableEdit && (
<Admonition
type="default"
- className="py-2 rounded-none border-0 border-b [&>h5]:mb-0.5"
- title="This snippet has been shared to the project and is only editable by the owner who created this snippet"
- description='You may duplicate this snippet into a personal copy by right clicking on the snippet and selecting "Duplicate query"'
+ className="rounded-none border-0 border-b"
+ title="Read-only snippet"
+ description="This snippet has been shared to the project and is only editable by the owner who created this snippet. You may duplicate this snippet into a personal copy by right clicking on the snippet and selecting “Duplicate query”."
/>
)}
<Editor
diff --git a/apps/studio/components/interfaces/Settings/General/TransferProjectPanel/TransferProjectButton.tsx b/apps/studio/components/interfaces/Settings/General/TransferProjectPanel/TransferProjectButton.tsx
index 4388d275dc6..43ce28a704e 100644
--- a/apps/studio/components/interfaces/Settings/General/TransferProjectPanel/TransferProjectButton.tsx
+++ b/apps/studio/components/interfaces/Settings/General/TransferProjectPanel/TransferProjectButton.tsx
@@ -270,22 +270,14 @@ export const TransferProjectButton = () => {
<Admonition
type="danger"
title="Project cannot be transferred"
- description={
- <>
- <p>{transferPreviewError.message}</p>
- </>
- }
+ description={transferPreviewError.message}
/>
)}
{transferError && (
<Admonition
type="danger"
title="Project cannot be transferred"
- description={
- <>
- <p>{transferError.message}</p>
- </>
- }
+ description={transferError.message}
/>
)}
</div>
diff --git a/apps/studio/components/interfaces/SignIn/SignInMfaForm.tsx b/apps/studio/components/interfaces/SignIn/SignInMfaForm.tsx
index 7685f4e2a34..d288eb5f730 100644
--- a/apps/studio/components/interfaces/SignIn/SignInMfaForm.tsx
+++ b/apps/studio/components/interfaces/SignIn/SignInMfaForm.tsx
@@ -97,7 +97,7 @@ export const SignInMfaForm = ({ context = 'sign-in' }: SignInMfaFormProps) => {
error={error}
subject="Error while signing in"
additionalActions={
- <Button asChild type="warning" className="w-min">
+ <Button asChild type="default">
<Link href="/sign-in">Back to sign in</Link>
</Button>
}
diff --git a/apps/studio/components/interfaces/Storage/AnalyticsBuckets/index.tsx b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/index.tsx
index 65a38be4f87..a3b93f29272 100644
--- a/apps/studio/components/interfaces/Storage/AnalyticsBuckets/index.tsx
+++ b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/index.tsx
@@ -74,7 +74,7 @@ export const AnalyticsBuckets = () => {
<>
<PageContainer>
<PageSection>
- <PageSectionContent>
+ <PageSectionContent className="flex flex-col gap-y-8">
<AlphaNotice
entity="Analytics buckets"
feedbackUrl="https://github.com/orgs/supabase/discussions/40116"
diff --git a/apps/studio/components/interfaces/Storage/BucketsUpgradePlan.tsx b/apps/studio/components/interfaces/Storage/BucketsUpgradePlan.tsx
index f43c2c9ef5c..cb6c2eb9705 100644
--- a/apps/studio/components/interfaces/Storage/BucketsUpgradePlan.tsx
+++ b/apps/studio/components/interfaces/Storage/BucketsUpgradePlan.tsx
@@ -10,7 +10,7 @@ export const BucketsUpgradePlan = ({ type }: { type: 'analytics' | 'vector' }) =
return (
<PageContainer>
<PageSection>
- <PageSectionContent>
+ <PageSectionContent className="flex flex-col gap-y-8">
<AlphaNotice
entity={type === 'analytics' ? 'Analytics buckets' : 'Vector buckets'}
feedbackUrl={
diff --git a/apps/studio/components/interfaces/Storage/StorageSettings/StorageListV2MigrationCallout.tsx b/apps/studio/components/interfaces/Storage/StorageSettings/StorageListV2MigrationCallout.tsx
index 2951ec07b9c..5058a9affe0 100644
--- a/apps/studio/components/interfaces/Storage/StorageSettings/StorageListV2MigrationCallout.tsx
+++ b/apps/studio/components/interfaces/Storage/StorageSettings/StorageListV2MigrationCallout.tsx
@@ -32,39 +32,40 @@ export const StorageListV2MigrationCallout = () => {
return (
<Admonition
- type={remainingMonths <= 1 ? 'warning' : 'note'}
+ type="note"
title="A new version of Storage is available for your project"
- >
- <p className="!leading-normal prose max-w-full text-sm !mb-0">
- Get access to the List-V2 endpoint for improved performance and the ability to enable
- Analytics buckets to your storage system
- </p>
- {remainingMonths <= 1 && (
- <p className="!leading-normal prose max-w-full text-sm">
- Your project's Storage will be automatically upgraded by{' '}
- <TimestampInfo
- displayAs="utc"
- utcTimestamp={MIGRATION_DEADLINE}
- className="text-sm text-foreground"
- labelFormat="DD MMM YYYY HH:mm (UTC)"
- />{' '}
- if the upgrade is not completed by then.
- </p>
- )}
- <div className="flex items-center gap-x-2 mt-3">
- <StorageListV2MigrationDialog />
- </div>
- </Admonition>
+ description={
+ <>
+ <p>
+ Get access to the List-V2 endpoint for improved performance and the ability to enable
+ Analytics buckets to your storage system.
+ </p>
+ {remainingMonths <= 1 && (
+ <p>
+ Your project's Storage will be automatically upgraded by{' '}
+ <TimestampInfo
+ displayAs="utc"
+ utcTimestamp={MIGRATION_DEADLINE}
+ className="text-sm text-inherit font-medium"
+ labelFormat="DD MMM YYYY HH:mm (UTC)"
+ />{' '}
+ if the upgrade is not completed by then.
+ </p>
+ )}
+ </>
+ }
+ actions={<StorageListV2MigrationDialog />}
+ />
)
}
export const StorageListV2MigratingCallout = () => {
return (
- <Admonition type="note" title="Project's storage is currently upgrading">
- <p className="!leading-normal prose max-w-full text-sm !mb-0">
- This notice will be closed once the upgrade has been completed - hang tight!
- </p>
- </Admonition>
+ <Admonition
+ type="note"
+ title="Project storage is currently upgrading"
+ description="This notice will be closed once the upgrade has been completed. Hang tight!"
+ />
)
}
diff --git a/apps/studio/components/interfaces/Storage/StorageSettings/StorageSettings.tsx b/apps/studio/components/interfaces/Storage/StorageSettings/StorageSettings.tsx
index 0be567883fa..b5d7af47d25 100644
--- a/apps/studio/components/interfaces/Storage/StorageSettings/StorageSettings.tsx
+++ b/apps/studio/components/interfaces/Storage/StorageSettings/StorageSettings.tsx
@@ -221,7 +221,7 @@ export const StorageSettings = () => {
return (
<PageContainer>
<PageSection>
- <PageSectionContent>
+ <PageSectionContent className="flex flex-col gap-y-8">
<Form_Shadcn_ {...form}>
{isLoading || isLoadingPermissions ? (
<GenericSkeletonLoader />
diff --git a/apps/studio/components/interfaces/Storage/VectorBuckets/index.tsx b/apps/studio/components/interfaces/Storage/VectorBuckets/index.tsx
index b8585792eff..56f013aced9 100644
--- a/apps/studio/components/interfaces/Storage/VectorBuckets/index.tsx
+++ b/apps/studio/components/interfaces/Storage/VectorBuckets/index.tsx
@@ -63,7 +63,7 @@ export const VectorsBuckets = () => {
<>
<PageContainer>
<PageSection>
- <PageSectionContent>
+ <PageSectionContent className="flex flex-col gap-y-8">
<AlphaNotice
entity="Vector buckets"
feedbackUrl="https://github.com/orgs/supabase/discussions/40815"
diff --git a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/FeedbackDropdown/FeedbackWidget.tsx b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/FeedbackDropdown/FeedbackWidget.tsx
index 48e9cb83c56..19c2c02196f 100644
--- a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/FeedbackDropdown/FeedbackWidget.tsx
+++ b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/FeedbackDropdown/FeedbackWidget.tsx
@@ -190,7 +190,7 @@ export const FeedbackWidget = ({ onClose }: FeedbackWidgetProps) => {
title="This looks like an issue that’s better handled by support"
className="rounded-none border-x-0 border-b-0"
>
- <p className="text-xs text-foreground-light !leading-normal !mb-0">
+ <p>
Please{' '}
<SupportLink
className={cn(InlineLinkClassName)}
@@ -198,7 +198,7 @@ export const FeedbackWidget = ({ onClose }: FeedbackWidgetProps) => {
>
open a support ticket
</SupportLink>{' '}
- to get help with this issue, as we do not reply to all product feedback.
+ to get help, as we do not reply to all product feedback.
</p>
</Admonition>
</motion.div>
diff --git a/apps/studio/components/ui/AlertError.tsx b/apps/studio/components/ui/AlertError.tsx
index 11c9b85dc08..49cbe8bc09d 100644
--- a/apps/studio/components/ui/AlertError.tsx
+++ b/apps/studio/components/ui/AlertError.tsx
@@ -41,9 +41,6 @@ const ContactSupportButton = ({
)
}
-/**
- * @deprecated Use `import { Admonition } from "ui-patterns/admonition"` instead
- */
// [Joshen] To standardize the language for all error UIs
export const AlertError = ({
@@ -78,10 +75,10 @@ export const AlertError = ({
}
actions={
additionalActions ? (
- <div className="flex gap-2 mt-3">
+ <>
{additionalActions}
<ContactSupportButton projectRef={projectRef} subject={subject} error={error} />
- </div>
+ </>
) : (
<ContactSupportButton projectRef={projectRef} subject={subject} error={error} />
)
diff --git a/apps/studio/components/ui/AlphaNotice.tsx b/apps/studio/components/ui/AlphaNotice.tsx
index 50e3f1f5248..98695473278 100644
--- a/apps/studio/components/ui/AlphaNotice.tsx
+++ b/apps/studio/components/ui/AlphaNotice.tsx
@@ -8,11 +8,25 @@ import { Admonition } from 'ui-patterns'
interface AlphaNoticeProps {
entity: string
feedbackUrl: string
+ className?: string
}
-export const AlphaNotice = ({ entity, feedbackUrl }: AlphaNoticeProps) => {
+export const AlphaNotice = ({ entity, feedbackUrl, className }: AlphaNoticeProps) => {
return (
- <Admonition showIcon={false} type="tip" className="relative mb-8 overflow-hidden">
+ <Admonition
+ showIcon={false}
+ type="tip"
+ layout="horizontal"
+ actions={
+ <Button asChild type="default" icon={<ExternalLink strokeWidth={1.5} />} className="mt-2">
+ <Link target="_blank" rel="noopener noreferrer" href={feedbackUrl}>
+ Share feedback
+ </Link>
+ </Button>
+ }
+ className={className}
+ >
+ {/* Background image */}
<div className="absolute -inset-16 z-0 opacity-50">
<img
src={`${BASE_PATH}/img/reports/bg-grafana-dark.svg`}
@@ -27,7 +41,8 @@ export const AlphaNotice = ({ entity, feedbackUrl }: AlphaNoticeProps) => {
<div className="absolute inset-0 bg-gradient-to-r from-background-alternative to-transparent" />
</div>
- <div className="relative z-10 flex flex-col md:flex-row md:items-center gap-y-2 md:gap-x-8 justify-between px-2 py-1">
+ {/* Content */}
+ <div className="relative z-10 flex flex-col md:flex-row md:items-center gap-y-2 md:gap-x-8 justify-between px-2">
<div className="flex flex-col gap-y-0.5">
<div className="flex flex-col gap-y-2 items-start">
<Badge variant="success" className="-ml-0.5">
@@ -41,11 +56,6 @@ export const AlphaNotice = ({ entity, feedbackUrl }: AlphaNoticeProps) => {
refine the experience and expand access.
</p>
</div>
- <Button asChild type="default" icon={<ExternalLink strokeWidth={1.5} />} className="mt-2">
- <Link target="_blank" rel="noopener noreferrer" href={feedbackUrl}>
- Share feedback
- </Link>
- </Button>
</div>
</Admonition>
)
diff --git a/apps/studio/pages/project/[ref]/database/replication/index.tsx b/apps/studio/pages/project/[ref]/database/replication/index.tsx
index ba573879ff3..eb4b280784e 100644
--- a/apps/studio/pages/project/[ref]/database/replication/index.tsx
+++ b/apps/studio/pages/project/[ref]/database/replication/index.tsx
@@ -40,6 +40,7 @@ const DatabaseReplicationPage: NextPageWithLayout = () => {
<AlphaNotice
entity="Replication"
feedbackUrl="https://github.com/orgs/supabase/discussions/39416"
+ className="mb-8"
/>
<Destinations />
</div>
diff --git a/packages/ui-patterns/src/Dialogs/ConfirmationModal.tsx b/packages/ui-patterns/src/Dialogs/ConfirmationModal.tsx
index df87a26d441..a71b0a4915d 100644
--- a/packages/ui-patterns/src/Dialogs/ConfirmationModal.tsx
+++ b/packages/ui-patterns/src/Dialogs/ConfirmationModal.tsx
@@ -106,7 +106,7 @@ export const ConfirmationModal = forwardRef<
type={variant as 'default' | 'destructive' | 'warning'}
label={alert.title}
description={alert.description}
- className="border-r-0 border-l-0 rounded-none -mt-px [&_svg]:ml-0.5 mb-0"
+ className="border-x-0 rounded-none -mt-px"
{...alert?.base}
/>
)}
diff --git a/packages/ui-patterns/src/Dialogs/TextConfirmModal.tsx b/packages/ui-patterns/src/Dialogs/TextConfirmModal.tsx
index dbf6428403d..ec6fccbe999 100644
--- a/packages/ui-patterns/src/Dialogs/TextConfirmModal.tsx
+++ b/packages/ui-patterns/src/Dialogs/TextConfirmModal.tsx
@@ -143,7 +143,7 @@ export const TextConfirmModal = forwardRef<
type={variant as 'default' | 'destructive' | 'warning'}
label={alert.title}
description={alert.description}
- className="border-r-0 border-l-0 rounded-none -mt-px [&_svg]:ml-0.5 mb-0"
+ className="border-x-0 rounded-none -mt-px"
{...alert?.base}
/>
)}
diff --git a/packages/ui-patterns/src/admonition.tsx b/packages/ui-patterns/src/admonition.tsx
index 39527557623..dc6237cdc63 100644
--- a/packages/ui-patterns/src/admonition.tsx
+++ b/packages/ui-patterns/src/admonition.tsx
@@ -23,6 +23,7 @@ export interface AdmonitionProps {
layout?: 'horizontal' | 'vertical'
actions?: ReactNode
icon?: ReactNode
+ className?: string
}
const admonitionToAlertMapping: Record<
@@ -107,7 +108,13 @@ export const Admonition = forwardRef<
ref={ref}
variant={typeMapped}
{...props}
- className={cn(admonitionSVG({ type: typeMapped }), props.className)}
+ className={cn(
+ // Handle occasional background elements
+ 'overflow-hidden',
+ // SVG icon
+ admonitionSVG({ type: typeMapped }),
+ props.className
+ )}
>
{!!icon ? (
icon
@@ -119,7 +126,9 @@ export const Admonition = forwardRef<
<div
className={cn(
'flex',
- layout === 'vertical' ? 'flex-col' : 'flex-row items-center justify-between gap-x-6'
+ layout === 'vertical'
+ ? 'flex-col'
+ : 'flex-row items-center justify-between gap-x-6 lg:gap-x-8'
)}
>
{label || title ? (
@@ -127,7 +136,7 @@ export const Admonition = forwardRef<
<AlertTitle_Shadcn_
{...childProps.title}
className={cn(
- 'text mt-0.5 flex gap-3 text-sm [&_p]:mb-1.5 [&_p]:mt-0',
+ 'text mt-0.5 flex gap-3 text-sm',
!label && 'flex-col',
childProps.title?.className
)}
@@ -143,18 +152,27 @@ export const Admonition = forwardRef<
{children && (
<AlertDescription_Shadcn_
{...childProps.description}
- className={cn('[&_p]:mb-1.5 [&_p]:mt-0', childProps?.description?.className)}
+ className={cn('', childProps?.description?.className)}
>
{children}
</AlertDescription_Shadcn_>
)}
</div>
) : (
- <div className="text mt [&_p]:mb-1.5 [&_p]:mt-0 mt-0.5 [&_p:last-child]:mb-0">
+ <div className="text my-0.5 [&_p]:mt-0 [&_p]:mb-1.5 [&_p:last-child]:mb-0">
{children}
</div>
)}
- {actions}
+ {actions && (
+ <div
+ className={cn(
+ 'flex flex-row gap-3',
+ layout === 'vertical' ? 'mt-3 items-start' : 'items-center'
+ )}
+ >
+ {actions}
+ </div>
+ )}
</div>
</Alert_Shadcn_>
)
diff --git a/packages/ui/src/components/shadcn/ui/alert.tsx b/packages/ui/src/components/shadcn/ui/alert.tsx
index 4c9a0deb20c..d001964149c 100644
--- a/packages/ui/src/components/shadcn/ui/alert.tsx
+++ b/packages/ui/src/components/shadcn/ui/alert.tsx
@@ -3,11 +3,12 @@ import * as React from 'react'
import { cn } from '../../../lib/utils/cn'
-// Ivan: replaced [&:has(svg)]:pl-14 with [&>svg~*]:pl-10 cause of github.com/shadcn-ui/ui/issues/998
export const alertVariants = cva(
cn(
- 'relative w-full text-sm rounded-lg border p-4 [&>svg~*]:pl-10 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground',
- '[&>svg]:w-[23px] [&>svg]:h-[23px] [&>svg]:p-1 [&>svg]:flex [&>svg]:rounded'
+ // Container
+ 'relative w-full text-sm rounded-lg border p-4',
+ // Icon SVG
+ '[&>svg~*]:pl-10 [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg]:w-[23px] [&>svg]:h-[23px] [&>svg]:p-1 [&>svg]:flex [&>svg]:rounded'
),
{
variants: {
@@ -35,20 +36,35 @@ const Alert = React.forwardRef<
Alert.displayName = 'Alert'
const AlertTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(
- ({ className, ...props }, ref) => <h5 ref={ref} className={cn('mb-1', className)} {...props} />
+ ({ className, ...props }, ref) => <h5 ref={ref} className={cn('mb-0.5', className)} {...props} />
)
AlertTitle.displayName = 'AlertTitle'
const AlertDescription = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLParagraphElement>
->(({ className, ...props }, ref) => (
- <div
- ref={ref}
- className={cn('text-sm text-foreground-light font-normal', className)}
- {...props}
- />
-))
+>(({ className, children, ...props }, ref) => {
+ // Automatically wrap primitive text nodes (string/number) in <p> tags for semantic HTML
+ const content =
+ typeof children === 'string' || typeof children === 'number' ? <p>{children}</p> : children
+
+ return (
+ <div
+ ref={ref}
+ className={cn(
+ 'text-sm text-foreground-light font-normal',
+ // Optically align text in container
+ 'mb-0.5',
+ // Handle paragraphs
+ '[&_p]:mb-0.5 [&_p:last-child]:mb-0',
+ className
+ )}
+ {...props}
+ >
+ {content}
+ </div>
+ )
+})
AlertDescription.displayName = 'AlertDescription'
export { Alert, AlertDescription, AlertTitle }