The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Migrate the last dropdowns to shadcn and delete the old Dropdown component (#17780)
Ivan Vasilov82206f828e1d
diff --git a/apps/docs/components/Navigation/RefSwitcher.tsx b/apps/docs/components/Navigation/RefSwitcher.tsxdeleted file mode 100644index c77b6ce6ebb..00000000000--- a/apps/docs/components/Navigation/RefSwitcher.tsx+++ /dev/null@@ -1,174 +0,0 @@-import Link from 'next/link'-import { useRouter } from 'next/router'-import { useEffect, useState } from 'react'-import { Badge, Dropdown, GlassPanel, IconChevronDown, IconChevronRight, Popover } from 'ui'--import { references } from './NavigationMenu/NavigationMenu.constants'--const RefSwitcher = () => {- const router = useRouter()- const [currentRef, setCurrentRef] = useState()- const [open, setOpen] = useState(false)-- useEffect(() => {- setOpen(false)- }, [router.asPath])-- return (- <div className="px-10 flex items-center -space-x-px">- <Popover- size="content"- open={open}- onOpenChange={() => setOpen(!open)}- overlay={- <>- {references.map((section) => {- return (- <>- <div className="w-full px-5 py-1 border-b border-scale-400 bg-whiteA-200">- <span className="text-xs font-mono uppercase tracking-wider font-medium text-scale-1000">- {section.label}- </span>- </div>- <div className="px-5 py-8 grid grid-cols-12 gap-8">- {section.items.map((item) => {- return (- <Link href={item.url}>- <a- className="flex gap-3 col-span-4 group relative cursor-pointer items-start min-w-[180px]"- onClick={() => setOpen(!open)}- >- <div className="flex justify-between gap-3">- <img- src={item.icon}- className="- mt-1 w-5 h-5 rounded- transition-all- ease-out- opacity-80 group-hover:opacity-100- scale-95 group-hover:scale-100- "- />- <div className="flex flex-col">- <div className="transition text-base text-scale-1100 group-hover:text-scale-1200 flex items-center">- <span>{item.label}</span>- <div className="relative h-4 w-4">- <div- className="- absolute- top-0.5- transition-all- ease-out- opacity-0 group-hover:opacity-100- scale-95 group-hover:scale-100- left-0 group-hover:left-1- "- >- <IconChevronRight strokeWidth={1.5} size={14} />- </div>- </div>- </div>- <span className="text-xs text-scale-1000">{item.description}</span>- </div>- </div>- </a>- </Link>- )- })}- </div>- </>- )- })}- </>- }- >- <div- className="- flex- group- items-center- justify-between- bg-scaleA-200- border- transition- hover:border-scale-600- hover:bg-scaleA-300- border-scale-500 pl-3 pr-1.5 w-full h-[32px] rounded- rounded-tr-none- rounded-br-none-- "- >- <div className="flex items-center justify-between w-full min-w-[128px]">- <div className="flex items-center space-x-2">- <img- src="/docs/img/icons/javascript-icon.svg"- className="w-4 h-4 rounded drop-shadow-sm"- />- <p className="text-scale-1200 text-sm group-hover:text-scale-1200 transition">- supabase-js- </p>- </div>- <div className="text-scale-900">- <IconChevronDown size={14} strokeWidth={1.5} />- </div>- </div>- </div>- </Popover>- <Dropdown size="small" align="start" side="bottom" overlay={<VersionOverlay />}>- <div className="w-20">- <div- className="- flex- group- items-center- justify-between- bg-scaleA-200- border- transition- hover:border-scale-600- hover:bg-scaleA-300- border-scale-500 pl-3 pr-1.5 w-full h-[32px] rounded--- rounded-tl-none- rounded-bl-none- "- >- <div className="flex items-center justify-between w-full">- <div className="flex items-center space-x-2">- <p className="font-mono text-scale-1200 text-xs group-hover:text-scale-1200 transition">- v2.0- </p>- </div>- <div className="text-scale-900">- <IconChevronDown size={14} strokeWidth={1.5} />- </div>- </div>- </div>- </div>- </Dropdown>- </div>- )-}--const VersionOverlay = () => {- return (- <>- <Dropdown.Label>Stable releases</Dropdown.Label>- <Dropdown.Item>- version 2.0- <Dropdown.RightSlot>- <Badge size="small">Latest</Badge>- </Dropdown.RightSlot>- </Dropdown.Item>- <Dropdown.Item>Version 1.0 </Dropdown.Item>- <Dropdown.Separator />- <Dropdown.Label>Alpha releases</Dropdown.Label>- <Dropdown.Misc>- <p className="text-scale-900 text-xs">Currently no alpha releases</p>- </Dropdown.Misc>- </>- )-}-export default RefSwitcherdiff --git a/apps/docs/components/RefVersionDropdown.tsx b/apps/docs/components/RefVersionDropdown.tsxindex 7a5b8bb88ec..900b1503732 100644--- a/apps/docs/components/RefVersionDropdown.tsx+++ b/apps/docs/components/RefVersionDropdown.tsx@@ -1,5 +1,13 @@-import { Badge, Dropdown, IconChevronDown } from 'ui'import { useRouter } from 'next/router'+import {+ Badge,+ DropdownMenuContent_Shadcn_,+ DropdownMenuItem_Shadcn_,+ DropdownMenuLabel_Shadcn_,+ DropdownMenuTrigger_Shadcn_,+ DropdownMenu_Shadcn_,+ IconChevronDown,+} from 'ui'import { REFERENCES } from './Navigation/NavigationMenu/NavigationMenu.constants'const RevVersionDropdown = () => {@@ -28,28 +36,10 @@ const RevVersionDropdown = () => {}return (- <Dropdown- size="small"- align="start"- side="bottom"- overlay={- <>- <Dropdown.Label>Stable releases</Dropdown.Label>- {versions.map((version, index) => (- <Dropdown.Item key={version} onClick={() => onSelectVersion(version)}>- <span className={`${currentVersion === version ? 'font-bold' : ''}`}>- Version {version}.0- </span>- <Dropdown.RightSlot>- {index === 0 && <Badge size="small">Latest</Badge>}- </Dropdown.RightSlot>- </Dropdown.Item>- ))}- </>- }- >- <div- className="+ <DropdownMenu_Shadcn_>+ <DropdownMenuTrigger_Shadcn_>+ <div+ className="groupjustify-betweenbg-scaleA-200@@ -60,14 +50,30 @@ const RevVersionDropdown = () => {font-monoflex items-center gap-1 text-scale-900 text-xs group-hover:text-scale-1200 transition"- >- {/* <span>version</span> */}- <span className="text-scale-1200 text-sm group-hover:text-scale-1200 transition">- {currentVersion}.0- </span>- <IconChevronDown size={14} strokeWidth={2} />- </div>- </Dropdown>+ >+ {/* <span>version</span> */}+ <span className="text-scale-1200 text-sm group-hover:text-scale-1200 transition">+ {currentVersion}.0+ </span>+ <IconChevronDown size={14} strokeWidth={2} />+ </div>+ </DropdownMenuTrigger_Shadcn_>+ <DropdownMenuContent_Shadcn_ align="start" side="bottom" className="w-48">+ <DropdownMenuLabel_Shadcn_ className="text-xs">Stable releases</DropdownMenuLabel_Shadcn_>+ {versions.map((version, index) => (+ <DropdownMenuItem_Shadcn_+ key={version}+ onClick={() => onSelectVersion(version)}+ className="justify-between flex"+ >+ <span className={`${currentVersion === version ? 'font-bold' : ''}`}>+ Version {version}.0+ </span>+ {index === 0 && <Badge size="small">Latest</Badge>}+ </DropdownMenuItem_Shadcn_>+ ))}+ </DropdownMenuContent_Shadcn_>+ </DropdownMenu_Shadcn_>)}export default RevVersionDropdowndiff --git a/apps/www/components/Blog/BlogFilters.tsx b/apps/www/components/Blog/BlogFilters.tsxindex b42319704d1..80105fe56d3 100644--- a/apps/www/components/Blog/BlogFilters.tsx+++ b/apps/www/components/Blog/BlogFilters.tsx@@ -1,13 +1,23 @@-import React, { useCallback, useEffect, useState } from 'react'-import { useRouter } from 'next/router'import { startCase } from 'lodash'+import { useRouter } from 'next/router'+import { useCallback, useEffect, useState } from 'react'-import { Button, Dropdown, IconChevronDown, IconSearch, IconX, Input } from 'ui'+import {+ Button,+ DropdownMenuContent_Shadcn_,+ DropdownMenuItem_Shadcn_,+ DropdownMenuTrigger_Shadcn_,+ DropdownMenu_Shadcn_,+ IconChevronDown,+ IconSearch,+ IconX,+ Input,+} from 'ui'import { useParams } from '~/hooks/useParams'-import PostTypes from '~/types/post'import { useBreakpoint } from 'common'import { AnimatePresence, motion } from 'framer-motion'+import PostTypes from '~/types/post'interface Props {posts: PostTypes[]@@ -72,32 +82,32 @@ const BlogFilters = ({ posts, setPosts, setCategory, allCategories, handlePostsexit={{ opacity: 0, transition: { duration: 0.05 } }}className="flex lg:hidden">- <Dropdown- side="bottom"- align="start"- size="large"- overlay={allCategories.map((category: string) => (- <Dropdown.Item- key="custom-expiry"- onClick={() => setCategory(category)}- className={[- (category === 'all' && !activeCategory) || category === activeCategory- ? 'text-brand-600'- : '',- ].join(' ')}+ <DropdownMenu_Shadcn_>+ <DropdownMenuTrigger_Shadcn_>+ <Button+ type="outline"+ iconRight={<IconChevronDown />}+ className="w-full min-w-[200px] flex justify-between items-center py-2">- {category === 'all' ? 'All Posts' : startCase(category.replaceAll('-', ' '))}- </Dropdown.Item>- ))}- >- <Button- type="outline"- iconRight={<IconChevronDown />}- className="w-full min-w-[200px] flex justify-between items-center py-2"- >- {!activeCategory ? 'All Posts' : startCase(activeCategory?.replaceAll('-', ' '))}- </Button>- </Dropdown>+ {!activeCategory ? 'All Posts' : startCase(activeCategory?.replaceAll('-', ' '))}+ </Button>+ </DropdownMenuTrigger_Shadcn_>+ <DropdownMenuContent_Shadcn_ side="bottom" align="start">+ {allCategories.map((category: string) => (+ <DropdownMenuItem_Shadcn_+ key="custom-expiry"+ onClick={() => setCategory(category)}+ className={[+ (category === 'all' && !activeCategory) || category === activeCategory+ ? 'text-brand-600'+ : '',+ ].join(' ')}+ >+ {category === 'all' ? 'All Posts' : startCase(category.replaceAll('-', ' '))}+ </DropdownMenuItem_Shadcn_>+ ))}+ </DropdownMenuContent_Shadcn_>+ </DropdownMenu_Shadcn_></motion.div>)}<div className="hidden lg:flex flex-wrap items-center flex-grow gap-2">diff --git a/packages/ui/index.tsx b/packages/ui/index.tsxindex 588421db51d..90f49eab6a8 100644--- a/packages/ui/index.tsx+++ b/packages/ui/index.tsx@@ -37,7 +37,6 @@ export * from './src/components/Menu'export * from './src/components/Modal'export * from './src/components/SidePanel'-export * from './src/components/Dropdown'export * from './src/components/ConsentToast'export * from './src/components/ContextMenu'export * from './src/components/Popover'diff --git a/packages/ui/src/components/Dropdown/Dropdown.module.css b/packages/ui/src/components/Dropdown/Dropdown.module.cssdeleted file mode 100644index 751546ff202..00000000000--- a/packages/ui/src/components/Dropdown/Dropdown.module.css+++ /dev/null@@ -1,112 +0,0 @@-/* .sbui-dropdown-item {- @apply text-xs;- @apply text-typography-body-light dark:text-typography-body-dark;- @apply px-4 py-1.5 flex items-center space-x-2;- @apply cursor-pointer;- @apply focus:bg-bg-secondary-light dark:focus:bg-bg-primary-dark border-none;- cursor: 'default';-- user-select: none;-}--/* .sbui-dropdown-item svg {- @apply text-typography-body-secondary-light dark:text-typography-body-secondary-dark;-} */--/* .sbui-dropdown-label {- @apply text-typography-body-secondary-light dark:text-typography-body-secondary-dark;- @apply px-4 py-1.5 flex items-center space-x-2;- font-size: 0.65rem;-}--.sbui-dropdown-misc {- @apply px-4 py-1.5;-}--.sbui-dropdown-item:focus-visible {- border: none;- outline: none;-}--.sbui-dropdown-input {- @apply flex items-center space-x-0 pl-8 pr-4;-}--.sbui-dropdown-input__check {- @apply absolute left-2;- @apply flex items-center;-} */--/* .sbui-dropdown__content {- @apply bg-bg-primary-light dark:bg-bg-secondary-dark p-0;- @apply border border-lightmode dark:border-darkmode;- @apply rounded;- @apply shadow;- border-style: solid;- border-width: 1px;-} */--/* @keyframes fadeIn {- from {- transform: scale(0.95);- opacity: 0;- }- to {- transform: scale(1);- opacity: 1;- }-}--@keyframes fadeOut {- from {- transform: scale(1);- opacity: 1;- }- to {- transform: scale(0.95);- opacity: 0;- }-} */-/* .sbui-dropdown__content {- transform-origin: 'var(--radix-dropdown-menu-content-transform-origin)';-} */--/* .sbui-dropdown__content[data-state='open'] {- animation: fadeIn 50ms ease-out;-}--.sbui-dropdown__content[data-state='closed'] {- animation: fadeOut 50ms ease-in;-} */--/* .sbui-dropdown__trigger {- @apply border-none bg-transparent p-0 focus:ring-0;-} */--/* .sbui-dropdown__arrow {- @apply fill-current text-bg-primary-light dark:text-bg-secondary-dark;- @apply border-0 border-t;- border-style: solid;--}--.sbui-dropdown-item-trigger {- @apply text-xs;- @apply text-typography-body-light dark:text-typography-body-dark;- @apply px-4 py-1.5 flex items-center space-x-2;- @apply cursor-pointer;- cursor: 'default';-}--.sbui-dropdown-item-trigger svg {- @apply text-typography-body-secondary-light dark:text-typography-body-secondary-dark;-}--.sbui-dropdown-item-trigger:focus-visible {- border: none;- outline: none;-} */--/* .sbui-dropdown__trigger-item[data-state='open'] {- @apply bg-bg-secondary-light dark:bg-bg-primary-dark border-none;-} */diff --git a/packages/ui/src/components/Dropdown/Dropdown.stories.tsx b/packages/ui/src/components/Dropdown/Dropdown.stories.tsxdeleted file mode 100644index 0148f14b3bf..00000000000--- a/packages/ui/src/components/Dropdown/Dropdown.stories.tsx+++ /dev/null@@ -1,328 +0,0 @@-import React, { useState } from 'react'-import { Dropdown } from './'-import { Button } from '../Button'-import { Input } from '../Input'--import { IconSettings } from './../Icon/icons/IconSettings'-import { IconLogOut } from './../Icon/icons/IconLogOut'-import { IconChevronDown } from './../Icon/icons/IconChevronDown'-import { IconChevronRight } from './../Icon/icons/IconChevronRight'-import { IconHardDrive } from './../Icon/icons/IconHardDrive'-import { IconLogIn } from './../Icon/icons/IconLogIn'-import { IconSearch } from './../Icon/icons/IconSearch'--export default {- title: 'Navigation/Dropdown',- component: Dropdown,-}--const DemoContainer = ({ children }: { children: React.ReactNode }) => (- <div- className="- flex justify-center items-center- w-screen h-screen- "- >- <div- className="- bg border-- p-3 px-5- shadow-sm- rounded-md- flex- gap-4- justify-between- items-center- w-3/4- "- >- <div>- <h4 className="text-scale-1200 text-base">Shall we nest some components?</h4>- <p className="text-scale-1100 text-sm">yea sure, go on then.</p>- </div>- <div className="relative">{children}</div>- </div>- </div>-)--export const DefaultFull = (args: any) => {- const [checked, setChecked] = useState(false)- const [value, setValue] = useState('red')-- return (- <DemoContainer>- <Dropdown- side="bottom"- align="end"- overlay={[- <Dropdown.Misc>- <div>- <span className="block text-body">Signed in as </span>-- <span className="text-body-light">[email protected] </span>- </div>- </Dropdown.Misc>,- <Dropdown.Separator />,- <Dropdown.Label>Group label</Dropdown.Label>,- <Dropdown.Item onClick={() => console.log('clicked')}>Account</Dropdown.Item>,- <Dropdown.Item>- Settings <Dropdown.RightSlot>⌘+T</Dropdown.RightSlot>- </Dropdown.Item>,- <Dropdown.Separator />,- <Dropdown.Checkbox checked={checked} onChange={setChecked}>- Show subtitles- </Dropdown.Checkbox>,- <Dropdown.Separator />,- <Dropdown.RadioGroup value={value} onChange={setValue}>- <Dropdown.Radio value={'red'}>Red</Dropdown.Radio>- <Dropdown.Radio value={'blue'}>Blue</Dropdown.Radio>- <Dropdown.Radio value={'green'}>Green</Dropdown.Radio>- </Dropdown.RadioGroup>,- <Dropdown.Separator />,- <Dropdown- isNested- overlay={[- <Dropdown.RadioGroup value={value} onChange={setValue}>- <Dropdown.Radio value={'red'}>Red</Dropdown.Radio>- <Dropdown.Radio value={'blue'}>Blue</Dropdown.Radio>- <Dropdown.Radio value={'green'}>Green</Dropdown.Radio>- </Dropdown.RadioGroup>,- <Dropdown.Separator />,- <Dropdown.Label>Group label</Dropdown.Label>,- <Dropdown.Item onClick={() => console.log('clicked')}>Account</Dropdown.Item>,- <Dropdown.Item>- Settings <Dropdown.RightSlot>⌘+T</Dropdown.RightSlot>- </Dropdown.Item>,- ]}- >- <Dropdown.TriggerItem icon={<IconHardDrive />}>- Open sub menu{' '}- <Dropdown.RightSlot>- <IconChevronRight size={14} />- </Dropdown.RightSlot>- </Dropdown.TriggerItem>- </Dropdown>,- <Dropdown.Separator />,- <Dropdown.Item icon={<IconLogIn size="tiny" />}>Log out</Dropdown.Item>,- ]}- >- <Button asChild type="default" iconRight={<IconChevronDown />}>- <span>Click for dropdown</span>- </Button>- </Dropdown>- </DemoContainer>- )-}--export const Default = (args: any) => (- <div style={{ margin: '0 auto', minHeight: '420px', marginTop: '220px' }}>- <Dropdown- {...args}- overlay={[- <Dropdown.Misc>- <div>- <span className="block">Signed in as </span>-- <span>[email protected] </span>- </div>- </Dropdown.Misc>,- <Dropdown.Separator />,- <Dropdown.Label>Group label</Dropdown.Label>,- <Dropdown.Item onClick={() => console.log('clicked')}>Account</Dropdown.Item>,- <Dropdown.Item>- Settings <Dropdown.RightSlot>⌘+T</Dropdown.RightSlot>- </Dropdown.Item>,- <Dropdown.Separator />,- <Dropdown.Item icon={<IconLogIn size="tiny" />}>Log out</Dropdown.Item>,- ]}- >- <Button asChild type="secondary" iconRight={<IconChevronDown />}>- <span>Click for dropdown</span>- </Button>- </Dropdown>- </div>-)--Default.args = {}--export const doNotcloseOverlay = (args: any) => (- <div style={{ margin: '0 auto', minHeight: '420px', marginTop: '220px' }}>- <Dropdown- {...args}- overlay={[- <Dropdown.Misc>- <span>Signed in as </span>- <span>[email protected] </span>- </Dropdown.Misc>,- <Dropdown.Separator />,- <Dropdown.Item>Account</Dropdown.Item>,- <Dropdown.Item>Settings</Dropdown.Item>,- <Dropdown.Item>- <Button icon={<IconLogOut />}>Log out</Button>- </Dropdown.Item>,- ]}- >- <Button asChild type="outline" iconRight={<IconChevronDown />}>- <span>Click for dropdown</span>- </Button>- </Dropdown>- </div>-)--doNotcloseOverlay.args = {}--export const withCustomStyles = (args: any) => (- <div- style={{- margin: '0 auto',- minHeight: '420px',- marginTop: '220px',- marginLeft: '400px',- }}- >- <Dropdown- overlayStyle={{ minWidth: '500px' }}- placement="bottomRight"- {...args}- overlay={[- <Dropdown.Item>- <span>Signed in as </span>- <span>[email protected] </span>- </Dropdown.Item>,- <Dropdown.Separator />,- <Dropdown.Item>Account</Dropdown.Item>,- <Dropdown.Item>Settings</Dropdown.Item>,- <Dropdown.Separator />,- <Dropdown.Item>- <Button type="default" icon={<IconLogOut />}>- Log out- </Button>- </Dropdown.Item>,- ]}- >- <Button asChild type="outline" iconRight={<IconChevronDown />}>- <span>Click for dropdown</span>- </Button>- </Dropdown>- </div>-)--withCustomStyles.args = {}--export const SearchList = (args: any) => (- <div style={{ margin: '0 auto', minHeight: '420px', marginTop: '220px' }}>- <Dropdown- {...args}- overlay={[- <Dropdown.Misc>- <Input size="tiny" icon={<IconSearch size={14} />} autoFocus={false} />- </Dropdown.Misc>,- <Dropdown.Item>- <span>Signed in as </span>- <span>[email protected] </span>- </Dropdown.Item>,- <Dropdown.Item>- <span>Signed in as </span>- <span>[email protected] </span>- </Dropdown.Item>,- <Dropdown.Separator />,- <Dropdown.Item icon={<IconLogIn />}>- <span>Log out</span>- </Dropdown.Item>,- ]}- >- <Button asChild type="outline" iconRight={<IconChevronDown />}>- <span>Click for dropdown</span>- </Button>- </Dropdown>- </div>-)--SearchList.args = {}--export const Checkbox = (args: any) => {- const [checked, setChecked] = useState(false)-- return (- <div style={{ margin: '0 auto', minHeight: '420px', marginTop: '220px' }}>- <Dropdown- {...args}- overlay={[- <Dropdown.Item icon={<IconSettings size="small" />}>Account</Dropdown.Item>,- <Dropdown.Item>Settings</Dropdown.Item>,- <Dropdown.Separator />,- <Dropdown.Checkbox checked={checked} onChange={setChecked}>- Show subtitles- </Dropdown.Checkbox>,- ]}- >- <Button asChild type="outline" iconRight={<IconChevronDown />}>- <span>Click for dropdown</span>- </Button>- </Dropdown>- </div>- )-}--export const Radio = (args: any) => {- const [value, setValue] = useState('red')-- return (- <div style={{ margin: '0 auto', minHeight: '420px', marginTop: '220px' }}>- <Dropdown- {...args}- overlay={[- <Dropdown.RadioGroup value={value} onChange={setValue}>- <Dropdown.Radio value={'red'}>Red</Dropdown.Radio>- <Dropdown.Radio value={'blue'}>Blue</Dropdown.Radio>- <Dropdown.Radio value={'green'}>Green</Dropdown.Radio>- </Dropdown.RadioGroup>,- ]}- >- <Button asChild type="outline" iconRight={<IconChevronDown />}>- <span>Click for dropdown</span>- </Button>- </Dropdown>- </div>- )-}--export const Nested = (args: any) => {- const [value, setValue] = useState('red')-- return (- <div style={{ margin: '0 auto', minHeight: '420px', marginTop: '220px' }}>- <Dropdown- {...args}- overlay={- <>- <Dropdown.RadioGroup value={value} onChange={setValue}>- <Dropdown.Radio value={'red'}>Red</Dropdown.Radio>- <Dropdown.Radio value={'blue'}>Blue</Dropdown.Radio>- <Dropdown.Radio value={'green'}>Green</Dropdown.Radio>- </Dropdown.RadioGroup>-- <Dropdown- isNested- overlay={[- <Dropdown.RadioGroup value={value} onChange={setValue}>- <Dropdown.Radio value={'red'}>Red</Dropdown.Radio>- <Dropdown.Radio value={'blue'}>Blue</Dropdown.Radio>- <Dropdown.Radio value={'green'}>Green</Dropdown.Radio>- </Dropdown.RadioGroup>,- ]}- >- <Dropdown.TriggerItem>Open sub menu</Dropdown.TriggerItem>- </Dropdown>- <Dropdown.Item>hello</Dropdown.Item>- </>- }- >- <Button asChild type="outline" iconRight={<IconChevronDown />}>- <span>Click for dropdown</span>- </Button>- </Dropdown>- </div>- )-}diff --git a/packages/ui/src/components/Dropdown/Dropdown.tsx b/packages/ui/src/components/Dropdown/Dropdown.tsxdeleted file mode 100644index a1c1a3b25fe..00000000000--- a/packages/ui/src/components/Dropdown/Dropdown.tsx+++ /dev/null@@ -1,229 +0,0 @@-import React, { useState } from 'react'--import * as RadixDropdown from '@radix-ui/react-dropdown-menu'-import { IconCheck } from '../Icon/icons/IconCheck'--import type * as RadixDropdownTypes from '@radix-ui/react-dropdown-menu/'--import styleHandler from '../../lib/theme/styleHandler'-import { IconTarget } from '../Icon/icons/IconTarget'-import { cn } from './../../lib/utils'--interface RootProps extends RadixDropdownTypes.DropdownMenuProps {- open?: boolean- arrow?: boolean- side?: RadixDropdownTypes.DropdownMenuContentProps['side']- align?: RadixDropdownTypes.DropdownMenuContentProps['align']- sideOffset?: RadixDropdownTypes.DropdownMenuContentProps['sideOffset']- overlay?: RadixDropdownTypes.DropdownMenuContentProps['children']- children?: RadixDropdownTypes.DropdownMenuTriggerProps['children']- size?: 'tiny' | 'small' | 'medium' | 'large' | 'xlarge' | 'content'- className?: string- style?: React.CSSProperties- isNested?: Boolean-}--function Dropdown({- align = 'center', //Default value- side = 'bottom', //Default value- sideOffset = 6,- overlay,- children,- size = 'medium',- className,- style,- arrow,- isNested,- ...props-}: RootProps) {- let __styles = styleHandler('dropdown')-- let classes = [__styles.content, __styles.size[size]]- if (className) {- classes.push(className)- }-- return (- <RadixDropdown.Root {...props}>- {isNested ? (- <RadixDropdown.Sub>- <RadixDropdown.SubTrigger className={[__styles.item_nested].join(' ')}>- {children}- </RadixDropdown.SubTrigger>- <RadixDropdown.SubContent- sideOffset={sideOffset}- className={classes.join(' ')}- style={style}- >- {arrow && (- <RadixDropdown.Arrow className={__styles.arrow} offset={10}></RadixDropdown.Arrow>- )}- {overlay}- </RadixDropdown.SubContent>- </RadixDropdown.Sub>- ) : (- <>- <RadixDropdown.Trigger className={__styles.trigger}>{children}</RadixDropdown.Trigger>- <RadixDropdown.Portal>- <RadixDropdown.Content- sideOffset={sideOffset}- side={side}- align={align}- className={classes.join(' ')}- style={style}- >- {arrow && (- <RadixDropdown.Arrow className={__styles.arrow} offset={10}></RadixDropdown.Arrow>- )}- {overlay}- </RadixDropdown.Content>- </RadixDropdown.Portal>- </>- )}- </RadixDropdown.Root>- )-}--export function RightSlot({ children }: { children: React.ReactNode }) {- let __styles = styleHandler('dropdown')- return <div className={__styles.right_slot}>{children}</div>-}--interface ItemProps extends RadixDropdownTypes.DropdownMenuItemProps {- children: React.ReactNode- icon?: React.ReactNode-}--export function Item({ icon, className, ...props }: ItemProps) {- let __styles = styleHandler('dropdown')-- return (- <RadixDropdown.Item- className={cn(__styles.item, className, props.disabled && __styles.disabled)}- {...props}- >- {icon && icon}- <span className="w-full">{props.children}</span>- </RadixDropdown.Item>- )-}--export function TriggerItem({ children, icon, disabled }: ItemProps) {- let __styles = styleHandler('dropdown')- return (- <div className={__styles.item}>- {icon && icon}- <span>{children}</span>- </div>- )-}--export function Misc({ children, icon }: ItemProps) {- let __styles = styleHandler('dropdown')- return (- <div className={__styles.misc}>- {icon && icon}- {children}- </div>- )-}--export function Separator() {- let __styles = styleHandler('dropdown')-- return <RadixDropdown.Separator className={__styles.separator} />-}--// to do : remove onChange omit in favor of using onCheckedChange-interface CheckboxProps extends Omit<RadixDropdownTypes.DropdownMenuCheckboxItemProps, 'onChange'> {- ItemIndicator?: React.ReactNode- onChange?(x: boolean): void-}--export function Checkbox({- checked: propsChecked,- ItemIndicator,- onChange,- className,- ...props-}: CheckboxProps) {- const [checked, setChecked] = useState(propsChecked ?? false)-- let __styles = styleHandler('dropdown')-- const handleChange = (e: any) => {- // to do : remove onChange in favor of using onCheckedChange- if (onChange) onChange(e)- if (props.onCheckedChange) props.onCheckedChange(e)- setChecked(e)- }-- return (- <RadixDropdown.CheckboxItem- checked={checked}- onCheckedChange={handleChange}- className={cn(__styles.item, __styles.input, className)}- {...props}- >- <RadixDropdown.ItemIndicator className={__styles.check}>- {ItemIndicator ? ItemIndicator : <IconCheck size="tiny" strokeWidth={3} />}- <RadixDropdown.CheckboxItem />- </RadixDropdown.ItemIndicator>- <span>{props.children}</span>- </RadixDropdown.CheckboxItem>- )-}--interface RadioProps extends RadixDropdownTypes.DropdownMenuRadioItemProps {- ItemIndicator?: React.ReactNode-}--export function Radio({ ItemIndicator, className, ...props }: RadioProps) {- let __styles = styleHandler('dropdown')-- return (- <RadixDropdown.RadioItem className={cn(__styles.item, __styles.input, className)} {...props}>- <RadixDropdown.ItemIndicator className={__styles.check}>- {ItemIndicator ? ItemIndicator : <IconTarget strokeWidth={6} size={10} />}- </RadixDropdown.ItemIndicator>- <span>{props.children}</span>- </RadixDropdown.RadioItem>- )-}--// to do : remove onChange omit in favor of using onValueChange-interface RadioGroupProps extends Omit<RadixDropdownTypes.DropdownMenuRadioGroupProps, 'onChange'> {- onChange?(x: string): void-}--export function RadioGroup({ value: propsValue, onChange, ...props }: RadioGroupProps) {- const [value, setValue] = useState(propsValue ? propsValue : '')-- const handleChange = (e: any) => {- // to do : remove onChange in favor of using onValueChange- if (onChange) onChange(e)- if (props.onValueChange) props.onValueChange(e)- setValue(e)- }-- return <RadixDropdown.RadioGroup value={value} onValueChange={handleChange} {...props} />-}--interface LabelProps extends RadixDropdownTypes.DropdownMenuLabelProps {}--export function Label({ className, ...props }: LabelProps) {- let __styles = styleHandler('dropdown')-- return <RadixDropdown.Label className={cn(__styles.label, className)} {...props} />-}--Dropdown.Item = Item-Dropdown.Misc = Misc-Dropdown.Checkbox = Checkbox-Dropdown.Radio = Radio-Dropdown.RadioGroup = RadioGroup-Dropdown.Label = Label-Dropdown.Separator = Separator-Dropdown.RightSlot = RightSlot-Dropdown.TriggerItem = TriggerItem-export default Dropdowndiff --git a/packages/ui/src/components/Dropdown/index.tsx b/packages/ui/src/components/Dropdown/index.tsxdeleted file mode 100644index a34974dee8c..00000000000--- a/packages/ui/src/components/Dropdown/index.tsx+++ /dev/null@@ -1 +0,0 @@-export { default as Dropdown } from './Dropdown'diff --git a/packages/ui/src/lib/theme/defaultTheme.ts b/packages/ui/src/lib/theme/defaultTheme.tsindex 832713fae83..84ab1ad6c49 100644--- a/packages/ui/src/lib/theme/defaultTheme.ts+++ b/packages/ui/src/lib/theme/defaultTheme.ts@@ -1058,99 +1058,6 @@ export default {},},- /*- * Dropdown- */-- dropdown: {- // root:- trigger: `- flex- border-none- rounded- bg-transparent p-0- outline-none- outline-offset-1- transition-all- focus:outline-4- focus:outline-scale-600- `,- item_nested: `- border-none- focus:outline-none- focus:bg-scale-300 dark:focus:bg-scale-500- focus:text-scale-1200- data-open:bg-scale-300 dark:data-open:bg-scale-500- data-open:text-scale-1200- `,- content: `- z-40- bg-overlay- border- rounded- shadow-lg- py-1.5- origin-dropdown- data-open:animate-dropdown-content-show- data-closed:animate-dropdown-content-hide- min-w-fit- `,- size: {- tiny: `w-40`,- small: `w-48`,- medium: `w-64`,- large: `w-80`,- xlarge: `w-96`,- content: `w-auto`,- },- arrow: `- fill-current- border-0 border-t- `,- item: `- group- relative- text-sm- text-body-light- px-4 py-1.5 flex items-center space-x-2- cursor-pointer- focus:bg-selection- focus:text-body- border-none- focus:outline-none- `,- disabled: `opacity-50 cursor-default`,- label: `- text-body-lighter- px-4 flex items-center space-x-2 py-1.5- text-xs- `,- separator: `- w-full- my-2- border-t-[1px]- `,- misc: `- px-4 py-1.5- `,- check: `- absolute left-3- flex items-center- data-checked:text-scale-1200- `,- input: `- flex items-center space-x-0 pl-8 pr-4- `,- right_slot: `- text-scale-900- group-focus:text-scale-1000- absolute- -translate-y-1/2- right-2- top-1/2- `,- },-/** Popover*/diff --git a/studio/components/layouts/TableEditorLayout/TableEditorMenu.tsx b/studio/components/layouts/TableEditorLayout/TableEditorMenu.tsxindex a092a8c4c33..bcb8b58eab7 100644--- a/studio/components/layouts/TableEditorLayout/TableEditorMenu.tsx+++ b/studio/components/layouts/TableEditorLayout/TableEditorMenu.tsx@@ -15,7 +15,11 @@ import {CommandItem_Shadcn_,CommandList_Shadcn_,Command_Shadcn_,- Dropdown,+ DropdownMenuContent_Shadcn_,+ DropdownMenuRadioGroup_Shadcn_,+ DropdownMenuRadioItem_Shadcn_,+ DropdownMenuTrigger_Shadcn_,+ DropdownMenu_Shadcn_,IconCheck,IconChevronsDown,IconCode,@@ -345,65 +349,46 @@ const TableEditorMenu = () => {</div><div className="flex gap-3 items-center">- <Dropdown- size="small"- side="bottom"- align="start"- style={{ zIndex: 1 }}- overlay={[- <Dropdown.Item- key="alphabetical"- icon={- sort === 'alphabetical' ? (- <IconCheck size="tiny" />- ) : (- <div className="w-[14px] h-[14px]" />- )- }- onClick={() => {- setSort('alphabetical')- }}- >- Alphabetical- </Dropdown.Item>,- <Dropdown.Item- key="grouped-alphabetical"- icon={- sort === 'grouped-alphabetical' ? (- <IconCheck size="tiny" />- ) : (- <div className="w-[14px] h-[14px]" />- )- }- onClick={() => {- setSort('grouped-alphabetical')- }}- >- Entity Type- </Dropdown.Item>,- ]}- >- <Tooltip.Root delayDuration={0}>- <Tooltip.Trigger asChild>- <div className="text-foreground-lighter transition-colors hover:text-foreground">- <IconChevronsDown size={18} strokeWidth={1} />- </div>- </Tooltip.Trigger>- <Tooltip.Portal>- <Tooltip.Content side="bottom">- <Tooltip.Arrow className="radix-tooltip-arrow" />- <div- className={[- 'rounded bg-scale-100 py-1 px-2 leading-none shadow',- 'border border-scale-200',- ].join(' ')}- >- <span className="text-xs">Sort By</span>+ <DropdownMenu_Shadcn_>+ <DropdownMenuTrigger_Shadcn_>+ <Tooltip.Root delayDuration={0}>+ <Tooltip.Trigger asChild>+ <div className="text-foreground-lighter transition-colors hover:text-foreground">+ <IconChevronsDown size={18} strokeWidth={1} /></div>- </Tooltip.Content>- </Tooltip.Portal>- </Tooltip.Root>- </Dropdown>+ </Tooltip.Trigger>+ <Tooltip.Portal>+ <Tooltip.Content side="bottom">+ <Tooltip.Arrow className="radix-tooltip-arrow" />+ <div+ className={[+ 'rounded bg-scale-100 py-1 px-2 leading-none shadow',+ 'border border-scale-200',+ ].join(' ')}+ >+ <span className="text-xs">Sort By</span>+ </div>+ </Tooltip.Content>+ </Tooltip.Portal>+ </Tooltip.Root>+ </DropdownMenuTrigger_Shadcn_>+ <DropdownMenuContent_Shadcn_ side="bottom" align="start" className="w-48">+ <DropdownMenuRadioGroup_Shadcn_+ value={sort}+ onValueChange={(value: any) => setSort(value)}+ >+ <DropdownMenuRadioItem_Shadcn_ key="alphabetical" value="alphabetical">+ Alphabetical+ </DropdownMenuRadioItem_Shadcn_>+ <DropdownMenuRadioItem_Shadcn_+ key="grouped-alphabetical"+ value="grouped-alphabetical"+ >+ Entity Type+ </DropdownMenuRadioItem_Shadcn_>+ </DropdownMenuRadioGroup_Shadcn_>+ </DropdownMenuContent_Shadcn_>+ </DropdownMenu_Shadcn_><buttonclassName="cursor-pointer text-foreground-lighter transition-colors hover:text-foreground"