@carbon/react 1.31.2 → 1.32.0-rc.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/README.md +1 -1
- package/es/components/Accordion/Accordion.Skeleton.d.ts +64 -0
- package/es/components/Accordion/Accordion.Skeleton.js +3 -3
- package/es/components/Accordion/Accordion.d.ts +65 -0
- package/es/components/Accordion/Accordion.js +5 -6
- package/es/components/Accordion/AccordionItem.d.ts +105 -0
- package/es/components/Accordion/AccordionItem.js +12 -9
- package/es/components/Accordion/AccordionProvider.d.ts +20 -0
- package/es/components/Accordion/AccordionProvider.js +25 -0
- package/es/components/Accordion/index.d.ts +11 -0
- package/es/components/Button/Button.Skeleton.d.ts +28 -0
- package/es/components/Button/Button.Skeleton.js +5 -3
- package/es/components/Button/Button.d.ts +72 -0
- package/es/components/Button/Button.js +13 -10
- package/es/components/Button/index.d.ts +11 -0
- package/es/components/Button/index.js +2 -1
- package/es/components/ButtonSet/ButtonSet.d.ts +17 -0
- package/es/components/ButtonSet/ButtonSet.js +1 -2
- package/es/components/ButtonSet/index.d.ts +9 -0
- package/es/components/CodeSnippet/CodeSnippet.js +1 -0
- package/es/components/ComboButton/index.js +1 -0
- package/es/components/ComposedModal/ComposedModal.d.ts +70 -0
- package/es/components/ComposedModal/ComposedModal.js +58 -67
- package/es/components/ComposedModal/ModalFooter.d.ts +71 -0
- package/es/components/ComposedModal/ModalFooter.js +22 -19
- package/es/components/ComposedModal/ModalHeader.d.ts +58 -0
- package/es/components/ComposedModal/ModalHeader.js +8 -25
- package/es/components/ComposedModal/index.d.ts +9 -0
- package/es/components/ContainedList/ContainedList.js +12 -1
- package/es/components/ContentSwitcher/ContentSwitcher.d.ts +109 -0
- package/es/components/ContentSwitcher/ContentSwitcher.js +14 -6
- package/es/components/DangerButton/DangerButton.d.ts +9 -0
- package/es/components/DangerButton/DangerButton.js +2 -2
- package/es/components/DangerButton/index.d.ts +9 -0
- package/es/components/DataTable/TableBatchAction.js +1 -0
- package/es/components/DataTable/TableBatchActions.js +1 -0
- package/es/components/DataTable/TableBody.d.ts +29 -0
- package/es/components/DataTable/TableBody.js +2 -3
- package/es/components/DataTable/TableContainer.d.ts +51 -0
- package/es/components/DataTable/TableContainer.js +3 -4
- package/es/components/DataTable/TableExpandHeader.d.ts +86 -0
- package/es/components/DataTable/TableExpandHeader.js +4 -5
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +12 -16
- package/es/components/Dropdown/Dropdown.js +1 -0
- package/es/components/FluidTextInput/FluidTextInput.js +1 -0
- package/es/components/FormGroup/FormGroup.d.ts +80 -0
- package/es/components/IconButton/index.js +3 -2
- package/es/components/Layout/index.d.ts +74 -0
- package/es/components/Layout/index.js +14 -5
- package/es/components/Link/Link.d.ts +2 -2
- package/es/components/Link/Link.js +2 -1
- package/es/components/MenuButton/index.js +1 -0
- package/es/components/Modal/Modal.js +1 -0
- package/es/components/ModalWrapper/ModalWrapper.js +1 -0
- package/es/components/Notification/Notification.d.ts +531 -0
- package/es/components/Notification/Notification.js +40 -6
- package/es/components/Notification/index.d.ts +7 -0
- package/es/components/PrimaryButton/PrimaryButton.js +1 -0
- package/es/components/SecondaryButton/SecondaryButton.js +1 -0
- package/es/components/Select/Select.d.ts +1 -1
- package/es/components/SkeletonText/SkeletonText.d.ts +61 -0
- package/es/components/SkeletonText/SkeletonText.js +15 -17
- package/es/components/SkeletonText/index.d.ts +9 -0
- package/es/components/Switch/Switch.d.ts +56 -0
- package/es/components/Switch/Switch.js +4 -4
- package/es/components/Tab/index.d.ts +9 -0
- package/es/components/TabContent/TabContent.d.ts +40 -0
- package/es/components/TabContent/TabContent.js +6 -12
- package/es/components/TabContent/index.d.ts +10 -0
- package/es/components/Tabs/Tabs.Skeleton.d.ts +33 -0
- package/es/components/Tabs/Tabs.Skeleton.js +2 -2
- package/es/components/Tabs/Tabs.d.ts +303 -0
- package/es/components/Tabs/Tabs.js +136 -95
- package/es/components/Tabs/index.d.ts +10 -0
- package/es/components/Tabs/usePressable.js +11 -0
- package/es/components/TextInput/ControlledPasswordInput.d.ts +90 -0
- package/es/components/TextInput/ControlledPasswordInput.js +5 -6
- package/es/components/Tile/Tile.d.ts +153 -0
- package/es/components/Tile/Tile.js +62 -74
- package/es/components/Tile/index.d.ts +7 -0
- package/es/components/Toggle/Toggle.Skeleton.d.ts +3 -47
- package/es/components/Toggle/Toggle.Skeleton.js +24 -64
- package/es/components/Toggle/Toggle.js +1 -1
- package/es/components/UIShell/HeaderGlobalAction.js +1 -0
- package/es/components/UIShell/SideNav.d.ts +1 -1
- package/es/index.js +16 -16
- package/es/internal/keyboard/match.js +2 -2
- package/es/internal/useControllableState.js +2 -2
- package/es/internal/wrapFocus.js +6 -6
- package/es/prop-types/requiredIfGivenPropIsTruthy.js +1 -1
- package/es/prop-types/types.js +3 -0
- package/lib/components/Accordion/Accordion.Skeleton.d.ts +64 -0
- package/lib/components/Accordion/Accordion.Skeleton.js +3 -3
- package/lib/components/Accordion/Accordion.d.ts +65 -0
- package/lib/components/Accordion/Accordion.js +5 -6
- package/lib/components/Accordion/AccordionItem.d.ts +105 -0
- package/lib/components/Accordion/AccordionItem.js +11 -8
- package/lib/components/Accordion/AccordionProvider.d.ts +20 -0
- package/lib/components/Accordion/AccordionProvider.js +34 -0
- package/lib/components/Accordion/index.d.ts +11 -0
- package/lib/components/Button/Button.Skeleton.d.ts +28 -0
- package/lib/components/Button/Button.Skeleton.js +5 -3
- package/lib/components/Button/Button.d.ts +72 -0
- package/lib/components/Button/Button.js +18 -11
- package/lib/components/Button/index.d.ts +11 -0
- package/lib/components/Button/index.js +6 -0
- package/lib/components/ButtonSet/ButtonSet.d.ts +17 -0
- package/lib/components/ButtonSet/ButtonSet.js +1 -2
- package/lib/components/ButtonSet/index.d.ts +9 -0
- package/lib/components/CodeSnippet/CodeSnippet.js +1 -0
- package/lib/components/ComboButton/index.js +1 -0
- package/lib/components/ComposedModal/ComposedModal.d.ts +70 -0
- package/lib/components/ComposedModal/ComposedModal.js +58 -67
- package/lib/components/ComposedModal/ModalFooter.d.ts +71 -0
- package/lib/components/ComposedModal/ModalFooter.js +22 -19
- package/lib/components/ComposedModal/ModalHeader.d.ts +58 -0
- package/lib/components/ComposedModal/ModalHeader.js +8 -25
- package/lib/components/ComposedModal/index.d.ts +9 -0
- package/lib/components/ContainedList/ContainedList.js +12 -1
- package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +109 -0
- package/lib/components/ContentSwitcher/ContentSwitcher.js +14 -6
- package/lib/components/DangerButton/DangerButton.d.ts +9 -0
- package/lib/components/DangerButton/DangerButton.js +2 -2
- package/lib/components/DangerButton/index.d.ts +9 -0
- package/lib/components/DataTable/TableBatchAction.js +1 -0
- package/lib/components/DataTable/TableBatchActions.js +1 -0
- package/lib/components/DataTable/TableBody.d.ts +29 -0
- package/lib/components/DataTable/TableBody.js +3 -4
- package/lib/components/DataTable/TableContainer.d.ts +51 -0
- package/lib/components/DataTable/TableContainer.js +3 -4
- package/lib/components/DataTable/TableExpandHeader.d.ts +86 -0
- package/lib/components/DataTable/TableExpandHeader.js +4 -5
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +12 -16
- package/lib/components/Dropdown/Dropdown.js +1 -0
- package/lib/components/FluidTextInput/FluidTextInput.js +1 -0
- package/lib/components/FormGroup/FormGroup.d.ts +80 -0
- package/lib/components/IconButton/index.js +3 -2
- package/lib/components/Layout/index.d.ts +74 -0
- package/lib/components/Layout/index.js +14 -5
- package/lib/components/Link/Link.d.ts +2 -2
- package/lib/components/Link/Link.js +2 -1
- package/lib/components/MenuButton/index.js +1 -0
- package/lib/components/Modal/Modal.js +1 -0
- package/lib/components/ModalWrapper/ModalWrapper.js +1 -0
- package/lib/components/Notification/Notification.d.ts +531 -0
- package/lib/components/Notification/Notification.js +40 -6
- package/lib/components/Notification/index.d.ts +7 -0
- package/lib/components/PrimaryButton/PrimaryButton.js +1 -0
- package/lib/components/SecondaryButton/SecondaryButton.js +1 -0
- package/lib/components/Select/Select.d.ts +1 -1
- package/lib/components/SkeletonText/SkeletonText.d.ts +61 -0
- package/lib/components/SkeletonText/SkeletonText.js +15 -17
- package/lib/components/SkeletonText/index.d.ts +9 -0
- package/lib/components/Switch/Switch.d.ts +56 -0
- package/lib/components/Switch/Switch.js +4 -4
- package/lib/components/Tab/index.d.ts +9 -0
- package/lib/components/TabContent/TabContent.d.ts +40 -0
- package/lib/components/TabContent/TabContent.js +6 -12
- package/lib/components/TabContent/index.d.ts +10 -0
- package/lib/components/Tabs/Tabs.Skeleton.d.ts +33 -0
- package/lib/components/Tabs/Tabs.Skeleton.js +2 -2
- package/lib/components/Tabs/Tabs.d.ts +303 -0
- package/lib/components/Tabs/Tabs.js +135 -94
- package/lib/components/Tabs/index.d.ts +10 -0
- package/lib/components/Tabs/usePressable.js +11 -0
- package/lib/components/TextInput/ControlledPasswordInput.d.ts +90 -0
- package/lib/components/TextInput/ControlledPasswordInput.js +5 -6
- package/lib/components/Tile/Tile.d.ts +153 -0
- package/lib/components/Tile/Tile.js +62 -74
- package/lib/components/Tile/index.d.ts +7 -0
- package/lib/components/Toggle/Toggle.Skeleton.d.ts +3 -47
- package/lib/components/Toggle/Toggle.Skeleton.js +22 -62
- package/lib/components/Toggle/Toggle.js +1 -1
- package/lib/components/UIShell/HeaderGlobalAction.js +1 -0
- package/lib/components/UIShell/SideNav.d.ts +1 -1
- package/lib/index.js +51 -47
- package/lib/internal/keyboard/match.js +2 -2
- package/lib/internal/useControllableState.js +2 -2
- package/lib/internal/wrapFocus.js +6 -6
- package/lib/prop-types/requiredIfGivenPropIsTruthy.js +1 -1
- package/lib/prop-types/types.js +3 -0
- package/package.json +4 -3
- package/scss/components/contained-list/_contained-list.scss +9 -0
- package/scss/components/contained-list/_index.scss +9 -0
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { type ReactNode, type MouseEvent, type ComponentType, type FunctionComponent, type ButtonHTMLAttributes, type HTMLAttributes } from 'react';
|
|
9
|
+
import { type ButtonProps } from '../Button';
|
|
10
|
+
export interface NotificationActionButtonProps extends ButtonProps<'button'> {
|
|
11
|
+
/**
|
|
12
|
+
* Specify the content of the notification action button.
|
|
13
|
+
*/
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Specify an optional className to be applied to the notification action button
|
|
17
|
+
*/
|
|
18
|
+
className?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Specify if the visual treatment of the button should be for an inline notification
|
|
21
|
+
*/
|
|
22
|
+
inline?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Optionally specify a click handler for the notification action button.
|
|
25
|
+
*/
|
|
26
|
+
onClick?(): void;
|
|
27
|
+
}
|
|
28
|
+
export declare function NotificationActionButton({ children, className: customClassName, onClick, inline, ...rest }: NotificationActionButtonProps): JSX.Element;
|
|
29
|
+
export declare namespace NotificationActionButton {
|
|
30
|
+
var propTypes: {
|
|
31
|
+
/**
|
|
32
|
+
* Specify the content of the notification action button.
|
|
33
|
+
*/
|
|
34
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
35
|
+
/**
|
|
36
|
+
* Specify an optional className to be applied to the notification action button
|
|
37
|
+
*/
|
|
38
|
+
className: PropTypes.Requireable<string>;
|
|
39
|
+
/**
|
|
40
|
+
* Specify if the visual treatment of the button should be for an inline notification
|
|
41
|
+
*/
|
|
42
|
+
inline: PropTypes.Requireable<boolean>;
|
|
43
|
+
/**
|
|
44
|
+
* Optionally specify a click handler for the notification action button.
|
|
45
|
+
*/
|
|
46
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* NotificationButton
|
|
51
|
+
* ==================
|
|
52
|
+
*/
|
|
53
|
+
export interface NotificationButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
54
|
+
/**
|
|
55
|
+
* Specify an optional icon for the Button through a string,
|
|
56
|
+
* if provided. However, regular "close" icon is preferred.
|
|
57
|
+
*/
|
|
58
|
+
name?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Specify the notification type
|
|
61
|
+
*/
|
|
62
|
+
notificationType?: 'toast' | 'inline' | 'actionable';
|
|
63
|
+
/**
|
|
64
|
+
* Optional prop to allow overriding the icon rendering.
|
|
65
|
+
* Can be a React component class
|
|
66
|
+
*/
|
|
67
|
+
renderIcon?: ComponentType<{
|
|
68
|
+
className?: string;
|
|
69
|
+
name?: string;
|
|
70
|
+
}> | FunctionComponent<{
|
|
71
|
+
className?: string;
|
|
72
|
+
name?: string;
|
|
73
|
+
}>;
|
|
74
|
+
}
|
|
75
|
+
export declare function NotificationButton({ 'aria-label': ariaLabel, ariaLabel: deprecatedAriaLabel, className, type, renderIcon: IconTag, name, notificationType, ...rest }: NotificationButtonProps): JSX.Element;
|
|
76
|
+
export declare namespace NotificationButton {
|
|
77
|
+
var propTypes: {
|
|
78
|
+
/**
|
|
79
|
+
* Specify a label to be read by screen readers on the container node
|
|
80
|
+
*/
|
|
81
|
+
"aria-label": PropTypes.Requireable<string>;
|
|
82
|
+
/**
|
|
83
|
+
* Deprecated, please use `aria-label` instead.
|
|
84
|
+
* Specify a label to be read by screen readers on the container note.
|
|
85
|
+
*/
|
|
86
|
+
ariaLabel: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
|
|
87
|
+
/**
|
|
88
|
+
* Specify an optional className to be applied to the notification button
|
|
89
|
+
*/
|
|
90
|
+
className: PropTypes.Requireable<string>;
|
|
91
|
+
/**
|
|
92
|
+
* Specify an optional icon for the Button through a string,
|
|
93
|
+
* if something but regular "close" icon is desirable
|
|
94
|
+
*/
|
|
95
|
+
name: PropTypes.Requireable<string>;
|
|
96
|
+
/**
|
|
97
|
+
* Specify the notification type
|
|
98
|
+
*/
|
|
99
|
+
notificationType: PropTypes.Requireable<string>;
|
|
100
|
+
/**
|
|
101
|
+
* Optional prop to allow overriding the icon rendering.
|
|
102
|
+
* Can be a React component class
|
|
103
|
+
*/
|
|
104
|
+
renderIcon: PropTypes.Requireable<object>;
|
|
105
|
+
/**
|
|
106
|
+
* Optional prop to specify the type of the Button
|
|
107
|
+
*/
|
|
108
|
+
type: PropTypes.Requireable<string>;
|
|
109
|
+
};
|
|
110
|
+
var defaultProps: {
|
|
111
|
+
"aria-label": string;
|
|
112
|
+
notificationType: string;
|
|
113
|
+
type: string;
|
|
114
|
+
renderIcon: any;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
export interface NotificationIconProps {
|
|
118
|
+
iconDescription: string;
|
|
119
|
+
kind: 'error' | 'success' | 'warning' | 'warning-alt' | 'info' | 'info-square';
|
|
120
|
+
notificationType: 'inline' | 'toast';
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* ToastNotification
|
|
124
|
+
* =================
|
|
125
|
+
*/
|
|
126
|
+
export interface ToastNotificationProps extends HTMLAttributes<HTMLDivElement> {
|
|
127
|
+
/**
|
|
128
|
+
* Provide a description for "close" icon button that can be read by screen readers
|
|
129
|
+
*/
|
|
130
|
+
'aria-label'?: string;
|
|
131
|
+
/**
|
|
132
|
+
* Specify the caption
|
|
133
|
+
*/
|
|
134
|
+
caption?: string;
|
|
135
|
+
/**
|
|
136
|
+
* Specify the content
|
|
137
|
+
*/
|
|
138
|
+
children?: ReactNode;
|
|
139
|
+
/**
|
|
140
|
+
* Specify an optional className to be applied to the notification box
|
|
141
|
+
*/
|
|
142
|
+
className?: string;
|
|
143
|
+
/**
|
|
144
|
+
* Specify the close button should be disabled, or not
|
|
145
|
+
*/
|
|
146
|
+
hideCloseButton?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Specify what state the notification represents
|
|
149
|
+
*/
|
|
150
|
+
kind: 'error' | 'info' | 'info-square' | 'success' | 'warning' | 'warning-alt';
|
|
151
|
+
/**
|
|
152
|
+
* Specify whether you are using the low contrast variant of the ToastNotification.
|
|
153
|
+
*/
|
|
154
|
+
lowContrast?: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Provide a function that is called when menu is closed
|
|
157
|
+
*/
|
|
158
|
+
onClose?(event: MouseEvent): boolean | void;
|
|
159
|
+
/**
|
|
160
|
+
* Provide a function that is called when the close button is clicked
|
|
161
|
+
*/
|
|
162
|
+
onCloseButtonClick(event: MouseEvent): void;
|
|
163
|
+
/**
|
|
164
|
+
* By default, this value is "status". You can also provide an alternate
|
|
165
|
+
* role if it makes sense from the accessibility-side
|
|
166
|
+
*/
|
|
167
|
+
role: 'alert' | 'log' | 'status';
|
|
168
|
+
/**
|
|
169
|
+
* Provide a description for "status" icon that can be read by screen readers
|
|
170
|
+
*/
|
|
171
|
+
statusIconDescription?: string;
|
|
172
|
+
/**
|
|
173
|
+
* Specify the subtitle
|
|
174
|
+
*/
|
|
175
|
+
subtitle?: string;
|
|
176
|
+
/**
|
|
177
|
+
* Specify an optional duration the notification should be closed in
|
|
178
|
+
*/
|
|
179
|
+
timeout?: number;
|
|
180
|
+
/**
|
|
181
|
+
* Specify the title
|
|
182
|
+
*/
|
|
183
|
+
title?: string;
|
|
184
|
+
}
|
|
185
|
+
export declare function ToastNotification({ ['aria-label']: ariaLabel, ariaLabel: deprecatedAriaLabel, role, onClose, onCloseButtonClick, statusIconDescription, className, children, kind, lowContrast, hideCloseButton, timeout, title, caption, subtitle, ...rest }: ToastNotificationProps): JSX.Element | null;
|
|
186
|
+
export declare namespace ToastNotification {
|
|
187
|
+
var propTypes: {
|
|
188
|
+
/**
|
|
189
|
+
* Provide a description for "close" icon button that can be read by screen readers
|
|
190
|
+
*/
|
|
191
|
+
"aria-label": PropTypes.Requireable<string>;
|
|
192
|
+
/**
|
|
193
|
+
* Deprecated, please use `aria-label` instead.
|
|
194
|
+
* Provide a description for "close" icon button that can be read by screen readers
|
|
195
|
+
*/
|
|
196
|
+
ariaLabel: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
|
|
197
|
+
/**
|
|
198
|
+
* Specify the caption
|
|
199
|
+
*/
|
|
200
|
+
caption: PropTypes.Requireable<string>;
|
|
201
|
+
/**
|
|
202
|
+
* Specify the content
|
|
203
|
+
*/
|
|
204
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
205
|
+
/**
|
|
206
|
+
* Specify an optional className to be applied to the notification box
|
|
207
|
+
*/
|
|
208
|
+
className: PropTypes.Requireable<string>;
|
|
209
|
+
/**
|
|
210
|
+
* Specify the close button should be disabled, or not
|
|
211
|
+
*/
|
|
212
|
+
hideCloseButton: PropTypes.Requireable<boolean>;
|
|
213
|
+
/**
|
|
214
|
+
* Specify what state the notification represents
|
|
215
|
+
*/
|
|
216
|
+
kind: PropTypes.Requireable<string>;
|
|
217
|
+
/**
|
|
218
|
+
* Specify whether you are using the low contrast variant of the ToastNotification.
|
|
219
|
+
*/
|
|
220
|
+
lowContrast: PropTypes.Requireable<boolean>;
|
|
221
|
+
/**
|
|
222
|
+
* Provide a function that is called when menu is closed
|
|
223
|
+
*/
|
|
224
|
+
onClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
225
|
+
/**
|
|
226
|
+
* Provide a function that is called when the close button is clicked
|
|
227
|
+
*/
|
|
228
|
+
onCloseButtonClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
229
|
+
/**
|
|
230
|
+
* By default, this value is "status". You can also provide an alternate
|
|
231
|
+
* role if it makes sense from the accessibility-side
|
|
232
|
+
*/
|
|
233
|
+
role: PropTypes.Requireable<string>;
|
|
234
|
+
/**
|
|
235
|
+
* Provide a description for "status" icon that can be read by screen readers
|
|
236
|
+
*/
|
|
237
|
+
statusIconDescription: PropTypes.Requireable<string>;
|
|
238
|
+
/**
|
|
239
|
+
* Specify the subtitle
|
|
240
|
+
*/
|
|
241
|
+
subtitle: PropTypes.Requireable<string>;
|
|
242
|
+
/**
|
|
243
|
+
* Specify an optional duration the notification should be closed in
|
|
244
|
+
*/
|
|
245
|
+
timeout: PropTypes.Requireable<number>;
|
|
246
|
+
/**
|
|
247
|
+
* Specify the title
|
|
248
|
+
*/
|
|
249
|
+
title: PropTypes.Requireable<string>;
|
|
250
|
+
};
|
|
251
|
+
var defaultProps: {
|
|
252
|
+
kind: string;
|
|
253
|
+
role: string;
|
|
254
|
+
onCloseButtonClick: () => void;
|
|
255
|
+
hideCloseButton: boolean;
|
|
256
|
+
timeout: number;
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* InlineNotification
|
|
261
|
+
* ==================
|
|
262
|
+
*/
|
|
263
|
+
export interface InlineNotificationProps extends HTMLAttributes<HTMLDivElement> {
|
|
264
|
+
/**
|
|
265
|
+
* Provide a description for "close" icon button that can be read by screen readers
|
|
266
|
+
*/
|
|
267
|
+
'aria-label'?: string;
|
|
268
|
+
/**
|
|
269
|
+
* Specify the content
|
|
270
|
+
*/
|
|
271
|
+
children?: ReactNode;
|
|
272
|
+
/**
|
|
273
|
+
* Specify an optional className to be applied to the notification box
|
|
274
|
+
*/
|
|
275
|
+
className?: string;
|
|
276
|
+
/**
|
|
277
|
+
* Specify the close button should be disabled, or not
|
|
278
|
+
*/
|
|
279
|
+
hideCloseButton?: boolean;
|
|
280
|
+
/**
|
|
281
|
+
* Specify what state the notification represents
|
|
282
|
+
*/
|
|
283
|
+
kind: 'error' | 'info' | 'info-square' | 'success' | 'warning' | 'warning-alt';
|
|
284
|
+
/**
|
|
285
|
+
* Specify whether you are using the low contrast variant of the InlineNotification.
|
|
286
|
+
*/
|
|
287
|
+
lowContrast?: boolean;
|
|
288
|
+
/**
|
|
289
|
+
* Provide a function that is called when menu is closed
|
|
290
|
+
*/
|
|
291
|
+
onClose?(event: MouseEvent): boolean | void;
|
|
292
|
+
/**
|
|
293
|
+
* Provide a function that is called when the close button is clicked
|
|
294
|
+
*/
|
|
295
|
+
onCloseButtonClick(event: MouseEvent): void;
|
|
296
|
+
/**
|
|
297
|
+
* By default, this value is "status". You can also provide an alternate
|
|
298
|
+
* role if it makes sense from the accessibility-side.
|
|
299
|
+
*/
|
|
300
|
+
role: 'alert' | 'log' | 'status';
|
|
301
|
+
/**
|
|
302
|
+
* Provide a description for "status" icon that can be read by screen readers
|
|
303
|
+
*/
|
|
304
|
+
statusIconDescription?: string;
|
|
305
|
+
/**
|
|
306
|
+
* Specify the subtitle
|
|
307
|
+
*/
|
|
308
|
+
subtitle?: string;
|
|
309
|
+
/**
|
|
310
|
+
* Specify the title
|
|
311
|
+
*/
|
|
312
|
+
title?: string;
|
|
313
|
+
}
|
|
314
|
+
export declare function InlineNotification({ ['aria-label']: ariaLabel, children, title, subtitle, role, onClose, onCloseButtonClick, statusIconDescription, className, kind, lowContrast, hideCloseButton, ...rest }: InlineNotificationProps): JSX.Element | null;
|
|
315
|
+
export declare namespace InlineNotification {
|
|
316
|
+
var propTypes: {
|
|
317
|
+
/**
|
|
318
|
+
* Provide a description for "close" icon button that can be read by screen readers
|
|
319
|
+
*/
|
|
320
|
+
"aria-label": PropTypes.Requireable<string>;
|
|
321
|
+
/**
|
|
322
|
+
* Specify the content
|
|
323
|
+
*/
|
|
324
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
325
|
+
/**
|
|
326
|
+
* Specify an optional className to be applied to the notification box
|
|
327
|
+
*/
|
|
328
|
+
className: PropTypes.Requireable<string>;
|
|
329
|
+
/**
|
|
330
|
+
* Specify the close button should be disabled, or not
|
|
331
|
+
*/
|
|
332
|
+
hideCloseButton: PropTypes.Requireable<boolean>;
|
|
333
|
+
/**
|
|
334
|
+
* Specify what state the notification represents
|
|
335
|
+
*/
|
|
336
|
+
kind: PropTypes.Requireable<string>;
|
|
337
|
+
/**
|
|
338
|
+
* Specify whether you are using the low contrast variant of the InlineNotification.
|
|
339
|
+
*/
|
|
340
|
+
lowContrast: PropTypes.Requireable<boolean>;
|
|
341
|
+
/**
|
|
342
|
+
* Provide a function that is called when menu is closed
|
|
343
|
+
*/
|
|
344
|
+
onClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
345
|
+
/**
|
|
346
|
+
* Provide a function that is called when the close button is clicked
|
|
347
|
+
*/
|
|
348
|
+
onCloseButtonClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
349
|
+
/**
|
|
350
|
+
* By default, this value is "status". You can also provide an alternate
|
|
351
|
+
* role if it makes sense from the accessibility-side.
|
|
352
|
+
*/
|
|
353
|
+
role: PropTypes.Requireable<string>;
|
|
354
|
+
/**
|
|
355
|
+
* Provide a description for "status" icon that can be read by screen readers
|
|
356
|
+
*/
|
|
357
|
+
statusIconDescription: PropTypes.Requireable<string>;
|
|
358
|
+
/**
|
|
359
|
+
* Specify the subtitle
|
|
360
|
+
*/
|
|
361
|
+
subtitle: PropTypes.Requireable<string>;
|
|
362
|
+
/**
|
|
363
|
+
* Specify the title
|
|
364
|
+
*/
|
|
365
|
+
title: PropTypes.Requireable<string>;
|
|
366
|
+
};
|
|
367
|
+
var defaultProps: {
|
|
368
|
+
kind: string;
|
|
369
|
+
role: string;
|
|
370
|
+
onCloseButtonClick: () => void;
|
|
371
|
+
hideCloseButton: boolean;
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* ActionableNotification
|
|
376
|
+
* ======================
|
|
377
|
+
*/
|
|
378
|
+
export interface ActionableNotificationProps extends HTMLAttributes<HTMLDivElement> {
|
|
379
|
+
/**
|
|
380
|
+
* Pass in the action button label that will be rendered within the ActionableNotification.
|
|
381
|
+
*/
|
|
382
|
+
actionButtonLabel: string;
|
|
383
|
+
/**
|
|
384
|
+
* Provide a description for "close" icon button that can be read by screen readers
|
|
385
|
+
*/
|
|
386
|
+
'aria-label'?: string;
|
|
387
|
+
/**
|
|
388
|
+
* Specify the content
|
|
389
|
+
*/
|
|
390
|
+
children?: ReactNode;
|
|
391
|
+
/**
|
|
392
|
+
* Specify an optional className to be applied to the notification box
|
|
393
|
+
*/
|
|
394
|
+
className?: string;
|
|
395
|
+
/**
|
|
396
|
+
* Specify if pressing the escape key should close notifications
|
|
397
|
+
*/
|
|
398
|
+
closeOnEscape?: boolean;
|
|
399
|
+
/**
|
|
400
|
+
* Specify if focus should be moved to the component when the notification contains actions
|
|
401
|
+
*/
|
|
402
|
+
hasFocus?: boolean;
|
|
403
|
+
/**
|
|
404
|
+
* Specify the close button should be disabled, or not
|
|
405
|
+
*/
|
|
406
|
+
hideCloseButton?: boolean;
|
|
407
|
+
inline?: boolean;
|
|
408
|
+
/**
|
|
409
|
+
* Specify what state the notification represents
|
|
410
|
+
*/
|
|
411
|
+
kind: 'error' | 'info' | 'info-square' | 'success' | 'warning' | 'warning-alt';
|
|
412
|
+
/**
|
|
413
|
+
* Specify whether you are using the low contrast variant of the ActionableNotification.
|
|
414
|
+
*/
|
|
415
|
+
lowContrast?: boolean;
|
|
416
|
+
/**
|
|
417
|
+
* Provide a function that is called when the action is clicked
|
|
418
|
+
*/
|
|
419
|
+
onActionButtonClick?(): void;
|
|
420
|
+
/**
|
|
421
|
+
* Provide a function that is called when menu is closed.
|
|
422
|
+
* Default behavior of hiding the notification is prevented if this function returns false.
|
|
423
|
+
*/
|
|
424
|
+
onClose?(event: MouseEvent): boolean | void;
|
|
425
|
+
/**
|
|
426
|
+
* Provide a function that is called when the close button is clicked
|
|
427
|
+
*/
|
|
428
|
+
onCloseButtonClick(event: MouseEvent): void;
|
|
429
|
+
/**
|
|
430
|
+
* By default, this value is "alertdialog". You can also provide an alternate
|
|
431
|
+
* role if it makes sense from from an accessibility perspective.
|
|
432
|
+
*/
|
|
433
|
+
role?: string;
|
|
434
|
+
/**
|
|
435
|
+
* Provide a description for "status" icon that can be read by screen readers
|
|
436
|
+
*/
|
|
437
|
+
statusIconDescription?: string;
|
|
438
|
+
/**
|
|
439
|
+
* Specify the subtitle
|
|
440
|
+
*/
|
|
441
|
+
subtitle?: string;
|
|
442
|
+
/**
|
|
443
|
+
* Specify the title
|
|
444
|
+
*/
|
|
445
|
+
title?: string;
|
|
446
|
+
}
|
|
447
|
+
export declare function ActionableNotification({ actionButtonLabel, ['aria-label']: ariaLabel, ariaLabel: deprecatedAriaLabel, children, role, onActionButtonClick, onClose, onCloseButtonClick, statusIconDescription, className, inline, kind, lowContrast, hideCloseButton, hasFocus, closeOnEscape, title, subtitle, ...rest }: ActionableNotificationProps): JSX.Element | null;
|
|
448
|
+
export declare namespace ActionableNotification {
|
|
449
|
+
var propTypes: {
|
|
450
|
+
/**
|
|
451
|
+
* Pass in the action button label that will be rendered within the ActionableNotification.
|
|
452
|
+
*/
|
|
453
|
+
actionButtonLabel: PropTypes.Validator<string>;
|
|
454
|
+
/**
|
|
455
|
+
* Provide a description for "close" icon button that can be read by screen readers
|
|
456
|
+
*/
|
|
457
|
+
"aria-label": PropTypes.Requireable<string>;
|
|
458
|
+
/**
|
|
459
|
+
* Deprecated, please use `aria-label` instead.
|
|
460
|
+
* Provide a description for "close" icon button that can be read by screen readers
|
|
461
|
+
*/
|
|
462
|
+
ariaLabel: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
|
|
463
|
+
/**
|
|
464
|
+
* Specify the content
|
|
465
|
+
*/
|
|
466
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
467
|
+
/**
|
|
468
|
+
* Specify an optional className to be applied to the notification box
|
|
469
|
+
*/
|
|
470
|
+
className: PropTypes.Requireable<string>;
|
|
471
|
+
/**
|
|
472
|
+
* Specify if pressing the escape key should close notifications
|
|
473
|
+
*/
|
|
474
|
+
closeOnEscape: PropTypes.Requireable<boolean>;
|
|
475
|
+
/**
|
|
476
|
+
* Specify if focus should be moved to the component when the notification contains actions
|
|
477
|
+
*/
|
|
478
|
+
hasFocus: PropTypes.Requireable<boolean>;
|
|
479
|
+
/**
|
|
480
|
+
* Specify the close button should be disabled, or not
|
|
481
|
+
*/
|
|
482
|
+
hideCloseButton: PropTypes.Requireable<boolean>;
|
|
483
|
+
inline: PropTypes.Requireable<boolean>;
|
|
484
|
+
/**
|
|
485
|
+
* Specify what state the notification represents
|
|
486
|
+
*/
|
|
487
|
+
kind: PropTypes.Validator<string>;
|
|
488
|
+
/**
|
|
489
|
+
* Specify whether you are using the low contrast variant of the ActionableNotification.
|
|
490
|
+
*/
|
|
491
|
+
lowContrast: PropTypes.Requireable<boolean>;
|
|
492
|
+
/**
|
|
493
|
+
* Provide a function that is called when the action is clicked
|
|
494
|
+
*/
|
|
495
|
+
onActionButtonClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
496
|
+
/**
|
|
497
|
+
* Provide a function that is called when menu is closed
|
|
498
|
+
*/
|
|
499
|
+
onClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
500
|
+
/**
|
|
501
|
+
* Provide a function that is called when the close button is clicked
|
|
502
|
+
*/
|
|
503
|
+
onCloseButtonClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
504
|
+
/**
|
|
505
|
+
* By default, this value is "alertdialog". You can also provide an alternate
|
|
506
|
+
* role if it makes sense from the accessibility-side.
|
|
507
|
+
*/
|
|
508
|
+
role: PropTypes.Requireable<string>;
|
|
509
|
+
/**
|
|
510
|
+
* Provide a description for "status" icon that can be read by screen readers
|
|
511
|
+
*/
|
|
512
|
+
statusIconDescription: PropTypes.Requireable<string>;
|
|
513
|
+
/**
|
|
514
|
+
* Specify the subtitle
|
|
515
|
+
*/
|
|
516
|
+
subtitle: PropTypes.Requireable<string>;
|
|
517
|
+
/**
|
|
518
|
+
* Specify the title
|
|
519
|
+
*/
|
|
520
|
+
title: PropTypes.Requireable<string>;
|
|
521
|
+
};
|
|
522
|
+
var defaultProps: {
|
|
523
|
+
kind: string;
|
|
524
|
+
role: string;
|
|
525
|
+
onCloseButtonClick: () => void;
|
|
526
|
+
hideCloseButton: boolean;
|
|
527
|
+
hasFocus: boolean;
|
|
528
|
+
closeOnEscape: boolean;
|
|
529
|
+
inline: boolean;
|
|
530
|
+
};
|
|
531
|
+
}
|
|
@@ -16,6 +16,7 @@ var deprecate = require('../../prop-types/deprecate.js');
|
|
|
16
16
|
var cx = require('classnames');
|
|
17
17
|
var iconsReact = require('@carbon/icons-react');
|
|
18
18
|
var Button = require('../Button/Button.js');
|
|
19
|
+
require('../Button/Button.Skeleton.js');
|
|
19
20
|
var useIsomorphicEffect = require('../../internal/useIsomorphicEffect.js');
|
|
20
21
|
var useNoInteractiveChildren = require('../../internal/useNoInteractiveChildren.js');
|
|
21
22
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
@@ -86,9 +87,16 @@ NotificationActionButton.propTypes = {
|
|
|
86
87
|
*/
|
|
87
88
|
onClick: PropTypes__default["default"].func
|
|
88
89
|
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* NotificationButton
|
|
93
|
+
* ==================
|
|
94
|
+
*/
|
|
95
|
+
|
|
89
96
|
function NotificationButton(_ref2) {
|
|
90
97
|
let {
|
|
91
|
-
|
|
98
|
+
'aria-label': ariaLabel,
|
|
99
|
+
// @ts-expect-error: deprecated prop
|
|
92
100
|
ariaLabel: deprecatedAriaLabel,
|
|
93
101
|
className,
|
|
94
102
|
type,
|
|
@@ -154,6 +162,12 @@ NotificationButton.defaultProps = {
|
|
|
154
162
|
type: 'button',
|
|
155
163
|
renderIcon: iconsReact.Close
|
|
156
164
|
};
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* NotificationIcon
|
|
168
|
+
* ================
|
|
169
|
+
*/
|
|
170
|
+
|
|
157
171
|
const iconTypes = {
|
|
158
172
|
error: iconsReact.ErrorFilled,
|
|
159
173
|
success: iconsReact.CheckmarkFilled,
|
|
@@ -183,9 +197,16 @@ NotificationIcon.propTypes = {
|
|
|
183
197
|
kind: PropTypes__default["default"].oneOf(['error', 'success', 'warning', 'warning-alt', 'info', 'info-square']).isRequired,
|
|
184
198
|
notificationType: PropTypes__default["default"].oneOf(['inline', 'toast']).isRequired
|
|
185
199
|
};
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* ToastNotification
|
|
203
|
+
* =================
|
|
204
|
+
*/
|
|
205
|
+
|
|
186
206
|
function ToastNotification(_ref4) {
|
|
187
207
|
let {
|
|
188
208
|
['aria-label']: ariaLabel,
|
|
209
|
+
// @ts-expect-error: deprecated prop
|
|
189
210
|
ariaLabel: deprecatedAriaLabel,
|
|
190
211
|
role,
|
|
191
212
|
onClose,
|
|
@@ -265,7 +286,7 @@ function ToastNotification(_ref4) {
|
|
|
265
286
|
onClick: handleCloseButtonClick,
|
|
266
287
|
"aria-hidden": "true",
|
|
267
288
|
"aria-label": deprecatedAriaLabel || ariaLabel,
|
|
268
|
-
tabIndex:
|
|
289
|
+
tabIndex: -1
|
|
269
290
|
}));
|
|
270
291
|
}
|
|
271
292
|
ToastNotification.propTypes = {
|
|
@@ -320,7 +341,7 @@ ToastNotification.propTypes = {
|
|
|
320
341
|
*/
|
|
321
342
|
statusIconDescription: PropTypes__default["default"].string,
|
|
322
343
|
/**
|
|
323
|
-
* Specify the
|
|
344
|
+
* Specify the subtitle
|
|
324
345
|
*/
|
|
325
346
|
subtitle: PropTypes__default["default"].string,
|
|
326
347
|
/**
|
|
@@ -339,6 +360,12 @@ ToastNotification.defaultProps = {
|
|
|
339
360
|
hideCloseButton: false,
|
|
340
361
|
timeout: 0
|
|
341
362
|
};
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* InlineNotification
|
|
366
|
+
* ==================
|
|
367
|
+
*/
|
|
368
|
+
|
|
342
369
|
function InlineNotification(_ref5) {
|
|
343
370
|
let {
|
|
344
371
|
['aria-label']: ariaLabel,
|
|
@@ -401,7 +428,7 @@ function InlineNotification(_ref5) {
|
|
|
401
428
|
onClick: handleCloseButtonClick,
|
|
402
429
|
"aria-hidden": "true",
|
|
403
430
|
"aria-label": ariaLabel,
|
|
404
|
-
tabIndex:
|
|
431
|
+
tabIndex: -1
|
|
405
432
|
}));
|
|
406
433
|
}
|
|
407
434
|
InlineNotification.propTypes = {
|
|
@@ -447,7 +474,7 @@ InlineNotification.propTypes = {
|
|
|
447
474
|
*/
|
|
448
475
|
statusIconDescription: PropTypes__default["default"].string,
|
|
449
476
|
/**
|
|
450
|
-
* Specify the
|
|
477
|
+
* Specify the subtitle
|
|
451
478
|
*/
|
|
452
479
|
subtitle: PropTypes__default["default"].string,
|
|
453
480
|
/**
|
|
@@ -461,10 +488,17 @@ InlineNotification.defaultProps = {
|
|
|
461
488
|
onCloseButtonClick: () => {},
|
|
462
489
|
hideCloseButton: false
|
|
463
490
|
};
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* ActionableNotification
|
|
494
|
+
* ======================
|
|
495
|
+
*/
|
|
496
|
+
|
|
464
497
|
function ActionableNotification(_ref6) {
|
|
465
498
|
let {
|
|
466
499
|
actionButtonLabel,
|
|
467
500
|
['aria-label']: ariaLabel,
|
|
501
|
+
// @ts-expect-error: deprecated prop
|
|
468
502
|
ariaLabel: deprecatedAriaLabel,
|
|
469
503
|
children,
|
|
470
504
|
role,
|
|
@@ -609,7 +643,7 @@ ActionableNotification.propTypes = {
|
|
|
609
643
|
*/
|
|
610
644
|
statusIconDescription: PropTypes__default["default"].string,
|
|
611
645
|
/**
|
|
612
|
-
* Specify the
|
|
646
|
+
* Specify the subtitle
|
|
613
647
|
*/
|
|
614
648
|
subtitle: PropTypes__default["default"].string,
|
|
615
649
|
/**
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
export { NotificationActionButton, type NotificationActionButtonProps, NotificationButton, type NotificationButtonProps, ToastNotification, type ToastNotificationProps, InlineNotification, type InlineNotificationProps, ActionableNotification, type ActionableNotificationProps, } from './Notification';
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
12
12
|
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
13
|
var React = require('react');
|
|
14
14
|
var Button = require('../Button/Button.js');
|
|
15
|
+
require('../Button/Button.Skeleton.js');
|
|
15
16
|
|
|
16
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
18
|
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
12
12
|
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
13
|
var React = require('react');
|
|
14
14
|
var Button = require('../Button/Button.js');
|
|
15
|
+
require('../Button/Button.Skeleton.js');
|
|
15
16
|
|
|
16
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
18
|
|