@carbon/react 1.107.0 → 1.108.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/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +909 -909
- package/es/components/Button/Button.d.ts +2 -2
- package/es/components/ChatButton/ChatButton.d.ts +1 -1
- package/es/components/ChatButton/ChatButton.js +1 -1
- package/es/components/ComposedModal/ComposedModal.js +10 -5
- package/es/components/ErrorBoundary/ErrorBoundaryContext.d.ts +1 -1
- package/es/components/ErrorBoundary/ErrorBoundaryContext.js +1 -1
- package/es/components/FileUploader/FileUploader.d.ts +5 -0
- package/es/components/FileUploader/FileUploader.js +14 -6
- package/es/components/FileUploader/FileUploaderItem.d.ts +5 -1
- package/es/components/FileUploader/FileUploaderItem.js +4 -2
- package/es/components/FileUploader/Filename.d.ts +5 -1
- package/es/components/FileUploader/Filename.js +2 -1
- package/es/components/Menu/MenuItem.js +13 -5
- package/es/components/Modal/Modal.js +22 -12
- package/es/components/Modal/isTopmostVisibleModal.d.ts +7 -0
- package/es/components/Modal/isTopmostVisibleModal.js +21 -0
- package/es/components/MultiSelect/FilterableMultiSelect.js +9 -8
- package/es/components/MultiSelect/MultiSelect.js +9 -8
- package/es/components/MultiSelect/tools/isSelectAllItem.d.ts +9 -0
- package/es/components/MultiSelect/tools/isSelectAllItem.js +17 -0
- package/es/components/MultiSelect/tools/sorting.js +1 -1
- package/es/components/OverflowMenu/OverflowMenu.js +12 -11
- package/es/components/PageHeader/PageHeader.d.ts +4 -0
- package/es/components/PageHeader/PageHeader.js +18 -0
- package/es/components/PageHeader/index.d.ts +4 -0
- package/es/components/UIShell/SwitcherDivider.d.ts +2 -2
- package/es/components/UIShell/SwitcherDivider.js +2 -2
- package/es/internal/warning.d.ts +1 -1
- package/lib/components/Button/Button.d.ts +2 -2
- package/lib/components/ChatButton/ChatButton.d.ts +1 -1
- package/lib/components/ChatButton/ChatButton.js +1 -1
- package/lib/components/ComposedModal/ComposedModal.js +10 -5
- package/lib/components/ErrorBoundary/ErrorBoundaryContext.d.ts +1 -1
- package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +1 -1
- package/lib/components/FileUploader/FileUploader.d.ts +5 -0
- package/lib/components/FileUploader/FileUploader.js +14 -6
- package/lib/components/FileUploader/FileUploaderItem.d.ts +5 -1
- package/lib/components/FileUploader/FileUploaderItem.js +4 -2
- package/lib/components/FileUploader/Filename.d.ts +5 -1
- package/lib/components/FileUploader/Filename.js +2 -1
- package/lib/components/Menu/MenuItem.js +12 -4
- package/lib/components/Modal/Modal.js +22 -12
- package/lib/components/Modal/isTopmostVisibleModal.d.ts +7 -0
- package/lib/components/Modal/isTopmostVisibleModal.js +21 -0
- package/lib/components/MultiSelect/FilterableMultiSelect.js +9 -8
- package/lib/components/MultiSelect/MultiSelect.js +9 -8
- package/lib/components/MultiSelect/tools/isSelectAllItem.d.ts +9 -0
- package/lib/components/MultiSelect/tools/isSelectAllItem.js +17 -0
- package/lib/components/MultiSelect/tools/sorting.js +3 -3
- package/lib/components/OverflowMenu/OverflowMenu.js +11 -10
- package/lib/components/PageHeader/PageHeader.d.ts +4 -0
- package/lib/components/PageHeader/PageHeader.js +18 -0
- package/lib/components/PageHeader/index.d.ts +4 -0
- package/lib/components/UIShell/SwitcherDivider.d.ts +2 -2
- package/lib/components/UIShell/SwitcherDivider.js +2 -2
- package/lib/internal/warning.d.ts +1 -1
- package/lib/internal/warning.js +1 -1
- package/package.json +10 -10
|
@@ -13,6 +13,7 @@ import AspectRatio from "../AspectRatio/AspectRatio.js";
|
|
|
13
13
|
import { Popover, PopoverContent } from "../Popover/index.js";
|
|
14
14
|
import { DefinitionTooltip } from "../Tooltip/DefinitionTooltip.js";
|
|
15
15
|
import { MenuItem } from "../Menu/MenuItem.js";
|
|
16
|
+
import { deprecateComponent } from "../../prop-types/deprecateComponent.js";
|
|
16
17
|
import { GridAsGridComponent } from "../Grid/Grid.js";
|
|
17
18
|
import Column from "../Grid/Column.js";
|
|
18
19
|
import { MenuButton } from "../MenuButton/index.js";
|
|
@@ -33,7 +34,18 @@ import { breakpoints } from "@carbon/layout";
|
|
|
33
34
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
34
35
|
* LICENSE file in the root directory of this source tree.
|
|
35
36
|
*/
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated PageHeader has moved to Carbon for IBM Products.
|
|
39
|
+
* See https://github.com/carbon-design-system/carbon/issues/21926
|
|
40
|
+
*/
|
|
41
|
+
const pageHeaderDeprecationMessage = (componentName) => `The \`${componentName}\` component in \`@carbon/react\` has been deprecated and moved to \`@carbon/ibm-products\`. See https://github.com/carbon-design-system/carbon/issues/21926`;
|
|
42
|
+
const usePageHeaderDeprecation = (componentName) => {
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
deprecateComponent(componentName, pageHeaderDeprecationMessage(componentName));
|
|
45
|
+
}, [componentName]);
|
|
46
|
+
};
|
|
36
47
|
const PageHeader = React.forwardRef(({ className, children, ...other }, ref) => {
|
|
48
|
+
usePageHeaderDeprecation("PageHeader");
|
|
37
49
|
return /* @__PURE__ */ jsx("div", {
|
|
38
50
|
className: classNames({ [`${usePrefix()}--page-header`]: true }, className),
|
|
39
51
|
ref,
|
|
@@ -43,6 +55,7 @@ const PageHeader = React.forwardRef(({ className, children, ...other }, ref) =>
|
|
|
43
55
|
});
|
|
44
56
|
PageHeader.displayName = "PageHeader";
|
|
45
57
|
const PageHeaderBreadcrumbBar = React.forwardRef(({ border = true, className, children, renderIcon: IconElement, contentActions, contentActionsFlush, pageActions, pageActionsFlush, ...other }, ref) => {
|
|
58
|
+
usePageHeaderDeprecation("PageHeaderBreadcrumbBar");
|
|
46
59
|
const prefix = usePrefix();
|
|
47
60
|
const classNames$1 = classNames({
|
|
48
61
|
[`${prefix}--page-header__breadcrumb-bar`]: true,
|
|
@@ -79,6 +92,7 @@ const PageHeaderBreadcrumbBar = React.forwardRef(({ border = true, className, ch
|
|
|
79
92
|
});
|
|
80
93
|
PageHeaderBreadcrumbBar.displayName = "PageHeaderBreadcrumbBar";
|
|
81
94
|
const PageHeaderContent = React.forwardRef(({ className, children, title, renderIcon: IconElement, contextualActions, pageActions, ...other }, ref) => {
|
|
95
|
+
usePageHeaderDeprecation("PageHeaderContent");
|
|
82
96
|
const prefix = usePrefix();
|
|
83
97
|
const classNames$2 = classNames({ [`${prefix}--page-header__content`]: true }, className);
|
|
84
98
|
const titleRef = useRef(null);
|
|
@@ -141,6 +155,7 @@ PageHeaderContent.propTypes = {
|
|
|
141
155
|
pageActions: PropTypes.node
|
|
142
156
|
};
|
|
143
157
|
const PageHeaderContentPageActions = ({ className, children, menuButtonLabel = "Actions", actions, ...other }) => {
|
|
158
|
+
usePageHeaderDeprecation("PageHeaderContentPageActions");
|
|
144
159
|
const classNames$3 = classNames({ [`${usePrefix()}--page-header__content__page-actions`]: true }, className);
|
|
145
160
|
const containerRef = useRef(null);
|
|
146
161
|
const offsetRef = useRef(null);
|
|
@@ -194,6 +209,7 @@ PageHeaderContentPageActions.propTypes = {
|
|
|
194
209
|
actions: PropTypes.oneOfType([PropTypes.node, PropTypes.array])
|
|
195
210
|
};
|
|
196
211
|
const PageHeaderContentText = ({ className, children, subtitle, ...other }) => {
|
|
212
|
+
usePageHeaderDeprecation("PageHeaderContentText");
|
|
197
213
|
const prefix = usePrefix();
|
|
198
214
|
return /* @__PURE__ */ jsxs("div", {
|
|
199
215
|
className: classNames({ [`${prefix}--page-header__content__body`]: true }, className),
|
|
@@ -212,6 +228,7 @@ PageHeaderContentText.propTypes = {
|
|
|
212
228
|
subtitle: PropTypes.string
|
|
213
229
|
};
|
|
214
230
|
const PageHeaderHeroImage = ({ className, children, ...other }) => {
|
|
231
|
+
usePageHeaderDeprecation("PageHeaderHeroImage");
|
|
215
232
|
const classNames$4 = classNames({ [`${usePrefix()}--page-header__hero-image`]: true }, className);
|
|
216
233
|
const isLg = useMatchMedia(`(min-width: ${breakpoints.lg.width})`);
|
|
217
234
|
return /* @__PURE__ */ jsx(AspectRatio, {
|
|
@@ -227,6 +244,7 @@ PageHeaderHeroImage.propTypes = {
|
|
|
227
244
|
className: PropTypes.string
|
|
228
245
|
};
|
|
229
246
|
const PageHeaderTabBar = React.forwardRef(({ className, children, tags = [], ...other }, ref) => {
|
|
247
|
+
usePageHeaderDeprecation("PageHeaderTabBar");
|
|
230
248
|
const prefix = usePrefix();
|
|
231
249
|
const classNames$5 = classNames({ [`${prefix}--page-header__tab-bar`]: true }, className);
|
|
232
250
|
const [openPopover, setOpenPopover] = useState(false);
|
|
@@ -4,5 +4,9 @@
|
|
|
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
|
+
/**
|
|
8
|
+
* @deprecated PageHeader has moved to Carbon for IBM Products.
|
|
9
|
+
* See https://github.com/carbon-design-system/carbon/issues/21926
|
|
10
|
+
*/
|
|
7
11
|
export { PageHeader, PageHeaderBreadcrumbBar, PageHeaderContent, PageHeaderContentPageActions, PageHeaderContentText, PageHeaderTabBar, PageHeaderHeroImage, Root, BreadcrumbBar, Content, ContentPageActions, ContentText, TabBar, HeroImage, } from './PageHeader';
|
|
8
12
|
export type { PageHeaderProps, PageHeaderBreadcrumbBarProps, PageHeaderContentProps, PageHeaderContentPageActionsProps, PageHeaderContentTextProps, PageHeaderTabBarProps, PageHeaderHeroImageProps, } from './PageHeader';
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
export interface SwitcherDividerProps {
|
|
9
9
|
/**
|
|
10
|
-
* Optionally provide a custom class to apply to the underlying `<
|
|
10
|
+
* Optionally provide a custom class to apply to the underlying `<hr>` node
|
|
11
11
|
*/
|
|
12
12
|
className?: string;
|
|
13
13
|
}
|
|
@@ -15,7 +15,7 @@ declare const SwitcherDivider: {
|
|
|
15
15
|
({ className: customClassName, ...other }: SwitcherDividerProps): import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
propTypes: {
|
|
17
17
|
/**
|
|
18
|
-
* Optionally provide a custom class to apply to the underlying `<
|
|
18
|
+
* Optionally provide a custom class to apply to the underlying `<hr>` node
|
|
19
19
|
*/
|
|
20
20
|
className: PropTypes.Requireable<string>;
|
|
21
21
|
};
|
|
@@ -13,10 +13,10 @@ import { jsx } from "react/jsx-runtime";
|
|
|
13
13
|
//#region src/components/UIShell/SwitcherDivider.tsx
|
|
14
14
|
const SwitcherDivider = ({ className: customClassName, ...other }) => {
|
|
15
15
|
const classNames$1 = classNames(`${usePrefix()}--switcher__item--divider`, { [customClassName || ""]: !!customClassName });
|
|
16
|
-
return /* @__PURE__ */ jsx("hr", {
|
|
16
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("hr", {
|
|
17
17
|
...other,
|
|
18
18
|
className: classNames$1
|
|
19
|
-
});
|
|
19
|
+
}) });
|
|
20
20
|
};
|
|
21
21
|
SwitcherDivider.propTypes = { className: PropTypes.string };
|
|
22
22
|
//#endregion
|
package/es/internal/warning.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
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
|
-
import React
|
|
7
|
+
import React from 'react';
|
|
8
8
|
import { IconButtonKind } from '../IconButton';
|
|
9
9
|
import { PolymorphicComponentPropWithRef } from '../../internal/PolymorphicProps';
|
|
10
10
|
export declare const ButtonKinds: readonly ["primary", "secondary", "danger", "ghost", "danger--primary", "danger--ghost", "danger--tertiary", "tertiary"];
|
|
@@ -82,6 +82,6 @@ export interface ButtonBaseProps extends React.ButtonHTMLAttributes<HTMLButtonEl
|
|
|
82
82
|
tooltipPosition?: ButtonTooltipPosition;
|
|
83
83
|
}
|
|
84
84
|
export type ButtonProps<T extends React.ElementType> = PolymorphicComponentPropWithRef<T, ButtonBaseProps>;
|
|
85
|
-
export type ButtonComponent = <T extends React.ElementType = 'button'>(props: ButtonProps<T
|
|
85
|
+
export type ButtonComponent = <T extends React.ElementType = 'button'>(props: ButtonProps<T>, context?: any) => React.ReactElement | any;
|
|
86
86
|
declare const _default: ButtonComponent;
|
|
87
87
|
export default _default;
|
|
@@ -17,7 +17,7 @@ prop_types = require_runtime.__toESM(prop_types);
|
|
|
17
17
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
18
18
|
//#region src/components/ChatButton/ChatButton.tsx
|
|
19
19
|
/**
|
|
20
|
-
* Copyright IBM Corp. 2024,
|
|
20
|
+
* Copyright IBM Corp. 2024, 2026
|
|
21
21
|
*
|
|
22
22
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
23
23
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -27,6 +27,7 @@ const require_wrapFocus = require("../../internal/wrapFocus.js");
|
|
|
27
27
|
const require_Dialog = require("../Dialog/Dialog.js");
|
|
28
28
|
const require_useComposedModalState = require("./useComposedModalState.js");
|
|
29
29
|
const require_ComposedModalPresence = require("./ComposedModalPresence.js");
|
|
30
|
+
const require_isTopmostVisibleModal = require("../Modal/isTopmostVisibleModal.js");
|
|
30
31
|
let classnames = require("classnames");
|
|
31
32
|
classnames = require_runtime.__toESM(classnames);
|
|
32
33
|
let react = require("react");
|
|
@@ -102,9 +103,14 @@ const ComposedModalDialog = react.default.forwardRef(function ComposedModalDialo
|
|
|
102
103
|
const button = (0, react.useRef)(null);
|
|
103
104
|
const startSentinel = (0, react.useRef)(null);
|
|
104
105
|
const endSentinel = (0, react.useRef)(null);
|
|
106
|
+
const modalRef = (0, react.useRef)(null);
|
|
105
107
|
const onMouseDownTarget = (0, react.useRef)(null);
|
|
106
108
|
const presenceContext = (0, react.useContext)(require_ComposedModalPresence.ComposedModalPresenceContext);
|
|
107
|
-
const mergedRefs = (0, _floating_ui_react.useMergeRefs)([
|
|
109
|
+
const mergedRefs = (0, _floating_ui_react.useMergeRefs)([
|
|
110
|
+
modalRef,
|
|
111
|
+
ref,
|
|
112
|
+
presenceContext?.presenceRef
|
|
113
|
+
]);
|
|
108
114
|
const enablePresence = require_index.useFeatureFlag("enable-presence") || presenceContext?.autoEnablePresence;
|
|
109
115
|
const open = externalOpen || enablePresence;
|
|
110
116
|
const modalState = require_useComposedModalState.useComposedModalState(open);
|
|
@@ -188,15 +194,14 @@ const ComposedModalDialog = react.default.forwardRef(function ComposedModalDialo
|
|
|
188
194
|
(0, react.useEffect)(() => {
|
|
189
195
|
if (!open) return;
|
|
190
196
|
const handleEscapeKey = (event) => {
|
|
191
|
-
if (require_match.match(event, require_keys.Escape)) {
|
|
197
|
+
if (require_match.match(event, require_keys.Escape) && require_isTopmostVisibleModal.isTopmostVisibleModal(modalRef.current, prefix)) {
|
|
192
198
|
event.preventDefault();
|
|
193
|
-
event.stopPropagation();
|
|
194
199
|
closeModal(event);
|
|
195
200
|
}
|
|
196
201
|
};
|
|
197
|
-
document.addEventListener("keydown", handleEscapeKey
|
|
202
|
+
document.addEventListener("keydown", handleEscapeKey);
|
|
198
203
|
return () => {
|
|
199
|
-
document.removeEventListener("keydown", handleEscapeKey
|
|
204
|
+
document.removeEventListener("keydown", handleEscapeKey);
|
|
200
205
|
};
|
|
201
206
|
}, [open]);
|
|
202
207
|
(0, react.useEffect)(() => {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
require("../../_virtual/_rolldown/runtime.js");
|
|
9
9
|
//#region src/components/ErrorBoundary/ErrorBoundaryContext.ts
|
|
10
10
|
/**
|
|
11
|
-
* Copyright IBM Corp. 2016,
|
|
11
|
+
* Copyright IBM Corp. 2016, 2026
|
|
12
12
|
*
|
|
13
13
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
14
14
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -11,6 +11,7 @@ interface FileItem {
|
|
|
11
11
|
file: File & {
|
|
12
12
|
invalidFileType?: boolean;
|
|
13
13
|
};
|
|
14
|
+
disabled?: boolean;
|
|
14
15
|
}
|
|
15
16
|
export interface FileChangeData {
|
|
16
17
|
addedFiles: FileItem[];
|
|
@@ -113,6 +114,10 @@ export interface FileUploaderHandle {
|
|
|
113
114
|
* Get current files (only available when 'enable-enhanced-file-uploader' feature flag is enabled)
|
|
114
115
|
*/
|
|
115
116
|
getCurrentFiles?: () => FileItem[];
|
|
117
|
+
/**
|
|
118
|
+
* Set current files (only available when 'enable-enhanced-file-uploader' feature flag is enabled)
|
|
119
|
+
*/
|
|
120
|
+
setCurrentFiles?: (files: FileItem[]) => void;
|
|
116
121
|
}
|
|
117
122
|
declare const FileUploader: {
|
|
118
123
|
(props: FileUploaderProps): React.ReactElement;
|
|
@@ -158,9 +158,14 @@ const FileUploader = (0, react.forwardRef)(({ accept, buttonKind, buttonLabel, c
|
|
|
158
158
|
});
|
|
159
159
|
} else setLegacyFileNames([]);
|
|
160
160
|
},
|
|
161
|
-
...enhancedFileUploaderEnabled && {
|
|
162
|
-
|
|
163
|
-
|
|
161
|
+
...enhancedFileUploaderEnabled && {
|
|
162
|
+
getCurrentFiles() {
|
|
163
|
+
return [...fileItems];
|
|
164
|
+
},
|
|
165
|
+
setCurrentFiles: (files) => {
|
|
166
|
+
setFileItems(files);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
164
169
|
}), [
|
|
165
170
|
enhancedFileUploaderEnabled,
|
|
166
171
|
fileItems,
|
|
@@ -171,12 +176,14 @@ const FileUploader = (0, react.forwardRef)(({ accept, buttonKind, buttonLabel, c
|
|
|
171
176
|
[className]: className
|
|
172
177
|
});
|
|
173
178
|
const getHelperLabelClasses = (baseClass) => (0, classnames.default)(baseClass, { [`${prefix}--label-description--disabled`]: disabled });
|
|
174
|
-
const
|
|
179
|
+
const getSelectedFileClasses = (file) => (0, classnames.default)(`${prefix}--file__selected-file`, {
|
|
175
180
|
[`${prefix}--file__selected-file--md`]: size === "field" || size === "md",
|
|
176
|
-
[`${prefix}--file__selected-file--sm`]: size === "small" || size === "sm"
|
|
181
|
+
[`${prefix}--file__selected-file--sm`]: size === "small" || size === "sm",
|
|
182
|
+
[`${prefix}--file__selected-file--disabled`]: file.disabled
|
|
177
183
|
});
|
|
178
184
|
const displayFiles = enhancedFileUploaderEnabled ? fileItems.map((item, index) => ({
|
|
179
185
|
name: item.name,
|
|
186
|
+
disabled: item.disabled,
|
|
180
187
|
key: item.uuid,
|
|
181
188
|
index
|
|
182
189
|
})) : legacyFileNames.map((name, index) => ({
|
|
@@ -215,7 +222,7 @@ const FileUploader = (0, react.forwardRef)(({ accept, buttonKind, buttonLabel, c
|
|
|
215
222
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
216
223
|
className: `${prefix}--file-container`,
|
|
217
224
|
children: displayFiles.length === 0 ? null : displayFiles.map((file) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
218
|
-
className:
|
|
225
|
+
className: getSelectedFileClasses(file),
|
|
219
226
|
ref: (node) => {
|
|
220
227
|
nodes[file.index] = node;
|
|
221
228
|
},
|
|
@@ -229,6 +236,7 @@ const FileUploader = (0, react.forwardRef)(({ accept, buttonKind, buttonLabel, c
|
|
|
229
236
|
className: `${prefix}--file__state-container`,
|
|
230
237
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Filename.default, {
|
|
231
238
|
name: file.name,
|
|
239
|
+
disabled: file.disabled,
|
|
232
240
|
iconDescription,
|
|
233
241
|
status: filenameStatus,
|
|
234
242
|
onKeyDown: (evt) => {
|
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import React, { type HTMLAttributes } from 'react';
|
|
9
9
|
export interface FileUploaderItemProps extends HTMLAttributes<HTMLSpanElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Specify whether file uploader item is disabled
|
|
12
|
+
*/
|
|
13
|
+
disabled?: boolean;
|
|
10
14
|
/**
|
|
11
15
|
* Error message body for an invalid file upload
|
|
12
16
|
*/
|
|
@@ -52,7 +56,7 @@ export interface FileUploaderItemProps extends HTMLAttributes<HTMLSpanElement> {
|
|
|
52
56
|
*/
|
|
53
57
|
uuid?: string;
|
|
54
58
|
}
|
|
55
|
-
declare function FileUploaderItem({ uuid, name, status, iconDescription, onDelete, invalid, errorSubject, errorBody, size, className, ...other }: FileUploaderItemProps): import("react/jsx-runtime").JSX.Element;
|
|
59
|
+
declare function FileUploaderItem({ uuid, name, status, iconDescription, onDelete, invalid, errorSubject, errorBody, size, className, disabled, ...other }: FileUploaderItemProps): import("react/jsx-runtime").JSX.Element;
|
|
56
60
|
declare namespace FileUploaderItem {
|
|
57
61
|
var propTypes: {
|
|
58
62
|
/**
|
|
@@ -29,7 +29,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
29
29
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
30
30
|
* LICENSE file in the root directory of this source tree.
|
|
31
31
|
*/
|
|
32
|
-
function FileUploaderItem({ uuid, name, status = "uploading", iconDescription, onDelete = require_noopFn.noopFn, invalid, errorSubject, errorBody, size, className, ...other }) {
|
|
32
|
+
function FileUploaderItem({ uuid, name, status = "uploading", iconDescription, onDelete = require_noopFn.noopFn, invalid, errorSubject, errorBody, size, className, disabled, ...other }) {
|
|
33
33
|
const textRef = (0, react.useRef)(null);
|
|
34
34
|
const [isEllipsisApplied, setIsEllipsisApplied] = (0, react.useState)(false);
|
|
35
35
|
const prefix = require_usePrefix.usePrefix();
|
|
@@ -38,7 +38,8 @@ function FileUploaderItem({ uuid, name, status = "uploading", iconDescription, o
|
|
|
38
38
|
const classes = (0, classnames.default)(`${prefix}--file__selected-file`, className, {
|
|
39
39
|
[`${prefix}--file__selected-file--invalid`]: invalid,
|
|
40
40
|
[`${prefix}--file__selected-file--md`]: size === "md",
|
|
41
|
-
[`${prefix}--file__selected-file--sm`]: size === "sm"
|
|
41
|
+
[`${prefix}--file__selected-file--sm`]: size === "sm",
|
|
42
|
+
[`${prefix}--file__selected-file--disabled`]: disabled
|
|
42
43
|
});
|
|
43
44
|
const isInvalid = invalid ? `${prefix}--file-filename-container-wrap-invalid` : `${prefix}--file-filename-container-wrap`;
|
|
44
45
|
const filterSpaceName = (name) => {
|
|
@@ -93,6 +94,7 @@ function FileUploaderItem({ uuid, name, status = "uploading", iconDescription, o
|
|
|
93
94
|
className: `${prefix}--file__state-container`,
|
|
94
95
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Filename.default, {
|
|
95
96
|
name,
|
|
97
|
+
disabled,
|
|
96
98
|
iconDescription,
|
|
97
99
|
status,
|
|
98
100
|
invalid,
|
|
@@ -17,6 +17,10 @@ export interface FilenameProps extends Omit<HTMLAttributes<HTMLElement> & SVGAtt
|
|
|
17
17
|
* Provide a description of the SVG icon to denote file upload status
|
|
18
18
|
*/
|
|
19
19
|
iconDescription?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Specify whether the file uploader item is disabled
|
|
22
|
+
*/
|
|
23
|
+
disabled?: boolean;
|
|
20
24
|
/**
|
|
21
25
|
* Specify if the file is invalid
|
|
22
26
|
*/
|
|
@@ -34,7 +38,7 @@ export interface FilenameProps extends Omit<HTMLAttributes<HTMLElement> & SVGAtt
|
|
|
34
38
|
*/
|
|
35
39
|
tabIndex?: number;
|
|
36
40
|
}
|
|
37
|
-
declare function Filename({ iconDescription, status, invalid, name, tabIndex, ['aria-describedby']: ariaDescribedBy, ...rest }: FilenameProps): import("react/jsx-runtime").JSX.Element | null;
|
|
41
|
+
declare function Filename({ iconDescription, status, invalid, disabled, name, tabIndex, ['aria-describedby']: ariaDescribedBy, ...rest }: FilenameProps): import("react/jsx-runtime").JSX.Element | null;
|
|
38
42
|
declare namespace Filename {
|
|
39
43
|
var propTypes: {
|
|
40
44
|
/**
|
|
@@ -21,7 +21,7 @@ let _carbon_icons_react = require("@carbon/icons-react");
|
|
|
21
21
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
22
22
|
* LICENSE file in the root directory of this source tree.
|
|
23
23
|
*/
|
|
24
|
-
function Filename({ iconDescription = "Uploading file", status = "uploading", invalid, name, tabIndex = 0, ["aria-describedby"]: ariaDescribedBy, ...rest }) {
|
|
24
|
+
function Filename({ iconDescription = "Uploading file", status = "uploading", invalid, disabled, name, tabIndex = 0, ["aria-describedby"]: ariaDescribedBy, ...rest }) {
|
|
25
25
|
const prefix = require_usePrefix.usePrefix();
|
|
26
26
|
switch (status) {
|
|
27
27
|
case "uploading": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index.default, {
|
|
@@ -31,6 +31,7 @@ function Filename({ iconDescription = "Uploading file", status = "uploading", in
|
|
|
31
31
|
className: `${prefix}--file-loading`
|
|
32
32
|
});
|
|
33
33
|
case "edit": return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [invalid && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_carbon_icons_react.WarningFilled, { className: `${prefix}--file-invalid` }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
34
|
+
disabled,
|
|
34
35
|
"aria-label": `${iconDescription} - ${name}`,
|
|
35
36
|
className: `${prefix}--file-close`,
|
|
36
37
|
type: "button",
|
|
@@ -38,13 +38,21 @@ const MenuItem = (0, react.forwardRef)(function MenuItem({ children, className,
|
|
|
38
38
|
const [rtl, setRtl] = (0, react.useState)(false);
|
|
39
39
|
const { refs, floatingStyles, context: floatingContext } = (0, _floating_ui_react.useFloating)({
|
|
40
40
|
open: submenuOpen,
|
|
41
|
-
onOpenChange:
|
|
41
|
+
onOpenChange: (open, event) => {
|
|
42
|
+
if (open) setSubmenuOpen(true);
|
|
43
|
+
else {
|
|
44
|
+
const relatedTarget = event && "relatedTarget" in event ? event.relatedTarget : null;
|
|
45
|
+
if (relatedTarget instanceof Node && menuItem.current?.contains(relatedTarget)) return;
|
|
46
|
+
setSubmenuOpen(false);
|
|
47
|
+
if (!(relatedTarget instanceof HTMLElement && relatedTarget.closest("[role=\"menuitem\"]")?.querySelector("[role=\"menu\"]"))) menuItem.current?.focus();
|
|
48
|
+
}
|
|
49
|
+
},
|
|
42
50
|
placement: rtl ? "left-start" : "right-start",
|
|
43
51
|
whileElementsMounted: _floating_ui_react.autoUpdate,
|
|
44
|
-
middleware: [(0, _floating_ui_react.offset)({
|
|
45
|
-
mainAxis: -6,
|
|
52
|
+
middleware: [(0, _floating_ui_react.flip)(), (0, _floating_ui_react.offset)(({ placement }) => ({
|
|
53
|
+
mainAxis: placement.startsWith("left") ? 10 : -6,
|
|
46
54
|
crossAxis: -6
|
|
47
|
-
})],
|
|
55
|
+
}))],
|
|
48
56
|
strategy: "fixed"
|
|
49
57
|
});
|
|
50
58
|
const { getReferenceProps, getFloatingProps } = (0, _floating_ui_react.useInteractions)([(0, _floating_ui_react.useHover)(floatingContext, {
|
|
@@ -30,6 +30,7 @@ const require_toggleClass = require("../../tools/toggleClass.js");
|
|
|
30
30
|
const require_requiredIfGivenPropIsTruthy = require("../../prop-types/requiredIfGivenPropIsTruthy.js");
|
|
31
31
|
const require_wrapFocus = require("../../internal/wrapFocus.js");
|
|
32
32
|
const require_Dialog = require("../Dialog/Dialog.js");
|
|
33
|
+
const require_isTopmostVisibleModal = require("./isTopmostVisibleModal.js");
|
|
33
34
|
const require_usePreviousValue = require("../../internal/usePreviousValue.js");
|
|
34
35
|
const require_ModalPresence = require("./ModalPresence.js");
|
|
35
36
|
let classnames = require("classnames");
|
|
@@ -82,6 +83,7 @@ const ModalDialog = react.default.forwardRef(function ModalDialog({ "aria-label"
|
|
|
82
83
|
const secondaryButton = (0, react.useRef)(null);
|
|
83
84
|
const contentRef = (0, react.useRef)(null);
|
|
84
85
|
const innerModal = (0, react.useRef)(null);
|
|
86
|
+
const modalRef = (0, react.useRef)(null);
|
|
85
87
|
const startTrap = (0, react.useRef)(null);
|
|
86
88
|
const endTrap = (0, react.useRef)(null);
|
|
87
89
|
const wrapFocusTimeout = (0, react.useRef)(null);
|
|
@@ -93,7 +95,11 @@ const ModalDialog = react.default.forwardRef(function ModalDialog({ "aria-label"
|
|
|
93
95
|
const primaryButtonClass = (0, classnames.default)({ [`${prefix}--btn--loading`]: loadingStatus !== "inactive" });
|
|
94
96
|
const loadingActive = loadingStatus !== "inactive";
|
|
95
97
|
const presenceContext = (0, react.useContext)(require_ModalPresence.ModalPresenceContext);
|
|
96
|
-
const mergedRefs = require_useMergedRefs.useMergedRefs([
|
|
98
|
+
const mergedRefs = require_useMergedRefs.useMergedRefs([
|
|
99
|
+
modalRef,
|
|
100
|
+
ref,
|
|
101
|
+
presenceContext?.presenceRef
|
|
102
|
+
]);
|
|
97
103
|
const enablePresence = require_index.useFeatureFlag("enable-presence") || presenceContext?.autoEnablePresence;
|
|
98
104
|
const open = externalOpen || enablePresence;
|
|
99
105
|
const prevOpen = require_usePreviousValue.usePreviousValue(open);
|
|
@@ -107,14 +113,19 @@ const ModalDialog = react.default.forwardRef(function ModalDialog({ "aria-label"
|
|
|
107
113
|
}
|
|
108
114
|
function handleKeyDown(evt) {
|
|
109
115
|
const { target } = evt;
|
|
110
|
-
evt.stopPropagation();
|
|
111
116
|
if (open && target instanceof HTMLElement) {
|
|
112
|
-
if (require_match.match(evt, require_keys.Enter) && shouldSubmitOnEnter && !isCloseButton(target) && document.activeElement !== button.current)
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
if (require_match.match(evt, require_keys.Enter) && shouldSubmitOnEnter && !isCloseButton(target) && document.activeElement !== button.current) {
|
|
118
|
+
evt.stopPropagation();
|
|
119
|
+
onRequestSubmit(evt);
|
|
120
|
+
}
|
|
121
|
+
if (focusTrapWithoutSentinels && !enableDialogElement && require_match.match(evt, require_keys.Tab) && innerModal.current) {
|
|
122
|
+
evt.stopPropagation();
|
|
123
|
+
require_wrapFocus.wrapFocusWithoutSentinels({
|
|
124
|
+
containerNode: innerModal.current,
|
|
125
|
+
currentActiveNode: target,
|
|
126
|
+
event: evt
|
|
127
|
+
});
|
|
128
|
+
}
|
|
118
129
|
}
|
|
119
130
|
}
|
|
120
131
|
function handleOnClick(evt) {
|
|
@@ -191,15 +202,14 @@ const ModalDialog = react.default.forwardRef(function ModalDialog({ "aria-label"
|
|
|
191
202
|
(0, react.useEffect)(() => {
|
|
192
203
|
if (!open) return;
|
|
193
204
|
const handleEscapeKey = (event) => {
|
|
194
|
-
if (require_match.match(event, require_keys.Escape)) {
|
|
205
|
+
if (require_match.match(event, require_keys.Escape) && require_isTopmostVisibleModal.isTopmostVisibleModal(modalRef.current, prefix)) {
|
|
195
206
|
event.preventDefault();
|
|
196
|
-
event.stopPropagation();
|
|
197
207
|
onRequestClose(event);
|
|
198
208
|
}
|
|
199
209
|
};
|
|
200
|
-
document.addEventListener("keydown", handleEscapeKey
|
|
210
|
+
document.addEventListener("keydown", handleEscapeKey);
|
|
201
211
|
return () => {
|
|
202
|
-
document.removeEventListener("keydown", handleEscapeKey
|
|
212
|
+
document.removeEventListener("keydown", handleEscapeKey);
|
|
203
213
|
};
|
|
204
214
|
}, [open]);
|
|
205
215
|
(0, react.useEffect)(() => {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2026
|
|
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 declare const isTopmostVisibleModal: (node: HTMLElement | null, prefix: string) => boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2026
|
|
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
|
+
|
|
8
|
+
//#region src/components/Modal/isTopmostVisibleModal.ts
|
|
9
|
+
/**
|
|
10
|
+
* Copyright IBM Corp. 2026
|
|
11
|
+
*
|
|
12
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
13
|
+
* LICENSE file in the root directory of this source tree.
|
|
14
|
+
*/
|
|
15
|
+
const isTopmostVisibleModal = (node, prefix) => {
|
|
16
|
+
if (!node) return false;
|
|
17
|
+
const visibleModals = document.querySelectorAll(`.${prefix}--modal.is-visible`);
|
|
18
|
+
return visibleModals.item(visibleModals.length - 1) === node;
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.isTopmostVisibleModal = isTopmostVisibleModal;
|
|
@@ -26,6 +26,7 @@ const require_ListBoxTrigger = require("../ListBox/next/ListBoxTrigger.js");
|
|
|
26
26
|
const require_mergeRefs = require("../../tools/mergeRefs.js");
|
|
27
27
|
const require_filter = require("./filter.js");
|
|
28
28
|
const require_MultiSelectPropTypes = require("./MultiSelectPropTypes.js");
|
|
29
|
+
const require_isSelectAllItem = require("./tools/isSelectAllItem.js");
|
|
29
30
|
const require_sorting = require("./tools/sorting.js");
|
|
30
31
|
const require_Selection = require("../../internal/Selection.js");
|
|
31
32
|
let classnames = require("classnames");
|
|
@@ -66,8 +67,8 @@ const FilterableMultiSelect = (0, react.forwardRef)(function FilterableMultiSele
|
|
|
66
67
|
itemToString,
|
|
67
68
|
filterItems
|
|
68
69
|
]);
|
|
69
|
-
const nonSelectAllItems = (0, react.useMemo)(() => filteredItems.filter((item) => !item
|
|
70
|
-
const selectAll = filteredItems.some(
|
|
70
|
+
const nonSelectAllItems = (0, react.useMemo)(() => filteredItems.filter((item) => !require_isSelectAllItem.isSelectAllItem(item)), [filteredItems]);
|
|
71
|
+
const selectAll = filteredItems.some(require_isSelectAllItem.isSelectAllItem);
|
|
71
72
|
const { selectedItems: controlledSelectedItems, onItemChange, clearSelection, toggleAll } = require_Selection.useSelection({
|
|
72
73
|
disabled,
|
|
73
74
|
initialSelectedItems,
|
|
@@ -135,7 +136,7 @@ const FilterableMultiSelect = (0, react.forwardRef)(function FilterableMultiSele
|
|
|
135
136
|
setIsOpen(open);
|
|
136
137
|
}, [open]);
|
|
137
138
|
const sortedItems = (0, react.useMemo)(() => {
|
|
138
|
-
const selectAllItem = items.find(
|
|
139
|
+
const selectAllItem = items.find(require_isSelectAllItem.isSelectAllItem);
|
|
139
140
|
const selectableRealItems = nonSelectAllItems.filter((item) => !item.disabled);
|
|
140
141
|
const sortedReal = sortItems(nonSelectAllItems, {
|
|
141
142
|
selectedItems: {
|
|
@@ -271,7 +272,7 @@ const FilterableMultiSelect = (0, react.forwardRef)(function FilterableMultiSele
|
|
|
271
272
|
switch (type) {
|
|
272
273
|
case InputKeyDownEnter:
|
|
273
274
|
if (sortedItems.length === 0) return changes;
|
|
274
|
-
if (changes.selectedItem && changes.selectedItem.disabled !== true) if (changes.selectedItem
|
|
275
|
+
if (changes.selectedItem && changes.selectedItem.disabled !== true) if (require_isSelectAllItem.isSelectAllItem(changes.selectedItem)) handleSelectAllClick();
|
|
275
276
|
else onItemChange(changes.selectedItem);
|
|
276
277
|
setHighlightedIndex(changes.selectedItem);
|
|
277
278
|
return {
|
|
@@ -279,7 +280,7 @@ const FilterableMultiSelect = (0, react.forwardRef)(function FilterableMultiSele
|
|
|
279
280
|
highlightedIndex: state.highlightedIndex
|
|
280
281
|
};
|
|
281
282
|
case ItemClick:
|
|
282
|
-
if (changes.selectedItem
|
|
283
|
+
if (require_isSelectAllItem.isSelectAllItem(changes.selectedItem)) handleSelectAllClick();
|
|
283
284
|
else onItemChange(changes.selectedItem);
|
|
284
285
|
setHighlightedIndex(changes.selectedItem);
|
|
285
286
|
return changes;
|
|
@@ -377,7 +378,7 @@ const FilterableMultiSelect = (0, react.forwardRef)(function FilterableMultiSele
|
|
|
377
378
|
const candidate = slug ?? decorator;
|
|
378
379
|
const candidateIsAILabel = require_utils.isComponentElement(candidate, require_index.AILabel);
|
|
379
380
|
const normalizedDecorator = candidateIsAILabel ? (0, react.cloneElement)(candidate, { size: "mini" }) : candidate;
|
|
380
|
-
const selectedItemsLength = controlledSelectedItems.filter((item) => !item
|
|
381
|
+
const selectedItemsLength = controlledSelectedItems.filter((item) => !require_isSelectAllItem.isSelectAllItem(item)).length;
|
|
381
382
|
const className = (0, classnames.default)(`${prefix}--multi-select`, `${prefix}--combo-box`, `${prefix}--multi-select--filterable`, {
|
|
382
383
|
[`${prefix}--multi-select--invalid`]: normalizedProps.invalid,
|
|
383
384
|
[`${prefix}--multi-select--invalid--focused`]: inputFocused && normalizedProps.invalid,
|
|
@@ -534,7 +535,7 @@ const FilterableMultiSelect = (0, react.forwardRef)(function FilterableMultiSele
|
|
|
534
535
|
children: isOpen ? sortedItems.map((item, index) => {
|
|
535
536
|
let isChecked;
|
|
536
537
|
let isIndeterminate = false;
|
|
537
|
-
if (item
|
|
538
|
+
if (require_isSelectAllItem.isSelectAllItem(item)) {
|
|
538
539
|
isChecked = selectAllStatus.checked;
|
|
539
540
|
isIndeterminate = selectAllStatus.indeterminate;
|
|
540
541
|
} else isChecked = controlledSelectedItems.filter((selected) => (0, react_fast_compare.default)(selected, item)).length > 0;
|
|
@@ -548,7 +549,7 @@ const FilterableMultiSelect = (0, react.forwardRef)(function FilterableMultiSele
|
|
|
548
549
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$2.default.MenuItem, {
|
|
549
550
|
"aria-label": itemText,
|
|
550
551
|
"aria-checked": isIndeterminate ? "mixed" : isChecked,
|
|
551
|
-
isActive: isChecked && !item
|
|
552
|
+
isActive: isChecked && !require_isSelectAllItem.isSelectAllItem(item),
|
|
552
553
|
isHighlighted: highlightedIndex === index,
|
|
553
554
|
title: itemText,
|
|
554
555
|
disabled,
|