"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Item = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const Collapse_1 = require("../../Collapse");
const ItemButton_1 = require("./ItemButton");
const List_1 = require("./List");
const useLogic_1 = require("./useLogic");
const Item = (props) => {
    const { collapsedIn, item: [, value], } = props;
    const { active: externalActive, icon, items, text, component, ...componentProps } = value;
    const { handleClick, isOpen, selected, isGroupTitleItem } = (0, useLogic_1.useLogic)(props);
    return ((0, jsx_runtime_1.jsxs)("li", { children: [(0, jsx_runtime_1.jsx)(ItemButton_1.ItemButton, { opened: isOpen, collapsedIn: collapsedIn, selected: selected, text: text, icon: icon, component: component, ...componentProps, onClick: handleClick, isGroupTitleItem: isGroupTitleItem }), items && ((0, jsx_runtime_1.jsx)(Collapse_1.Collapse, { in: isOpen, children: (0, jsx_runtime_1.jsx)(List_1.List, { collapsedIn: collapsedIn, items: items }) }))] }));
};
exports.Item = Item;
