@carbon/ibm-products 2.43.2-canary.249 → 2.43.2-canary.251

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.
@@ -6,7 +6,7 @@
6
6
  */
7
7
  /// <reference path="../../../src/custom-typings/index.d.ts" />
8
8
  import { Link } from '@carbon/react';
9
- import React from 'react';
9
+ import React, { RefObject } from 'react';
10
10
  interface Link {
11
11
  url: string;
12
12
  text: string;
@@ -138,6 +138,10 @@ export interface NotificationsPanelProps {
138
138
  * Sets the today label text
139
139
  */
140
140
  todayLabel?: string;
141
+ /**
142
+ * Reference to trigger button
143
+ */
144
+ triggerButtonRef?: RefObject<any>;
141
145
  /**
142
146
  * Sets the View all button text
143
147
  */
@@ -22,7 +22,7 @@ import { useClickOutside } from '../../global/js/hooks/useClickOutside.js';
22
22
  import { NotificationsEmptyState } from '../EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js';
23
23
 
24
24
  var _Close;
25
- var _excluded = ["className", "data", "daysAgoText", "dismissAllLabel", "dismissSingleNotificationIconDescription", "doNotDisturbDefaultToggled", "doNotDisturbLabel", "emptyStateLabel", "hourAgoText", "hoursAgoText", "minuteAgoText", "minutesAgoText", "monthAgoText", "monthsAgoText", "nowText", "onClickOutside", "onDismissAllNotifications", "onDismissSingleNotification", "onDoNotDisturbChange", "onSettingsClick", "onViewAllClick", "open", "previousLabel", "readLessLabel", "readMoreLabel", "secondsAgoText", "settingsIconDescription", "title", "todayLabel", "viewAllLabel", "yearAgoText", "yearsAgoText", "yesterdayAtText", "yesterdayLabel", "selectorsFloatingMenus"];
25
+ var _excluded = ["className", "data", "daysAgoText", "dismissAllLabel", "dismissSingleNotificationIconDescription", "doNotDisturbDefaultToggled", "doNotDisturbLabel", "emptyStateLabel", "hourAgoText", "hoursAgoText", "minuteAgoText", "minutesAgoText", "monthAgoText", "monthsAgoText", "nowText", "onClickOutside", "onDismissAllNotifications", "onDismissSingleNotification", "onDoNotDisturbChange", "onSettingsClick", "onViewAllClick", "open", "previousLabel", "readLessLabel", "readMoreLabel", "secondsAgoText", "settingsIconDescription", "title", "todayLabel", "viewAllLabel", "yearAgoText", "yearsAgoText", "yesterdayAtText", "yesterdayLabel", "selectorsFloatingMenus", "triggerButtonRef"];
26
26
 
27
27
  // The block part of our conventional BEM class names (blockClass__E--M).
28
28
  var componentName = 'NotificationsPanel';
@@ -143,6 +143,7 @@ var NotificationsPanel = /*#__PURE__*/React__default.forwardRef(function (_ref,
143
143
  _ref$yesterdayLabel = _ref.yesterdayLabel,
144
144
  yesterdayLabel = _ref$yesterdayLabel === void 0 ? defaults.yesterdayLabel : _ref$yesterdayLabel,
145
145
  selectorsFloatingMenus = _ref.selectorsFloatingMenus,
146
+ triggerButtonRef = _ref.triggerButtonRef,
146
147
  rest = _objectWithoutProperties(_ref, _excluded);
147
148
  var notificationPanelRef = useRef(null);
148
149
  var notificationPanelInnerRef = useRef(null);
@@ -167,6 +168,10 @@ var NotificationsPanel = /*#__PURE__*/React__default.forwardRef(function (_ref,
167
168
  }, [data]);
168
169
  useClickOutside(ref || notificationPanelRef, function () {
169
170
  onClickOutside();
171
+ setTimeout(function () {
172
+ var _triggerButtonRef$cur;
173
+ triggerButtonRef === null || triggerButtonRef === void 0 || (_triggerButtonRef$cur = triggerButtonRef.current) === null || _triggerButtonRef$cur === void 0 || _triggerButtonRef$cur.focus();
174
+ }, 0);
170
175
  });
171
176
  useEffect(function () {
172
177
  // initialize the notification panel to open
@@ -220,6 +225,10 @@ var NotificationsPanel = /*#__PURE__*/React__default.forwardRef(function (_ref,
220
225
  event.stopPropagation();
221
226
  if (event.key === 'Escape') {
222
227
  onClickOutside();
228
+ setTimeout(function () {
229
+ var _triggerButtonRef$cur2;
230
+ triggerButtonRef === null || triggerButtonRef === void 0 || (_triggerButtonRef$cur2 = triggerButtonRef.current) === null || _triggerButtonRef$cur2 === void 0 || _triggerButtonRef$cur2.focus();
231
+ }, 0);
223
232
  }
224
233
  };
225
234
  useEffect(function () {
@@ -595,6 +604,10 @@ NotificationsPanel.propTypes = {
595
604
  * Sets the today label text
596
605
  */
597
606
  todayLabel: PropTypes.string,
607
+ /**
608
+ * Sets the today label text
609
+ */
610
+ triggerButtonRef: PropTypes.any,
598
611
  /**
599
612
  * Sets the View all button text
600
613
  */
@@ -6,7 +6,7 @@
6
6
  */
7
7
  /// <reference path="../../../src/custom-typings/index.d.ts" />
8
8
  import { Link } from '@carbon/react';
9
- import React from 'react';
9
+ import React, { RefObject } from 'react';
10
10
  interface Link {
11
11
  url: string;
12
12
  text: string;
@@ -138,6 +138,10 @@ export interface NotificationsPanelProps {
138
138
  * Sets the today label text
139
139
  */
140
140
  todayLabel?: string;
141
+ /**
142
+ * Reference to trigger button
143
+ */
144
+ triggerButtonRef?: RefObject<any>;
141
145
  /**
142
146
  * Sets the View all button text
143
147
  */
@@ -31,7 +31,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
31
31
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
32
32
 
33
33
  var _Close;
34
- var _excluded = ["className", "data", "daysAgoText", "dismissAllLabel", "dismissSingleNotificationIconDescription", "doNotDisturbDefaultToggled", "doNotDisturbLabel", "emptyStateLabel", "hourAgoText", "hoursAgoText", "minuteAgoText", "minutesAgoText", "monthAgoText", "monthsAgoText", "nowText", "onClickOutside", "onDismissAllNotifications", "onDismissSingleNotification", "onDoNotDisturbChange", "onSettingsClick", "onViewAllClick", "open", "previousLabel", "readLessLabel", "readMoreLabel", "secondsAgoText", "settingsIconDescription", "title", "todayLabel", "viewAllLabel", "yearAgoText", "yearsAgoText", "yesterdayAtText", "yesterdayLabel", "selectorsFloatingMenus"];
34
+ var _excluded = ["className", "data", "daysAgoText", "dismissAllLabel", "dismissSingleNotificationIconDescription", "doNotDisturbDefaultToggled", "doNotDisturbLabel", "emptyStateLabel", "hourAgoText", "hoursAgoText", "minuteAgoText", "minutesAgoText", "monthAgoText", "monthsAgoText", "nowText", "onClickOutside", "onDismissAllNotifications", "onDismissSingleNotification", "onDoNotDisturbChange", "onSettingsClick", "onViewAllClick", "open", "previousLabel", "readLessLabel", "readMoreLabel", "secondsAgoText", "settingsIconDescription", "title", "todayLabel", "viewAllLabel", "yearAgoText", "yearsAgoText", "yesterdayAtText", "yesterdayLabel", "selectorsFloatingMenus", "triggerButtonRef"];
35
35
 
36
36
  // The block part of our conventional BEM class names (blockClass__E--M).
37
37
  var componentName = 'NotificationsPanel';
@@ -152,6 +152,7 @@ exports.NotificationsPanel = /*#__PURE__*/React__default["default"].forwardRef(f
152
152
  _ref$yesterdayLabel = _ref.yesterdayLabel,
153
153
  yesterdayLabel = _ref$yesterdayLabel === void 0 ? defaults.yesterdayLabel : _ref$yesterdayLabel,
154
154
  selectorsFloatingMenus = _ref.selectorsFloatingMenus,
155
+ triggerButtonRef = _ref.triggerButtonRef,
155
156
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
156
157
  var notificationPanelRef = React.useRef(null);
157
158
  var notificationPanelInnerRef = React.useRef(null);
@@ -176,6 +177,10 @@ exports.NotificationsPanel = /*#__PURE__*/React__default["default"].forwardRef(f
176
177
  }, [data]);
177
178
  useClickOutside.useClickOutside(ref || notificationPanelRef, function () {
178
179
  onClickOutside();
180
+ setTimeout(function () {
181
+ var _triggerButtonRef$cur;
182
+ triggerButtonRef === null || triggerButtonRef === void 0 || (_triggerButtonRef$cur = triggerButtonRef.current) === null || _triggerButtonRef$cur === void 0 || _triggerButtonRef$cur.focus();
183
+ }, 0);
179
184
  });
180
185
  React.useEffect(function () {
181
186
  // initialize the notification panel to open
@@ -229,6 +234,10 @@ exports.NotificationsPanel = /*#__PURE__*/React__default["default"].forwardRef(f
229
234
  event.stopPropagation();
230
235
  if (event.key === 'Escape') {
231
236
  onClickOutside();
237
+ setTimeout(function () {
238
+ var _triggerButtonRef$cur2;
239
+ triggerButtonRef === null || triggerButtonRef === void 0 || (_triggerButtonRef$cur2 = triggerButtonRef.current) === null || _triggerButtonRef$cur2 === void 0 || _triggerButtonRef$cur2.focus();
240
+ }, 0);
232
241
  }
233
242
  };
234
243
  React.useEffect(function () {
@@ -604,6 +613,10 @@ exports.NotificationsPanel.propTypes = {
604
613
  * Sets the today label text
605
614
  */
606
615
  todayLabel: index["default"].string,
616
+ /**
617
+ * Sets the today label text
618
+ */
619
+ triggerButtonRef: index["default"].any,
607
620
  /**
608
621
  * Sets the View all button text
609
622
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/ibm-products",
3
3
  "description": "Carbon for IBM Products",
4
- "version": "2.43.2-canary.249+189f45221",
4
+ "version": "2.43.2-canary.251+6dd626ac4",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -120,5 +120,5 @@
120
120
  "react": "^16.8.6 || ^17.0.1 || ^18.2.0",
121
121
  "react-dom": "^16.8.6 || ^17.0.1 || ^18.2.0"
122
122
  },
123
- "gitHead": "189f4522187981788b0eb431b89f8b6e89eecd47"
123
+ "gitHead": "6dd626ac445a255ca9e7c64eb851c11dbb0117f7"
124
124
  }