@canonical/react-components 4.0.1 → 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.
- package/dist/components/Notifications/Notification/Notification.d.ts +5 -1
- package/dist/components/Notifications/Notification/Notification.js +3 -2
- package/dist/components/SideNavigation/SideNavigation.d.ts +5 -1
- package/dist/components/SideNavigation/SideNavigation.js +4 -2
- package/dist/esm/components/Notifications/Notification/Notification.d.ts +5 -1
- package/dist/esm/components/Notifications/Notification/Notification.js +3 -2
- package/dist/esm/components/SideNavigation/SideNavigation.d.ts +5 -1
- package/dist/esm/components/SideNavigation/SideNavigation.js +4 -2
- package/package.json +1 -1
|
@@ -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(
|
|
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",
|
|
@@ -41,10 +41,14 @@ export type Props<L = SideNavigationLinkDefaultElement> = PropsWithSpread<{
|
|
|
41
41
|
* Classes to apply to the nav element.
|
|
42
42
|
*/
|
|
43
43
|
navClassName?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Aria label to apply to the nav element.
|
|
46
|
+
*/
|
|
47
|
+
ariaLabel?: string;
|
|
44
48
|
}, HTMLProps<HTMLDivElement>>;
|
|
45
49
|
/**
|
|
46
50
|
* This is a [React](https://reactjs.org/) component for side navigation, used
|
|
47
51
|
* in the [Vanilla](https://vanillaframework.io/docs/) layouts.
|
|
48
52
|
*/
|
|
49
|
-
declare const SideNavigation: <L = SideNavigationLinkDefaultElement>({ children, className, dark, hasIcons, items, linkComponent, listClassName, navClassName, ...props }: Props<L>) => React.JSX.Element;
|
|
53
|
+
declare const SideNavigation: <L = SideNavigationLinkDefaultElement>({ children, className, dark, hasIcons, items, linkComponent, listClassName, navClassName, ariaLabel, ...props }: Props<L>) => React.JSX.Element;
|
|
50
54
|
export default SideNavigation;
|
|
@@ -9,7 +9,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
9
9
|
var _SideNavigationItem = _interopRequireDefault(require("./SideNavigationItem"));
|
|
10
10
|
var _utils = require("../../utils");
|
|
11
11
|
const _excluded = ["items"],
|
|
12
|
-
_excluded2 = ["children", "className", "dark", "hasIcons", "items", "linkComponent", "listClassName", "navClassName"];
|
|
12
|
+
_excluded2 = ["children", "className", "dark", "hasIcons", "items", "linkComponent", "listClassName", "navClassName", "ariaLabel"];
|
|
13
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
14
|
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; }
|
|
15
15
|
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; }
|
|
@@ -81,7 +81,8 @@ const SideNavigation = _ref2 => {
|
|
|
81
81
|
items,
|
|
82
82
|
linkComponent,
|
|
83
83
|
listClassName,
|
|
84
|
-
navClassName
|
|
84
|
+
navClassName,
|
|
85
|
+
ariaLabel
|
|
85
86
|
} = _ref2,
|
|
86
87
|
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
87
88
|
return /*#__PURE__*/_react.default.createElement("div", _extends({
|
|
@@ -90,6 +91,7 @@ const SideNavigation = _ref2 => {
|
|
|
90
91
|
"is-dark": dark
|
|
91
92
|
})
|
|
92
93
|
}, props), /*#__PURE__*/_react.default.createElement("nav", {
|
|
94
|
+
"aria-label": ariaLabel,
|
|
93
95
|
className: navClassName
|
|
94
96
|
}, children !== null && children !== void 0 ? children : generateItems(items, listClassName, linkComponent, dark)));
|
|
95
97
|
};
|
|
@@ -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(
|
|
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",
|
|
@@ -41,10 +41,14 @@ export type Props<L = SideNavigationLinkDefaultElement> = PropsWithSpread<{
|
|
|
41
41
|
* Classes to apply to the nav element.
|
|
42
42
|
*/
|
|
43
43
|
navClassName?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Aria label to apply to the nav element.
|
|
46
|
+
*/
|
|
47
|
+
ariaLabel?: string;
|
|
44
48
|
}, HTMLProps<HTMLDivElement>>;
|
|
45
49
|
/**
|
|
46
50
|
* This is a [React](https://reactjs.org/) component for side navigation, used
|
|
47
51
|
* in the [Vanilla](https://vanillaframework.io/docs/) layouts.
|
|
48
52
|
*/
|
|
49
|
-
declare const SideNavigation: <L = SideNavigationLinkDefaultElement>({ children, className, dark, hasIcons, items, linkComponent, listClassName, navClassName, ...props }: Props<L>) => React.JSX.Element;
|
|
53
|
+
declare const SideNavigation: <L = SideNavigationLinkDefaultElement>({ children, className, dark, hasIcons, items, linkComponent, listClassName, navClassName, ariaLabel, ...props }: Props<L>) => React.JSX.Element;
|
|
50
54
|
export default SideNavigation;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var _excluded = ["items"],
|
|
2
|
-
_excluded2 = ["children", "className", "dark", "hasIcons", "items", "linkComponent", "listClassName", "navClassName"];
|
|
2
|
+
_excluded2 = ["children", "className", "dark", "hasIcons", "items", "linkComponent", "listClassName", "navClassName", "ariaLabel"];
|
|
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; }
|
|
5
5
|
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); }
|
|
@@ -74,7 +74,8 @@ var SideNavigation = _ref2 => {
|
|
|
74
74
|
items,
|
|
75
75
|
linkComponent,
|
|
76
76
|
listClassName,
|
|
77
|
-
navClassName
|
|
77
|
+
navClassName,
|
|
78
|
+
ariaLabel
|
|
78
79
|
} = _ref2,
|
|
79
80
|
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
80
81
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
@@ -83,6 +84,7 @@ var SideNavigation = _ref2 => {
|
|
|
83
84
|
"is-dark": dark
|
|
84
85
|
})
|
|
85
86
|
}, props), /*#__PURE__*/React.createElement("nav", {
|
|
87
|
+
"aria-label": ariaLabel,
|
|
86
88
|
className: navClassName
|
|
87
89
|
}, children !== null && children !== void 0 ? children : generateItems(items, listClassName, linkComponent, dark)));
|
|
88
90
|
};
|