diff --git a/apps/design-system/__registry__/index.tsx b/apps/design-system/__registry__/index.tsx index b442e4c0ecc..5b69704eecc 100644 --- a/apps/design-system/__registry__/index.tsx +++ b/apps/design-system/__registry__/index.tsx @@ -126,17 +126,6 @@ export const Index: Record = { subcategory: "undefined", chunks: [] }, - "admonition-description-only": { - name: "admonition-description-only", - type: "components:example", - registryDependencies: ["admonition"], - component: React.lazy(() => import("@/registry/default/example/admonition-description-only")), - source: "", - files: ["registry/default/example/admonition-description-only.tsx"], - category: "undefined", - subcategory: "undefined", - chunks: [] - }, "admonition-warning": { name: "admonition-warning", type: "components:example", @@ -148,17 +137,6 @@ export const Index: Record = { subcategory: "undefined", chunks: [] }, - "admonition-success": { - name: "admonition-success", - type: "components:example", - registryDependencies: ["admonition"], - component: React.lazy(() => import("@/registry/default/example/admonition-success")), - source: "", - files: ["registry/default/example/admonition-success.tsx"], - category: "undefined", - subcategory: "undefined", - chunks: [] - }, "admonition-destructive": { name: "admonition-destructive", type: "components:example", diff --git a/apps/design-system/content/docs/fragments/admonition.mdx b/apps/design-system/content/docs/fragments/admonition.mdx index 95994fc87ba..d9c0e89a4a9 100644 --- a/apps/design-system/content/docs/fragments/admonition.mdx +++ b/apps/design-system/content/docs/fragments/admonition.mdx @@ -15,12 +15,6 @@ Admonition provides focus for situations that require a callout. Use Admonition instead of [Alert](../components/alert) unless you specifically need the primitives. If in doubt, stick with Admonition. -Use `title` for the heading slot and `description` for short body copy. The `description` should always end in a period. - -Use `children` instead of `description` when the body needs rich React or MDX content such as links, lists, or multiple paragraphs, and this cannot be achieved via a React Fragment as a `description` value. - -Avoid `label` in new code. It is a legacy alias for `title` that still exists for older docs content. - ## Usage ```tsx @@ -53,7 +47,7 @@ Only ever use the `primary` (green) button `type` on a `default` Admonition. Eve className="[&_.preview>[data-orientation=vertical]]:sm:max-w-[70%]" /> -### Responsive +## Responsive Resize your browser to see the button(s) change `layout` based on the Admonition’s width. @@ -85,24 +79,6 @@ AlertError for example rolls up consistent error handling and support contact me className="[&_.preview>[data-orientation=vertical]]:sm:max-w-[70%]" /> -### Description only - -You may omit the title when the Admonition is short and sits near a heading that already provides enough context. Do not do the inverse: a title-only Admonition usually reads like an incomplete sentence and should include supporting description copy. - - - -### Success - -Use `success` strictly for positive, completed states where the user does not need to take corrective action. - - - ### 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. diff --git a/apps/design-system/registry/default/example/admonition-description-only.tsx b/apps/design-system/registry/default/example/admonition-description-only.tsx deleted file mode 100644 index 319432ad8f9..00000000000 --- a/apps/design-system/registry/default/example/admonition-description-only.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { Admonition } from 'ui-patterns/admonition' - -export default function AdmonitionDescriptionOnly() { - return ( - - ) -} diff --git a/apps/design-system/registry/default/example/admonition-success.tsx b/apps/design-system/registry/default/example/admonition-success.tsx deleted file mode 100644 index 7196bf474c8..00000000000 --- a/apps/design-system/registry/default/example/admonition-success.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { Admonition } from 'ui-patterns/admonition' - -export default function AdmonitionSuccess() { - return ( - - ) -} diff --git a/apps/design-system/registry/examples.ts b/apps/design-system/registry/examples.ts index d5f9a19ae22..9f04225b28b 100644 --- a/apps/design-system/registry/examples.ts +++ b/apps/design-system/registry/examples.ts @@ -25,24 +25,12 @@ export const examples: Registry = [ registryDependencies: ['admonition'], files: ['example/admonition-button.tsx'], }, - { - name: 'admonition-description-only', - type: 'components:example', - registryDependencies: ['admonition'], - files: ['example/admonition-description-only.tsx'], - }, { name: 'admonition-warning', type: 'components:example', registryDependencies: ['admonition'], files: ['example/admonition-warning.tsx'], }, - { - name: 'admonition-success', - type: 'components:example', - registryDependencies: ['admonition'], - files: ['example/admonition-success.tsx'], - }, { name: 'admonition-destructive', type: 'components:example', diff --git a/apps/design-system/styles/globals.css b/apps/design-system/styles/globals.css index bea8d6b3338..0160d13280c 100644 --- a/apps/design-system/styles/globals.css +++ b/apps/design-system/styles/globals.css @@ -5,7 +5,7 @@ @import './../../../packages/ui/build/css/themes/classic-dark.css'; @import './../../../packages/ui/build/css/themes/light.css'; -@config '../tailwind.config.cjs'; +@config '../tailwind.config.js'; @import 'config/typography.css'; diff --git a/apps/design-system/tailwind.config.cjs b/apps/design-system/tailwind.config.js similarity index 100% rename from apps/design-system/tailwind.config.cjs rename to apps/design-system/tailwind.config.js diff --git a/apps/studio/components/interfaces/Auth/Users/UserOverview.tsx b/apps/studio/components/interfaces/Auth/Users/UserOverview.tsx index 06811897b55..1e847c0e004 100644 --- a/apps/studio/components/interfaces/Auth/Users/UserOverview.tsx +++ b/apps/studio/components/interfaces/Auth/Users/UserOverview.tsx @@ -181,7 +181,7 @@ export const UserOverview = ({ user, onDeleteSuccess }: UserOverviewProps) => { {isBanned ? ( ) : ( diff --git a/apps/studio/components/interfaces/Database/Publications/PublicationsTables.tsx b/apps/studio/components/interfaces/Database/Publications/PublicationsTables.tsx index 127770b9032..8c55200cdc6 100644 --- a/apps/studio/components/interfaces/Database/Publications/PublicationsTables.tsx +++ b/apps/studio/components/interfaces/Database/Publications/PublicationsTables.tsx @@ -74,17 +74,16 @@ export const PublicationsTables = () => { /> + {!isLoadingPermissions && !canUpdatePublications && ( + + )} - {!isLoadingPermissions && !canUpdatePublications && ( - - )} - {(isLoading || isLoadingPermissions) && (
diff --git a/apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationPanelFields.tsx b/apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationPanelFields.tsx index 67f0f80e6c3..a08a6c472c8 100644 --- a/apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationPanelFields.tsx +++ b/apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/DestinationPanelFields.tsx @@ -653,26 +653,21 @@ export const AnalyticsBucketFields = ({

{isSuccessKeys && keyNoLongerExists && ( - - Please select another key or create a new set, as this destination will - not work otherwise. S3 access keys can be managed in your{' '} - - storage settings - - . - - } - /> + +

+ Please select another key or create a new set, as this destination will not + work otherwise. S3 access keys can be managed in your{' '} + + storage settings + +

+
)} {s3AccessKeyId === CREATE_NEW_KEY && ( )}
@@ -738,7 +733,7 @@ export const AnalyticsBucketFields = ({ layout="horizontal" label="S3 Secret Access Key" className="relative" - description="The secret key corresponding to your selected access key ID." + description="The secret key corresponding to your selected access key ID" > { return ( ) } diff --git a/apps/studio/components/interfaces/Integrations/Queues/SingleQueue/QueueSettings.tsx b/apps/studio/components/interfaces/Integrations/Queues/SingleQueue/QueueSettings.tsx index e945f6b3e5e..af634743e83 100644 --- a/apps/studio/components/interfaces/Integrations/Queues/SingleQueue/QueueSettings.tsx +++ b/apps/studio/components/interfaces/Integrations/Queues/SingleQueue/QueueSettings.tsx @@ -278,7 +278,7 @@ export const QueueSettings = ({}: QueueSettingsProps) => { )} diff --git a/apps/studio/components/interfaces/Integrations/templates/StripeSyncEngine/StripeSyncSettingsPage.tsx b/apps/studio/components/interfaces/Integrations/templates/StripeSyncEngine/StripeSyncSettingsPage.tsx index f21fc6f5201..af152e75464 100644 --- a/apps/studio/components/interfaces/Integrations/templates/StripeSyncEngine/StripeSyncSettingsPage.tsx +++ b/apps/studio/components/interfaces/Integrations/templates/StripeSyncEngine/StripeSyncSettingsPage.tsx @@ -32,7 +32,7 @@ export const StripeSyncSettingsPage = () => { return ( - + ) diff --git a/apps/studio/components/interfaces/OrganizationInvite/OrganizationInvite.tsx b/apps/studio/components/interfaces/OrganizationInvite/OrganizationInvite.tsx index 1f0d55f0ac3..dd4101c5e45 100644 --- a/apps/studio/components/interfaces/OrganizationInvite/OrganizationInvite.tsx +++ b/apps/studio/components/interfaces/OrganizationInvite/OrganizationInvite.tsx @@ -73,7 +73,7 @@ export const OrganizationInvite = () => {
diff --git a/apps/studio/components/interfaces/Settings/API/PostgrestConfig.tsx b/apps/studio/components/interfaces/Settings/API/PostgrestConfig.tsx index c1d3fcdaf0e..bc9f40ede61 100644 --- a/apps/studio/components/interfaces/Settings/API/PostgrestConfig.tsx +++ b/apps/studio/components/interfaces/Settings/API/PostgrestConfig.tsx @@ -272,7 +272,7 @@ export const PostgrestConfig = () => { ) : isError ? ( - + ) : ( <> diff --git a/apps/studio/components/interfaces/Settings/Addons/IPv4SidePanel.tsx b/apps/studio/components/interfaces/Settings/Addons/IPv4SidePanel.tsx index 0bf56a72a55..47dcbecab1e 100644 --- a/apps/studio/components/interfaces/Settings/Addons/IPv4SidePanel.tsx +++ b/apps/studio/components/interfaces/Settings/Addons/IPv4SidePanel.tsx @@ -161,7 +161,7 @@ const IPv4SidePanel = () => { {!isAws && ( )} diff --git a/apps/studio/components/interfaces/Settings/Database/JitDatabaseAccess/JitDbAccessRuleSheet.tsx b/apps/studio/components/interfaces/Settings/Database/JitDatabaseAccess/JitDbAccessRuleSheet.tsx index a6703fbd200..80b0dd8236f 100644 --- a/apps/studio/components/interfaces/Settings/Database/JitDatabaseAccess/JitDbAccessRuleSheet.tsx +++ b/apps/studio/components/interfaces/Settings/Database/JitDatabaseAccess/JitDbAccessRuleSheet.tsx @@ -305,7 +305,7 @@ export function JitDbAccessRuleSheet({ {grants.length === 0 ? ( ) : ( diff --git a/apps/studio/components/interfaces/Settings/General/DashboardPreferences.tsx b/apps/studio/components/interfaces/Settings/General/DashboardPreferences.tsx index 7eb72fa9de3..cce9e5b592e 100644 --- a/apps/studio/components/interfaces/Settings/General/DashboardPreferences.tsx +++ b/apps/studio/components/interfaces/Settings/General/DashboardPreferences.tsx @@ -96,7 +96,7 @@ export const DashboardPreferences = () => { {/* [Joshen] Ideally we're able to persist this for all users in the project, but will need support in our middleware */} {isLoading ? ( diff --git a/apps/studio/components/interfaces/Support/ProjectAndPlanInfo.tsx b/apps/studio/components/interfaces/Support/ProjectAndPlanInfo.tsx index 08453d0628d..cd1799e1bd6 100644 --- a/apps/studio/components/interfaces/Support/ProjectAndPlanInfo.tsx +++ b/apps/studio/components/interfaces/Support/ProjectAndPlanInfo.tsx @@ -42,9 +42,7 @@ export function ProjectAndPlanInfo({ - {!hasProjectSelected && ( - - )} + {!hasProjectSelected && } {showPlanExpectationInfo && orgSlug && diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/ApiAccessToggle.tsx b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/ApiAccessToggle.tsx index 29fcb1824a1..12153250543 100644 --- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/ApiAccessToggle.tsx +++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/ApiAccessToggle.tsx @@ -403,10 +403,7 @@ const SchemaExposureOptions = ({ return ( <> {isError && ( - + )} {isSchemaExposed && apiUrl && ( diff --git a/apps/studio/pages/cli/login.tsx b/apps/studio/pages/cli/login.tsx index d14daf924a8..912c1c5a941 100644 --- a/apps/studio/pages/cli/login.tsx +++ b/apps/studio/pages/cli/login.tsx @@ -73,7 +73,7 @@ const CliLoginPage: NextPageWithLayout = () => {

diff --git a/packages/ui-patterns/src/admonition.tsx b/packages/ui-patterns/src/admonition.tsx index 9971f35d921..6700794f61b 100644 --- a/packages/ui-patterns/src/admonition.tsx +++ b/packages/ui-patterns/src/admonition.tsx @@ -2,43 +2,19 @@ import { cva } from 'class-variance-authority' import { ComponentProps, forwardRef, ReactNode } from 'react' import { Alert_Shadcn_, AlertDescription_Shadcn_, AlertTitle_Shadcn_, cn } from 'ui' -type AdmonitionType = - | 'note' - | 'tip' - | 'caution' - | 'danger' - | 'deprecation' - | 'default' - | 'destructive' - | 'success' - | 'warning' - -type AdmonitionBodyContent = - | { - description: string | ReactNode - children?: ReactNode - } - | { - description?: string | ReactNode - children: ReactNode - } - -type AdmonitionContentProps = - | ({ - title?: string - /** @deprecated Use title instead. */ - label?: string - } & AdmonitionBodyContent) - | { - title?: never - /** @deprecated Use title instead. */ - label?: never - description?: string | ReactNode - children?: ReactNode - } - -interface AdmonitionBaseProps { - type?: AdmonitionType +export interface AdmonitionProps { + type: + | 'note' + | 'tip' + | 'caution' + | 'danger' + | 'deprecation' + | 'default' + | 'destructive' + | 'warning' + label?: string + title?: string + description?: string | ReactNode showIcon?: boolean childProps?: { title?: ComponentProps @@ -50,9 +26,10 @@ interface AdmonitionBaseProps { className?: string } -export type AdmonitionProps = AdmonitionBaseProps & AdmonitionContentProps - -const admonitionToAlertMapping: Record = { +const admonitionToAlertMapping: Record< + AdmonitionProps['type'], + 'default' | 'destructive' | 'warning' +> = { note: 'default', tip: 'default', caution: 'warning', @@ -61,7 +38,6 @@ const admonitionToAlertMapping: Record ( @@ -79,21 +55,6 @@ const InfoIcon = () => ( ) -const SuccessIcon = () => ( - - - -) - export const WarningIcon = ({ className }: { className?: string }) => ( svg]:bg-foreground-muted`, - success: `bg-brand-400 dark:bg-brand bg-opacity-15 dark:bg-opacity-10 border-brand-400 dark:border-brand-500 [&>svg]:text-white dark:[&>svg]:text-brand-link [&>svg]:bg-brand dark:[&>svg]:bg-brand-500/50`, warning: ``, destructive: ``, }, }, }) -const admonitionBodyClassName = - '[&_p]:!mt-0 [&_p]:!mb-1.5 [&_p:last-child]:!mb-0 [&_p:only-child]:!mb-0 [&_ul]:!my-1.5 [&_ol]:!my-1.5 [&_li]:!my-0.5' - export const Admonition = forwardRef< React.ElementRef, - Omit, keyof AdmonitionProps | 'children'> & - AdmonitionProps + React.ComponentPropsWithoutRef & AdmonitionProps >( ( { @@ -146,11 +102,6 @@ export const Admonition = forwardRef< ref ) => { const typeMapped = variant ? admonitionToAlertMapping[variant] : admonitionToAlertMapping[type] - const typeStyle = type === 'success' ? 'success' : typeMapped - - if (process.env.NODE_ENV !== 'production' && (label || title) && !description && !children) { - throw new Error('Admonition title-only usage is not supported. Add description or children.') - } return ( {!!icon ? ( icon - ) : showIcon && typeStyle === 'success' ? ( - ) : (showIcon && typeMapped === 'warning') || typeMapped === 'destructive' ? ( ) : showIcon ? ( @@ -185,29 +134,20 @@ export const Admonition = forwardRef< 'flex-col @md:flex-row @md:items-center @md:justify-between @md:gap-x-6 @lg:gap-x-8' )} > - {label || title || description ? ( + {label || title ? (
- {(label || title) && ( - - {label || title} - - )} + + {label || title} + {description && ( - + {description} )} @@ -215,14 +155,16 @@ export const Admonition = forwardRef< {children && ( {children} )}
) : ( -
{children}
+
+ {children} +
)} {actions && (
svg]:text-background [&>svg]:bg-foreground', destructive: - 'bg-destructive-200 border-destructive-400 text-foreground [&>svg]:text-destructive-200 [&>svg]:bg-destructive-600', + 'bg-destructive-200 border-destructive-400 [&>svg]:text-destructive-200 [&>svg]:bg-destructive-600', warning: - 'bg-warning-200 border-warning-400 text-foreground [&>svg]:text-warning-200 [&>svg]:bg-warning-600', + 'bg-warning-200 border-warning-400 [&>svg]:text-warning-200 [&>svg]:bg-warning-600', }, }, defaultVariants: {