UNPKG

@i-novus/ui-core

Version:

Базовые UI компоненты

15 lines (14 loc) 973 B
import { jsx as _jsx } from "react/jsx-runtime"; import { useRef } from 'react'; import classNames from 'classnames'; import { Option } from './Option'; import { ID_PREFIX, SELECTED_OPTION_ID } from './constants'; export const CalendarSelectOptions = ({ options, prefix, initialValue, onClickOption }) => { const optionsContainerRef = useRef(null); return (_jsx("div", { ref: optionsContainerRef, className: `${prefix}-calendar__select-content`, children: options.map((option) => { const isSelected = option === initialValue; return (_jsx(Option, { id: isSelected ? SELECTED_OPTION_ID : `${ID_PREFIX}${option}`, name: option, parentContainerRef: optionsContainerRef, prefix: prefix, isSelected: isSelected, onClick: onClickOption, className: classNames(`${prefix}-calendar__select-option`, { [`${prefix}-calendar__select-option_selected`]: isSelected, }), children: option }, option)); }) })); };