Skip to content

Commit

Permalink
fix: build
Browse files Browse the repository at this point in the history
  • Loading branch information
albertfolch-redeemeum committed Oct 30, 2024
1 parent a39d82d commit 3cf598b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
18 changes: 11 additions & 7 deletions packages/react-kit/src/components/form/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,16 @@ export default function SelectComponent<M extends boolean>({
const displayError =
typeof displayErrorMessage === "string" && displayErrorMessage !== "";

const handleChange = (
option: Parameters<NonNullable<typeof onChange>>[0],
actionMeta: Parameters<NonNullable<typeof onChange>>[1]
) => {
if (!meta.touched) {
helpers.setTouched(true);
}
helpers.setValue(option);
onChange?.(option, actionMeta);
};
const handleBlur = () => {
if (!meta.touched) {
helpers.setTouched(true);
Expand All @@ -141,13 +151,7 @@ export default function SelectComponent<M extends boolean>({
placeholder={placeholder}
options={options}
value={field.value}
onChange={(option, ...rest) => {
if (!meta.touched) {
helpers.setTouched(true);
}
helpers.setValue(option);
onChange?.(option, ...rest);
}}
onChange={handleChange}
onBlur={handleBlur}
isSearchable={isSearchable}
isClearable={isClearable}
Expand Down
4 changes: 2 additions & 2 deletions packages/react-kit/src/components/form/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ReactNode } from "react";
import Select, {
import {
ActionMeta,
CSSObjectWithLabel,
MultiValue,
Expand Down Expand Up @@ -103,7 +103,7 @@ export type SelectProps<M extends boolean | undefined = false> = BaseProps & {
option: M extends true
? MultiValue<SelectDataProps<string>>
: SingleValue<SelectDataProps<string>>,
actionMeta: ActionMeta<SelectDataProps<string>>
actionMeta?: ActionMeta<SelectDataProps<string>>
) => void;
label?: string;
theme?: Partial<{
Expand Down

0 comments on commit 3cf598b

Please sign in to comment.