@porsche-design-system/components-react
Version:
Porsche Design System is a component library designed to help developers create the best experience for software or services distributed by Dr. Ing. h.c. F. Porsche AG.
41 lines (37 loc) • 2.02 kB
JavaScript
'use strict';
var jsxRuntime = require('react/jsx-runtime');
var splitChildren = require('../../splitChildren.cjs');
var react = require('react');
var minifyCss = require('../../minifyCss.cjs');
var stripFocusAndHoverStyles = require('../../stripFocusAndHoverStyles.cjs');
var stylesEntry = require('../../../../../../components/dist/styles/esm/styles-entry.cjs');
var utilsEntry = require('../../../../../../components/dist/utils/esm/utils-entry.cjs');
/**
* @slot {"name": "", "description": "Default slot for the text to render." }
*/
class DSRText extends react.Component {
host;
render() {
splitChildren.splitChildren(this.props.children);
const colorDeprecationMap = {
brand: 'primary',
default: 'primary',
'neutral-contrast-low': 'contrast-low',
'neutral-contrast-medium': 'contrast-medium',
'neutral-contrast-high': 'contrast-high',
'notification-neutral': 'notification-info',
};
const weightDeprecationMap = {
thin: 'regular',
semibold: 'semi-bold',
};
const alignDeprecationMap = {
left: 'start',
right: 'end',
};
const TagType = utilsEntry.getTextTagType(null, this.props.tag);
const style = minifyCss.minifyCss(stripFocusAndHoverStyles.stripFocusAndHoverStyles(stylesEntry.getTextCss(this.props.size, (weightDeprecationMap[this.props.weight] || this.props.weight), (alignDeprecationMap[this.props.align] || this.props.align), (colorDeprecationMap[this.props.color] || this.props.color), this.props.ellipsis, this.props.theme)));
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsx(TagType, { className: "root", children: jsxRuntime.jsx("slot", {}) })] }), this.props.children] }));
}
}
exports.DSRText = DSRText;