/* eslint-disable @typescript-eslint/no-explicit-any */ 'use client' import dynamic from "next/dynamic" import type { SingleValue } from "react-select" import { replaceByParam } from '@/helper' import useLocaleStore from '@/stores/localeStore' import { themeColors } from '@/constant/constant' import type { Props as SelectProps } from "react-select" import { JSX } from "react" const Select = dynamic( () => import("react-select").then(m => m.default), { ssr: false } ) as ( props: SelectProps ) => JSX.Element export type SelectOption = { id: string name: string time?: string description?: string } type SelectCustomProp = { customSet: SelectOption[] excludeSet: SelectOption[] selectedCustomSet: string placeholder: string setSelectedCustomSet: (value: string) => void } export default function SelectCustomText({ customSet, excludeSet, selectedCustomSet, placeholder, setSelectedCustomSet }: SelectCustomProp) { const options: SelectOption[] = customSet const { theme } = useLocaleStore() const c = themeColors[theme] || themeColors.winter const customStyles = { option: (p: any, s: any) => ({ ...p, display: 'flex', alignItems: 'center', gap: '8px', padding: '8px 12px', backgroundColor: s.isFocused ? c.bgHover : c.bg, color: c.text, cursor: 'pointer' }), singleValue: (p: any) => ({ ...p, display: 'flex', alignItems: 'center', gap: '8px', color: c.text }), control: (p: any) => ({ ...p, backgroundColor: c.bg, borderColor: c.border, boxShadow: 'none' }), menu: (p: any) => ({ ...p, backgroundColor: c.bg, color: c.text, zIndex: 9999 }), menuPortal: (p: any) => ({ ...p, zIndex: 9999 }) } const formatOptionLabel = (option: SelectOption) => (
{option.time &&
{option.time}
} {option.description &&
}
) return (