HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //var/www/design.system/src/molecules/Inputs/Select/Select.tsx
import { Select as SelectAntd, ConfigProvider, SelectProps } from 'antd';
import './сustom.scss';
import styles from './Select.module.scss';
import cn from 'classnames';
import Icon from '../../../atoms/Icon/Icon.tsx';
import Body from '../../../atoms/Typography/Body/Body.tsx';

const customTheme = {
  components: {
    Select: {
      hoverBorderColor: 'var(--borderBrandPrimary)',
      activeBorderColor: 'var(--borderBrandPrimary)',
    },
  },
};

interface ISelectProps extends SelectProps {
  label?: string;
  className?: string;
}

/**
 * Кастомный Select компонент на основе Ant Design.
 *
 * Поддерживает все стандартные пропсы Ant Design Select.
 *
 * Полную документацию смотрите на официальном сайте: https://ant.design/components/select#api
 */

const Select = ({ label, className, ...rest }: ISelectProps) => {
  return (
    <ConfigProvider theme={customTheme}>
      <div
        className={cn(
          styles.root,
          {
            [styles.disabled]: rest.disabled,
          },
          className
        )}
      >
        {label && <Body className={styles.label}>{label}</Body>}
        <SelectAntd
          className={cn('customSelectStyle')}
          onChange={rest.onChange}
          labelRender={({ label }) => <Body isSingleLine={true}>{label}</Body>}
          suffixIcon={<Icon name={'chevron-down'} size={16} />}
          placeholder={<Body isSingleLine={true}>{rest.placeholder}</Body>}
          notFoundContent={'Ничего не найдено'}
          {...rest}
        />
      </div>
    </ConfigProvider>
  );
};

export default Select;