chore: update cmdk 1.0.0 (#28937)

* chore: update cmdk 1.0.0

* update react-popover

* fixed disabled states

* address breaking changes from cmdk update

* fix formatting

* update column options popover
This commit is contained in:
Alaister Young
2024-08-28 21:53:16 +08:00
committed by GitHub
parent 5c8a885bf5
commit dd79d9e2cb
15 changed files with 812 additions and 631 deletions

View File

@@ -11,6 +11,7 @@ import {
CommandEmpty_Shadcn_ as CommandEmpty,
CommandItem_Shadcn_ as CommandItem,
CommandGroup_Shadcn_ as CommandGroup,
CommandList_Shadcn_ as CommandList,
cn,
ScrollArea,
} from 'ui'
@@ -72,30 +73,32 @@ export function ComboBox<Opt extends ComboBoxOption>({
<PopoverContent className="p-0" side="bottom">
<Command>
<CommandInput placeholder={`Search ${name}...`} className="border-none ring-0" />
<CommandEmpty>No {name} found.</CommandEmpty>
<CommandGroup>
<ScrollArea className={options.length > 10 ? 'h-[280px]' : ''}>
{options.map((option) => (
<CommandItem
key={option.id}
value={option.value}
onSelect={(selectedValue: string) => {
setOpen(false)
onSelectOption(selectedValue)
}}
className="cursor-pointer"
>
<Check
className={cn(
'mr-2 h-4 w-4',
selectedOption === option.value ? 'opacity-100' : 'opacity-0'
)}
/>
{option.displayName}
</CommandItem>
))}
</ScrollArea>
</CommandGroup>
<CommandList>
<CommandEmpty>No {name} found.</CommandEmpty>
<CommandGroup>
<ScrollArea className={options.length > 10 ? 'h-[280px]' : ''}>
{options.map((option) => (
<CommandItem
key={option.id}
value={option.value}
onSelect={(selectedValue: string) => {
setOpen(false)
onSelectOption(selectedValue)
}}
className="cursor-pointer"
>
<Check
className={cn(
'mr-2 h-4 w-4',
selectedOption === option.value ? 'opacity-100' : 'opacity-0'
)}
/>
{option.displayName}
</CommandItem>
))}
</ScrollArea>
</CommandGroup>
</CommandList>
</Command>
</PopoverContent>
</Popover>