"use strict";
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
    if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
    return cooked;
};
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
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 React = __importStar(require("react"));
var styled_components_1 = __importStar(require("@xstyled/styled-components"));
var system_1 = require("@xstyled/system");
var Icon_1 = __importDefault(require("../Icon/Icon"));
var rightcaret_svg_1 = __importDefault(require("../shared/assets/pattern/rightcaret.svg"));
var Item = styled_components_1.default.li(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n  position: relative;\n\n  display: flex;\n  align-items: center;\n  margin: 0;\n  padding: 2 6;\n\n  i {\n    margin-right: 10;\n  }\n\n  &:hover {\n    background-color: primary;\n    color: ", ";\n  }\n\n  ul {\n    display: none;\n    position: absolute;\n    top: -2px;\n    left: 97%;\n    color: ", ";\n\n    i {\n      width: 18px;\n      height: 20px;\n      margin-right: 6;\n    }\n  }\n\n  svg {\n    fill: ", ";\n  }\n\n  ", ";\n\n  ", ";\n"], ["\n  position: relative;\n\n  display: flex;\n  align-items: center;\n  margin: 0;\n  padding: 2 6;\n\n  i {\n    margin-right: 10;\n  }\n\n  &:hover {\n    background-color: primary;\n    color: ", ";\n  }\n\n  ul {\n    display: none;\n    position: absolute;\n    top: -2px;\n    left: 97%;\n    color: ", ";\n\n    i {\n      width: 18px;\n      height: 20px;\n      margin-right: 6;\n    }\n  }\n\n  svg {\n    fill: ", ";\n  }\n\n  ", ";\n\n  ",
    ";\n"])), system_1.th('colors.white'), system_1.th('colors.black'), system_1.th('colors.white'), function (_a) {
    var icon = _a.icon;
    return !icon && 'padding-left: 26px;';
}, function (_a) {
    var hasList = _a.hasList;
    return hasList && styled_components_1.css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n      &:after {\n        position: absolute;\n        width: 5px;\n        height: 8px;\n        right: 8px;\n\n        content: '';\n        background-color: ", ";\n        mask-image: url('", "');\n        mask-position: center center;\n        mask-size: 5px 8px;\n        mask-repeat: no-repeat;\n      }\n\n      &:hover {\n        &:after {\n          background-color: ", ";\n        }\n\n        ul {\n          display: block;\n        }\n      }\n    "], ["\n      &:after {\n        position: absolute;\n        width: 5px;\n        height: 8px;\n        right: 8px;\n\n        content: '';\n        background-color: ", ";\n        mask-image: url('", "');\n        mask-position: center center;\n        mask-size: 5px 8px;\n        mask-repeat: no-repeat;\n      }\n\n      &:hover {\n        &:after {\n          background-color: ", ";\n        }\n\n        ul {\n          display: block;\n        }\n      }\n    "])), system_1.th('colors.black'), rightcaret_svg_1.default, system_1.th('colors.white'));
});
var ListItem = function (_a) {
    var icon = _a.icon, _b = _a.children, children = _b === void 0 ? [] : _b, rest = __rest(_a, ["icon", "children"]);
    return (React.createElement(Item, __assign({}, rest, { icon: icon, hasList: Boolean(children &&
            React.Children.map(children, function (child) {
                return React.isValidElement(child);
            }).some(function (child) { return child; })) }),
        icon && React.createElement(Icon_1.default, { name: icon }),
        children));
};
ListItem.displayName = 'List.Item';
exports.default = ListItem;
var templateObject_1, templateObject_2;
//# sourceMappingURL=ListItem.js.map