@carbon/react 1.89.0-rc.0 → 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 +1113 -851
- package/es/components/AILabel/index.d.ts +2 -5
- package/es/components/AILabel/index.js +2 -42
- package/es/components/ComposedModal/ComposedModal.js +2 -2
- package/es/components/Copy/Copy.js +1 -0
- 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/Link/Link.js +15 -1
- package/es/components/Menu/MenuContext.d.ts +1 -1
- package/es/components/Menu/MenuContext.js +11 -4
- package/es/components/Menu/MenuItem.js +4 -10
- package/es/components/Modal/Modal.js +17 -9
- package/es/components/MultiSelect/FilterableMultiSelect.js +1 -5
- package/es/components/MultiSelect/MultiSelect.js +3 -7
- package/es/components/Popover/index.d.ts +4 -0
- package/es/components/Popover/index.js +8 -2
- package/es/components/StructuredList/StructuredList.d.ts +16 -0
- package/es/components/StructuredList/StructuredList.js +23 -11
- package/es/components/Toggletip/index.d.ts +13 -36
- package/es/components/Toggletip/index.js +12 -51
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -0
- package/es/internal/Selection.js +1 -1
- package/es/internal/useMergedRefs.js +4 -3
- package/lib/components/AILabel/index.d.ts +2 -5
- package/lib/components/AILabel/index.js +1 -41
- package/lib/components/ComposedModal/ComposedModal.js +2 -2
- package/lib/components/Copy/Copy.js +1 -0
- 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/Link/Link.js +15 -1
- package/lib/components/Menu/MenuContext.d.ts +1 -1
- package/lib/components/Menu/MenuContext.js +11 -4
- package/lib/components/Menu/MenuItem.js +4 -10
- package/lib/components/Modal/Modal.js +24 -16
- package/lib/components/MultiSelect/FilterableMultiSelect.js +1 -5
- package/lib/components/MultiSelect/MultiSelect.js +3 -7
- package/lib/components/Popover/index.d.ts +4 -0
- package/lib/components/Popover/index.js +8 -2
- package/lib/components/StructuredList/StructuredList.d.ts +16 -0
- package/lib/components/StructuredList/StructuredList.js +23 -11
- package/lib/components/Toggletip/index.d.ts +13 -36
- package/lib/components/Toggletip/index.js +11 -50
- package/lib/index.d.ts +2 -1
- package/lib/index.js +60 -58
- package/lib/internal/Selection.js +1 -1
- package/lib/internal/useMergedRefs.js +3 -2
- package/package.json +15 -16
- package/telemetry.yml +5 -2
|
@@ -30,6 +30,7 @@ function StructuredListWrapper(props) {
|
|
|
30
30
|
ariaLabel: deprecatedAriaLabel,
|
|
31
31
|
isCondensed,
|
|
32
32
|
isFlush,
|
|
33
|
+
selectedInitialRow,
|
|
33
34
|
...other
|
|
34
35
|
} = props;
|
|
35
36
|
const prefix = usePrefix();
|
|
@@ -38,7 +39,7 @@ function StructuredListWrapper(props) {
|
|
|
38
39
|
[`${prefix}--structured-list--condensed`]: isCondensed,
|
|
39
40
|
[`${prefix}--structured-list--flush`]: isFlush && !selection
|
|
40
41
|
}, className);
|
|
41
|
-
const [selectedRow, setSelectedRow] = React.useState(null);
|
|
42
|
+
const [selectedRow, setSelectedRow] = React.useState(selectedInitialRow ?? null);
|
|
42
43
|
return /*#__PURE__*/React.createElement(GridSelectedRowStateContext.Provider, {
|
|
43
44
|
value: selectedRow
|
|
44
45
|
}, /*#__PURE__*/React.createElement(GridSelectedRowDispatchContext.Provider, {
|
|
@@ -79,7 +80,11 @@ StructuredListWrapper.propTypes = {
|
|
|
79
80
|
/**
|
|
80
81
|
* Specify whether your StructuredListWrapper should have selections
|
|
81
82
|
*/
|
|
82
|
-
selection: PropTypes.bool
|
|
83
|
+
selection: PropTypes.bool,
|
|
84
|
+
/**
|
|
85
|
+
* Specify which row will be selected initially
|
|
86
|
+
*/
|
|
87
|
+
selectedInitialRow: PropTypes.string
|
|
83
88
|
};
|
|
84
89
|
function StructuredListHead(props) {
|
|
85
90
|
const {
|
|
@@ -141,21 +146,22 @@ function StructuredListRow(props) {
|
|
|
141
146
|
head,
|
|
142
147
|
onClick,
|
|
143
148
|
selection,
|
|
149
|
+
id,
|
|
144
150
|
...other
|
|
145
151
|
} = props;
|
|
146
152
|
const [hasFocusWithin, setHasFocusWithin] = useState(false);
|
|
147
|
-
const
|
|
153
|
+
const rowId = id ?? useId('grid-input');
|
|
148
154
|
const selectedRow = React.useContext(GridSelectedRowStateContext);
|
|
149
155
|
const setSelectedRow = React.useContext(GridSelectedRowDispatchContext);
|
|
150
156
|
const prefix = usePrefix();
|
|
151
157
|
const value = {
|
|
152
|
-
id
|
|
158
|
+
id: rowId
|
|
153
159
|
};
|
|
154
160
|
const classes = cx(`${prefix}--structured-list-row`, {
|
|
155
161
|
[`${prefix}--structured-list-row--header-row`]: head,
|
|
156
|
-
[`${prefix}--structured-list-row--focused-within`]: hasFocusWithin && !selection || hasFocusWithin && selection && (selectedRow ===
|
|
162
|
+
[`${prefix}--structured-list-row--focused-within`]: hasFocusWithin && !selection || hasFocusWithin && selection && (selectedRow === rowId || selectedRow === null),
|
|
157
163
|
// Ensure focus on the first item when navigating through Tab keys and no row is selected (selectedRow === null)
|
|
158
|
-
[`${prefix}--structured-list-row--selected`]: selectedRow ===
|
|
164
|
+
[`${prefix}--structured-list-row--selected`]: selectedRow === rowId
|
|
159
165
|
}, className);
|
|
160
166
|
const itemRef = useRef(null);
|
|
161
167
|
const handleClick = () => {
|
|
@@ -176,15 +182,17 @@ function StructuredListRow(props) {
|
|
|
176
182
|
className: classes,
|
|
177
183
|
ref: itemRef,
|
|
178
184
|
onClick: event => {
|
|
179
|
-
setSelectedRow?.(
|
|
185
|
+
setSelectedRow?.(rowId);
|
|
180
186
|
onClick && onClick(event);
|
|
181
187
|
if (selection) {
|
|
182
188
|
// focus items only when selection is enabled
|
|
183
189
|
setHasFocusWithin(true);
|
|
184
190
|
}
|
|
185
191
|
},
|
|
186
|
-
onFocus:
|
|
187
|
-
|
|
192
|
+
onFocus: event => {
|
|
193
|
+
if (selection || event.currentTarget === event.target) {
|
|
194
|
+
setHasFocusWithin(true);
|
|
195
|
+
}
|
|
188
196
|
},
|
|
189
197
|
onBlur: () => {
|
|
190
198
|
setHasFocusWithin(false);
|
|
@@ -192,7 +200,7 @@ function StructuredListRow(props) {
|
|
|
192
200
|
onKeyDown: onKeyDown
|
|
193
201
|
}), /*#__PURE__*/React.createElement(GridRowContext.Provider, {
|
|
194
202
|
value: value
|
|
195
|
-
}, selection && /*#__PURE__*/React.createElement(StructuredListCell, null, selectedRow ===
|
|
203
|
+
}, selection && /*#__PURE__*/React.createElement(StructuredListCell, null, selectedRow === rowId ? /*#__PURE__*/React.createElement(RadioButtonChecked, {
|
|
196
204
|
className: `${prefix}--structured-list__icon`
|
|
197
205
|
}) : /*#__PURE__*/React.createElement(RadioButton, {
|
|
198
206
|
className: `${prefix}--structured-list__icon`
|
|
@@ -226,7 +234,11 @@ StructuredListRow.propTypes = {
|
|
|
226
234
|
/**
|
|
227
235
|
* Mark if this row should be selectable
|
|
228
236
|
*/
|
|
229
|
-
selection: PropTypes.bool
|
|
237
|
+
selection: PropTypes.bool,
|
|
238
|
+
/**
|
|
239
|
+
* Specify row id so that it can be used for initial selection
|
|
240
|
+
*/
|
|
241
|
+
id: PropTypes.string
|
|
230
242
|
};
|
|
231
243
|
function StructuredListInput(props) {
|
|
232
244
|
const defaultId = useId('structureListInput');
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import React, { type ElementType, type ReactNode } from 'react';
|
|
9
|
-
import { type PopoverAlignment } from '../Popover';
|
|
9
|
+
import { type PopoverAlignment, PopoverBaseProps } from '../Popover';
|
|
10
10
|
import { PolymorphicProps } from '../../types/common';
|
|
11
11
|
import { PolymorphicComponentPropWithRef } from '../../internal/PolymorphicProps';
|
|
12
12
|
type ToggletipLabelProps<E extends ElementType> = {
|
|
@@ -36,12 +36,7 @@ export declare namespace ToggletipLabel {
|
|
|
36
36
|
className: PropTypes.Requireable<string>;
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
export interface ToggletipBaseProps {
|
|
40
|
-
align?: PopoverAlignment;
|
|
41
|
-
alignmentAxisOffset?: number;
|
|
42
|
-
autoAlign?: boolean;
|
|
43
|
-
className?: string;
|
|
44
|
-
children?: ReactNode;
|
|
39
|
+
export interface ToggletipBaseProps extends Omit<PopoverBaseProps, 'open'> {
|
|
45
40
|
defaultOpen?: boolean;
|
|
46
41
|
}
|
|
47
42
|
export type ToggletipProps<T extends ElementType> = PolymorphicComponentPropWithRef<T, ToggletipBaseProps>;
|
|
@@ -53,39 +48,21 @@ export type ToggletipProps<T extends ElementType> = PolymorphicComponentPropWith
|
|
|
53
48
|
export declare function Toggletip<E extends ElementType = 'span'>({ align, as, autoAlign, className: customClassName, children, defaultOpen, ...rest }: ToggletipProps<E>): import("react/jsx-runtime").JSX.Element;
|
|
54
49
|
export declare namespace Toggletip {
|
|
55
50
|
var propTypes: {
|
|
56
|
-
/**
|
|
57
|
-
* Specify how the toggletip should align with the button
|
|
58
|
-
*/
|
|
59
|
-
align: PropTypes.Requireable<string>;
|
|
60
|
-
/**
|
|
61
|
-
* **Experimental:** Provide an offset value for alignment axis. Only takes effect when `autoalign` is enabled.
|
|
62
|
-
*/
|
|
63
|
-
alignmentAxisOffset: PropTypes.Requireable<number>;
|
|
64
|
-
/**
|
|
65
|
-
* Provide a custom element or component to render the top-level node for the
|
|
66
|
-
* component.
|
|
67
|
-
*/
|
|
68
|
-
as: PropTypes.Requireable<PropTypes.ReactComponentLike>;
|
|
69
|
-
/**
|
|
70
|
-
* Will auto-align the popover on first render if it is not visible. This prop
|
|
71
|
-
* is currently experimental and is subject to future changes. Requires
|
|
72
|
-
* React v17+
|
|
73
|
-
* @see https://github.com/carbon-design-system/carbon/issues/18714
|
|
74
|
-
*/
|
|
75
|
-
autoAlign: PropTypes.Requireable<boolean>;
|
|
76
|
-
/**
|
|
77
|
-
* Custom children to be rendered as the content of the label
|
|
78
|
-
*/
|
|
79
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
80
|
-
/**
|
|
81
|
-
* Provide a custom class name to be added to the outermost node in the
|
|
82
|
-
* component
|
|
83
|
-
*/
|
|
84
|
-
className: PropTypes.Requireable<string>;
|
|
85
51
|
/**
|
|
86
52
|
* Specify if the toggletip should be open by default
|
|
87
53
|
*/
|
|
88
54
|
defaultOpen: PropTypes.Requireable<boolean>;
|
|
55
|
+
align?: PopoverAlignment;
|
|
56
|
+
alignmentAxisOffset?: number;
|
|
57
|
+
autoAlign?: boolean;
|
|
58
|
+
autoAlignBoundary?: import("@floating-ui/dom").Boundary;
|
|
59
|
+
caret?: boolean;
|
|
60
|
+
children?: React.ReactNode;
|
|
61
|
+
className?: string;
|
|
62
|
+
dropShadow?: boolean;
|
|
63
|
+
highContrast?: boolean;
|
|
64
|
+
isTabTip?: boolean;
|
|
65
|
+
onRequestClose?: () => void;
|
|
89
66
|
};
|
|
90
67
|
}
|
|
91
68
|
export interface ToggletipButtonBaseProps {
|
|
@@ -9,7 +9,7 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
|
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import React, { useContext, useRef, useState } from 'react';
|
|
12
|
-
import {
|
|
12
|
+
import { Popover, PopoverContent } from '../Popover/index.js';
|
|
13
13
|
import { Escape } from '../../internal/keyboard/keys.js';
|
|
14
14
|
import { match } from '../../internal/keyboard/match.js';
|
|
15
15
|
import { useWindowEvent } from '../../internal/useEvent.js';
|
|
@@ -100,6 +100,7 @@ function Toggletip({
|
|
|
100
100
|
};
|
|
101
101
|
const onKeyDown = event => {
|
|
102
102
|
if (open && match(event, Escape)) {
|
|
103
|
+
event.stopPropagation();
|
|
103
104
|
actions.close();
|
|
104
105
|
|
|
105
106
|
// If the menu is closed while focus is still inside the menu, it should return to the trigger button (#12922)
|
|
@@ -149,57 +150,17 @@ function Toggletip({
|
|
|
149
150
|
autoAlign: autoAlign
|
|
150
151
|
}, rest), children));
|
|
151
152
|
}
|
|
152
|
-
Toggletip.propTypes = {
|
|
153
|
-
/**
|
|
154
|
-
* Specify how the toggletip should align with the button
|
|
155
|
-
*/
|
|
156
|
-
align: PropTypes.oneOf(['top', 'top-left',
|
|
157
|
-
// deprecated use top-start instead
|
|
158
|
-
'top-right',
|
|
159
|
-
// deprecated use top-end instead
|
|
160
|
-
|
|
161
|
-
'bottom', 'bottom-left',
|
|
162
|
-
// deprecated use bottom-start instead
|
|
163
|
-
'bottom-right',
|
|
164
|
-
// deprecated use bottom-end instead
|
|
165
153
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
//
|
|
175
|
-
|
|
176
|
-
// new values to match floating-ui
|
|
177
|
-
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
178
|
-
/**
|
|
179
|
-
* **Experimental:** Provide an offset value for alignment axis. Only takes effect when `autoalign` is enabled.
|
|
180
|
-
*/
|
|
181
|
-
alignmentAxisOffset: PropTypes.number,
|
|
182
|
-
/**
|
|
183
|
-
* Provide a custom element or component to render the top-level node for the
|
|
184
|
-
* component.
|
|
185
|
-
*/
|
|
186
|
-
as: PropTypes.elementType,
|
|
187
|
-
/**
|
|
188
|
-
* Will auto-align the popover on first render if it is not visible. This prop
|
|
189
|
-
* is currently experimental and is subject to future changes. Requires
|
|
190
|
-
* React v17+
|
|
191
|
-
* @see https://github.com/carbon-design-system/carbon/issues/18714
|
|
192
|
-
*/
|
|
193
|
-
autoAlign: PropTypes.bool,
|
|
194
|
-
/**
|
|
195
|
-
* Custom children to be rendered as the content of the label
|
|
196
|
-
*/
|
|
197
|
-
children: PropTypes.node,
|
|
198
|
-
/**
|
|
199
|
-
* Provide a custom class name to be added to the outermost node in the
|
|
200
|
-
* component
|
|
201
|
-
*/
|
|
202
|
-
className: PropTypes.string,
|
|
154
|
+
// Get all the properties from Popover except for "open".
|
|
155
|
+
// The Typescript types for PropTypes are really messed up so we need lots of
|
|
156
|
+
// casting. It will be great when we can finally get rid of PropTypes altogether.
|
|
157
|
+
const {
|
|
158
|
+
open,
|
|
159
|
+
...popoverNonOpenPropTypes
|
|
160
|
+
} = Popover.propTypes ?? {};
|
|
161
|
+
Toggletip.propTypes = {
|
|
162
|
+
// Has all of Popover's PropTypes except for "open".
|
|
163
|
+
...popoverNonOpenPropTypes,
|
|
203
164
|
/**
|
|
204
165
|
* Specify if the toggletip should be open by default
|
|
205
166
|
*/
|
package/es/index.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ export * from './components/OrderedList';
|
|
|
58
58
|
export * from './components/OverflowMenu';
|
|
59
59
|
export * from './components/OverflowMenuItem';
|
|
60
60
|
export * as unstable__PageHeader from './components/PageHeader';
|
|
61
|
+
export * as preview__Dialog from './components/Dialog';
|
|
61
62
|
export * from './components/Pagination';
|
|
62
63
|
export * from './components/Pagination/Pagination.Skeleton';
|
|
63
64
|
export * from './components/PaginationNav';
|
|
@@ -185,7 +186,6 @@ export type { TableToolbarSearchProps } from './components/DataTable/TableToolba
|
|
|
185
186
|
export type { DataTableSkeletonProps } from './components/DataTableSkeleton/DataTableSkeleton';
|
|
186
187
|
export type { DatePickerProps } from './components/DatePicker/DatePicker';
|
|
187
188
|
export type { DatePickerInputProps } from './components/DatePickerInput/DatePickerInput';
|
|
188
|
-
export type { DialogProps } from './components/Dialog/index';
|
|
189
189
|
export type { DropdownProps } from './components/Dropdown/Dropdown';
|
|
190
190
|
export type { ErrorBoundaryProps } from './components/ErrorBoundary/ErrorBoundary';
|
|
191
191
|
export type { FeatureFlagsProps } from './components/FeatureFlags/index';
|
|
@@ -267,6 +267,7 @@ export type { OrderedListProps } from './components/OrderedList/OrderedList';
|
|
|
267
267
|
export type { OverflowMenuProps } from './components/OverflowMenu/OverflowMenu';
|
|
268
268
|
export type { OverflowMenuItemProps } from './components/OverflowMenuItem/OverflowMenuItem';
|
|
269
269
|
export type { PageHeaderProps, PageHeaderBreadcrumbBarProps, PageHeaderContentProps, PageHeaderHeroImageProps, PageHeaderTabBarProps, } from './components/PageHeader';
|
|
270
|
+
export type { DialogProps, DialogHeaderProps, DialogControlsProps, DialogCloseButtonProps, DialogTitleProps, DialogSubtitleProps, DialogBodyProps, DialogFooterProps, } from './components/Dialog';
|
|
270
271
|
export type { PaginationProps } from './components/Pagination/Pagination';
|
|
271
272
|
export type { PaginationSkeletonProps } from './components/Pagination/Pagination.Skeleton';
|
|
272
273
|
export type { DirectionButtonProps } from './components/PaginationNav/PaginationNav';
|
package/es/index.js
CHANGED
|
@@ -105,6 +105,8 @@ export { default as OverflowMenu } from './components/OverflowMenu/index.js';
|
|
|
105
105
|
export { default as OverflowMenuItem } from './components/OverflowMenuItem/OverflowMenuItem.js';
|
|
106
106
|
import * as index from './components/PageHeader/index.js';
|
|
107
107
|
export { index as unstable__PageHeader };
|
|
108
|
+
import * as index$1 from './components/Dialog/index.js';
|
|
109
|
+
export { index$1 as preview__Dialog };
|
|
108
110
|
export { default as Pagination } from './components/Pagination/Pagination.js';
|
|
109
111
|
export { default as PaginationSkeleton } from './components/Pagination/Pagination.Skeleton.js';
|
|
110
112
|
export { default as PaginationNav } from './components/PaginationNav/PaginationNav.js';
|
package/es/internal/Selection.js
CHANGED
|
@@ -48,7 +48,7 @@ const useSelection = ({
|
|
|
48
48
|
|
|
49
49
|
// Assert special properties (e.g., `disabled`, `isSelectAll`, etc.) are
|
|
50
50
|
// `any` since those properties aren’t part of the generic type.
|
|
51
|
-
const allSelectableItems = filteredItems.filter(item => !item?.disabled);
|
|
51
|
+
const allSelectableItems = filteredItems.filter(item => !item?.disabled && !item?.isSelectAll);
|
|
52
52
|
const disabledItemCount = filteredItems.filter(item => item?.disabled).length;
|
|
53
53
|
let newSelectedItems;
|
|
54
54
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { useCallback } from 'react';
|
|
8
|
+
import { useMemo, useCallback } from 'react';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Merges multiple refs into a single callback ref.
|
|
@@ -16,15 +16,16 @@ import { useCallback } from 'react';
|
|
|
16
16
|
* node, assigns that node to every ref in the array.
|
|
17
17
|
*/
|
|
18
18
|
const useMergedRefs = refs => {
|
|
19
|
+
const memoizedRefs = useMemo(() => refs, refs);
|
|
19
20
|
return useCallback(node => {
|
|
20
|
-
|
|
21
|
+
memoizedRefs.forEach(ref => {
|
|
21
22
|
if (typeof ref === 'function') {
|
|
22
23
|
ref(node);
|
|
23
24
|
} else if (ref) {
|
|
24
25
|
ref.current = node;
|
|
25
26
|
}
|
|
26
27
|
});
|
|
27
|
-
}, [
|
|
28
|
+
}, [memoizedRefs]);
|
|
28
29
|
};
|
|
29
30
|
|
|
30
31
|
export { useMergedRefs };
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
+
import { ToggletipBaseProps } from '../Toggletip';
|
|
8
9
|
import type { DeprecatedPopoverAlignment, NewPopoverAlignment, PopoverAlignment } from '../Popover';
|
|
9
10
|
export type AILabelContentProps = React.HTMLAttributes<HTMLSpanElement>;
|
|
10
11
|
export declare const AILabelContent: React.ForwardRefExoticComponent<AILabelContentProps & React.RefAttributes<unknown>>;
|
|
@@ -17,15 +18,11 @@ export declare const AILabelActions: React.ForwardRefExoticComponent<AILabelActi
|
|
|
17
18
|
export type DeprecatedAlignment = DeprecatedPopoverAlignment;
|
|
18
19
|
export type NewAlignment = NewPopoverAlignment;
|
|
19
20
|
export type Alignment = PopoverAlignment;
|
|
20
|
-
export interface AILabelProps {
|
|
21
|
+
export interface AILabelProps extends ToggletipBaseProps {
|
|
21
22
|
AILabelContent?: React.ReactNode;
|
|
22
23
|
aiText?: string;
|
|
23
24
|
aiTextLabel?: string;
|
|
24
25
|
textLabel?: string;
|
|
25
|
-
align?: Alignment;
|
|
26
|
-
autoAlign?: boolean;
|
|
27
|
-
children?: React.ReactNode;
|
|
28
|
-
className?: string;
|
|
29
26
|
kind?: 'default' | 'inline';
|
|
30
27
|
onRevertClick?: (evt: React.MouseEvent<HTMLButtonElement>) => void;
|
|
31
28
|
revertActive?: boolean;
|
|
@@ -10,12 +10,10 @@
|
|
|
10
10
|
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
11
11
|
var cx = require('classnames');
|
|
12
12
|
var PropTypes = require('prop-types');
|
|
13
|
-
var deprecateValuesWithin = require('../../prop-types/deprecateValuesWithin.js');
|
|
14
13
|
var React = require('react');
|
|
15
14
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
16
15
|
var index = require('../Toggletip/index.js');
|
|
17
16
|
var index$1 = require('../IconButton/index.js');
|
|
18
|
-
var mapPopoverAlign = require('../../tools/mapPopoverAlign.js');
|
|
19
17
|
var iconsReact = require('@carbon/icons-react');
|
|
20
18
|
var useId = require('../../internal/useId.js');
|
|
21
19
|
var deprecate = require('../../prop-types/deprecate.js');
|
|
@@ -145,6 +143,7 @@ const AILabel = /*#__PURE__*/React.forwardRef(function AILabel({
|
|
|
145
143
|
});
|
|
146
144
|
AILabel.displayName = 'AILabel';
|
|
147
145
|
AILabel.propTypes = {
|
|
146
|
+
...index.Toggletip.propTypes,
|
|
148
147
|
/**
|
|
149
148
|
* Specify the content you want rendered inside the `AILabel` ToggleTip
|
|
150
149
|
*/
|
|
@@ -158,49 +157,10 @@ AILabel.propTypes = {
|
|
|
158
157
|
* Specify additional text to be rendered next to the AI label in the inline variant
|
|
159
158
|
*/
|
|
160
159
|
aiTextLabel: deprecate.deprecate(PropTypes.string, '`aiTextLabel` on `AILabel` has been deprecated - Please use the `textLabel` prop instead'),
|
|
161
|
-
/**
|
|
162
|
-
* Specify how the popover should align with the button
|
|
163
|
-
*/
|
|
164
|
-
align: deprecateValuesWithin.default(PropTypes.oneOf(['top', 'top-left',
|
|
165
|
-
// deprecated use top-start instead
|
|
166
|
-
'top-right',
|
|
167
|
-
// deprecated use top-end instead
|
|
168
|
-
|
|
169
|
-
'bottom', 'bottom-left',
|
|
170
|
-
// deprecated use bottom-start instead
|
|
171
|
-
'bottom-right',
|
|
172
|
-
// deprecated use bottom-end instead
|
|
173
|
-
|
|
174
|
-
'left', 'left-bottom',
|
|
175
|
-
// deprecated use left-end instead
|
|
176
|
-
'left-top',
|
|
177
|
-
// deprecated use left-start instead
|
|
178
|
-
|
|
179
|
-
'right', 'right-bottom',
|
|
180
|
-
// deprecated use right-end instead
|
|
181
|
-
'right-top',
|
|
182
|
-
// deprecated use right-start instead
|
|
183
|
-
|
|
184
|
-
// new values to match floating-ui
|
|
185
|
-
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']), ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'], mapPopoverAlign.mapPopoverAlign),
|
|
186
160
|
/**
|
|
187
161
|
* Specify the text that will be provided to the aria-label of the `AILabel` button
|
|
188
162
|
*/
|
|
189
163
|
'aria-label': PropTypes.string,
|
|
190
|
-
/**
|
|
191
|
-
* Will auto-align the popover. This prop is currently experimental and is
|
|
192
|
-
* subject to future changes. Requires React v17+
|
|
193
|
-
* @see https://github.com/carbon-design-system/carbon/issues/18714
|
|
194
|
-
*/
|
|
195
|
-
autoAlign: PropTypes.bool,
|
|
196
|
-
/**
|
|
197
|
-
* Specify the content you want rendered inside the `AILabel` ToggleTip
|
|
198
|
-
*/
|
|
199
|
-
children: PropTypes.node,
|
|
200
|
-
/**
|
|
201
|
-
* Specify an optional className to be added to the `AILabel`
|
|
202
|
-
*/
|
|
203
|
-
className: PropTypes.string,
|
|
204
164
|
/**
|
|
205
165
|
* Specify the type of `AILabel`, from the following list of types:
|
|
206
166
|
*/
|
|
@@ -28,7 +28,7 @@ var match = require('../../internal/keyboard/match.js');
|
|
|
28
28
|
var index$1 = require('../FeatureFlags/index.js');
|
|
29
29
|
var events = require('../../tools/events.js');
|
|
30
30
|
var deprecate = require('../../prop-types/deprecate.js');
|
|
31
|
-
var
|
|
31
|
+
var Dialog = require('../Dialog/Dialog.js');
|
|
32
32
|
var warning = require('../../internal/warning.js');
|
|
33
33
|
var index$2 = require('../AILabel/index.js');
|
|
34
34
|
var utils = require('../../internal/utils.js');
|
|
@@ -308,7 +308,7 @@ const ComposedModal = /*#__PURE__*/React.forwardRef(function ComposedModal({
|
|
|
308
308
|
const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/React.cloneElement(candidate, {
|
|
309
309
|
size: 'sm'
|
|
310
310
|
}) : null;
|
|
311
|
-
const modalBody = enableDialogElement ? /*#__PURE__*/React.createElement(
|
|
311
|
+
const modalBody = enableDialogElement ? /*#__PURE__*/React.createElement(Dialog.Dialog, {
|
|
312
312
|
open: open,
|
|
313
313
|
focusAfterCloseRef: launcherButtonRef,
|
|
314
314
|
modal: true,
|
|
@@ -61,6 +61,7 @@ function Copy({
|
|
|
61
61
|
autoAlign: autoAlign,
|
|
62
62
|
className: classNames,
|
|
63
63
|
label: animation ? feedback : initialLabel,
|
|
64
|
+
leaveDelayMs: animation ? feedbackTimeout : undefined,
|
|
64
65
|
onClick: events.composeEventHandlers([onClick, handleClick]),
|
|
65
66
|
onAnimationEnd: events.composeEventHandlers([onAnimationEnd, handleAnimationEnd])
|
|
66
67
|
}, other, {
|
|
@@ -551,9 +551,16 @@ const DataTable = props => {
|
|
|
551
551
|
* @param headerKey - The field for the header that we are sorting by.
|
|
552
552
|
*/
|
|
553
553
|
const handleSortBy = headerKey => () => {
|
|
554
|
-
setState(prev =>
|
|
555
|
-
|
|
556
|
-
|
|
554
|
+
setState(prev => {
|
|
555
|
+
const sortState = sorting.getNextSortState(props, prev, {
|
|
556
|
+
key: headerKey
|
|
557
|
+
});
|
|
558
|
+
return {
|
|
559
|
+
...prev,
|
|
560
|
+
// Preserve ALL existing state
|
|
561
|
+
...sortState // Then apply only the sorting changes
|
|
562
|
+
};
|
|
563
|
+
});
|
|
557
564
|
};
|
|
558
565
|
|
|
559
566
|
/**
|