@up-group-ui/react-controls
Version:
Up shared react controls
28 lines • 2.58 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.UpPanel = void 0;
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var SvgIcon_1 = (0, tslib_1.__importDefault)(require("../../Display/SvgIcon"));
var classnames_1 = (0, tslib_1.__importDefault)(require("classnames"));
var styles_1 = require("./styles");
var withTheme_1 = (0, tslib_1.__importDefault)(require("../../../Common/theming/withTheme"));
var Grid_1 = require("../Grid");
var UpPanel = function (props) {
var type = props.type, children = props.children, message = props.message, iconName = props.iconName, iconSize = props.iconSize, title = props.title, footer = props.footer, disableAutoIntentIcon = props.disableAutoIntentIcon, theme = props.theme, className = props.className;
var resolvedIconName = !iconName && !disableAutoIntentIcon && theme.intentTypeIcons ? theme.intentTypeIcons[type] : iconName;
var icon = ((0, jsx_runtime_1.jsx)(SvgIcon_1.default, { iconName: resolvedIconName, width: iconSize, height: iconSize, color: theme && theme.colorMap ? theme.colorMap[type] : theme.colorMap.defaultDark }, void 0));
return ((0, jsx_runtime_1.jsxs)("div", (0, tslib_1.__assign)({ className: (0, classnames_1.default)('up-panel', className, (0, styles_1.getStyles)(props)) }, { children: [title && (0, jsx_runtime_1.jsx)("div", (0, tslib_1.__assign)({ className: "up-panel_header" }, { children: title }), void 0), (0, jsx_runtime_1.jsx)(Grid_1.UpGrid, (0, tslib_1.__assign)({ className: "up-panel_body" }, { children: (0, jsx_runtime_1.jsxs)(Grid_1.UpRow, (0, tslib_1.__assign)({ justify: 'center', align: 'middle' }, { children: [resolvedIconName && (0, jsx_runtime_1.jsx)(Grid_1.UpCol, (0, tslib_1.__assign)({ span: 2 }, { children: icon }), void 0), (0, jsx_runtime_1.jsx)(Grid_1.UpCol, (0, tslib_1.__assign)({ span: resolvedIconName ? 22 : 24 }, { children: (0, jsx_runtime_1.jsxs)("div", (0, tslib_1.__assign)({ className: "up-panel_message" }, { children: [message && (0, jsx_runtime_1.jsx)("p", { children: message }, void 0), children] }), void 0) }), void 0)] }), void 0) }), void 0), props.footer && (0, jsx_runtime_1.jsx)("div", (0, tslib_1.__assign)({ className: "up-panel_footer" }, { children: footer }), void 0)] }), void 0));
};
exports.UpPanel = UpPanel;
UpPanel.defaultProps = {
title: null,
footer: null,
type: 'default',
message: null,
iconName: null,
iconSize: null,
disableAutoIntentIcon: true,
};
exports.default = (0, withTheme_1.default)(UpPanel);
//# sourceMappingURL=UpPanel.js.map