Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/ui/src/dropdowns/custom-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const CustomSelect = (props: ICustomSelectProps) => {
optionsClassName = "",
value,
tabIndex,
closeOnSelect = true,
} = props;
// states
const [referenceElement, setReferenceElement] = useState<HTMLButtonElement | null>(null);
Expand Down Expand Up @@ -60,7 +61,10 @@ const CustomSelect = (props: ICustomSelectProps) => {
ref={dropdownRef}
tabIndex={tabIndex}
value={value}
onChange={onChange}
onChange={(val) => {
onChange?.(val);
if (closeOnSelect) closeDropdown();
}}
className={cn("relative flex-shrink-0 text-left", className)}
onKeyDown={handleKeyDown}
disabled={disabled}
Expand All @@ -71,7 +75,7 @@ const CustomSelect = (props: ICustomSelectProps) => {
<button
ref={setReferenceElement}
type="button"
className={`flex items-center justify-between gap-1 text-xs ${
className={`flex items-center justify-between gap-1 text-xs rounded ${
disabled ? "cursor-not-allowed text-custom-text-200" : "cursor-pointer hover:bg-custom-background-80"
} ${customButtonClassName}`}
onClick={toggleDropdown}
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/dropdowns/helper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export interface ICustomSelectProps extends IDropdownProps {
children: React.ReactNode;
value: any;
onChange: any;
closeOnSelect?: boolean;
}

interface CustomSearchSelectProps {
Expand Down
Loading