"use strict";
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var jsx_runtime_1 = require("react/jsx-runtime");
var react_1 = __importDefault(require("react"));
var styles_1 = require("../../../hooks/styles");
var Container_1 = require("../../../components/Container");
var Icon_1 = require("../../../components/Icon");
var Text_1 = __importDefault(require("../../../components/Text"));
var styles_2 = require("../../../utils/styles");
var Button = function (_a) {
    var icon = _a.icon, text = _a.text, isSelected = _a.isSelected, onClick = _a.onClick;
    var _b = (0, styles_1.useHoverProps)(), hoverProps = _b[0], isHover = _b[1];
    return ((0, jsx_runtime_1.jsxs)(Container_1.Container, __assign({ onClick: onClick, "$width": "140px", "$height": "32px", "$padding": "0 4px", "$borderRadius": "8px", "$cursor": true, "$display": "flex", "$alignItems": "center", "$gap": "8px", "$background": isHover ? styles_2.theme.color.gray[200] : 'none', "$transition": "background" }, hoverProps, { children: [!!icon && ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { type: icon, "$size": "20px", "$fill": styles_2.theme.color.extra.black })), (0, jsx_runtime_1.jsx)(Text_1.default, { type: "b6", value: text || '', "$color": styles_2.theme.color.extra.black, "$flexGrowHorizontal": true, "$ellipsis": true }), !!isSelected && ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { type: "check", "$size": "16px", "$fill": styles_2.theme.color.extra.black }))] })));
};
exports.default = react_1.default.memo(function (_a) {
    var selectedOption = _a.selectedOption, _b = _a.options, options = _b === void 0 ? [] : _b, onChangeOption = _a.onChangeOption, _c = _a.position, position = _c === void 0 ? 'left' : _c, props = __rest(_a, ["selectedOption", "options", "onChangeOption", "position"]);
    return ((0, jsx_runtime_1.jsx)(Container_1.Container, __assign({ "$position": "absolute", "$top": "100%", "$left": position === 'left' ? '0' : undefined, "$right": position === 'right' ? '0' : undefined, "$maxHeight": "176px", "$padding": "8px", "$borderRadius": "8px", "$background": styles_2.theme.color.extra.white, "$zIndex": styles_2.theme.zIndex.dropdown, "$display": "flex", "$flexDirection": "column", "$gap": "8px", "$overflow": "auto", "$css": styles_2.theme.effect.dropdown }, props, { children: options.map(function (_a) {
            var value = _a.value, icon = _a.icon, text = _a.text;
            return ((0, jsx_runtime_1.jsx)(Button, { icon: icon, text: text, isSelected: selectedOption === value, onClick: function () { return onChangeOption === null || onChangeOption === void 0 ? void 0 : onChangeOption(value); } }, value));
        }) })));
});
//# sourceMappingURL=index.js.map