Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): Select component on icon click #8

Merged
merged 2 commits into from
Nov 16, 2023
Merged
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
19 changes: 10 additions & 9 deletions libs/ui/src/select/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@ const selectClasses = cva(
disabled: false,
readonly: false,
className:
"border border-secondary-300 dark:border-zinc-700 focus:ring-primary-200 focus:border-primary-500 dark:focus:ring-primary-100/20 dark:focus:border-primary-400 focus:ring-2",
"border border-secondary-300 dark:border-zinc-700 group-focus:ring-primary-200 group-focus:border-primary-500 dark:group-focus:ring-primary-100/20 dark:group-focus:border-primary-400 group-focus:ring-2",
},
{
variant: ["solid", "outline"],
disabled: false,
readonly: false,
className: "hover:border-primary-500 dark:hover:border-primary-400",
className:
"group-hover:border-primary-500 dark:group-hover:border-primary-400",
},
{
variant: ["solid", "outline", "ghost"],
Expand All @@ -79,7 +80,7 @@ const selectClasses = cva(
disabled: false,
readonly: false,
},
},
}
);

export type Select = Omit<
Expand Down Expand Up @@ -108,7 +109,7 @@ export const Select = forwardRef<HTMLSelectElement, Select>(
isReadOnly = false,
...props
},
forwardedRef,
forwardedRef
) => {
const context = useFieldControlContext() ?? {
isDisabled: false,
Expand All @@ -123,7 +124,7 @@ export const Select = forwardRef<HTMLSelectElement, Select>(
readonly = isReadOnly || context.isReadOnly;

return (
<div className="relative flex w-full items-center">
<div className="group relative flex w-full items-center">
<select
{...props}
name={field_name}
Expand All @@ -139,7 +140,7 @@ export const Select = forwardRef<HTMLSelectElement, Select>(
disabled,
readonly,
}),
className,
className
)
}
ref={forwardedRef}
Expand All @@ -152,13 +153,13 @@ export const Select = forwardRef<HTMLSelectElement, Select>(
size === "sm" && "right-2",
size === "md" && "right-3",
size === "lg" && "right-4",
"dark:text-secondary-300 absolute h-3.5 w-3.5 stroke-2",
"dark:text-secondary-300 absolute h-3.5 w-3.5 stroke-2 cursor-pointer pointer-events-none"
)}
/>
)}
</div>
);
},
}
);

Select.displayName = "Select";
Expand All @@ -168,7 +169,7 @@ export type SelectItem = JSX.IntrinsicElements["option"];
export const SelectItem = forwardRef<HTMLOptionElement, SelectItem>(
(props, forwardedRef) => {
return <option {...props} ref={forwardedRef} />;
},
}
);

SelectItem.displayName = "SelectItem";