UNPKG

1.5 kBJavaScriptView Raw
1"use strict";
2var __importDefault = (this && this.__importDefault) || function (mod) {
3 return (mod && mod.__esModule) ? mod : { "default": mod };
4};
5Object.defineProperty(exports, "__esModule", { value: true });
6exports.Dropdown = Dropdown;
7const react_1 = __importDefault(require("react"));
8const UI_js_1 = require("../UI.js");
9/**
10 * Render a dropdown component to use in the navigation bar.
11 *
12 * @group Components
13 * @see https://daypicker.dev/guides/custom-components
14 */
15function Dropdown(props) {
16 const { options, className, components, classNames, ...selectProps } = props;
17 const cssClassSelect = [classNames[UI_js_1.UI.Dropdown], className].join(" ");
18 const selectedOption = options?.find(({ value }) => value === selectProps.value);
19 return (react_1.default.createElement("span", { "data-disabled": selectProps.disabled, className: classNames[UI_js_1.UI.DropdownRoot] },
20 react_1.default.createElement(components.Select, { className: cssClassSelect, ...selectProps }, options?.map(({ value, label, disabled }) => (react_1.default.createElement(components.Option, { key: value, value: value, disabled: disabled }, label)))),
21 react_1.default.createElement("span", { className: classNames[UI_js_1.UI.CaptionLabel], "aria-hidden": true },
22 selectedOption?.label,
23 react_1.default.createElement(components.Chevron, { orientation: "down", size: 18, className: classNames[UI_js_1.UI.Chevron] }))));
24}
25//# sourceMappingURL=Dropdown.js.map
\No newline at end of file