"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.RadioItem = exports.RadioItems = exports.SubItems = exports.SubTrigger = exports.Sub = exports.Separator = exports.Item = exports.Items = exports.Trigger = exports.Root = void 0;
const react_1 = __importDefault(require("react"));
const DropdownBase = __importStar(require("@radix-ui/react-dropdown-menu"));
const varsUtilities_1 = require("../../varsUtilities");
const inlines_1 = require("inlines");
const icons_1 = require("../../icons");
const utils_1 = require("../../utils");
const hooks_1 = require("../../hooks");
function Root({ children }) {
    return react_1.default.createElement(DropdownBase.Root, null, children);
}
exports.Root = Root;
function Trigger({ children }) {
    return react_1.default.createElement(DropdownBase.Trigger, { asChild: true }, children);
}
exports.Trigger = Trigger;
function Items({ children }) {
    return (react_1.default.createElement(DropdownBase.Portal, null,
        react_1.default.createElement(DropdownBase.Content, { asChild: true, onCloseAutoFocus: (e) => {
                e.preventDefault();
            } },
            react_1.default.createElement(inlines_1.styled.div, { style: {
                    minWidth: 174,
                    width: 'fit-content',
                    maxWidth: 267,
                    padding: 8,
                    borderRadius: 8,
                    border: `1px solid ${(0, varsUtilities_1.color)('border', 'default', 'strong')}`,
                    background: (0, varsUtilities_1.color)('standalone', 'modal', 'default'),
                    boxShadow: '0px 2px 8px -1px rgba(27, 36, 44, 0.08), 0px 2px 2px -1px rgba(27, 36, 44, 0.04)',
                    boxSizing: 'border-box',
                    overflowY: 'auto',
                    maxHeight: 'calc(var(--radix-dropdown-menu-content-available-height) - 16px)',
                    '& > * + *': {
                        marginTop: '2px',
                    },
                } }, children))));
}
exports.Items = Items;
function Item({ icon, children, onClick, disabled }) {
    return (react_1.default.createElement(DropdownBase.Item, { asChild: true, disabled: disabled, onSelect: onClick },
        react_1.default.createElement(inlines_1.styled.div, { style: {
                fontSize: 14,
                fontWeight: 500,
                lineHeight: '24px',
                fontFamily: 'Inter',
                position: 'relative',
                padding: '4px 12px',
                borderRadius: 8,
                outline: 'none',
                userSelect: 'none',
                WebkitUserSelect: 'none',
                color: (0, varsUtilities_1.color)('content', 'default', 'primary'),
                '&:not([data-disabled]):hover': {
                    background: (0, varsUtilities_1.color)('action', 'system', 'active'),
                },
                [utils_1.BpTablet]: {
                    '&:not([data-disabled]):hover': {
                        background: (0, varsUtilities_1.color)('action', 'system', 'normal'),
                    },
                },
                '&:focus': { background: (0, varsUtilities_1.color)('action', 'system', 'active') },
                '&:not([data-disabled])': {
                    cursor: 'pointer',
                },
            } },
            icon && (react_1.default.createElement("div", { style: {
                    position: 'absolute',
                    top: 6,
                    left: 12,
                    color: (0, varsUtilities_1.color)('content', 'default'),
                } }, icon)),
            react_1.default.createElement("div", { style: { paddingLeft: icon ? 30 : 0 } }, children))));
}
exports.Item = Item;
function Separator() {
    return (react_1.default.createElement(DropdownBase.Separator, { style: {
            height: 1,
            background: (0, varsUtilities_1.color)('border', 'default', 'strong'),
            margin: '8px -8px',
        } }));
}
exports.Separator = Separator;
function Sub({ children }) {
    return react_1.default.createElement(DropdownBase.Sub, null, children);
}
exports.Sub = Sub;
function SubTrigger({ children, icon }) {
    return (react_1.default.createElement(DropdownBase.SubTrigger, { asChild: true },
        react_1.default.createElement(inlines_1.styled.div, { style: {
                fontSize: 14,
                fontWeight: 500,
                lineHeight: '24px',
                fontFamily: 'Inter',
                position: 'relative',
                padding: '4px 12px',
                borderRadius: 8,
                outline: 'none',
                userSelect: 'none',
                WebkitUserSelect: 'none',
                cursor: 'pointer',
                color: (0, varsUtilities_1.color)('content', 'default', 'primary'),
                '&:hover': { background: (0, varsUtilities_1.color)('action', 'system', 'active') },
                [utils_1.BpTablet]: {
                    '&:hover': null,
                },
                '&:focus': { background: (0, varsUtilities_1.color)('action', 'system', 'active') },
                '&[data-state=open]': {
                    background: (0, varsUtilities_1.color)('action', 'system', 'active'),
                },
            } },
            icon && (react_1.default.createElement("div", { style: { position: 'absolute', top: 6, left: 12 } }, icon)),
            react_1.default.createElement("div", { style: { padding: '0px 30px' } }, children),
            react_1.default.createElement("div", { style: { position: 'absolute', display: 'flex', right: 12, top: 6 } },
                react_1.default.createElement(icons_1.IconChevronRight, null)))));
}
exports.SubTrigger = SubTrigger;
function SubItems({ children }) {
    const { width } = (0, hooks_1.useWindowResize)();
    return (react_1.default.createElement(DropdownBase.Portal, null,
        react_1.default.createElement(DropdownBase.SubContent, { sideOffset: width < 640 ? -200 : 0, asChild: true },
            react_1.default.createElement(inlines_1.styled.div, { style: {
                    width: 267,
                    padding: 8,
                    borderRadius: 8,
                    border: `1px solid ${(0, varsUtilities_1.color)('border', 'default', 'strong')}`,
                    background: (0, varsUtilities_1.color)('standalone', 'modal', 'default'),
                    boxShadow: '0px 2px 8px -1px rgba(27, 36, 44, 0.08), 0px 2px 2px -1px rgba(27, 36, 44, 0.04)',
                    boxSizing: 'border-box',
                    overflowY: 'auto',
                    maxHeight: 'calc(var(--radix-dropdown-menu-content-available-height) - 16px)',
                    '& > * + *': {
                        marginTop: '2px',
                    },
                } }, children))));
}
exports.SubItems = SubItems;
function RadioItems({ children, value, onChange, }) {
    return (react_1.default.createElement(DropdownBase.RadioGroup, { value: value, onValueChange: onChange }, children));
}
exports.RadioItems = RadioItems;
function RadioItem({ children, value }) {
    return (react_1.default.createElement(DropdownBase.RadioItem, { value: value, asChild: true },
        react_1.default.createElement(inlines_1.styled.div, { style: {
                fontSize: 14,
                fontWeight: 500,
                lineHeight: '24px',
                fontFamily: 'Inter',
                position: 'relative',
                padding: '4px 12px',
                borderRadius: 8,
                outline: 'none',
                userSelect: 'none',
                WebkitUserSelect: 'none',
                cursor: 'pointer',
                color: (0, varsUtilities_1.color)('content', 'default', 'primary'),
                '&:hover': { background: (0, varsUtilities_1.color)('action', 'system', 'active') },
                [utils_1.BpTablet]: {
                    '&:hover': null,
                },
                '&:focus': { background: (0, varsUtilities_1.color)('action', 'system', 'active') },
            } },
            react_1.default.createElement(DropdownBase.ItemIndicator, { asChild: true },
                react_1.default.createElement("div", { style: { position: 'absolute', top: 6, left: 12 } },
                    react_1.default.createElement(icons_1.IconCheckLarge, null))),
            react_1.default.createElement("div", { style: { paddingLeft: 30 } }, children))));
}
exports.RadioItem = RadioItem;
//# sourceMappingURL=index.js.map