The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat: new api keys [hidden] (#33252)
Jonathan Summers-Muir4649bf911e59
diff --git a/apps/design-system/registry/default/example/combobox-dropdown-menu.tsx b/apps/design-system/registry/default/example/combobox-dropdown-menu.tsxindex f2e06033516..b1c29126099 100644--- a/apps/design-system/registry/default/example/combobox-dropdown-menu.tsx+++ b/apps/design-system/registry/default/example/combobox-dropdown-menu.tsx@@ -3,7 +3,7 @@import * as React from 'react'import { Calendar, MoreHorizontal, Tags, Trash, User } from 'lucide-react'-import { Button, CommandList_Shadcn_ } from 'ui'+import { Button, CommandList_Shadcn_, ScrollArea } from 'ui'import {Command_Shadcn_,CommandEmpty_Shadcn_,@@ -75,23 +75,25 @@ export default function ComboboxDropdownMenu() {<DropdownMenuSubContent className="p-0"><Command_Shadcn_><CommandInput_Shadcn_ placeholder="Filter label..." autoFocus={true} />- <CommandList_Shadcn_>- <CommandEmpty_Shadcn_>No label found.</CommandEmpty_Shadcn_>- <CommandGroup_Shadcn_>- {labels.map((label) => (- <CommandItem_Shadcn_- key={label}- value={label}- onSelect={(value) => {- setLabel(value)- setOpen(false)- }}- >- {label}- </CommandItem_Shadcn_>- ))}- </CommandGroup_Shadcn_>- </CommandList_Shadcn_>+ <ScrollArea className="h-20">+ <CommandList_Shadcn_>+ <CommandEmpty_Shadcn_>No label found.</CommandEmpty_Shadcn_>+ <CommandGroup_Shadcn_>+ {labels.map((label) => (+ <CommandItem_Shadcn_+ key={label}+ value={label}+ onSelect={(value) => {+ setLabel(value)+ setOpen(false)+ }}+ >+ {label}+ </CommandItem_Shadcn_>+ ))}+ </CommandGroup_Shadcn_>+ </CommandList_Shadcn_>+ </ScrollArea></Command_Shadcn_></DropdownMenuSubContent></DropdownMenuSub>diff --git a/apps/studio/components/interfaces/APIKeys/APIKeyDeleteDialog.tsx b/apps/studio/components/interfaces/APIKeys/APIKeyDeleteDialog.tsxnew file mode 100644index 00000000000..5b27b54556d--- /dev/null+++ b/apps/studio/components/interfaces/APIKeys/APIKeyDeleteDialog.tsx@@ -0,0 +1,65 @@+import { useState } from 'react'+import { toast } from 'sonner'++import { PermissionAction } from '@supabase/shared-types/out/constants'+import { useParams } from 'common/hooks'+import { useAPIKeyDeleteMutation } from 'data/api-keys/api-key-delete-mutation'+import { APIKeysData } from 'data/api-keys/api-keys-query'+import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'+import { DropdownMenuItem } from 'ui'+import TextConfirmModal from 'ui-patterns/Dialogs/TextConfirmModal'++interface APIKeyDeleteDialogProps {+ apiKey: Extract<APIKeysData[number], { type: 'secret' | 'publishable' }>+}++export const APIKeyDeleteDialog = ({ apiKey }: APIKeyDeleteDialogProps) => {+ const { ref: projectRef } = useParams()+ const [isOpen, setIsOpen] = useState(false)++ const canDeleteAPIKeys = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_WRITE, '*')++ const { mutate: deleteAPIKey, isLoading: isDeletingAPIKey } = useAPIKeyDeleteMutation({+ onSuccess: () => {+ toast.success(`Successfully deleted API key`)+ setIsOpen(false)+ },+ })++ const onDeleteAPIKey = () => {+ if (!projectRef) return console.error('Project ref is required')+ deleteAPIKey({ projectRef, id: apiKey.id })+ }++ return (+ <>+ <DropdownMenuItem+ className="flex gap-2 !pointer-events-auto"+ onClick={async (e) => {+ if (canDeleteAPIKeys) {+ e.preventDefault()+ setIsOpen(true)+ }+ }}+ >+ Delete API key+ </DropdownMenuItem>+ <TextConfirmModal+ visible={isOpen}+ onCancel={() => setIsOpen(false)}+ onConfirm={onDeleteAPIKey}+ title={`Delete ${apiKey.description ?? ''} API secret key`}+ confirmString={apiKey.description || 'Delete API secret key'}+ confirmLabel="Delete API secret key"+ confirmPlaceholder="Type API key description to confirm"+ loading={isDeletingAPIKey}+ variant="destructive"+ alert={{+ title: 'This cannot be undone',+ description:+ 'Deleting this API key will invalidate it immediately. Any applications using this key will no longer be able to access this project.',+ }}+ />+ </>+ )+}diff --git a/apps/studio/components/interfaces/APIKeys/APIKeyRow.tsx b/apps/studio/components/interfaces/APIKeys/APIKeyRow.tsxnew file mode 100644index 00000000000..a41a838b7a9--- /dev/null+++ b/apps/studio/components/interfaces/APIKeys/APIKeyRow.tsx@@ -0,0 +1,193 @@+import { PermissionAction } from '@supabase/shared-types/out/constants'+import { useQueryClient } from '@tanstack/react-query'+import { InputVariants } from '@ui/components/shadcn/ui/input'+import { Eye, MoreVertical } from 'lucide-react'+import { useState } from 'react'+import { toast } from 'sonner'++import { useParams } from 'common'+import CopyButton from 'components/ui/CopyButton'+import { useAPIKeyIdQuery } from 'data/api-keys/[id]/api-key-id-query'+import { APIKeysData } from 'data/api-keys/api-keys-query'+import { apiKeysKeys } from 'data/api-keys/keys'+import { AnimatePresence, motion } from 'framer-motion'+import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'+import {+ Button,+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuSeparator,+ DropdownMenuTrigger,+ TableCell,+ TableRow,+ cn,+} from 'ui'+import { APIKeyDeleteDialog } from './APIKeyDeleteDialog'++export const APIKeyRow = ({+ apiKey,+}: {+ apiKey: Extract<APIKeysData[number], { type: 'secret' | 'publishable' }>+}) => {+ const MotionTableRow = motion(TableRow)++ return (+ <MotionTableRow+ layout+ initial={{ opacity: 0, height: 0 }}+ animate={{ opacity: 1, height: 'auto' }}+ exit={{ opacity: 0, height: 0 }}+ transition={{+ type: 'spring',+ stiffness: 500,+ damping: 50,+ mass: 1,+ }}+ >+ <TableCell className="py-2">{apiKey.description || '/'}</TableCell>+ <TableCell className="py-2">+ <div className="flex flex-row gap-2">+ <Input apiKey={apiKey} />+ </div>+ </TableCell>++ <TableCell className="flex justify-end">+ <DropdownMenu>+ <DropdownMenuTrigger className="px-1 focus-visible:outline-none" asChild>+ <Button+ type="text"+ size="tiny"+ icon={+ <MoreVertical size="14" className="text-foreground-light hover:text-foreground" />+ }+ />+ </DropdownMenuTrigger>+ <DropdownMenuContent className="max-w-40" align="end">+ <APIKeyDeleteDialog apiKey={apiKey} />+ </DropdownMenuContent>+ </DropdownMenu>+ </TableCell>+ </MotionTableRow>+ )+}++function Input({+ apiKey,+}: {+ apiKey: Extract<APIKeysData[number], { type: 'secret' | 'publishable' }>+}) {+ const queryClient = useQueryClient()+ const { ref: projectRef } = useParams()++ const [show, setShowState] = useState(false)++ // to do+ // const canReadAPIKeys = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_WRITE, '*')++ const isSecret = apiKey.type === 'secret'++ const {+ data,+ isLoading: isLoadingApiKey,+ error,+ refetch: refetchApiKey,+ } = useAPIKeyIdQuery(+ {+ projectRef,+ id: apiKey.id as string,+ reveal: true,+ },+ {+ enabled: show,+ staleTime: 0, // Data is considered stale immediately+ cacheTime: 0, // Cache is cleared immediately after query becomes stale+ }+ )++ async function onSubmitShow() {+ setShowState(true)+ // Set a timeout to invalidate the cache after a certain amount of time+ setTimeout(() => {+ setShowState(false)+ queryClient.removeQueries({+ queryKey: apiKeysKeys.single(projectRef, apiKey.id as string),+ exact: true,+ })+ }, 10000) // Destroy query after 10 seconds+ }++ async function onCopy() {+ // if ID already exists from a reveal action, return that+ if (data?.api_key) return data?.api_key++ try {+ // fetch ID and then destroy query immediately+ const result = await refetchApiKey()+ queryClient.removeQueries({+ queryKey: apiKeysKeys.single(projectRef, apiKey.id as string),+ exact: true,+ })++ if (result.isSuccess) return result.data.api_key++ if (error) {+ toast.error('Failed to copy secret API key')+ }+ } catch (error) {+ console.error('Failed to fetch API key:', error)+ }++ // Fallback to the masked version+ return apiKey.api_key+ }++ return (+ <>+ <div+ className={cn(+ InputVariants({ size: 'tiny' }),+ 'flex-1 grow gap-0 font-mono rounded-full max-w-60 overflow-hidden',+ show ? 'ring-1 ring-foreground-lighter ring-opacity-50' : 'ring-0 ring-opacity-0',+ 'transition-all'+ )}+ >+ <AnimatePresence mode="wait" initial={false}>+ <motion.span+ key={show ? 'shown' : 'hidden'}+ initial={{ opacity: 0, y: show ? 16 : -16 }}+ animate={{ opacity: 1, y: 0 }}+ exit={{ opacity: 0, y: show ? 16 : -16 }}+ transition={{+ duration: 0.12,+ y: { type: 'spring', stiffness: 2450, damping: 55 },+ }}+ className="truncate"+ >+ {show ? data?.api_key : apiKey?.api_key}+ </motion.span>+ </AnimatePresence>+ </div>+ {isSecret && (+ <AnimatePresence>+ {!show && (+ <motion.div+ initial={{ opacity: 0, scale: 1, width: 0 }}+ animate={{ opacity: 1, scale: 1, width: 'auto' }}+ exit={{ opacity: 0, scale: 1, width: 0 }}+ transition={{ duration: 0.12 }}+ style={{ overflow: 'hidden' }}+ >+ <Button+ type="outline"+ className="rounded-full px-2"+ icon={<Eye strokeWidth={2} />}+ onClick={onSubmitShow}+ />+ </motion.div>+ )}+ </AnimatePresence>+ )}+ <CopyButton type="default" asyncText={onCopy} iconOnly className="rounded-full px-2" />+ </>+ )+}diff --git a/apps/studio/components/interfaces/APIKeys/APIKeysTable.tsx b/apps/studio/components/interfaces/APIKeys/APIKeysTable.tsxnew file mode 100644index 00000000000..49aa3a94a97--- /dev/null+++ b/apps/studio/components/interfaces/APIKeys/APIKeysTable.tsx@@ -0,0 +1,25 @@+import { AnimatePresence } from 'framer-motion'++import { APIKeysData } from 'data/api-keys/api-keys-query'+import { APIKeyRow } from './APIKeyRow'++const APIKeysTable = ({+ apiKeys,+}: {+ apiKeys: Extract<APIKeysData[number], { type: 'secret' | 'publishable' }>[]+}) => {+ return (+ <table>+ <thead />+ <tbody>+ <AnimatePresence initial={false}>+ {apiKeys.map((apiKey) => (+ <APIKeyRow key={apiKey.id} apiKey={apiKey} />+ ))}+ </AnimatePresence>+ </tbody>+ </table>+ )+}++export default APIKeysTablediff --git a/apps/studio/components/interfaces/APIKeys/CreatePublishableAPIKeyModal.tsx b/apps/studio/components/interfaces/APIKeys/CreatePublishableAPIKeyModal.tsxnew file mode 100644index 00000000000..ff749d9ff24--- /dev/null+++ b/apps/studio/components/interfaces/APIKeys/CreatePublishableAPIKeyModal.tsx@@ -0,0 +1,124 @@+import { useState } from 'react'+import * as z from 'zod'+import { zodResolver } from '@hookform/resolvers/zod'+import { SubmitHandler, useForm } from 'react-hook-form'+import {+ Button,+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogSection,+ DialogSectionSeparator,+ DialogTitle,+ DialogTrigger,+ FormControl_Shadcn_,+ FormField_Shadcn_,+ Form_Shadcn_,+ Input_Shadcn_,+ AlertDescription_Shadcn_,+ AlertTitle_Shadcn_,+ Alert_Shadcn_,+} from 'ui'+import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'++import { useAPIKeyCreateMutation } from 'data/api-keys/api-key-create-mutation'+import { useParams } from 'next/navigation'++const FORM_ID = 'create-publishable-api-key'+const SCHEMA = z.object({+ description: z.string(),+})++export interface CreatePublishableAPIKeyModalProps {+ projectRef: string+}++function CreatePublishableAPIKeyModal() {+ const params = useParams()+ const projectRef = params?.ref as string++ const [visible, setVisible] = useState(false)++ const onClose = (value: boolean) => {+ setVisible(value)+ }++ const form = useForm<z.infer<typeof SCHEMA>>({+ resolver: zodResolver(SCHEMA),+ defaultValues: {+ description: '',+ },+ })++ const { mutate: createAPIKey, isLoading: isCreatingAPIKey } = useAPIKeyCreateMutation()++ const onSubmit: SubmitHandler<z.infer<typeof SCHEMA>> = async (values) => {+ createAPIKey(+ {+ projectRef,+ type: 'publishable',+ description: values.description.trim(),+ },+ {+ onSuccess: () => {+ onClose(false)+ },+ }+ )+ }++ return (+ <Dialog open={visible} onOpenChange={onClose}>+ <DialogTrigger asChild>+ <Button type="default" className="pointer-events-auto">+ Create new+ </Button>+ </DialogTrigger>+ <DialogContent>+ <DialogHeader>+ <DialogTitle>Create new publishable API key</DialogTitle>+ <DialogDescription>+ Publishable API keys are used to authorize requests to your project from the web, mobile+ or desktop apps, CLIs or other public components of your application. They are safe to+ be published online and embedded in code.+ </DialogDescription>+ </DialogHeader>+ <DialogSectionSeparator />+ <DialogSection className="flex flex-col gap-4">+ <Form_Shadcn_ {...form}>+ <form+ className="flex flex-col gap-4"+ id={FORM_ID}+ onSubmit={form.handleSubmit(onSubmit)}+ >+ <FormField_Shadcn_+ key="description"+ name="description"+ control={form.control}+ render={({ field }) => (+ <FormItemLayout+ label="Description"+ description="Provide a description about what this key is used for."+ >+ <FormControl_Shadcn_>+ <Input_Shadcn_ {...field} placeholder="(Optional)" />+ </FormControl_Shadcn_>+ </FormItemLayout>+ )}+ />+ </form>+ </Form_Shadcn_>+ </DialogSection>+ <DialogFooter>+ <Button form={FORM_ID} htmlType="submit" loading={isCreatingAPIKey}>+ Create Publishable API key+ </Button>+ </DialogFooter>+ </DialogContent>+ </Dialog>+ )+}++export default CreatePublishableAPIKeyModaldiff --git a/apps/studio/components/interfaces/APIKeys/CreateSecretAPIKeyModal.tsx b/apps/studio/components/interfaces/APIKeys/CreateSecretAPIKeyModal.tsxnew file mode 100644index 00000000000..646304c7625--- /dev/null+++ b/apps/studio/components/interfaces/APIKeys/CreateSecretAPIKeyModal.tsx@@ -0,0 +1,116 @@+import { zodResolver } from '@hookform/resolvers/zod'+import { useState } from 'react'+import { SubmitHandler, useForm } from 'react-hook-form'+import {+ Button,+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogSection,+ DialogSectionSeparator,+ DialogTitle,+ DialogTrigger,+ FormControl_Shadcn_,+ FormField_Shadcn_,+ Form_Shadcn_,+ Input_Shadcn_,+} from 'ui'+import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'+import * as z from 'zod'++import { useParams } from 'common'+import { useAPIKeyCreateMutation } from 'data/api-keys/api-key-create-mutation'+import { Plus } from 'lucide-react'++const FORM_ID = 'create-secret-api-key'+const SCHEMA = z.object({+ description: z.string(),+})++const CreateSecretAPIKeyModal = () => {+ const [visible, setVisible] = useState(false)+ const { ref: projectRef } = useParams()++ const onClose = (value: boolean) => {+ setVisible(value)+ }++ const form = useForm<z.infer<typeof SCHEMA>>({+ resolver: zodResolver(SCHEMA),+ defaultValues: {+ description: '',+ },+ })++ const { mutate: createAPIKey, isLoading: isCreatingAPIKey } = useAPIKeyCreateMutation()++ const onSubmit: SubmitHandler<z.infer<typeof SCHEMA>> = async (values) => {+ createAPIKey(+ {+ projectRef,+ type: 'secret',+ description: values.description.trim(),+ },+ {+ onSuccess: () => {+ onClose(false)+ },+ }+ )+ }++ return (+ <Dialog open={visible} onOpenChange={onClose}>+ <DialogTrigger asChild>+ <Button type="default" className="mt-2" icon={<Plus />}>+ Add new Secret key+ </Button>+ </DialogTrigger>+ <DialogContent>+ <DialogHeader>+ <DialogTitle>Create new secret API key</DialogTitle>+ <DialogDescription>+ Secret API keys are used to authorize requests to your project from servers, functions,+ workers or other backend components of your application. Keep them secret, don't publish+ them online and don't check them in source code.+ </DialogDescription>+ </DialogHeader>+ <DialogSectionSeparator />+ <DialogSection className="flex flex-col gap-4">+ <Form_Shadcn_ {...form}>+ <form+ className="flex flex-col gap-4"+ id={FORM_ID}+ onSubmit={form.handleSubmit(onSubmit)}+ >+ <FormField_Shadcn_+ key="description"+ name="description"+ control={form.control}+ render={({ field }) => (+ <FormItemLayout+ label="Description"+ description="Provide a description about what this key is used for."+ >+ <FormControl_Shadcn_>+ <Input_Shadcn_ {...field} placeholder="(Optional)" />+ </FormControl_Shadcn_>+ </FormItemLayout>+ )}+ />+ </form>+ </Form_Shadcn_>+ </DialogSection>+ <DialogFooter>+ <Button form={FORM_ID} htmlType="submit" loading={isCreatingAPIKey}>+ Create API key+ </Button>+ </DialogFooter>+ </DialogContent>+ </Dialog>+ )+}++export default CreateSecretAPIKeyModaldiff --git a/apps/studio/components/interfaces/APIKeys/LegacyAPIKeys.tsx b/apps/studio/components/interfaces/APIKeys/LegacyAPIKeys.tsxnew file mode 100644index 00000000000..387b501b2cc--- /dev/null+++ b/apps/studio/components/interfaces/APIKeys/LegacyAPIKeys.tsx@@ -0,0 +1,17 @@+import { FormHeader } from 'components/ui/Forms/FormHeader'+import DisplayApiSettings from 'components/ui/ProjectSettings/DisplayApiSettings'++const LegacyAPIKeys = () => {+ return (+ <div>+ <FormHeader+ title="Legacy API keys"+ description="Legacy, JWT-based API keys. Support for these is ending in October 2025. Prefer Publishable and Secret API keys instead."+ />+ <DisplayApiSettings legacy showNotice={false} />+ </div>+ )+ return+}++export default LegacyAPIKeysdiff --git a/apps/studio/components/interfaces/APIKeys/PublishableAPIKeys.tsx b/apps/studio/components/interfaces/APIKeys/PublishableAPIKeys.tsxnew file mode 100644index 00000000000..4a660756c81--- /dev/null+++ b/apps/studio/components/interfaces/APIKeys/PublishableAPIKeys.tsx@@ -0,0 +1,138 @@+import { PermissionAction } from '@supabase/shared-types/out/constants'+import { InputVariants } from '@ui/components/shadcn/ui/input'+import { useParams } from 'common'+import CopyButton from 'components/ui/CopyButton'+import { FormHeader } from 'components/ui/Forms/FormHeader'+import { useAPIKeysQuery } from 'data/api-keys/api-keys-query'+import { useCheckPermissions, usePermissionsLoaded } from 'hooks/misc/useCheckPermissions'+import { Link } from 'lucide-react'+import { useMemo } from 'react'+import { cn, EyeOffIcon, Input_Shadcn_, Skeleton, WarningIcon } from 'ui'+import QuickKeyCopyWrapper from './QuickKeyCopy'+// to add in later with follow up PR+// import CreatePublishableAPIKeyModal from './CreatePublishableAPIKeyModal'+// to add in later with follow up PR+// import ShowPublicJWTsDialogComposer from '../JwtSecrets/ShowPublicJWTsDialogComposer'++export const PublishableAPIKeys = () => {+ const { ref: projectRef } = useParams()+ const {+ data: apiKeysData,+ isLoading: isLoadingApiKeys,+ error,+ } = useAPIKeysQuery({ projectRef, reveal: false })++ const publishableApiKeys = useMemo(+ () => apiKeysData?.filter(({ type }) => type === 'publishable') ?? [],+ [apiKeysData]+ )++ const isPermissionsLoading = !usePermissionsLoaded()+ const canReadAPIKeys = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_WRITE, '*')++ // The default publisahble key will always be the first one+ const apiKey = publishableApiKeys[0]++ return (+ <div>+ <FormHeader+ title="Publishable key"+ description="Use these API keys on the web, in mobile or desktop apps, CLIs or other public components of your app. It's safe to publish these."+ />+ <div className="flex flex-col gap-8">+ <div className="-space-y-px w-content w-fit">+ <div className="bg-surface-100 px-5 py-2 flex items-center gap-5 first:rounded-t-md border">+ <span className="text-sm">Default publishable key</span>+ <div className="flex items-center gap-2">+ <ApiKeyInput />+ <CopyButton+ disabled={isPermissionsLoading || isLoadingApiKeys || !canReadAPIKeys}+ type="default"+ text={apiKey?.api_key}+ iconOnly+ size={'tiny'}+ className="px-2 rounded-full"+ />+ </div>+ </div>+ {error && canReadAPIKeys ? (+ <div className="text-xs bg-warning-200 last:rounded-b-md border border-warning-400 px-5 text-foreground-lighter py-1">+ <div className="text-warning">Failed to load publishable key: {error?.message}</div>+ </div>+ ) : (+ <div className="text-xs bg-200 last:rounded-b-md border px-5 text-foreground-lighter py-1">+ Publishable key can be safely shared in public+ </div>+ )}+ </div>+ <div className="flex flex-col gap-2 max-w-64">+ <div className="flex items-center gap-2 text-xs text-foreground-light hover:text-foreground cursor-pointer">+ <Link size={14} className="text-foreground-light" /> Show Supabase Url+ </div>+ {/* <Separator /> */}+ {/* @mildtomato - To add in later with follow up PR */}+ {/* <ShowPublicJWTsDialogComposer /> */}+ </div>++ {/* <CreatePublishableAPIKeyModal /> */}++ <QuickKeyCopyWrapper />+ </div>+ </div>+ )+}++function ApiKeyInput() {+ const { ref: projectRef } = useParams()+ const {+ data: apiKeysData,+ isLoading: isApiKeysLoading,+ error,+ } = useAPIKeysQuery({ projectRef, reveal: false })+ const publishableApiKeys = useMemo(+ () => apiKeysData?.filter(({ type }) => type === 'publishable') ?? [],+ [apiKeysData]+ )+ const isPermissionsLoading = !usePermissionsLoaded()+ const canReadAPIKeys = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_WRITE, '*')+ // The default publisahble key will always be the first one+ const apiKey = publishableApiKeys[0]++ const baseClasses = 'flex-1 grow gap-1 rounded-full min-w-[300px] truncate'+ const size = 'tiny'++ if (isApiKeysLoading || isPermissionsLoading) {+ return (+ <div className={cn(InputVariants({ size }), baseClasses, 'items-center')}>+ <Skeleton className="h-2 w-48 rounded-full bg-foreground-muted" />+ </div>+ )+ }++ if (!canReadAPIKeys) {+ return (+ <div className={cn(InputVariants({ size }), baseClasses, 'items-center gap-2 font-normal')}>+ <EyeOffIcon />+ You do not have permission to read API Key+ </div>+ )+ }++ if (error) {+ return (+ <div className={cn(InputVariants({ size }), baseClasses, 'items-center gap-2 font-normal')}>+ <WarningIcon />+ Failed to load publishable key+ </div>+ )+ }++ return (+ <Input_Shadcn_+ key={apiKey?.id}+ size={size}+ className={cn(baseClasses, 'font-mono')}+ value={apiKey?.api_key}+ />+ )+}diff --git a/apps/studio/components/interfaces/APIKeys/QuickKeyCopy.tsx b/apps/studio/components/interfaces/APIKeys/QuickKeyCopy.tsxnew file mode 100644index 00000000000..1de291da97b--- /dev/null+++ b/apps/studio/components/interfaces/APIKeys/QuickKeyCopy.tsx@@ -0,0 +1,136 @@+import React, { useState } from 'react'+import { Button, EyeIcon, EyeOffIcon, Skeleton, WarningIcon } from 'ui'+import { ChevronsUpDownIcon } from 'lucide-react'+import { useParams } from 'common'+import { useAPIKeysQuery } from 'data/api-keys/api-keys-query'+import { SimpleCodeBlock } from 'ui/src/components/SimpleCodeBlock'+import { useCheckPermissions, usePermissionsLoaded } from 'hooks/misc/useCheckPermissions'+import { PermissionAction } from '@supabase/shared-types/out/constants'+import { useProjectSettingsV2Query } from 'data/config/project-settings-v2-query'++const frameworkOptions = ['React', 'Vue', 'Angular', 'Svelte'] // Add more as needed++const QuickKeyCopyWrapper = () => {+ const [selectedFramework, setSelectedFramework] = useState('React')++ return (+ <div className="flex flex-col gap-0 bg-alternative/50 border rounded-lg overflow-hidden">+ <div className="flex items-center gap-3 text-xs justify-between px-5 py-4">+ <div className="flex flex-col gap-0">+ <h4 className="text-sm">Quick key copy</h4>+ <p className="text-foreground-lighter">+ Choose your framework and paste the code into your environment file.+ </p>+ </div>+ <Button+ type="default"+ iconRight={<ChevronsUpDownIcon />}+ onClick={() => {+ const currentIndex = frameworkOptions.indexOf(selectedFramework)+ const nextIndex = (currentIndex + 1) % frameworkOptions.length+ setSelectedFramework(frameworkOptions[nextIndex])+ }}+ >+ {selectedFramework}+ </Button>+ </div>+ <QuickKeyCopyContent selectedFramework={selectedFramework} />+ </div>+ )+}++const QuickKeyCopyContent = ({ selectedFramework }: { selectedFramework: string }) => {+ const { ref: projectRef } = useParams()+ const {+ data: projectAPI,+ isLoading: isProjectApiLoading,+ error: projectApiError,+ } = useProjectSettingsV2Query({+ projectRef: projectRef as string,+ })+ const {+ data: apiKeysData,+ isLoading: isApiKeysLoading,+ error: apiKeysError,+ } = useAPIKeysQuery({+ projectRef: projectRef as string,+ reveal: false,+ })+ const isPermissionsLoading = !usePermissionsLoaded()+ const canReadAPIKeys = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_WRITE, '*')++ const publishableApiKey = apiKeysData?.find(({ type }) => type === 'publishable')?.api_key+ const dataErrors = projectApiError || apiKeysError+ const permissionErrors = !canReadAPIKeys && !isPermissionsLoading++ if (isProjectApiLoading || isApiKeysLoading || isPermissionsLoading) {+ return (+ <div className="bg-alternative px-5 py-3 border-t overflow-hidden flex flex-col gap-0 h-20">+ <div className="flex items-center gap-2 mb-3">+ <Skeleton className="h-4 w-4 rounded" />+ <Skeleton className="h-4 w-[48px] rounded" />+ </div>+ <Skeleton className="h-[40px] w-3/4 rounded" />+ </div>+ )+ }++ const EmptyContainer = ({ children }: { children: React.ReactNode }) => {+ return (+ <div className="bg-alternative justify-center px-5 py-3 border-t overflow-hidden flex flex-col gap-1 h-20">+ {children}+ </div>+ )+ }++ // if (!canReadAPIKeys) {+ // return (+ // <EmptyContainer>+ // <div className="flex items-center gap-2">+ // <EyeOffIcon />+ // <p className="text-sm text-foreground">You do not have permission to read API Keys</p>+ // </div>+ // <p className="text-foreground-light text-xs">+ // Please contact your project admin/owner to request access.+ // </p>+ // </EmptyContainer>+ // )+ // }++ // TO DO : this needs to be changed to just if(error)+ // currently it's not working as API returns an error.+ if (dataErrors) {+ return (+ <EmptyContainer>+ <div className="flex items-center gap-2">+ <WarningIcon />+ <p className="text-sm text-warning-600">Error loading Secret API Keys</p>+ </div>+ <p className="text-warning/75 text-xs">+ {projectApiError?.message ?? apiKeysError?.message ?? 'Error: Failed to load API keys'}+ </p>+ </EmptyContainer>+ )+ }++ const getEnvContent = () => {+ return `+NEXT_PUBLIC_SUPABASE_URL=${projectAPI?.app_config?.endpoint || ''}+NEXT_PUBLIC_SUPABASE_PUBLISHABLE_API_KEY=${!canReadAPIKeys ? 'You do not have permission to read the Publishable API key' : publishableApiKey || ''}+`+ }++ return (+ <div className="bg-alternative px-5 py-3 border-t overflow-hidden">+ <div className="flex items-center gap-2 mb-3">+ <div className="bg-foreground w-4 h-4 flex items-end justify-center rounded-sm">+ <span className="font-mono text-[8px] text-background font-bold">env</span>+ </div>+ <span className="font-mono text-xs">.env.local</span>+ </div>+ <SimpleCodeBlock parentClassName="!p-0">{getEnvContent()}</SimpleCodeBlock>+ </div>+ )+}++export default QuickKeyCopyWrapperdiff --git a/apps/studio/components/interfaces/APIKeys/SecretAPIKeys.tsx b/apps/studio/components/interfaces/APIKeys/SecretAPIKeys.tsxnew file mode 100644index 00000000000..4a52c82178a--- /dev/null+++ b/apps/studio/components/interfaces/APIKeys/SecretAPIKeys.tsx@@ -0,0 +1,146 @@+import { PermissionAction } from '@supabase/shared-types/out/constants'+import { useMemo } from 'react'++import { useParams } from 'common'+import { FormHeader } from 'components/ui/Forms/FormHeader'+import { APIKeysData, useAPIKeysQuery } from 'data/api-keys/api-keys-query'+import { useCheckPermissions, usePermissionsLoaded } from 'hooks/misc/useCheckPermissions'+import { Card, CardContent, EyeOffIcon, Skeleton, WarningIcon, cn } from 'ui'+import {+ Table,+ TableBody,+ TableCell,+ TableHead,+ TableHeader,+ TableRow,+} from 'ui/src/components/shadcn/ui/table'+import { APIKeyRow } from './APIKeyRow'+import CreateSecretAPIKeyModal from './CreateSecretAPIKeyModal'++export const SecretAPIKeys = () => {+ const { ref: projectRef } = useParams()+ const {+ data: apiKeysData,+ isLoading: isLoadingApiKeys,+ error,+ } = useAPIKeysQuery({ projectRef, reveal: false })++ const isLoadingPermissions = !usePermissionsLoaded()+ const canReadAPIKeys = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_WRITE, '*')++ const secretApiKeys = useMemo(+ () =>+ apiKeysData?.filter(+ (key): key is Extract<APIKeysData[number], { type: 'secret' }> => key.type === 'secret'+ ) ?? [],+ [apiKeysData]+ )++ const empty = secretApiKeys?.length === 0 && !isLoadingApiKeys && !isLoadingPermissions++ const RowLoading = () => (+ <TableRow>+ <TableCell>+ <Skeleton className="max-w-12 h-4 rounded-full" />+ </TableCell>+ <TableCell>+ <Skeleton className="max-w-60 h-4 rounded-full" />+ </TableCell>+ <TableCell>+ <Skeleton className="w-2 h-4 rounded-full" />+ </TableCell>+ </TableRow>+ )++ const TableContainer = ({ children }: { children: React.ReactNode }) => (+ <div>+ <FormHeader+ title="Secret keys"+ description="These API keys allow privileged access to your project's APIs. Use in servers, functions, workers or other backend components of your application. Keep secret and never publish."+ actions={<CreateSecretAPIKeyModal />}+ />+ <Card className={cn('w-full overflow-hidden', !empty && 'bg-surface-100')}>+ <CardContent className="p-0">+ <Table className="p-5">+ <TableHeader>+ <TableRow className={cn('bg-200', empty && 'hidden')}>+ <TableHead+ key=""+ className="text-left font-mono uppercase text-xs text-foreground-lighter h-auto py-2 overflow-hidden"+ >+ Name+ </TableHead>+ <TableHead className="text-left font-mono uppercase text-xs text-foreground-lighter h-auto py-2 pr-0">+ API Key+ </TableHead>+ <TableHead+ className="text-right font-mono uppercase text-xs text-foreground-lighter h-auto py-2"+ key="actions"+ />+ </TableRow>+ </TableHeader>+ <TableBody className="">{children}</TableBody>+ </Table>+ </CardContent>+ </Card>+ </div>+ )++ if (isLoadingApiKeys || isLoadingPermissions) {+ return (+ <TableContainer>+ <RowLoading />+ <RowLoading />+ </TableContainer>+ )+ }++ if (!canReadAPIKeys) {+ return (+ <TableContainer>+ <div className="!rounded-b-md overflow-hidden py-12 flex flex-col gap-1 items-center justify-center">+ <EyeOffIcon />+ <p className="text-sm text-foreground">+ You do not have permission to read API Secret Keys+ </p>+ <p className="text-foreground-light">+ Contact your organization owner/admin to request access.+ </p>+ </div>+ </TableContainer>+ )+ }++ if (error) {+ return (+ <TableContainer>+ <div className="!rounded-b-md overflow-hidden py-12 flex flex-col gap-1 items-center justify-center">+ <WarningIcon />+ <p className="text-sm text-warning-600">Error loading Secret API Keys</p>+ <p className="text-warning/75">{error.message}</p>+ </div>+ </TableContainer>+ )+ }++ if (empty) {+ return (+ <TableContainer>+ <div className="!rounded-b-md overflow-hidden py-12 flex flex-col gap-1 items-center justify-center">+ <p className="text-sm text-foreground">No secret API keys exist</p>+ <p className="text-sm text-foreground-light">+ Your project can't be accessed using secret API keys.+ </p>+ </div>+ </TableContainer>+ )+ }++ return (+ <TableContainer>+ {secretApiKeys.map((apiKey) => (+ <APIKeyRow key={apiKey.id} apiKey={apiKey} />+ ))}+ </TableContainer>+ )+}diff --git a/apps/studio/components/interfaces/Account/Preferences/ThemeSettings.tsx b/apps/studio/components/interfaces/Account/Preferences/ThemeSettings.tsxindex 21c44e24563..f4b5762c270 100644--- a/apps/studio/components/interfaces/Account/Preferences/ThemeSettings.tsx+++ b/apps/studio/components/interfaces/Account/Preferences/ThemeSettings.tsx@@ -1,9 +1,10 @@-import Panel from 'components/ui/Panel'-import { useLocalStorageQuery } from 'hooks/misc/useLocalStorage'-import { BASE_PATH, LOCAL_STORAGE_KEYS } from 'lib/constants'import { useTheme } from 'next-themes'import { useEffect, useState } from 'react'import SVG from 'react-inlinesvg'++import Panel from 'components/ui/Panel'+import { useLocalStorageQuery } from 'hooks/misc/useLocalStorage'+import { BASE_PATH, LOCAL_STORAGE_KEYS } from 'lib/constants'import {Label_Shadcn_,RadioGroup_Shadcn_,@@ -15,7 +16,7 @@ import {} from 'ui'import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'-const ThemeSettings = () => {+export const ThemeSettings = () => {const [mounted, setMounted] = useState(false)const { theme, setTheme } = useTheme()@@ -24,20 +25,14 @@ const ThemeSettings = () => {true)- const [expandNavigationPanel, setExpandNavigationPanel] = useState(allowNavPanelToExpand)-/*** Avoid Hydration Mismatch* https://github.com/pacocoursey/next-themes?tab=readme-ov-file#avoid-hydration-mismatch*/// useEffect only runs on the client, so now we can safely show the UI- useEffect(() => {- setMounted(true)- }, [])+ useEffect(() => setMounted(true), [])- if (!mounted) {- return null- }+ if (!mounted) return nullfunction SingleThemeSelection() {return (@@ -65,14 +60,9 @@ const ThemeSettings = () => {)}- function handleExpandNavigationPanel() {- setExpandNavigationPanel(!expandNavigationPanel)- setAllowNavPanelToExpand(!allowNavPanelToExpand)- }-return (<Panel title={<h5 key="panel-title">Appearance</h5>}>- <Panel.Content className="grid gap-8">+ <Panel.Content className="grid gap-8 !py-5"><div className="grid grid-cols-12"><div className="col-span-full md:col-span-4 flex flex-col gap-5"><Label_Shadcn_ htmlFor="theme" className="text-light">@@ -88,25 +78,22 @@ const ThemeSettings = () => {<SingleThemeSelection /></div></div>-- <Separator />-+ </Panel.Content>+ <Separator />+ <Panel.Content><FormItemLayoutisReactForm={false}label="Expand Navigation menu"layout="flex-row-reverse"description="Allow the Navigation panel to expand on hover"- className="pb-3"><Switchsize="large"- checked={expandNavigationPanel}- onCheckedChange={() => handleExpandNavigationPanel()}+ checked={allowNavPanelToExpand}+ onCheckedChange={setAllowNavPanelToExpand}/></FormItemLayout></Panel.Content></Panel>)}--export default ThemeSettingsdiff --git a/apps/studio/components/interfaces/Account/Preferences/index.ts b/apps/studio/components/interfaces/Account/Preferences/index.tsindex be8a47b1747..4c1f94c38e2 100644--- a/apps/studio/components/interfaces/Account/Preferences/index.ts+++ b/apps/studio/components/interfaces/Account/Preferences/index.ts@@ -1,3 +1,2 @@export { default as AccountInformation } from './AccountInformation'export { default as AnalyticsSettings } from './AnalyticsSettings'-export { default as ThemeSettings } from './ThemeSettings'diff --git a/apps/studio/components/layouts/ProjectSettingsLayout/SettingsLayout.tsx b/apps/studio/components/layouts/ProjectSettingsLayout/SettingsLayout.tsxindex 61456306745..50297f9f669 100644--- a/apps/studio/components/layouts/ProjectSettingsLayout/SettingsLayout.tsx+++ b/apps/studio/components/layouts/ProjectSettingsLayout/SettingsLayout.tsx@@ -47,6 +47,7 @@ const SettingsLayout = ({ title, children }: PropsWithChildren<SettingsLayoutPro])const diskAndComputeEnabled = useFlag('diskAndComputeForm')+ const newApiKeys = useFlag('newApiKeys')const menuRoutes = generateSettingsMenu(ref, project, organization, {auth: authEnabled,@@ -54,6 +55,7 @@ const SettingsLayout = ({ title, children }: PropsWithChildren<SettingsLayoutProstorage: storageEnabled,invoices: invoicesEnabled,diskAndCompute: diskAndComputeEnabled,+ newApiKeys,})return (diff --git a/apps/studio/components/layouts/ProjectSettingsLayout/SettingsMenu.utils.tsx b/apps/studio/components/layouts/ProjectSettingsLayout/SettingsMenu.utils.tsxindex f365c006b18..0013b6e19a4 100644--- a/apps/studio/components/layouts/ProjectSettingsLayout/SettingsMenu.utils.tsx+++ b/apps/studio/components/layouts/ProjectSettingsLayout/SettingsMenu.utils.tsx@@ -15,6 +15,7 @@ export const generateSettingsMenu = (storage?: booleaninvoices?: booleandiskAndCompute?: boolean+ newApiKeys?: boolean}): ProductMenuGroup[] => {const isProjectBuilding = project?.status === PROJECT_STATUS.COMING_UP@@ -59,6 +60,17 @@ export const generateSettingsMenu = (url: `/project/${ref}/settings/integrations`,items: [],},+ ...(features?.newApiKeys+ ? [+ {+ name: 'API Keys',+ key: 'api-keys',+ url: `/project/${ref}/settings/api-keys`,+ items: [],+ label: 'NEW',+ },+ ]+ : []),]: []),{@@ -87,7 +99,7 @@ export const generateSettingsMenu = (items: [],},{- name: 'API',+ name: 'Data API',key: 'api',url: isProjectBuilding ? buildingUrl : `/project/${ref}/settings/api`,items: [],diff --git a/apps/studio/components/layouts/project/[ref]/settings/APIKeysLayout.tsx b/apps/studio/components/layouts/project/[ref]/settings/APIKeysLayout.tsxnew file mode 100644index 00000000000..629b34f6fa9--- /dev/null+++ b/apps/studio/components/layouts/project/[ref]/settings/APIKeysLayout.tsx@@ -0,0 +1,91 @@+import {+ ScaffoldContainer,+ ScaffoldDescription,+ ScaffoldHeader,+ ScaffoldTitle,+} from 'components/layouts/Scaffold'+import { useLocalStorageQuery } from 'hooks/misc/useLocalStorage'+import { Sparkles } from 'lucide-react'+import { PropsWithChildren } from 'react'+import {+ buttonVariants,+ cn,+ Separator,+ Tabs_Shadcn_,+ TabsList_Shadcn_,+ TabsTrigger_Shadcn_,+} from 'ui'++import { LOCAL_STORAGE_KEYS } from 'lib/constants'+import { useParams } from 'common'++const ApiKeysLayout = ({ children }: PropsWithChildren) => {+ const { ref: projectRef } = useParams()+ const [apiKeysView, setApiKeysViewState] = useLocalStorageQuery(+ LOCAL_STORAGE_KEYS.API_KEYS_VIEW(projectRef ?? ''),+ 'new-keys'+ )++ return (+ <>+ <ScaffoldContainer>+ <ScaffoldHeader>+ <ScaffoldTitle>API Keys</ScaffoldTitle>+ <ScaffoldDescription>+ Configure API keys that help secure your project+ </ScaffoldDescription>+ </ScaffoldHeader>+ </ScaffoldContainer>+ <ScaffoldContainer className="flex flex-col gap-10">+ <Tabs_Shadcn_+ defaultValue={apiKeysView}+ className="relative"+ value={apiKeysView}+ onValueChange={setApiKeysViewState}+ >+ <div className="flex-shrink-0">+ <TabsList_Shadcn_ className="inline-flex gap-1 p-1 bg-surface-75 bg-opacity-100 border rounded-lg">+ <TabsTrigger_Shadcn_+ value="new-keys"+ className={cn(+ buttonVariants({+ type: apiKeysView === 'new-keys' ? 'default' : 'text',+ size: 'tiny',+ }),+ apiKeysView !== 'new-keys'+ ? 'text-foreground-lighter'+ : '!border-foreground-muted',+ 'flex gap-2'+ )}+ >+ <Sparkles size={13} strokeWidth={1.2} className="text-foreground-light" />+ New Keys+ </TabsTrigger_Shadcn_>+ <TabsTrigger_Shadcn_+ value="legacy-keys"+ className={cn(+ buttonVariants({+ type: apiKeysView === 'legacy-keys' ? 'default' : 'text',+ size: 'tiny',+ }),+ apiKeysView !== 'legacy-keys'+ ? 'text-foreground-lighter'+ : '!border-foreground-muted'+ )}+ >+ Legacy Keys+ </TabsTrigger_Shadcn_>+ </TabsList_Shadcn_>+ </div>+ </Tabs_Shadcn_>+ </ScaffoldContainer>++ <ScaffoldContainer className="flex flex-col gap-10 py-8" bottomPadding>+ <Separator />+ {children}+ </ScaffoldContainer>+ </>+ )+}++export default ApiKeysLayoutdiff --git a/apps/studio/components/ui/CopyButton.tsx b/apps/studio/components/ui/CopyButton.tsxindex e421901a61e..31b52903962 100644--- a/apps/studio/components/ui/CopyButton.tsx+++ b/apps/studio/components/ui/CopyButton.tsx@@ -4,14 +4,28 @@ import { useEffect, useState } from 'react'import { copyToClipboard } from 'lib/helpers'import { Button, ButtonProps, cn } from 'ui'-export interface CopyButtonProps extends ButtonProps {- text: string+type CopyButtonBaseProps = {iconOnly?: booleancopyLabel?: stringcopiedLabel?: string+ onCopy?: () => Promise<string> | string}++type CopyButtonWithText = CopyButtonBaseProps & {+ text: string+ asyncText?: never+}++type CopyButtonWithAsyncText = CopyButtonBaseProps & {+ text?: never+ asyncText: () => Promise<string> | string+}++export type CopyButtonProps = (CopyButtonWithText | CopyButtonWithAsyncText) & ButtonProps+const CopyButton = ({text,+ asyncText,iconOnly = false,children,onClick,@@ -30,8 +44,9 @@ const CopyButton = ({return (<ButtononClick={async (e) => {+ const textToCopy = asyncText ? await asyncText() : textsetShowCopied(true)- await copyToClipboard(text)+ await copyToClipboard(textToCopy!)onClick?.(e)}}{...props}@@ -49,4 +64,5 @@ const CopyButton = ({</Button>)}+export default CopyButtondiff --git a/apps/studio/components/ui/Panel.tsx b/apps/studio/components/ui/Panel.tsxindex 6b4c50d7073..fd3724b6372 100644--- a/apps/studio/components/ui/Panel.tsx+++ b/apps/studio/components/ui/Panel.tsx@@ -62,8 +62,9 @@ const PanelNotice = forwardRef<description?: stringhref?: stringbuttonText?: string+ badgeLabel?: string}->(({ className, title, description, href, buttonText, ...props }, ref) => {+>(({ className, title, description, href, buttonText, badgeLabel, ...props }, ref) => {return (<divref={ref}@@ -95,7 +96,7 @@ const PanelNotice = forwardRef<flex-shrink-0 gap-1.5 border-dashed bg-opacity-0 bg-surface-400 text-foreground-lighter"><Megaphone size={16} strokeWidth={1.2} />- Upcoming change+ <span className="text-foreground-lighter">{badgeLabel ?? 'Upcoming change'}</span></Badge><Badgevariant={'default'}diff --git a/apps/studio/components/ui/ProjectSettings/DisplayApiSettings.tsx b/apps/studio/components/ui/ProjectSettings/DisplayApiSettings.tsxindex 98726e1d2f3..d4f7b1b9d1a 100644--- a/apps/studio/components/ui/ProjectSettings/DisplayApiSettings.tsx+++ b/apps/studio/components/ui/ProjectSettings/DisplayApiSettings.tsx@@ -1,17 +1,25 @@import { PermissionAction } from '@supabase/shared-types/out/constants'import { JwtSecretUpdateStatus } from '@supabase/shared-types/out/events'-import { AlertCircle, BookOpen, Loader2 } from 'lucide-react'-import { useParams } from 'common'import Panel from 'components/ui/Panel'import { useJwtSecretUpdatingStatusQuery } from 'data/config/jwt-secret-updating-status-query'import { useProjectSettingsV2Query } from 'data/config/project-settings-v2-query'import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'-import { Button, Input } from 'ui'+import { useFlag } from 'hooks/ui/useFlag'+import { AlertCircle, Loader2 } from 'lucide-react'+import { Input } from 'ui'-const DisplayApiSettings = ({ legacy }: { legacy?: boolean }) => {+const DisplayApiSettings = ({+ legacy,+ showNotice = true,+}: {+ legacy?: boolean+ showNotice?: boolean+}) => {const { ref: projectRef } = useParams()+ const newApiKeysFlag = useFlag('newApiKeys')+const {data: settings,isError: isProjectSettingsError,@@ -45,15 +53,6 @@ const DisplayApiSettings = ({ legacy }: { legacy?: boolean }) => {<br />You can use the keys below in the Supabase client libraries.<br />- <a- href="https://supabase.com/docs#client-libraries"- target="_blank"- rel="noreferrer"- >- <Button icon={<BookOpen />} type="default" className="mt-4">- Client Docs- </Button>- </a></p></div>)@@ -132,15 +131,30 @@ const DisplayApiSettings = ({ legacy }: { legacy?: boolean }) => {</Panel.Content>)))}- <Panel.Notice- className="border-t"- title="New API keys coming 2025"- description={`+ {showNotice ? (+ newApiKeysFlag ? (+ <Panel.Notice+ className="border-t"+ title="API keys have moved"+ badgeLabel={'Changelog'}+ description={`+ \`anon\` and \`service_role\` API keys can now be replaced with \`publishable\` and \`secret\` API keys.+ `}+ href="https://github.com/orgs/supabase/discussions/29260"+ buttonText="Read the announcement"+ />+ ) : (+ <Panel.Notice+ className="border-t"+ title="New API keys coming Q4 2024"+ description={`\`anon\` and \`service_role\` API keys will be changing to \`publishable\` and \`secret\` API keys.`}- href="https://github.com/orgs/supabase/discussions/29260"- buttonText="Read the announcement"- />+ href="https://github.com/orgs/supabase/discussions/29260"+ buttonText="Read the announcement"+ />+ )+ ) : null}</Panel></>)diff --git a/apps/studio/data/api-keys/[id]/api-key-id-query.ts b/apps/studio/data/api-keys/[id]/api-key-id-query.tsnew file mode 100644index 00000000000..06aae547d13--- /dev/null+++ b/apps/studio/data/api-keys/[id]/api-key-id-query.ts@@ -0,0 +1,47 @@+import { useQuery, UseQueryOptions } from '@tanstack/react-query'+import { get, handleError } from 'data/fetchers'+import { ResponseError } from 'types'+import { apiKeysKeys } from './../keys'++export interface APIKeyVariables {+ projectRef?: string+ id?: string+ reveal: boolean+}++export async function getAPIKeysById(+ { projectRef, id, reveal }: APIKeyVariables,+ signal?: AbortSignal+) {+ if (typeof projectRef === 'undefined') throw new Error('projectRef is required')+ if (typeof id === 'undefined') throw new Error('Content ID is required')++ const { data, error } = await get('/v1/projects/{ref}/api-keys/{id}', {+ params: {+ path: { ref: projectRef, id },+ query: { reveal },+ },+ signal,+ })++ if (error) {+ handleError(error)+ }++ return data+}++export type APIKeyIdData = Awaited<ReturnType<typeof getAPIKeysById>>++export const useAPIKeyIdQuery = <TData = APIKeyIdData>(+ { projectRef, id, reveal }: APIKeyVariables,+ { enabled = true, ...options }: UseQueryOptions<APIKeyIdData, ResponseError, TData> = {}+) =>+ useQuery<APIKeyIdData, ResponseError, TData>(+ apiKeysKeys.single(projectRef, id),+ ({ signal }) => getAPIKeysById({ projectRef, id, reveal }, signal),+ {+ enabled: enabled && typeof projectRef !== 'undefined' && typeof id !== 'undefined',+ ...options,+ }+ )diff --git a/apps/studio/data/api-keys/[id]/api-key-id-update-mutation.ts b/apps/studio/data/api-keys/[id]/api-key-id-update-mutation.tsnew file mode 100644index 00000000000..18751a12448--- /dev/null+++ b/apps/studio/data/api-keys/[id]/api-key-id-update-mutation.ts@@ -0,0 +1,70 @@+import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query'+import { handleError, patch } from 'data/fetchers'+import { toast } from 'sonner'+import { ResponseError } from 'types'+import { apiKeysKeys } from '../keys'++export interface UpdateAPIKeybyIdVariables {+ projectRef?: string+ id?: string+ description?: string+}++export async function updateAPIKeysById(+ { projectRef, id, description }: UpdateAPIKeybyIdVariables,+ signal?: AbortSignal+) {+ if (typeof projectRef === 'undefined') throw new Error('projectRef is required')+ if (typeof id === 'undefined') throw new Error('API key ID is required')++ const { data, error } = await patch('/v1/projects/{ref}/api-keys/{id}', {+ params: {+ path: { ref: projectRef, id },+ query: { reveal: false },+ },+ body: {+ description: description,+ },+ signal,+ })++ if (error) {+ handleError(error)+ }++ return data+}++export type ResourceUpdateData = Awaited<ReturnType<typeof updateAPIKeysById>>++export const useResourceUpdateMutation = ({+ onSuccess,+ onError,+ ...options+}: Omit<+ UseMutationOptions<ResourceUpdateData, ResponseError, UpdateAPIKeybyIdVariables>,+ 'mutationFn'+> = {}) => {+ const queryClient = useQueryClient()++ return useMutation<ResourceUpdateData, ResponseError, UpdateAPIKeybyIdVariables>(+ (vars) => updateAPIKeysById(vars),+ {+ async onSuccess(data, variables, context) {+ const { projectRef, id } = variables++ await queryClient.invalidateQueries(apiKeysKeys.list(projectRef))++ await onSuccess?.(data, variables, context)+ },+ async onError(data, variables, context) {+ if (onError === undefined) {+ toast.error(`Failed to mutate: ${data.message}`)+ } else {+ onError(data, variables, context)+ }+ },+ ...options,+ }+ )+}diff --git a/apps/studio/data/api-keys/api-key-create-mutation.ts b/apps/studio/data/api-keys/api-key-create-mutation.tsnew file mode 100644index 00000000000..431c7677601--- /dev/null+++ b/apps/studio/data/api-keys/api-key-create-mutation.ts@@ -0,0 +1,85 @@+import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query'+import { toast } from 'sonner'++import { handleError, post } from 'data/fetchers'+import type { ResponseError } from 'types'+import { apiKeysKeys } from './keys'++export type APIKeyCreateVariables = {+ projectRef?: string+ description: string+} & (+ | {+ type: 'publishable'+ }+ | {+ type: 'secret'+ // secret_jwt_template?: { // @mildtomato (Jonny) removed this field to reduce scope+ // role: string+ // } | null+ }+)++export async function createAPIKey(payload: APIKeyCreateVariables) {+ if (!payload.projectRef) throw new Error('projectRef is required')++ const { data, error } = await post('/v1/projects/{ref}/api-keys', {+ params: {+ path: { ref: payload.projectRef },+ query: {+ reveal: false,+ },+ },+ body:+ payload.type === 'secret'+ ? {+ type: payload.type,+ description: payload.description || null,+ // secret_jwt_template: payload?.secret_jwt_template || null,+ secret_jwt_template: {+ role: 'service_role', // @mildtomato (Jonny) this should be default in API for type secret+ },+ }+ : {+ type: payload.type,+ description: payload.description || null,+ },+ })++ if (error) handleError(error)+ return data+}++type APIKeyCreateData = Awaited<ReturnType<typeof createAPIKey>>++export const useAPIKeyCreateMutation = ({+ onSuccess,+ onError,+ ...options+}: Omit<+ UseMutationOptions<APIKeyCreateData, ResponseError, APIKeyCreateVariables>,+ 'mutationFn'+> = {}) => {+ const queryClient = useQueryClient()++ return useMutation<APIKeyCreateData, ResponseError, APIKeyCreateVariables>(+ (vars) => createAPIKey(vars),+ {+ async onSuccess(data, variables, context) {+ const { projectRef } = variables++ await queryClient.invalidateQueries(apiKeysKeys.list(projectRef))++ await onSuccess?.(data, variables, context)+ },+ async onError(data, variables, context) {+ if (onError === undefined) {+ toast.error(`Failed to mutate: ${data.message}`)+ } else {+ onError(data, variables, context)+ }+ },+ ...options,+ }+ )+}diff --git a/apps/studio/data/api-keys/api-key-delete-mutation.ts b/apps/studio/data/api-keys/api-key-delete-mutation.tsnew file mode 100644index 00000000000..7bedb402a2c--- /dev/null+++ b/apps/studio/data/api-keys/api-key-delete-mutation.ts@@ -0,0 +1,58 @@+import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query'+import { del, handleError } from 'data/fetchers'+import { toast } from 'sonner'+import type { ResponseError } from 'types'+import { apiKeysKeys } from './keys'++export type APIKeyDeleteVariables = {+ projectRef?: string+ id: string+}++export async function deleteAPIKey(payload: APIKeyDeleteVariables) {+ if (!payload.projectRef) throw new Error('projectRef is required')++ const { data, error } = await del('/v1/projects/{ref}/api-keys/{id}', {+ params: {+ path: { ref: payload.projectRef, id: payload.id },+ query: { reveal: false },+ },+ })++ if (error) handleError(error)+ return data+}++type APIKeyDeleteData = Awaited<ReturnType<typeof deleteAPIKey>>++export const useAPIKeyDeleteMutation = ({+ onSuccess,+ onError,+ ...options+}: Omit<+ UseMutationOptions<APIKeyDeleteData, ResponseError, APIKeyDeleteVariables>,+ 'mutationFn'+> = {}) => {+ const queryClient = useQueryClient()++ return useMutation<APIKeyDeleteData, ResponseError, APIKeyDeleteVariables>(+ (vars) => deleteAPIKey(vars),+ {+ async onSuccess(data, variables, context) {+ const { projectRef } = variables++ await queryClient.invalidateQueries(apiKeysKeys.list(projectRef))++ await onSuccess?.(data, variables, context)+ },+ async onError(data, variables, context) {+ if (onError === undefined) {+ toast.error(`Failed to mutate: ${data.message}`)+ } else {+ onError(data, variables, context)+ }+ },+ ...options,+ }+ )+}diff --git a/apps/studio/data/api-keys/api-keys-query.ts b/apps/studio/data/api-keys/api-keys-query.tsnew file mode 100644index 00000000000..27a5bcaeabc--- /dev/null+++ b/apps/studio/data/api-keys/api-keys-query.ts@@ -0,0 +1,81 @@+import { useQuery, UseQueryOptions } from '@tanstack/react-query'+import { get, handleError } from 'data/fetchers'+import { ResponseError } from 'types'++import { components } from 'api-types'+import { apiKeysKeys } from './keys'++type LegacyKeys = {+ api_key: string+ description?: string | null+ hash?: string | null+ id?: string | null+ inserted_at?: string | null+ name: string+ prefix?: string | null+ secret_jwt_template?: components['schemas']['ApiKeySecretJWTTemplate'] | null+ type: 'legacy' | null+ updated_at?: string | null+}++type SecretKeys = {+ api_key: string+ description?: string+ hash: string+ id: string+ inserted_at: string+ name: string+ prefix: string+ secret_jwt_template: components['schemas']['ApiKeySecretJWTTemplate']+ type: 'secret'+ updated_at?: string+}++type PublishableKeys = {+ api_key: string+ description?: string+ hash?: string+ id: string+ inserted_at: string+ name: string+ prefix?: string+ secret_jwt_template?: components['schemas']['ApiKeySecretJWTTemplate'] | null+ type: 'publishable'+ updated_at?: string+}++export interface APIKeysVariables {+ projectRef?: string+ reveal: boolean+}++export async function getAPIKeys({ projectRef, reveal }: APIKeysVariables, signal?: AbortSignal) {+ if (!projectRef) throw new Error('projectRef is required')++ const { data, error } = await get(`/v1/projects/{ref}/api-keys`, {+ params: { path: { ref: projectRef }, query: { reveal } },+ signal,+ })++ if (error) {+ handleError(error)+ }++ // [Jonny]: Overriding the types here since some stuff is not actually nullable or optional+ return data as unknown as (LegacyKeys | SecretKeys | PublishableKeys)[]+}++export type APIKeysData = Awaited<ReturnType<typeof getAPIKeys>>++export const useAPIKeysQuery = <TData = APIKeysData>(+ { projectRef, reveal }: APIKeysVariables,+ { enabled, ...options }: UseQueryOptions<APIKeysData, ResponseError, TData> = {}+) =>+ useQuery<APIKeysData, ResponseError, TData>(+ apiKeysKeys.list(projectRef),+ ({ signal }) => getAPIKeys({ projectRef, reveal }, signal),+ {+ enabled: enabled && !!projectRef,+ ...options,+ }+ )diff --git a/apps/studio/data/api-keys/keys.ts b/apps/studio/data/api-keys/keys.tsnew file mode 100644index 00000000000..96d50623291--- /dev/null+++ b/apps/studio/data/api-keys/keys.ts@@ -0,0 +1,4 @@+export const apiKeysKeys = {+ list: (projectRef?: string) => ['projects', projectRef, 'api-keys'] as const,+ single: (projectRef?: string, id?: string) => ['projects', projectRef, 'api-keys', id] as const,+}diff --git a/apps/studio/lib/constants/index.ts b/apps/studio/lib/constants/index.tsindex 1418f12a5e2..2a17b7d4ff7 100644--- a/apps/studio/lib/constants/index.ts+++ b/apps/studio/lib/constants/index.ts@@ -80,6 +80,9 @@ export const LOCAL_STORAGE_KEYS = {AUTH_SMTP_CHANGES_WARNING: 'auth-smtp-changes-warning-dismissed',AUTH_USERS_COLUMNS_CONFIGURATION: (ref: string) => `supabase-auth-users-columns-${ref}`,++ // api keys view switcher for new and legacy api keys+ API_KEYS_VIEW: (ref: string) => `supabase-api-keys-view-${ref}`,}export const OPT_IN_TAGS = {diff --git a/apps/studio/pages/account/me.tsx b/apps/studio/pages/account/me.tsxindex 011e993326c..695f047387e 100644--- a/apps/studio/pages/account/me.tsx+++ b/apps/studio/pages/account/me.tsx@@ -1,10 +1,7 @@-import {- AccountInformation,- AnalyticsSettings,- ThemeSettings,-} from 'components/interfaces/Account/Preferences'+import { AccountInformation, AnalyticsSettings } from 'components/interfaces/Account/Preferences'import { AccountDeletion } from 'components/interfaces/Account/Preferences/AccountDeletion'import { ProfileInformation } from 'components/interfaces/Account/Preferences/ProfileInformation'+import { ThemeSettings } from 'components/interfaces/Account/Preferences/ThemeSettings'import AccountLayout from 'components/layouts/AccountLayout/AccountLayout'import {ScaffoldContainer,diff --git a/apps/studio/pages/project/[ref]/settings/api-keys.tsx b/apps/studio/pages/project/[ref]/settings/api-keys.tsxnew file mode 100644index 00000000000..e0f90a1737e--- /dev/null+++ b/apps/studio/pages/project/[ref]/settings/api-keys.tsx@@ -0,0 +1,47 @@+import { PermissionAction } from '@supabase/shared-types/out/constants'+import { useParams } from 'common'++import LegacyAPIKeys from 'components/interfaces/APIKeys/LegacyAPIKeys'+import { PublishableAPIKeys } from 'components/interfaces/APIKeys/PublishableAPIKeys'+import { SecretAPIKeys } from 'components/interfaces/APIKeys/SecretAPIKeys'+import ApiKeysLayout from 'components/layouts/project/[ref]/settings/APIKeysLayout'+import SettingsLayout from 'components/layouts/ProjectSettingsLayout/SettingsLayout'+import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'+import { useLocalStorageQuery } from 'hooks/misc/useLocalStorage'+import { LOCAL_STORAGE_KEYS } from 'lib/constants'+import type { NextPageWithLayout } from 'types'+import { Separator } from 'ui'++const ApiKeysSettings: NextPageWithLayout = () => {+ const { ref: projectRef } = useParams()+ const [apiKeysView] = useLocalStorageQuery(+ LOCAL_STORAGE_KEYS.API_KEYS_VIEW(projectRef ?? ''),+ undefined+ )++ // const isPermissionsLoaded = usePermissionsLoaded()+ // TODO: check if these permissions cover third party auth as well+ const canReadAPIKeys = useCheckPermissions(PermissionAction.READ, 'api_keys')++ return (+ <>+ {apiKeysView !== 'legacy-keys' ? (+ <>+ <PublishableAPIKeys />+ <Separator />+ <SecretAPIKeys />+ </>+ ) : (+ <LegacyAPIKeys />+ )}+ </>+ )+}++ApiKeysSettings.getLayout = (page) => (+ <SettingsLayout>+ <ApiKeysLayout>{page}</ApiKeysLayout>+ </SettingsLayout>+)++export default ApiKeysSettingsdiff --git a/packages/ui-patterns/Dialogs/ConfirmationModal.tsx b/packages/ui-patterns/Dialogs/ConfirmationModal.tsxindex 3942f9133fd..fc44551ed24 100644--- a/packages/ui-patterns/Dialogs/ConfirmationModal.tsx+++ b/packages/ui-patterns/Dialogs/ConfirmationModal.tsx@@ -12,12 +12,13 @@ import {cn,} from 'ui'import { Admonition } from './../admonition'-import { DialogHeader } from 'ui/src/components/shadcn/ui/dialog'+import { DialogDescription, DialogHeader } from 'ui/src/components/shadcn/ui/dialog'export interface ConfirmationModalProps {loading?: booleanvisible: booleantitle: string | React.ReactNode+ description?: string | React.ReactNodesize?: React.ComponentProps<typeof DialogContent>['size']confirmLabel?: stringconfirmLabelLoading?: string@@ -40,6 +41,7 @@ const ConfirmationModal = forwardRef<({title,+ description,size = 'small',visible,onCancel,@@ -84,6 +86,7 @@ const ConfirmationModal = forwardRef<<DialogContent ref={ref} className="p-0 gap-0 pb-5 !block" size={size}><DialogHeader className={cn('border-b')} padding={'small'}><DialogTitle className="">{title}</DialogTitle>+ {description && <DialogDescription>{description}</DialogDescription>}</DialogHeader>{alert && (<Admonitiondiff --git a/packages/ui/src/components/SimpleCodeBlock/SimpleCodeBlock.tsx b/packages/ui/src/components/SimpleCodeBlock/SimpleCodeBlock.tsxindex 7ffcbd5ca56..6ec54244c17 100644--- a/packages/ui/src/components/SimpleCodeBlock/SimpleCodeBlock.tsx+++ b/packages/ui/src/components/SimpleCodeBlock/SimpleCodeBlock.tsx@@ -9,8 +9,9 @@import { useTheme } from 'next-themes'import { Highlight, Language, Prism, themes } from 'prism-react-renderer'import { PropsWithChildren, useEffect, useRef, useState } from 'react'+import { Button } from './../Button'+import { cn } from './../../lib/utils/cn'import { copyToClipboard } from '../../lib/utils'-import { Button } from '../Button'import { dart } from './prism'dart(Prism)@@ -62,7 +63,7 @@ export const SimpleCodeBlock = ({{({ className, tokens, getLineProps, getTokenProps }) => {return (<div className="Code codeBlockWrapper group">- <pre ref={target} className={`codeBlock ${className} ${parentClassName}`}>+ <pre ref={target} className={cn('codeBlock', className, parentClassName)}>{tokens.map((line, i) => {const lineProps = getLineProps({ line, key: i })diff --git a/packages/ui/src/components/StatusIcon.tsx b/packages/ui/src/components/StatusIcon.tsxindex 10fdfc12a27..15e63505f4a 100644--- a/packages/ui/src/components/StatusIcon.tsx+++ b/packages/ui/src/components/StatusIcon.tsx@@ -132,4 +132,64 @@ const CheckIcon: React.FC<SVGProps<SVGSVGElement> & StatusIconProps> = ({)}-export { CriticalIcon, InfoIcon, WarningIcon, CheckIcon }+const EyeIcon: React.FC<SVGProps<SVGSVGElement> & StatusIconProps> = ({+ hideBackground = false,+ ...props+}) => {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ width="24"+ height="24"+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ strokeWidth="2"+ strokeLinecap="round"+ strokeLinejoin="round"+ {...props}+ className={cn(+ !hideBackground+ ? 'w-4 h-4 p-0.5 bg-warning-600 text-warning-200 rounded'+ : 'w-3 h-3 text-warning-600',+ props.className+ )}+ >+ <path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" />+ <circle cx="12" cy="12" r="3" />+ </svg>+ )+}++const EyeOffIcon: React.FC<SVGProps<SVGSVGElement> & StatusIconProps> = ({+ hideBackground = false,+ ...props+}) => {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ width="24"+ height="24"+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ strokeWidth="2"+ strokeLinecap="round"+ strokeLinejoin="round"+ {...props}+ className={cn(+ !hideBackground+ ? 'w-4 h-4 p-0.5 bg-foreground-light text-background rounded'+ : 'w-3 h-3 text-warning-600',+ props.className+ )}+ >+ <path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49" />+ <path d="M14.084 14.158a3 3 0 0 1-4.242-4.242" />+ <path d="M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143" />+ <path d="m2 2 20 20" />+ </svg>+ )+}++export { CriticalIcon, InfoIcon, WarningIcon, CheckIcon, EyeIcon, EyeOffIcon }diff --git a/packages/ui/src/components/shadcn/ui/card.tsx b/packages/ui/src/components/shadcn/ui/card.tsxindex 9365e371f9b..081e0715cdb 100644--- a/packages/ui/src/components/shadcn/ui/card.tsx+++ b/packages/ui/src/components/shadcn/ui/card.tsx@@ -22,11 +22,7 @@ CardHeader.displayName = 'CardHeader'const CardTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(({ className, ...props }, ref) => (- <h3- ref={ref}- className={cn('text-lg font-semibold leading-none tracking-tight', className)}- {...props}- />+ <h3 ref={ref} className={cn('text-base leading-none tracking-tight', className)} {...props} />))CardTitle.displayName = 'CardTitle'@@ -35,7 +31,7 @@ const CardDescription = React.forwardRef<HTMLParagraphElement,React.HTMLAttributes<HTMLParagraphElement>>(({ className, ...props }, ref) => (- <p ref={ref} className={cn('text-sm text-foreground-muted', className)} {...props} />+ <p ref={ref} className={cn('text-sm text-foreground-light', className)} {...props} />))CardDescription.displayName = 'CardDescription'diff --git a/packages/ui/src/components/shadcn/ui/input.tsx b/packages/ui/src/components/shadcn/ui/input.tsxindex 5f2e8e5ab9b..6b109a2a985 100644--- a/packages/ui/src/components/shadcn/ui/input.tsx+++ b/packages/ui/src/components/shadcn/ui/input.tsx@@ -8,7 +8,11 @@ export interface InputPropsVariantProps<typeof InputVariants> {}export const InputVariants = cva(- 'aria-[] flex h-10 w-full rounded-md border border-control bg-foreground/[.026] px-3 py-2 text-base md:text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-foreground-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-background-control focus-visible:ring-offset-2 focus-visible:ring-offset-foreground-muted disabled:cursor-not-allowed disabled:opacity-50 aria-[invalid=true]:bg-destructive-200 aria-[invalid=true]:border-destructive-400 aria-[invalid=true]:focus:border-destructive aria-[invalid=true]:focus-visible:border-destructive',+ cn(+ 'flex h-10 w-full rounded-md border border-control bg-foreground/[.026] px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-foreground-muted',+ 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-background-control focus-visible:ring-offset-2 focus-visible:ring-offset-foreground-muted disabled:cursor-not-allowed disabled:opacity-50',+ 'aria-[] aria-[invalid=true]:bg-destructive-200 aria-[invalid=true]:border-destructive-400 aria-[invalid=true]:focus:border-destructive aria-[invalid=true]:focus-visible:border-destructive'+ ),{variants: {size: {diff --git a/packages/ui/src/components/shadcn/ui/tabs.tsx b/packages/ui/src/components/shadcn/ui/tabs.tsxindex 86b8c7b5693..2798833cd9e 100644--- a/packages/ui/src/components/shadcn/ui/tabs.tsx+++ b/packages/ui/src/components/shadcn/ui/tabs.tsx@@ -27,6 +27,7 @@ const TabsTrigger = React.forwardRef<ref={ref}className={cn('inline-flex items-center justify-center whitespace-nowrap py-1.5 text-sm ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:text-foreground data-[state=active]:shadow-sm text-foreground-lighter hover:text-foreground data-[state=active]:border-foreground border-b-2 border-transparent',+ 'group',className)}{...props}diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex c6c1f391b93..5ddf279f674 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -13559,7 +13559,7 @@ snapshots:'@babel/[email protected]':dependencies:'@babel/highlight': 7.24.7- picocolors: 1.0.1+ picocolors: 1.1.1'@babel/[email protected]':dependencies:@@ -27091,7 +27091,7 @@ snapshots:html-escaper: 2.0.2is-plain-object: 5.0.0opener: 1.5.2- picocolors: 1.0.1+ picocolors: 1.1.1sirv: 2.0.4ws: 7.5.10transitivePeerDependencies: