diff --git a/packages/talisman-ui/src/components/Dropdown.tsx b/packages/talisman-ui/src/components/Dropdown.tsx index d247153df..3de5a1894 100644 --- a/packages/talisman-ui/src/components/Dropdown.tsx +++ b/packages/talisman-ui/src/components/Dropdown.tsx @@ -1,10 +1,8 @@ import { Listbox } from "@headlessui/react" -import { ChevronDownIcon, XIcon } from "@talismn/icons" +import { ChevronDownIcon } from "@talismn/icons" import { classNames } from "@talismn/util" import { ReactNode } from "react" -import { SearchInput } from "./index" - export type DropdownOption = Record export type DropdownOptionRender = ( @@ -23,17 +21,12 @@ export type DropdownProps = { propertyLabel?: keyof T renderItem?: DropdownOptionRender value?: T | null | undefined - placeholder?: string | ReactNode + placeholder?: string onChange?: (item: T | null) => void - onClear?: (e: React.MouseEvent) => void disabled?: boolean className?: string buttonClassName?: string optionClassName?: string - isSearchable?: boolean - handleSearchChange?: (event: React.SetStateAction) => void - searchPlaceholder?: string - searchLabel?: string } export const Dropdown = >({ @@ -47,83 +40,48 @@ export const Dropdown = >({ items, value, placeholder, - isSearchable, - searchPlaceholder, - searchLabel, renderItem = DEFAULT_RENDER, onChange, - onClear, - handleSearchChange, -}: DropdownProps) => { - const canClear = !!value && onClear - return ( - - {({ open }) => ( -
- {label && ( - {label} - )} -
- -
- {value ? renderItem(value, propertyLabel) : placeholder} -
- {!disabled && canClear ? ( -
null}> - -
- ) : ( - !disabled && - )} -
-
-
- - {isSearchable && ( -
- {searchLabel && ( -
{searchLabel}
- )} - -
- )} -
- {items.map((item, i, arr) => ( - - {renderItem(item, propertyLabel)} - - ))} -
-
-
+}: DropdownProps) => ( + + {({ open }) => ( +
+ {label && {label}} +
+ +
+ {value ? renderItem(value, propertyLabel) : placeholder} +
+ {!disabled && } +
+
+
+ + {items.map((item, i, arr) => ( + + {renderItem(item, propertyLabel)} + + ))} +
- )} - - ) -} +
+ )} +
+)