UNPKG

@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.

14 lines (11 loc) 746 B
import { jsxs, jsx } from 'react/jsx-runtime'; import 'react'; import '../../provider.mjs'; import { getRole } from '../../../../../../components/dist/utils/esm/utils-entry.mjs'; import { PIcon } from '../components/icon.wrapper.mjs'; const messageId = 'message'; const StateMessage = ({ hasMessage, state, message, theme }) => { const isErrorState = state === 'error'; return (hasMessage && (jsxs("span", { id: messageId, className: "message", role: getRole(state), children: [jsx(PIcon, { name: isErrorState ? 'exclamation' : 'check', color: isErrorState ? 'notification-error' : 'notification-success', theme: theme, "aria-hidden": "true" }), message || jsx("slot", { name: "message" })] }))); }; export { StateMessage, messageId };