@carbon/react 1.89.0-rc.1 → 1.89.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/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1099 -837
- package/es/components/ComposedModal/ComposedModal.js +2 -2
- package/es/components/DataTable/DataTable.js +10 -3
- package/es/components/Dialog/Dialog.d.ts +245 -0
- package/es/components/Dialog/Dialog.js +593 -0
- package/es/components/Dialog/index.d.ts +3 -251
- package/es/components/Dialog/index.js +1 -609
- package/es/components/FeatureFlags/index.d.ts +3 -1
- package/es/components/FeatureFlags/index.js +5 -2
- package/es/components/FileUploader/FileUploader.d.ts +28 -6
- package/es/components/FileUploader/FileUploader.js +152 -38
- package/es/components/Menu/MenuItem.js +2 -1
- package/es/components/Modal/Modal.js +2 -2
- package/es/components/StructuredList/StructuredList.js +4 -2
- package/es/components/Toggletip/index.js +1 -0
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -0
- package/lib/components/ComposedModal/ComposedModal.js +2 -2
- package/lib/components/DataTable/DataTable.js +10 -3
- package/lib/components/Dialog/Dialog.d.ts +245 -0
- package/lib/components/Dialog/Dialog.js +602 -0
- package/lib/components/Dialog/index.d.ts +3 -251
- package/lib/components/Dialog/index.js +9 -614
- package/lib/components/FeatureFlags/index.d.ts +3 -1
- package/lib/components/FeatureFlags/index.js +5 -2
- package/lib/components/FileUploader/FileUploader.d.ts +28 -6
- package/lib/components/FileUploader/FileUploader.js +151 -37
- package/lib/components/Menu/MenuItem.js +2 -1
- package/lib/components/Modal/Modal.js +9 -9
- package/lib/components/StructuredList/StructuredList.js +4 -2
- package/lib/components/Toggletip/index.js +1 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +60 -58
- package/package.json +13 -13
- package/telemetry.yml +2 -0
|
@@ -24,7 +24,7 @@ import { match } from '../../internal/keyboard/match.js';
|
|
|
24
24
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
25
25
|
import { composeEventHandlers } from '../../tools/events.js';
|
|
26
26
|
import { deprecate } from '../../prop-types/deprecate.js';
|
|
27
|
-
import {
|
|
27
|
+
import { Dialog } from '../Dialog/Dialog.js';
|
|
28
28
|
import { warning } from '../../internal/warning.js';
|
|
29
29
|
import { AILabel } from '../AILabel/index.js';
|
|
30
30
|
import { isComponentElement } from '../../internal/utils.js';
|
|
@@ -304,7 +304,7 @@ const ComposedModal = /*#__PURE__*/React.forwardRef(function ComposedModal({
|
|
|
304
304
|
const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/cloneElement(candidate, {
|
|
305
305
|
size: 'sm'
|
|
306
306
|
}) : null;
|
|
307
|
-
const modalBody = enableDialogElement ? /*#__PURE__*/React.createElement(
|
|
307
|
+
const modalBody = enableDialogElement ? /*#__PURE__*/React.createElement(Dialog, {
|
|
308
308
|
open: open,
|
|
309
309
|
focusAfterCloseRef: launcherButtonRef,
|
|
310
310
|
modal: true,
|
|
@@ -549,9 +549,16 @@ const DataTable = props => {
|
|
|
549
549
|
* @param headerKey - The field for the header that we are sorting by.
|
|
550
550
|
*/
|
|
551
551
|
const handleSortBy = headerKey => () => {
|
|
552
|
-
setState(prev =>
|
|
553
|
-
|
|
554
|
-
|
|
552
|
+
setState(prev => {
|
|
553
|
+
const sortState = getNextSortState(props, prev, {
|
|
554
|
+
key: headerKey
|
|
555
|
+
});
|
|
556
|
+
return {
|
|
557
|
+
...prev,
|
|
558
|
+
// Preserve ALL existing state
|
|
559
|
+
...sortState // Then apply only the sorting changes
|
|
560
|
+
};
|
|
561
|
+
});
|
|
555
562
|
};
|
|
556
563
|
|
|
557
564
|
/**
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025
|
|
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 React, { type HTMLAttributes, type RefObject } from 'react';
|
|
8
|
+
import { InlineLoadingStatus } from '../InlineLoading/InlineLoading';
|
|
9
|
+
/**
|
|
10
|
+
* ----------
|
|
11
|
+
* Dialog
|
|
12
|
+
* ----------
|
|
13
|
+
*/
|
|
14
|
+
interface DialogProps extends HTMLAttributes<HTMLDialogElement> {
|
|
15
|
+
/**
|
|
16
|
+
* Provide the contents of the Dialog
|
|
17
|
+
*/
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Specify an optional className to be applied to the modal root node
|
|
21
|
+
*/
|
|
22
|
+
className?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Provide a ref to return focus to once the dialog is closed.
|
|
25
|
+
*/
|
|
26
|
+
focusAfterCloseRef?: RefObject<HTMLElement | null>;
|
|
27
|
+
/**
|
|
28
|
+
* Specifies whether the dialog is modal or non-modal. This cannot be changed
|
|
29
|
+
* while open=true
|
|
30
|
+
*/
|
|
31
|
+
modal?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Specify a handler for the dialog's cancel event.
|
|
34
|
+
* The browser fires this event when the user presses the Esc key and is cancelable.
|
|
35
|
+
*/
|
|
36
|
+
onCancel?: React.ReactEventHandler<HTMLDialogElement>;
|
|
37
|
+
/**
|
|
38
|
+
* Specify a click handler applied to the dialog.
|
|
39
|
+
*/
|
|
40
|
+
onClick?: React.ReactEventHandler<HTMLDialogElement>;
|
|
41
|
+
/**
|
|
42
|
+
* Specify a handler the dialog's close event.
|
|
43
|
+
* The browser fires this event after the dialog has closed.
|
|
44
|
+
*/
|
|
45
|
+
onClose?: React.ReactEventHandler<HTMLDialogElement>;
|
|
46
|
+
/**
|
|
47
|
+
* Specify a handler for closing Dialog.
|
|
48
|
+
* The handler should care of closing Dialog, e.g. changing `open` prop.
|
|
49
|
+
*/
|
|
50
|
+
onRequestClose?: React.ReactEventHandler<HTMLElement>;
|
|
51
|
+
/**
|
|
52
|
+
* Specify whether the Dialog is currently open
|
|
53
|
+
*/
|
|
54
|
+
open?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Specify the role of the dialog for accessibility
|
|
57
|
+
* 'dialog' is the default, but 'alertdialog' can be used for important messages requiring user attention
|
|
58
|
+
*/
|
|
59
|
+
role?: '' | 'alertdialog';
|
|
60
|
+
/**
|
|
61
|
+
* Specify a label for screen readers
|
|
62
|
+
*/
|
|
63
|
+
ariaLabel?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Specify the ID of an element that labels this dialog
|
|
66
|
+
*/
|
|
67
|
+
ariaLabelledBy?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Specify the ID of an element that describes this dialog
|
|
70
|
+
*/
|
|
71
|
+
ariaDescribedBy?: string;
|
|
72
|
+
}
|
|
73
|
+
declare const Dialog: React.ForwardRefExoticComponent<DialogProps & React.RefAttributes<unknown>>;
|
|
74
|
+
/**
|
|
75
|
+
* -------------
|
|
76
|
+
* DialogHeader
|
|
77
|
+
* -------------
|
|
78
|
+
*/
|
|
79
|
+
interface DialogHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
80
|
+
/**
|
|
81
|
+
* Provide the contents to be rendered inside of this component
|
|
82
|
+
*/
|
|
83
|
+
children?: React.ReactNode;
|
|
84
|
+
}
|
|
85
|
+
declare const DialogHeader: React.ForwardRefExoticComponent<DialogHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
86
|
+
/**
|
|
87
|
+
* ---------------
|
|
88
|
+
* DialogControls
|
|
89
|
+
* ---------------
|
|
90
|
+
*/
|
|
91
|
+
interface DialogControlsProps extends HTMLAttributes<HTMLDivElement> {
|
|
92
|
+
/**
|
|
93
|
+
* Provide the contents to be rendered inside of this component
|
|
94
|
+
*/
|
|
95
|
+
children?: React.ReactNode;
|
|
96
|
+
}
|
|
97
|
+
declare const DialogControls: React.ForwardRefExoticComponent<DialogControlsProps & React.RefAttributes<HTMLDivElement>>;
|
|
98
|
+
/**
|
|
99
|
+
* -------------------
|
|
100
|
+
* DialogCloseButton
|
|
101
|
+
* -------------------
|
|
102
|
+
*/
|
|
103
|
+
interface DialogCloseButtonProps extends HTMLAttributes<HTMLDivElement> {
|
|
104
|
+
/**
|
|
105
|
+
* Specify a click handler applied to the IconButton
|
|
106
|
+
*/
|
|
107
|
+
onClick?: React.MouseEventHandler;
|
|
108
|
+
}
|
|
109
|
+
declare const DialogCloseButton: React.ForwardRefExoticComponent<DialogCloseButtonProps & React.RefAttributes<HTMLDivElement>>;
|
|
110
|
+
/**
|
|
111
|
+
* ------------
|
|
112
|
+
* DialogTitle
|
|
113
|
+
* ------------
|
|
114
|
+
*/
|
|
115
|
+
interface DialogTitleProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
116
|
+
/**
|
|
117
|
+
* Provide the contents of the DialogTitle
|
|
118
|
+
*/
|
|
119
|
+
children?: React.ReactNode;
|
|
120
|
+
/**
|
|
121
|
+
* Specify an optional className to be applied to the title node
|
|
122
|
+
*/
|
|
123
|
+
className?: string;
|
|
124
|
+
/**
|
|
125
|
+
* Specify an optional id for the title element
|
|
126
|
+
*/
|
|
127
|
+
id?: string;
|
|
128
|
+
}
|
|
129
|
+
declare const DialogTitle: React.ForwardRefExoticComponent<DialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
130
|
+
/**
|
|
131
|
+
* ---------------
|
|
132
|
+
* DialogSubtitle
|
|
133
|
+
* ---------------
|
|
134
|
+
*/
|
|
135
|
+
interface DialogSubtitleProps extends HTMLAttributes<HTMLParagraphElement> {
|
|
136
|
+
/**
|
|
137
|
+
* Provide the contents of the DialogSubtitle
|
|
138
|
+
*/
|
|
139
|
+
children?: React.ReactNode;
|
|
140
|
+
/**
|
|
141
|
+
* Specify an optional className to be applied to the subtitle node
|
|
142
|
+
*/
|
|
143
|
+
className?: string;
|
|
144
|
+
/**
|
|
145
|
+
* Specify an optional id for the subtitle element
|
|
146
|
+
*/
|
|
147
|
+
id?: string;
|
|
148
|
+
}
|
|
149
|
+
declare const DialogSubtitle: React.ForwardRefExoticComponent<DialogSubtitleProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
150
|
+
/**
|
|
151
|
+
* -----------
|
|
152
|
+
* DialogBody
|
|
153
|
+
* -----------
|
|
154
|
+
*/
|
|
155
|
+
interface DialogBodyProps extends HTMLAttributes<HTMLDivElement> {
|
|
156
|
+
/**
|
|
157
|
+
* Provide the contents of the DialogBody
|
|
158
|
+
*/
|
|
159
|
+
children?: React.ReactNode;
|
|
160
|
+
/**
|
|
161
|
+
* Specify an optional className to be applied to the body node
|
|
162
|
+
*/
|
|
163
|
+
className?: string;
|
|
164
|
+
/**
|
|
165
|
+
* Specify whether the content has overflow that should be scrollable
|
|
166
|
+
*/
|
|
167
|
+
hasScrollingContent?: boolean;
|
|
168
|
+
}
|
|
169
|
+
declare const DialogBody: React.ForwardRefExoticComponent<DialogBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
170
|
+
/**
|
|
171
|
+
* -------------
|
|
172
|
+
* DialogFooter
|
|
173
|
+
* -------------
|
|
174
|
+
*/
|
|
175
|
+
interface DialogFooterProps extends HTMLAttributes<HTMLDivElement> {
|
|
176
|
+
/**
|
|
177
|
+
* Provide the contents of the DialogFooter
|
|
178
|
+
*/
|
|
179
|
+
children?: React.ReactNode;
|
|
180
|
+
/**
|
|
181
|
+
* Specify an optional className to be applied to the footer node
|
|
182
|
+
*/
|
|
183
|
+
className?: string;
|
|
184
|
+
/**
|
|
185
|
+
* Specify a handler for closing dialog (secondary button)
|
|
186
|
+
*/
|
|
187
|
+
onRequestClose?: React.ReactEventHandler<HTMLElement>;
|
|
188
|
+
/**
|
|
189
|
+
* Specify a handler for the secondary button.
|
|
190
|
+
* Useful if separate handler from `onRequestClose` is desirable
|
|
191
|
+
*/
|
|
192
|
+
onSecondarySubmit?: React.ReactEventHandler<HTMLElement>;
|
|
193
|
+
/**
|
|
194
|
+
* Specify a handler for submitting dialog (primary button)
|
|
195
|
+
*/
|
|
196
|
+
onRequestSubmit?: React.ReactEventHandler<HTMLElement>;
|
|
197
|
+
/**
|
|
198
|
+
* Specify the text for the primary button
|
|
199
|
+
*/
|
|
200
|
+
primaryButtonText?: React.ReactNode;
|
|
201
|
+
/**
|
|
202
|
+
* Specify whether the Button should be disabled, or not
|
|
203
|
+
*/
|
|
204
|
+
primaryButtonDisabled?: boolean;
|
|
205
|
+
/**
|
|
206
|
+
* Specify the text for the secondary button
|
|
207
|
+
*/
|
|
208
|
+
secondaryButtonText?: React.ReactNode;
|
|
209
|
+
/**
|
|
210
|
+
* Specify an array of config objects for secondary buttons
|
|
211
|
+
*/
|
|
212
|
+
secondaryButtons?: Array<{
|
|
213
|
+
buttonText: React.ReactNode;
|
|
214
|
+
onClick: React.MouseEventHandler<HTMLButtonElement>;
|
|
215
|
+
}>;
|
|
216
|
+
/**
|
|
217
|
+
* Specify whether the Dialog is for dangerous actions
|
|
218
|
+
*/
|
|
219
|
+
danger?: boolean;
|
|
220
|
+
/**
|
|
221
|
+
* Specify loading status
|
|
222
|
+
*/
|
|
223
|
+
loadingStatus?: InlineLoadingStatus;
|
|
224
|
+
/**
|
|
225
|
+
* Specify the description for the loading text
|
|
226
|
+
*/
|
|
227
|
+
loadingDescription?: string;
|
|
228
|
+
/**
|
|
229
|
+
* Specify the description for the loading icon
|
|
230
|
+
*/
|
|
231
|
+
loadingIconDescription?: string;
|
|
232
|
+
/**
|
|
233
|
+
* Specify an optional handler to be invoked when loading is
|
|
234
|
+
* successful
|
|
235
|
+
*/
|
|
236
|
+
onLoadingSuccess?: () => void;
|
|
237
|
+
}
|
|
238
|
+
declare const DialogFooter: React.ForwardRefExoticComponent<DialogFooterProps & React.RefAttributes<HTMLDivElement>>;
|
|
239
|
+
/**
|
|
240
|
+
* -------
|
|
241
|
+
* Exports
|
|
242
|
+
* -------
|
|
243
|
+
*/
|
|
244
|
+
export { Dialog, DialogHeader, DialogControls, DialogCloseButton, DialogTitle, DialogSubtitle, DialogBody, DialogFooter, };
|
|
245
|
+
export type { DialogProps, DialogHeaderProps, DialogControlsProps, DialogCloseButtonProps, DialogTitleProps, DialogSubtitleProps, DialogBodyProps, DialogFooterProps, };
|