diff --git a/src/components/helper/ButtonFilter.tsx b/src/components/helper/ButtonFilter.tsx new file mode 100644 index 00000000..81f70b92 --- /dev/null +++ b/src/components/helper/ButtonFilter.tsx @@ -0,0 +1,40 @@ +import Button, { ButtonProps } from '@/components/Button'; +import { getFilledFormikValuesCount } from '@/lib/formik-helper'; +import { Icon } from '@iconify/react'; +import { FormikValues } from 'formik'; + +export type ButtonFilterProps = ButtonProps & { + values: FormikValues; + onClick: () => void; +}; + +const ButtonFilter = ({ values, onClick, ...props }: ButtonFilterProps) => { + return ( + + ); +}; + +export default ButtonFilter; diff --git a/src/components/input/SelectInput.tsx b/src/components/input/SelectInput.tsx index e3dbc011..8d5b9170 100644 --- a/src/components/input/SelectInput.tsx +++ b/src/components/input/SelectInput.tsx @@ -9,15 +9,20 @@ import Select, { SingleValue, components as ReactSelectComponents, ControlProps, + MenuListProps, } from 'react-select'; import CreatableSelect from 'react-select/creatable'; import makeAnimated from 'react-select/animated'; import { useDebounce } from 'use-debounce'; import { cn, getByPath } from '@/lib/helper'; -import useSWR from 'swr'; +import useSWRInfinite from 'swr/infinite'; import { httpClientFetcher } from '@/services/http/client'; -import { BaseApiResponse } from '@/types/api/api-general'; -import { isResponseSuccess } from '@/lib/api-helper'; +import { + BaseApiResponse, + ErrorApiResponse, + SuccessApiResponse, +} from '@/types/api/api-general'; +import { isResponseError, isResponseSuccess } from '@/lib/api-helper'; export interface OptionType { value: string | number; @@ -59,6 +64,7 @@ interface SelectInputBaseProps { menuPortalTarget?: HTMLElement | null; closeMenuOnSelect?: boolean; hideSelectedOptions?: boolean; + onMenuScrollToBottom?: ((event: WheelEvent | TouchEvent) => void) | undefined; } export interface SelectInputProps @@ -97,6 +103,29 @@ const CustomControl = < ); }; +const CustomMenuList = < + Option, + IsMulti extends boolean, + Group extends GroupBase