1 | "use strict";
|
2 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
3 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
4 | };
|
5 | Object.defineProperty(exports, "__esModule", { value: true });
|
6 | exports.Dropdown = Dropdown;
|
7 | const react_1 = __importDefault(require("react"));
|
8 | const UI_js_1 = require("../UI.js");
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | function 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 |
|
\ | No newline at end of file |