'use strict';

const React = require('react');
const UI = require('../UI.cjs');

function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }

const React__default = /*#__PURE__*/_interopDefaultCompat(React);

/**
 * Render a dropdown component for navigation in the calendar.
 *
 * @group Components
 * @see https://daypicker.dev/guides/custom-components
 */
function Dropdown(props) {
    const { options, className, components, classNames, ...selectProps } = props;
    const cssClassSelect = [classNames[UI.UI.Dropdown], className].join(" ");
    const selectedOption = options?.find(({ value }) => value === selectProps.value);
    return (React__default.createElement("span", { "data-disabled": selectProps.disabled, className: classNames[UI.UI.DropdownRoot] },
        React__default.createElement(components.Select, { className: cssClassSelect, ...selectProps }, options?.map(({ value, label, disabled }) => (React__default.createElement(components.Option, { key: value, value: value, disabled: disabled }, label)))),
        React__default.createElement("span", { className: classNames[UI.UI.CaptionLabel], "aria-hidden": true },
            selectedOption?.label,
            React__default.createElement(components.Chevron, { orientation: "down", size: 18, className: classNames[UI.UI.Chevron] }))));
}

exports.Dropdown = Dropdown;
