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.

21 lines (17 loc) 905 B
'use strict'; var jsxRuntime = require('react/jsx-runtime'); require('react'); require('../../provider.cjs'); var icon_wrapper = require('../components/icon.wrapper.cjs'); const messageId = 'message'; const StateMessage = ({ hasMessage, state, message, theme }) => { const isErrorState = state === 'error'; return ( // needs to be rendered always to have correct behaviour for screen readers jsxRuntime.jsx("span", { id: messageId, className: "message", role: state === 'success' ? 'status' : 'alert', children: hasMessage && [ jsxRuntime.jsx(icon_wrapper.PIcon, { name: isErrorState ? 'exclamation' : 'check', color: isErrorState ? 'notification-error' : 'notification-success', theme: theme, "aria-hidden": "true" }), message || jsxRuntime.jsx("slot", { name: "message" }), ] })); }; exports.StateMessage = StateMessage; exports.messageId = messageId;