@canonical/react-components 4.1.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -48,6 +48,10 @@ export type Props = PropsWithSpread<{
48
48
  * Whether the title should display inline with the message.
49
49
  */
50
50
  inline?: boolean;
51
+ /**
52
+ * Optional element or component to use for the message.
53
+ */
54
+ messageElement?: ElementType;
51
55
  /**
52
56
  * The function to run when dismissing/closing the notification.
53
57
  */
@@ -106,5 +110,5 @@ and align with our component prop naming conventions.
106
110
  The `notificationTypes` const has also been replaced with `NotificationSeverity`
107
111
  to reflect the new prop name.
108
112
  */
109
- declare const Notification: ({ actions, borderless, children, className, close, inline, onDismiss, severity, status, timeout, timestamp, title, titleElement: TitleComponent, type, ...props }: Props) => React.JSX.Element;
113
+ declare const Notification: ({ actions, borderless, children, className, close, inline, messageElement: MessageComponent, onDismiss, severity, status, timeout, timestamp, title, titleElement: TitleComponent, type, ...props }: Props) => React.JSX.Element;
110
114
  export default Notification;
@@ -8,7 +8,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _Button = _interopRequireWildcard(require("../../Button"));
10
10
  var _utils = require("../../../utils");
11
- const _excluded = ["actions", "borderless", "children", "className", "close", "inline", "onDismiss", "severity", "status", "timeout", "timestamp", "title", "titleElement", "type"];
11
+ const _excluded = ["actions", "borderless", "children", "className", "close", "inline", "messageElement", "onDismiss", "severity", "status", "timeout", "timestamp", "title", "titleElement", "type"];
12
12
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
13
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
14
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
@@ -68,6 +68,7 @@ const Notification = _ref => {
68
68
  className,
69
69
  close,
70
70
  inline = false,
71
+ messageElement: MessageComponent = "p",
71
72
  onDismiss,
72
73
  severity = NotificationSeverity.INFORMATION,
73
74
  status,
@@ -102,7 +103,7 @@ const Notification = _ref => {
102
103
  }, title && /*#__PURE__*/_react.default.createElement(TitleComponent, {
103
104
  className: "p-notification__title",
104
105
  "data-testid": "notification-title"
105
- }, title), inline && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "\u2002"), /*#__PURE__*/_react.default.createElement("p", {
106
+ }, title), inline && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "\u2002"), /*#__PURE__*/_react.default.createElement(MessageComponent, {
106
107
  className: "p-notification__message"
107
108
  }, children), onDismiss && /*#__PURE__*/_react.default.createElement("button", {
108
109
  type: "button",
@@ -48,6 +48,10 @@ export type Props = PropsWithSpread<{
48
48
  * Whether the title should display inline with the message.
49
49
  */
50
50
  inline?: boolean;
51
+ /**
52
+ * Optional element or component to use for the message.
53
+ */
54
+ messageElement?: ElementType;
51
55
  /**
52
56
  * The function to run when dismissing/closing the notification.
53
57
  */
@@ -106,5 +110,5 @@ and align with our component prop naming conventions.
106
110
  The `notificationTypes` const has also been replaced with `NotificationSeverity`
107
111
  to reflect the new prop name.
108
112
  */
109
- declare const Notification: ({ actions, borderless, children, className, close, inline, onDismiss, severity, status, timeout, timestamp, title, titleElement: TitleComponent, type, ...props }: Props) => React.JSX.Element;
113
+ declare const Notification: ({ actions, borderless, children, className, close, inline, messageElement: MessageComponent, onDismiss, severity, status, timeout, timestamp, title, titleElement: TitleComponent, type, ...props }: Props) => React.JSX.Element;
110
114
  export default Notification;
@@ -1,4 +1,4 @@
1
- var _excluded = ["actions", "borderless", "children", "className", "close", "inline", "onDismiss", "severity", "status", "timeout", "timestamp", "title", "titleElement", "type"];
1
+ var _excluded = ["actions", "borderless", "children", "className", "close", "inline", "messageElement", "onDismiss", "severity", "status", "timeout", "timestamp", "title", "titleElement", "type"];
2
2
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
3
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
4
4
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
@@ -60,6 +60,7 @@ var Notification = _ref => {
60
60
  className,
61
61
  close,
62
62
  inline = false,
63
+ messageElement: MessageComponent = "p",
63
64
  onDismiss,
64
65
  severity = NotificationSeverity.INFORMATION,
65
66
  status,
@@ -94,7 +95,7 @@ var Notification = _ref => {
94
95
  }, title && /*#__PURE__*/React.createElement(TitleComponent, {
95
96
  className: "p-notification__title",
96
97
  "data-testid": "notification-title"
97
- }, title), inline && /*#__PURE__*/React.createElement(React.Fragment, null, "\u2002"), /*#__PURE__*/React.createElement("p", {
98
+ }, title), inline && /*#__PURE__*/React.createElement(React.Fragment, null, "\u2002"), /*#__PURE__*/React.createElement(MessageComponent, {
98
99
  className: "p-notification__message"
99
100
  }, children), onDismiss && /*#__PURE__*/React.createElement("button", {
100
101
  type: "button",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonical/react-components",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": {