@shopgate/engage
Version:
Shopgate's ENGAGE library.
31 lines (30 loc) • 851 B
JavaScript
import React from 'react';
import PropTypes from 'prop-types';
import { I18n } from "../../../components";
import styles from "./styles";
/**
* The LiveMessage component can be used to broadcast "aria-live" messages to assistive technology.
* @param {string} message The message - i18n placeholders are supported.
* @param {Object} params Optional params for the message.
* @param {string} 'aria-live' The aria-live type.
* @returns {JSX}
*/
import { jsx as _jsx } from "react/jsx-runtime";
const LiveMessage = ({
message,
params,
'aria-live': ariaLive
}) => /*#__PURE__*/_jsx("div", {
className: styles,
role: "log",
"aria-live": ariaLive,
children: /*#__PURE__*/_jsx(I18n.Text, {
string: message,
params: params
})
});
LiveMessage.defaultProps = {
'aria-live': 'polite',
params: null
};
export default LiveMessage;