@carbon/react 1.67.0-rc.0 → 1.67.1
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/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +948 -948
- package/es/components/Menu/Menu.js +1 -1
- package/es/components/Notification/Notification.d.ts +14 -9
- package/es/components/Notification/Notification.js +26 -7
- package/es/components/Notification/index.d.ts +1 -1
- package/es/components/Popover/index.js +1 -1
- package/es/components/Toggletip/index.d.ts +2 -15
- package/es/components/Toggletip/index.js +6 -3
- package/es/index.js +1 -1
- package/lib/components/Menu/Menu.js +1 -1
- package/lib/components/Notification/Notification.d.ts +14 -9
- package/lib/components/Notification/Notification.js +26 -6
- package/lib/components/Notification/index.d.ts +1 -1
- package/lib/components/Popover/index.js +1 -1
- package/lib/components/Toggletip/index.d.ts +2 -15
- package/lib/components/Toggletip/index.js +6 -3
- package/lib/index.js +1 -0
- package/package.json +8 -8
|
@@ -133,7 +133,6 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(_ref, forwardRef) {
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
function focusItem(e) {
|
|
136
|
-
e?.preventDefault();
|
|
137
136
|
const currentItem = focusableItems.findIndex(item => item.ref?.current?.contains(document.activeElement));
|
|
138
137
|
let indexToFocus = currentItem;
|
|
139
138
|
|
|
@@ -158,6 +157,7 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(_ref, forwardRef) {
|
|
|
158
157
|
if (indexToFocus !== currentItem) {
|
|
159
158
|
const nodeToFocus = focusableItems[indexToFocus];
|
|
160
159
|
nodeToFocus.ref?.current?.focus();
|
|
160
|
+
e?.preventDefault();
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
function handleBlur(e) {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import { type ReactNode, type MouseEvent, type ComponentType, type FunctionComponent, type ButtonHTMLAttributes, type HTMLAttributes } from 'react';
|
|
8
|
+
import React, { type ReactNode, type MouseEvent, type ComponentType, type FunctionComponent, type ButtonHTMLAttributes, type HTMLAttributes } from 'react';
|
|
9
9
|
import { type ButtonProps } from '../Button';
|
|
10
10
|
export interface NotificationActionButtonProps extends ButtonProps<'button'> {
|
|
11
11
|
/**
|
|
@@ -389,7 +389,7 @@ export interface ActionableNotificationProps extends HTMLAttributes<HTMLDivEleme
|
|
|
389
389
|
closeOnEscape?: boolean;
|
|
390
390
|
/**
|
|
391
391
|
* @deprecated This prop will be removed in the next major version, v12.
|
|
392
|
-
* Specify if focus should be moved to the component on render. To meet the spec for alertdialog, this must always be true. If you're setting this to false, explore using
|
|
392
|
+
* Specify if focus should be moved to the component on render. To meet the spec for alertdialog, this must always be true. If you're setting this to false, explore using Callout instead. https://github.com/carbon-design-system/carbon/pull/15532
|
|
393
393
|
*/
|
|
394
394
|
hasFocus?: boolean;
|
|
395
395
|
/**
|
|
@@ -465,7 +465,6 @@ export declare namespace ActionableNotification {
|
|
|
465
465
|
*/
|
|
466
466
|
closeOnEscape: PropTypes.Requireable<boolean>;
|
|
467
467
|
/**
|
|
468
|
-
* Deprecated, please use StaticNotification once it's available. Issue #15532
|
|
469
468
|
* Specify if focus should be moved to the component when the notification contains actions
|
|
470
469
|
*/
|
|
471
470
|
hasFocus: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
|
|
@@ -514,10 +513,10 @@ export declare namespace ActionableNotification {
|
|
|
514
513
|
};
|
|
515
514
|
}
|
|
516
515
|
/**
|
|
517
|
-
*
|
|
516
|
+
* Callout
|
|
518
517
|
* ==================
|
|
519
518
|
*/
|
|
520
|
-
export interface
|
|
519
|
+
export interface CalloutProps extends HTMLAttributes<HTMLDivElement> {
|
|
521
520
|
/**
|
|
522
521
|
* Pass in the action button label that will be rendered within the ActionableNotification.
|
|
523
522
|
*/
|
|
@@ -535,7 +534,7 @@ export interface StaticNotificationProps extends HTMLAttributes<HTMLDivElement>
|
|
|
535
534
|
*/
|
|
536
535
|
kind?: 'error' | 'info' | 'info-square' | 'success' | 'warning' | 'warning-alt';
|
|
537
536
|
/**
|
|
538
|
-
* Specify whether you are using the low contrast variant of the
|
|
537
|
+
* Specify whether you are using the low contrast variant of the Callout.
|
|
539
538
|
*/
|
|
540
539
|
lowContrast?: boolean;
|
|
541
540
|
/**
|
|
@@ -559,8 +558,8 @@ export interface StaticNotificationProps extends HTMLAttributes<HTMLDivElement>
|
|
|
559
558
|
*/
|
|
560
559
|
titleId?: string;
|
|
561
560
|
}
|
|
562
|
-
export declare function
|
|
563
|
-
export declare namespace
|
|
561
|
+
export declare function Callout({ actionButtonLabel, children, onActionButtonClick, title, titleId, subtitle, statusIconDescription, className, kind, lowContrast, ...rest }: CalloutProps): import("react/jsx-runtime").JSX.Element;
|
|
562
|
+
export declare namespace Callout {
|
|
564
563
|
var propTypes: {
|
|
565
564
|
/**
|
|
566
565
|
* Pass in the action button label that will be rendered within the ActionableNotification.
|
|
@@ -579,7 +578,7 @@ export declare namespace StaticNotification {
|
|
|
579
578
|
*/
|
|
580
579
|
kind: PropTypes.Requireable<string>;
|
|
581
580
|
/**
|
|
582
|
-
* Specify whether you are using the low contrast variant of the
|
|
581
|
+
* Specify whether you are using the low contrast variant of the Callout.
|
|
583
582
|
*/
|
|
584
583
|
lowContrast: PropTypes.Requireable<boolean>;
|
|
585
584
|
/**
|
|
@@ -604,3 +603,9 @@ export declare namespace StaticNotification {
|
|
|
604
603
|
titleId: PropTypes.Requireable<string>;
|
|
605
604
|
};
|
|
606
605
|
}
|
|
606
|
+
/**
|
|
607
|
+
* @deprecated Use `CalloutProps` instead.
|
|
608
|
+
*/
|
|
609
|
+
export interface StaticNotificationProps extends CalloutProps {
|
|
610
|
+
}
|
|
611
|
+
export declare const StaticNotification: React.FC<StaticNotificationProps>;
|
|
@@ -21,6 +21,7 @@ import { useId } from '../../internal/useId.js';
|
|
|
21
21
|
import { noopFn } from '../../internal/noopFn.js';
|
|
22
22
|
import wrapFocus, { wrapFocusWithoutSentinels } from '../../internal/wrapFocus.js';
|
|
23
23
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
24
|
+
import { warning } from '../../internal/warning.js';
|
|
24
25
|
import { Text } from '../Text/Text.js';
|
|
25
26
|
import { match, matches } from '../../internal/keyboard/match.js';
|
|
26
27
|
import { Tab, Escape } from '../../internal/keyboard/keys.js';
|
|
@@ -641,10 +642,9 @@ ActionableNotification.propTypes = {
|
|
|
641
642
|
*/
|
|
642
643
|
closeOnEscape: PropTypes.bool,
|
|
643
644
|
/**
|
|
644
|
-
* Deprecated, please use StaticNotification once it's available. Issue #15532
|
|
645
645
|
* Specify if focus should be moved to the component when the notification contains actions
|
|
646
646
|
*/
|
|
647
|
-
hasFocus: deprecate(PropTypes.bool),
|
|
647
|
+
hasFocus: deprecate(PropTypes.bool, 'hasFocus is deprecated. To conform to accessibility requirements hasFocus ' + 'should always be `true` for ActionableNotification. If you were ' + 'setting this prop to `false`, consider using the Callout component instead.'),
|
|
648
648
|
/**
|
|
649
649
|
* Specify the close button should be disabled, or not
|
|
650
650
|
*/
|
|
@@ -693,11 +693,11 @@ ActionableNotification.propTypes = {
|
|
|
693
693
|
};
|
|
694
694
|
|
|
695
695
|
/**
|
|
696
|
-
*
|
|
696
|
+
* Callout
|
|
697
697
|
* ==================
|
|
698
698
|
*/
|
|
699
699
|
|
|
700
|
-
function
|
|
700
|
+
function Callout(_ref8) {
|
|
701
701
|
let {
|
|
702
702
|
actionButtonLabel,
|
|
703
703
|
children,
|
|
@@ -747,7 +747,7 @@ function StaticNotification(_ref8) {
|
|
|
747
747
|
inline: true
|
|
748
748
|
}, actionButtonLabel)));
|
|
749
749
|
}
|
|
750
|
-
|
|
750
|
+
Callout.propTypes = {
|
|
751
751
|
/**
|
|
752
752
|
* Pass in the action button label that will be rendered within the ActionableNotification.
|
|
753
753
|
*/
|
|
@@ -765,7 +765,7 @@ StaticNotification.propTypes = {
|
|
|
765
765
|
*/
|
|
766
766
|
kind: PropTypes.oneOf(['error', 'info', 'info-square', 'success', 'warning', 'warning-alt']),
|
|
767
767
|
/**
|
|
768
|
-
* Specify whether you are using the low contrast variant of the
|
|
768
|
+
* Specify whether you are using the low contrast variant of the Callout.
|
|
769
769
|
*/
|
|
770
770
|
lowContrast: PropTypes.bool,
|
|
771
771
|
/**
|
|
@@ -790,4 +790,23 @@ StaticNotification.propTypes = {
|
|
|
790
790
|
titleId: PropTypes.string
|
|
791
791
|
};
|
|
792
792
|
|
|
793
|
-
|
|
793
|
+
// In renaming StaticNotification to Callout, the legacy StaticNotification
|
|
794
|
+
// export and it's types should remain usable until Callout is moved to stable.
|
|
795
|
+
// The StaticNotification component below forwards props to Callout and inherits
|
|
796
|
+
// CalloutProps to ensure consumer usage is not impacted, while providing them
|
|
797
|
+
// a deprecation warning.
|
|
798
|
+
// TODO: remove this when Callout moves to stable OR in v12, whichever is first
|
|
799
|
+
/**
|
|
800
|
+
* @deprecated Use `CalloutProps` instead.
|
|
801
|
+
*/
|
|
802
|
+
|
|
803
|
+
let didWarnAboutDeprecation = false;
|
|
804
|
+
const StaticNotification = props => {
|
|
805
|
+
if (process.env.NODE_ENV !== "production") {
|
|
806
|
+
process.env.NODE_ENV !== "production" ? warning(didWarnAboutDeprecation, '`StaticNotification` has been renamed to `Callout`.' + 'Run the following codemod to automatically update usages in your' + 'project: `npx @carbon/upgrade migrate refactor-to-callout --write`') : void 0;
|
|
807
|
+
didWarnAboutDeprecation = true;
|
|
808
|
+
}
|
|
809
|
+
return /*#__PURE__*/React__default.createElement(Callout, props);
|
|
810
|
+
};
|
|
811
|
+
|
|
812
|
+
export { ActionableNotification, Callout, InlineNotification, NotificationActionButton, NotificationButton, StaticNotification, ToastNotification };
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
export { NotificationActionButton, type NotificationActionButtonProps, NotificationButton, type NotificationButtonProps, ToastNotification, type ToastNotificationProps, InlineNotification, type InlineNotificationProps, ActionableNotification, type ActionableNotificationProps, StaticNotification, type StaticNotificationProps, } from './Notification';
|
|
7
|
+
export { NotificationActionButton, type NotificationActionButtonProps, NotificationButton, type NotificationButtonProps, ToastNotification, type ToastNotificationProps, InlineNotification, type InlineNotificationProps, ActionableNotification, type ActionableNotificationProps, StaticNotification, type StaticNotificationProps, Callout, type CalloutProps, } from './Notification';
|
|
@@ -206,7 +206,7 @@ const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFun
|
|
|
206
206
|
*/
|
|
207
207
|
const isTriggerElement = item?.type === 'button';
|
|
208
208
|
const isTriggerComponent = autoAlign && displayName && ['ToggletipButton'].includes(displayName);
|
|
209
|
-
const isAllowedTriggerComponent = autoAlign &&
|
|
209
|
+
const isAllowedTriggerComponent = autoAlign && !['ToggletipContent', 'PopoverContent'].includes(displayName);
|
|
210
210
|
if ( /*#__PURE__*/React__default.isValidElement(item) && (isTriggerElement || isTriggerComponent || isAllowedTriggerComponent)) {
|
|
211
211
|
const className = item?.props?.className;
|
|
212
212
|
const ref = (item?.props).ref;
|
|
@@ -99,20 +99,8 @@ interface ToggletipContentProps {
|
|
|
99
99
|
* `children` passed in as a prop inside of `PopoverContent` so that they will
|
|
100
100
|
* be rendered inside of the popover for this component.
|
|
101
101
|
*/
|
|
102
|
-
|
|
103
|
-
export
|
|
104
|
-
var propTypes: {
|
|
105
|
-
/**
|
|
106
|
-
* Custom children to be rendered as the content of the label
|
|
107
|
-
*/
|
|
108
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
109
|
-
/**
|
|
110
|
-
* Provide a custom class name to be added to the outermost node in the
|
|
111
|
-
* component
|
|
112
|
-
*/
|
|
113
|
-
className: PropTypes.Requireable<string>;
|
|
114
|
-
};
|
|
115
|
-
}
|
|
102
|
+
declare const ToggletipContent: React.ForwardRefExoticComponent<ToggletipContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
103
|
+
export { ToggletipContent };
|
|
116
104
|
interface ToggleTipActionsProps {
|
|
117
105
|
children?: ReactNode;
|
|
118
106
|
className?: string | undefined;
|
|
@@ -135,4 +123,3 @@ export declare namespace ToggletipActions {
|
|
|
135
123
|
className: PropTypes.Requireable<string>;
|
|
136
124
|
};
|
|
137
125
|
}
|
|
138
|
-
export {};
|
|
@@ -245,7 +245,7 @@ ToggletipButton.displayName = 'ToggletipButton';
|
|
|
245
245
|
* `children` passed in as a prop inside of `PopoverContent` so that they will
|
|
246
246
|
* be rendered inside of the popover for this component.
|
|
247
247
|
*/
|
|
248
|
-
function ToggletipContent(_ref4) {
|
|
248
|
+
const ToggletipContent = /*#__PURE__*/React__default.forwardRef(function ToggletipContent(_ref4, ref) {
|
|
249
249
|
let {
|
|
250
250
|
children,
|
|
251
251
|
className: customClassName
|
|
@@ -254,10 +254,12 @@ function ToggletipContent(_ref4) {
|
|
|
254
254
|
const prefix = usePrefix();
|
|
255
255
|
return /*#__PURE__*/React__default.createElement(PopoverContent, _extends({
|
|
256
256
|
className: customClassName
|
|
257
|
-
}, toggletip?.contentProps
|
|
257
|
+
}, toggletip?.contentProps, {
|
|
258
|
+
ref: ref
|
|
259
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
258
260
|
className: `${prefix}--toggletip-content`
|
|
259
261
|
}, children));
|
|
260
|
-
}
|
|
262
|
+
});
|
|
261
263
|
ToggletipContent.propTypes = {
|
|
262
264
|
/**
|
|
263
265
|
* Custom children to be rendered as the content of the label
|
|
@@ -269,6 +271,7 @@ ToggletipContent.propTypes = {
|
|
|
269
271
|
*/
|
|
270
272
|
className: PropTypes.string
|
|
271
273
|
};
|
|
274
|
+
ToggletipContent.displayName = 'ToggletipContent';
|
|
272
275
|
/**
|
|
273
276
|
* `ToggletipActions` is a container for one or two actions present at the base
|
|
274
277
|
* of a toggletip. It is used for layout of these items.
|
package/es/index.js
CHANGED
|
@@ -71,7 +71,7 @@ export { MenuButton } from './components/MenuButton/index.js';
|
|
|
71
71
|
export { default as Modal } from './components/Modal/Modal.js';
|
|
72
72
|
export { default as ModalWrapper } from './components/ModalWrapper/ModalWrapper.js';
|
|
73
73
|
import './components/MultiSelect/index.js';
|
|
74
|
-
export { ActionableNotification, InlineNotification, NotificationActionButton, NotificationButton, StaticNotification, ToastNotification } from './components/Notification/Notification.js';
|
|
74
|
+
export { ActionableNotification, Callout, InlineNotification, NotificationActionButton, NotificationButton, StaticNotification, ToastNotification } from './components/Notification/Notification.js';
|
|
75
75
|
export { default as NumberInputSkeleton } from './components/NumberInput/NumberInput.Skeleton.js';
|
|
76
76
|
export { NumberInput } from './components/NumberInput/NumberInput.js';
|
|
77
77
|
export { default as OrderedList } from './components/OrderedList/OrderedList.js';
|
|
@@ -143,7 +143,6 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(_ref, forwardRef) {
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
function focusItem(e) {
|
|
146
|
-
e?.preventDefault();
|
|
147
146
|
const currentItem = focusableItems.findIndex(item => item.ref?.current?.contains(document.activeElement));
|
|
148
147
|
let indexToFocus = currentItem;
|
|
149
148
|
|
|
@@ -168,6 +167,7 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(_ref, forwardRef) {
|
|
|
168
167
|
if (indexToFocus !== currentItem) {
|
|
169
168
|
const nodeToFocus = focusableItems[indexToFocus];
|
|
170
169
|
nodeToFocus.ref?.current?.focus();
|
|
170
|
+
e?.preventDefault();
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
function handleBlur(e) {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import { type ReactNode, type MouseEvent, type ComponentType, type FunctionComponent, type ButtonHTMLAttributes, type HTMLAttributes } from 'react';
|
|
8
|
+
import React, { type ReactNode, type MouseEvent, type ComponentType, type FunctionComponent, type ButtonHTMLAttributes, type HTMLAttributes } from 'react';
|
|
9
9
|
import { type ButtonProps } from '../Button';
|
|
10
10
|
export interface NotificationActionButtonProps extends ButtonProps<'button'> {
|
|
11
11
|
/**
|
|
@@ -389,7 +389,7 @@ export interface ActionableNotificationProps extends HTMLAttributes<HTMLDivEleme
|
|
|
389
389
|
closeOnEscape?: boolean;
|
|
390
390
|
/**
|
|
391
391
|
* @deprecated This prop will be removed in the next major version, v12.
|
|
392
|
-
* Specify if focus should be moved to the component on render. To meet the spec for alertdialog, this must always be true. If you're setting this to false, explore using
|
|
392
|
+
* Specify if focus should be moved to the component on render. To meet the spec for alertdialog, this must always be true. If you're setting this to false, explore using Callout instead. https://github.com/carbon-design-system/carbon/pull/15532
|
|
393
393
|
*/
|
|
394
394
|
hasFocus?: boolean;
|
|
395
395
|
/**
|
|
@@ -465,7 +465,6 @@ export declare namespace ActionableNotification {
|
|
|
465
465
|
*/
|
|
466
466
|
closeOnEscape: PropTypes.Requireable<boolean>;
|
|
467
467
|
/**
|
|
468
|
-
* Deprecated, please use StaticNotification once it's available. Issue #15532
|
|
469
468
|
* Specify if focus should be moved to the component when the notification contains actions
|
|
470
469
|
*/
|
|
471
470
|
hasFocus: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
|
|
@@ -514,10 +513,10 @@ export declare namespace ActionableNotification {
|
|
|
514
513
|
};
|
|
515
514
|
}
|
|
516
515
|
/**
|
|
517
|
-
*
|
|
516
|
+
* Callout
|
|
518
517
|
* ==================
|
|
519
518
|
*/
|
|
520
|
-
export interface
|
|
519
|
+
export interface CalloutProps extends HTMLAttributes<HTMLDivElement> {
|
|
521
520
|
/**
|
|
522
521
|
* Pass in the action button label that will be rendered within the ActionableNotification.
|
|
523
522
|
*/
|
|
@@ -535,7 +534,7 @@ export interface StaticNotificationProps extends HTMLAttributes<HTMLDivElement>
|
|
|
535
534
|
*/
|
|
536
535
|
kind?: 'error' | 'info' | 'info-square' | 'success' | 'warning' | 'warning-alt';
|
|
537
536
|
/**
|
|
538
|
-
* Specify whether you are using the low contrast variant of the
|
|
537
|
+
* Specify whether you are using the low contrast variant of the Callout.
|
|
539
538
|
*/
|
|
540
539
|
lowContrast?: boolean;
|
|
541
540
|
/**
|
|
@@ -559,8 +558,8 @@ export interface StaticNotificationProps extends HTMLAttributes<HTMLDivElement>
|
|
|
559
558
|
*/
|
|
560
559
|
titleId?: string;
|
|
561
560
|
}
|
|
562
|
-
export declare function
|
|
563
|
-
export declare namespace
|
|
561
|
+
export declare function Callout({ actionButtonLabel, children, onActionButtonClick, title, titleId, subtitle, statusIconDescription, className, kind, lowContrast, ...rest }: CalloutProps): import("react/jsx-runtime").JSX.Element;
|
|
562
|
+
export declare namespace Callout {
|
|
564
563
|
var propTypes: {
|
|
565
564
|
/**
|
|
566
565
|
* Pass in the action button label that will be rendered within the ActionableNotification.
|
|
@@ -579,7 +578,7 @@ export declare namespace StaticNotification {
|
|
|
579
578
|
*/
|
|
580
579
|
kind: PropTypes.Requireable<string>;
|
|
581
580
|
/**
|
|
582
|
-
* Specify whether you are using the low contrast variant of the
|
|
581
|
+
* Specify whether you are using the low contrast variant of the Callout.
|
|
583
582
|
*/
|
|
584
583
|
lowContrast: PropTypes.Requireable<boolean>;
|
|
585
584
|
/**
|
|
@@ -604,3 +603,9 @@ export declare namespace StaticNotification {
|
|
|
604
603
|
titleId: PropTypes.Requireable<string>;
|
|
605
604
|
};
|
|
606
605
|
}
|
|
606
|
+
/**
|
|
607
|
+
* @deprecated Use `CalloutProps` instead.
|
|
608
|
+
*/
|
|
609
|
+
export interface StaticNotificationProps extends CalloutProps {
|
|
610
|
+
}
|
|
611
|
+
export declare const StaticNotification: React.FC<StaticNotificationProps>;
|
|
@@ -25,6 +25,7 @@ var useId = require('../../internal/useId.js');
|
|
|
25
25
|
var noopFn = require('../../internal/noopFn.js');
|
|
26
26
|
var wrapFocus = require('../../internal/wrapFocus.js');
|
|
27
27
|
var index = require('../FeatureFlags/index.js');
|
|
28
|
+
var warning = require('../../internal/warning.js');
|
|
28
29
|
var Text = require('../Text/Text.js');
|
|
29
30
|
var match = require('../../internal/keyboard/match.js');
|
|
30
31
|
var keys = require('../../internal/keyboard/keys.js');
|
|
@@ -651,10 +652,9 @@ ActionableNotification.propTypes = {
|
|
|
651
652
|
*/
|
|
652
653
|
closeOnEscape: PropTypes__default["default"].bool,
|
|
653
654
|
/**
|
|
654
|
-
* Deprecated, please use StaticNotification once it's available. Issue #15532
|
|
655
655
|
* Specify if focus should be moved to the component when the notification contains actions
|
|
656
656
|
*/
|
|
657
|
-
hasFocus: deprecate["default"](PropTypes__default["default"].bool),
|
|
657
|
+
hasFocus: deprecate["default"](PropTypes__default["default"].bool, 'hasFocus is deprecated. To conform to accessibility requirements hasFocus ' + 'should always be `true` for ActionableNotification. If you were ' + 'setting this prop to `false`, consider using the Callout component instead.'),
|
|
658
658
|
/**
|
|
659
659
|
* Specify the close button should be disabled, or not
|
|
660
660
|
*/
|
|
@@ -703,11 +703,11 @@ ActionableNotification.propTypes = {
|
|
|
703
703
|
};
|
|
704
704
|
|
|
705
705
|
/**
|
|
706
|
-
*
|
|
706
|
+
* Callout
|
|
707
707
|
* ==================
|
|
708
708
|
*/
|
|
709
709
|
|
|
710
|
-
function
|
|
710
|
+
function Callout(_ref8) {
|
|
711
711
|
let {
|
|
712
712
|
actionButtonLabel,
|
|
713
713
|
children,
|
|
@@ -757,7 +757,7 @@ function StaticNotification(_ref8) {
|
|
|
757
757
|
inline: true
|
|
758
758
|
}, actionButtonLabel)));
|
|
759
759
|
}
|
|
760
|
-
|
|
760
|
+
Callout.propTypes = {
|
|
761
761
|
/**
|
|
762
762
|
* Pass in the action button label that will be rendered within the ActionableNotification.
|
|
763
763
|
*/
|
|
@@ -775,7 +775,7 @@ StaticNotification.propTypes = {
|
|
|
775
775
|
*/
|
|
776
776
|
kind: PropTypes__default["default"].oneOf(['error', 'info', 'info-square', 'success', 'warning', 'warning-alt']),
|
|
777
777
|
/**
|
|
778
|
-
* Specify whether you are using the low contrast variant of the
|
|
778
|
+
* Specify whether you are using the low contrast variant of the Callout.
|
|
779
779
|
*/
|
|
780
780
|
lowContrast: PropTypes__default["default"].bool,
|
|
781
781
|
/**
|
|
@@ -800,7 +800,27 @@ StaticNotification.propTypes = {
|
|
|
800
800
|
titleId: PropTypes__default["default"].string
|
|
801
801
|
};
|
|
802
802
|
|
|
803
|
+
// In renaming StaticNotification to Callout, the legacy StaticNotification
|
|
804
|
+
// export and it's types should remain usable until Callout is moved to stable.
|
|
805
|
+
// The StaticNotification component below forwards props to Callout and inherits
|
|
806
|
+
// CalloutProps to ensure consumer usage is not impacted, while providing them
|
|
807
|
+
// a deprecation warning.
|
|
808
|
+
// TODO: remove this when Callout moves to stable OR in v12, whichever is first
|
|
809
|
+
/**
|
|
810
|
+
* @deprecated Use `CalloutProps` instead.
|
|
811
|
+
*/
|
|
812
|
+
|
|
813
|
+
let didWarnAboutDeprecation = false;
|
|
814
|
+
const StaticNotification = props => {
|
|
815
|
+
if (process.env.NODE_ENV !== "production") {
|
|
816
|
+
process.env.NODE_ENV !== "production" ? warning.warning(didWarnAboutDeprecation, '`StaticNotification` has been renamed to `Callout`.' + 'Run the following codemod to automatically update usages in your' + 'project: `npx @carbon/upgrade migrate refactor-to-callout --write`') : void 0;
|
|
817
|
+
didWarnAboutDeprecation = true;
|
|
818
|
+
}
|
|
819
|
+
return /*#__PURE__*/React__default["default"].createElement(Callout, props);
|
|
820
|
+
};
|
|
821
|
+
|
|
803
822
|
exports.ActionableNotification = ActionableNotification;
|
|
823
|
+
exports.Callout = Callout;
|
|
804
824
|
exports.InlineNotification = InlineNotification;
|
|
805
825
|
exports.NotificationActionButton = NotificationActionButton;
|
|
806
826
|
exports.NotificationButton = NotificationButton;
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
export { NotificationActionButton, type NotificationActionButtonProps, NotificationButton, type NotificationButtonProps, ToastNotification, type ToastNotificationProps, InlineNotification, type InlineNotificationProps, ActionableNotification, type ActionableNotificationProps, StaticNotification, type StaticNotificationProps, } from './Notification';
|
|
7
|
+
export { NotificationActionButton, type NotificationActionButtonProps, NotificationButton, type NotificationButtonProps, ToastNotification, type ToastNotificationProps, InlineNotification, type InlineNotificationProps, ActionableNotification, type ActionableNotificationProps, StaticNotification, type StaticNotificationProps, Callout, type CalloutProps, } from './Notification';
|
|
@@ -216,7 +216,7 @@ const Popover = /*#__PURE__*/React__default["default"].forwardRef(function Popov
|
|
|
216
216
|
*/
|
|
217
217
|
const isTriggerElement = item?.type === 'button';
|
|
218
218
|
const isTriggerComponent = autoAlign && displayName && ['ToggletipButton'].includes(displayName);
|
|
219
|
-
const isAllowedTriggerComponent = autoAlign &&
|
|
219
|
+
const isAllowedTriggerComponent = autoAlign && !['ToggletipContent', 'PopoverContent'].includes(displayName);
|
|
220
220
|
if ( /*#__PURE__*/React__default["default"].isValidElement(item) && (isTriggerElement || isTriggerComponent || isAllowedTriggerComponent)) {
|
|
221
221
|
const className = item?.props?.className;
|
|
222
222
|
const ref = (item?.props).ref;
|
|
@@ -99,20 +99,8 @@ interface ToggletipContentProps {
|
|
|
99
99
|
* `children` passed in as a prop inside of `PopoverContent` so that they will
|
|
100
100
|
* be rendered inside of the popover for this component.
|
|
101
101
|
*/
|
|
102
|
-
|
|
103
|
-
export
|
|
104
|
-
var propTypes: {
|
|
105
|
-
/**
|
|
106
|
-
* Custom children to be rendered as the content of the label
|
|
107
|
-
*/
|
|
108
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
109
|
-
/**
|
|
110
|
-
* Provide a custom class name to be added to the outermost node in the
|
|
111
|
-
* component
|
|
112
|
-
*/
|
|
113
|
-
className: PropTypes.Requireable<string>;
|
|
114
|
-
};
|
|
115
|
-
}
|
|
102
|
+
declare const ToggletipContent: React.ForwardRefExoticComponent<ToggletipContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
103
|
+
export { ToggletipContent };
|
|
116
104
|
interface ToggleTipActionsProps {
|
|
117
105
|
children?: ReactNode;
|
|
118
106
|
className?: string | undefined;
|
|
@@ -135,4 +123,3 @@ export declare namespace ToggletipActions {
|
|
|
135
123
|
className: PropTypes.Requireable<string>;
|
|
136
124
|
};
|
|
137
125
|
}
|
|
138
|
-
export {};
|
|
@@ -255,7 +255,7 @@ ToggletipButton.displayName = 'ToggletipButton';
|
|
|
255
255
|
* `children` passed in as a prop inside of `PopoverContent` so that they will
|
|
256
256
|
* be rendered inside of the popover for this component.
|
|
257
257
|
*/
|
|
258
|
-
function ToggletipContent(_ref4) {
|
|
258
|
+
const ToggletipContent = /*#__PURE__*/React__default["default"].forwardRef(function ToggletipContent(_ref4, ref) {
|
|
259
259
|
let {
|
|
260
260
|
children,
|
|
261
261
|
className: customClassName
|
|
@@ -264,10 +264,12 @@ function ToggletipContent(_ref4) {
|
|
|
264
264
|
const prefix = usePrefix.usePrefix();
|
|
265
265
|
return /*#__PURE__*/React__default["default"].createElement(index.PopoverContent, _rollupPluginBabelHelpers["extends"]({
|
|
266
266
|
className: customClassName
|
|
267
|
-
}, toggletip?.contentProps
|
|
267
|
+
}, toggletip?.contentProps, {
|
|
268
|
+
ref: ref
|
|
269
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
268
270
|
className: `${prefix}--toggletip-content`
|
|
269
271
|
}, children));
|
|
270
|
-
}
|
|
272
|
+
});
|
|
271
273
|
ToggletipContent.propTypes = {
|
|
272
274
|
/**
|
|
273
275
|
* Custom children to be rendered as the content of the label
|
|
@@ -279,6 +281,7 @@ ToggletipContent.propTypes = {
|
|
|
279
281
|
*/
|
|
280
282
|
className: PropTypes__default["default"].string
|
|
281
283
|
};
|
|
284
|
+
ToggletipContent.displayName = 'ToggletipContent';
|
|
282
285
|
/**
|
|
283
286
|
* `ToggletipActions` is a container for one or two actions present at the base
|
|
284
287
|
* of a toggletip. It is used for layout of these items.
|
package/lib/index.js
CHANGED
|
@@ -315,6 +315,7 @@ exports.MenuButton = index$8.MenuButton;
|
|
|
315
315
|
exports.Modal = Modal["default"];
|
|
316
316
|
exports.ModalWrapper = ModalWrapper["default"];
|
|
317
317
|
exports.ActionableNotification = Notification.ActionableNotification;
|
|
318
|
+
exports.Callout = Notification.Callout;
|
|
318
319
|
exports.InlineNotification = Notification.InlineNotification;
|
|
319
320
|
exports.NotificationActionButton = Notification.NotificationActionButton;
|
|
320
321
|
exports.NotificationButton = Notification.NotificationButton;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/react",
|
|
3
3
|
"description": "React components for the Carbon Design System",
|
|
4
|
-
"version": "1.67.
|
|
4
|
+
"version": "1.67.1",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "es/index.js",
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@babel/runtime": "^7.24.7",
|
|
51
|
-
"@carbon/feature-flags": "^0.23.
|
|
52
|
-
"@carbon/icons-react": "^11.50.
|
|
53
|
-
"@carbon/layout": "^11.27.
|
|
54
|
-
"@carbon/styles": "^1.66.
|
|
51
|
+
"@carbon/feature-flags": "^0.23.1",
|
|
52
|
+
"@carbon/icons-react": "^11.50.1",
|
|
53
|
+
"@carbon/layout": "^11.27.1",
|
|
54
|
+
"@carbon/styles": "^1.66.1",
|
|
55
55
|
"@floating-ui/react": "^0.26.0",
|
|
56
56
|
"@ibm/telemetry-js": "^1.5.0",
|
|
57
57
|
"classnames": "2.5.1",
|
|
@@ -79,8 +79,8 @@
|
|
|
79
79
|
"@babel/preset-env": "^7.24.7",
|
|
80
80
|
"@babel/preset-react": "^7.24.7",
|
|
81
81
|
"@babel/preset-typescript": "^7.24.7",
|
|
82
|
-
"@carbon/test-utils": "^10.33.
|
|
83
|
-
"@carbon/themes": "^11.41.
|
|
82
|
+
"@carbon/test-utils": "^10.33.1",
|
|
83
|
+
"@carbon/themes": "^11.41.1",
|
|
84
84
|
"@figma/code-connect": "^1.0.6",
|
|
85
85
|
"@rollup/plugin-babel": "^6.0.0",
|
|
86
86
|
"@rollup/plugin-commonjs": "^26.0.0",
|
|
@@ -144,5 +144,5 @@
|
|
|
144
144
|
"**/*.scss",
|
|
145
145
|
"**/*.css"
|
|
146
146
|
],
|
|
147
|
-
"gitHead": "
|
|
147
|
+
"gitHead": "2df4c295d300f96fae292a00b88f07a99e9a80c7"
|
|
148
148
|
}
|