UNPKG

@yandex/ui

Version:

Yandex UI components

29 lines (28 loc) 1.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Icon = exports.cnIcon = void 0; var tslib_1 = require("tslib"); var react_1 = tslib_1.__importDefault(require("react")); var classname_1 = require("@bem-react/classname"); require("./Icon.css"); exports.cnIcon = classname_1.cn('Icon'); /** * Компонент для вставки иконки. * @param {IIconProps} props */ var Icon = function (_a) { var direction = _a.direction, size = _a.size, url = _a.url, _b = _a.style, style = _b === void 0 ? {} : _b, children = _a.children, title = _a.title, onClick = _a.onClick, // Извлекаем свойства, т.к. они не нужны на DOM узле // FIXME: https://github.com/bem/bem-react/issues/381 // @ts-ignore _type = _a.type, // @ts-ignore _glyph = _a.glyph, props = tslib_1.__rest(_a, ["direction", "size", "url", "style", "children", "title", "onClick", "type", "glyph"]); var className = exports.cnIcon({ direction: direction, size: size }, [props.className]); if (url !== undefined) { style.backgroundImage = "url('" + url + "')"; } return (react_1.default.createElement("span", tslib_1.__assign({}, props, { "aria-hidden": true, className: className, style: style, title: title, onClick: onClick }), children)); }; exports.Icon = Icon; exports.Icon.displayName = exports.cnIcon();