UNPKG

sccoreui

Version:

ui-sccore

16 lines (15 loc) 1.46 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const jsx_runtime_1 = require("react/jsx-runtime"); const svg_component_1 = tslib_1.__importDefault(require("../../directives/svg-component")); const ChipTag = (props) => { const { onRemove } = props; return props.template ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: props.template })) : ((0, jsx_runtime_1.jsxs)("span", Object.assign({ className: props.className ? "bg-gray-100 border-round-2xl flex justify-content-between align-items-center py-1 gap-2 px-3 text-gray-700" : props.className }, { children: [props.image && ((0, jsx_runtime_1.jsx)("img", { src: props.image, alt: props.imageAlt || "chip image" })), props.icon && (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: props.icon }), (0, jsx_runtime_1.jsx)("span", Object.assign({ className: "font-medium" }, { children: props.label })), props.removable && ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: "cursor-pointer", onClick: (e) => { const el = e.currentTarget.parentElement; props.onRemove !== undefined ? onRemove : el.remove(); } }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: props.removeIcon || (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "x-close" }) }) })))] }))); }; exports.default = ChipTag;