@carbon/react 1.99.0 → 1.100.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 +978 -978
- package/es/components/BadgeIndicator/index.d.ts +1 -1
- package/es/components/BadgeIndicator/index.js +8 -6
- package/es/components/Breadcrumb/BreadcrumbItem.d.ts +1 -1
- package/es/components/Breadcrumb/BreadcrumbItem.js +6 -7
- package/es/components/Button/Button.Skeleton.d.ts +28 -2
- package/es/components/Button/Button.js +3 -2
- package/es/components/ChatButton/ChatButton.d.ts +3 -2
- package/es/components/CheckboxGroup/CheckboxGroup.d.ts +60 -2
- package/es/components/ComboBox/ComboBox.d.ts +6 -7
- package/es/components/ComboBox/ComboBox.js +22 -10
- package/es/components/ComposedModal/ComposedModal.d.ts +2 -2
- package/es/components/ContainedList/ContainedList.d.ts +35 -6
- package/es/components/ContainedList/ContainedList.js +3 -1
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +32 -3
- package/es/components/ContainedList/index.d.ts +1 -1
- package/es/components/ContainedList/index.js +4 -1
- package/es/components/DangerButton/DangerButton.d.ts +1 -1
- package/es/components/DataTable/DataTable.d.ts +22 -5
- package/es/components/DataTable/DataTable.js +1 -1
- package/es/components/DataTable/TableExpandRow.d.ts +1 -1
- package/es/components/DataTable/TableExpandRow.js +2 -2
- package/es/components/DataTable/TableHeader.d.ts +1 -1
- package/es/components/DataTable/TableHeader.js +18 -16
- package/es/components/DataTable/TableToolbar.d.ts +25 -1
- package/es/components/DataTable/TableToolbarMenu.d.ts +25 -5
- package/es/components/DataTable/TableToolbarMenu.js +0 -3
- package/es/components/DataTableSkeleton/DataTableSkeleton.d.ts +51 -2
- package/es/components/DataTableSkeleton/DataTableSkeleton.js +6 -0
- package/es/components/DatePicker/DatePicker.d.ts +2 -2
- package/es/components/DatePicker/DatePicker.js +38 -53
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +28 -2
- package/es/components/DatePickerInput/DatePickerInput.d.ts +1 -1
- package/es/components/DatePickerInput/DatePickerInput.js +3 -2
- package/es/components/Dialog/Dialog.d.ts +1 -1
- package/es/components/Dropdown/Dropdown.Skeleton.d.ts +19 -2
- package/es/components/Dropdown/Dropdown.d.ts +3 -4
- package/es/components/Dropdown/Dropdown.js +16 -13
- package/es/components/ExpandableSearch/ExpandableSearch.d.ts +1 -1
- package/es/components/ExpandableSearch/ExpandableSearch.js +14 -12
- package/es/components/FileUploader/FileUploader.d.ts +1 -1
- package/es/components/FileUploader/FileUploader.js +2 -2
- package/es/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
- package/es/components/FileUploader/FileUploaderDropContainer.js +28 -10
- package/es/components/FluidComboBox/FluidComboBox.Skeleton.d.ts +11 -3
- package/es/components/FluidComboBox/FluidComboBox.d.ts +2 -7
- package/es/components/FluidComboBox/FluidComboBox.js +1 -2
- package/es/components/FluidDatePicker/FluidDatePicker.Skeleton.d.ts +15 -3
- package/es/components/FluidDatePicker/FluidDatePicker.d.ts +2 -2
- package/es/components/FluidDropdown/FluidDropdown.Skeleton.d.ts +11 -3
- package/es/components/FluidDropdown/FluidDropdown.d.ts +1 -6
- package/es/components/FluidDropdown/FluidDropdown.js +1 -2
- package/es/components/FluidForm/FluidForm.d.ts +15 -2
- package/es/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +2 -2
- package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.d.ts +11 -3
- package/es/components/FluidMultiSelect/FluidMultiSelect.d.ts +1 -6
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +1 -2
- package/es/components/FluidNumberInput/FluidNumberInput.Skeleton.d.ts +11 -3
- package/es/components/FluidNumberInput/FluidNumberInput.d.ts +1 -1
- package/es/components/FluidSearch/FluidSearch.Skeleton.d.ts +11 -3
- package/es/components/FluidSearch/FluidSearch.d.ts +1 -1
- package/es/components/FluidSearch/FluidSearch.js +3 -3
- package/es/components/FluidSelect/FluidSelect.Skeleton.d.ts +11 -3
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +11 -3
- package/es/components/FluidTextArea/FluidTextArea.d.ts +95 -1
- package/es/components/FluidTextInput/FluidPasswordInput.d.ts +83 -2
- package/es/components/FluidTextInput/FluidTextInput.Skeleton.d.ts +11 -3
- package/es/components/Grid/GridContext.d.ts +19 -1
- package/es/components/IconButton/index.d.ts +1 -1
- package/es/components/IconButton/index.js +2 -2
- package/es/components/InlineLoading/InlineLoading.js +5 -11
- package/es/components/Link/Link.js +3 -0
- package/es/components/ListBox/ListBoxField.d.ts +35 -2
- package/es/components/ListBox/ListBoxMenuIcon.d.ts +16 -3
- package/es/components/ListBox/ListBoxMenuItem.d.ts +1 -1
- package/es/components/ListBox/ListBoxSelection.d.ts +34 -3
- package/es/components/Menu/MenuItem.d.ts +2 -2
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +2 -2
- package/es/components/MultiSelect/FilterableMultiSelect.js +22 -13
- package/es/components/MultiSelect/MultiSelect.d.ts +3 -4
- package/es/components/MultiSelect/MultiSelect.js +24 -22
- package/es/components/Notification/Notification.d.ts +8 -7
- package/es/components/Notification/Notification.js +4 -4
- package/es/components/OverflowMenu/OverflowMenu.d.ts +1 -1
- package/es/components/OverflowMenu/OverflowMenu.js +0 -1
- package/es/components/OverflowMenu/index.d.ts +1 -1
- package/es/components/PageHeader/PageHeader.d.ts +3 -3
- package/es/components/Popover/index.js +21 -12
- package/es/components/Search/Search.d.ts +2 -2
- package/es/components/Select/Select.d.ts +1 -1
- package/es/components/Select/Select.js +2 -2
- package/es/components/SkeletonIcon/SkeletonIcon.d.ts +16 -2
- package/es/components/SkeletonText/SkeletonText.d.ts +1 -1
- package/es/components/Tag/Tag.d.ts +1 -1
- package/es/components/Tag/Tag.js +2 -0
- package/es/components/Text/Text.d.ts +1 -1
- package/es/components/Text/Text.js +4 -3
- package/es/components/Text/TextDirection.d.ts +1 -1
- package/es/components/Text/TextDirection.js +1 -3
- package/es/components/Text/TextDirectionContext.d.ts +3 -3
- package/es/components/TextArea/TextArea.js +1 -3
- package/es/components/TextInput/ControlledPasswordInput.d.ts +1 -1
- package/es/components/TextInput/ControlledPasswordInput.js +2 -2
- package/es/components/TextInput/PasswordInput.d.ts +1 -1
- package/es/components/TextInput/PasswordInput.js +2 -2
- package/es/components/TextInput/TextInput.d.ts +1 -1
- package/es/components/TextInput/TextInput.js +2 -2
- package/es/components/Tile/Tile.d.ts +1 -1
- package/es/components/Tile/Tile.js +37 -69
- package/es/components/Toggle/Toggle.Skeleton.d.ts +9 -3
- package/es/components/Toggletip/index.d.ts +1 -1
- package/es/components/Toggletip/index.js +9 -7
- package/es/components/Tooltip/DefinitionTooltip.d.ts +52 -1
- package/es/components/Tooltip/Tooltip.js +2 -0
- package/es/components/TreeView/TreeNode.d.ts +4 -4
- package/es/components/UIShell/Header.d.ts +20 -3
- package/es/components/UIShell/HeaderGlobalAction.d.ts +2 -2
- package/es/components/UIShell/HeaderName.js +1 -1
- package/es/components/UIShell/Link.d.ts +1 -1
- package/es/components/UIShell/Link.js +14 -14
- package/es/components/UIShell/SideNav.d.ts +3 -4
- package/es/components/UIShell/SideNav.js +37 -27
- package/es/components/UIShell/SideNavDivider.d.ts +11 -3
- package/es/components/UIShell/SideNavHeader.d.ts +24 -1
- package/es/components/UIShell/SideNavIcon.d.ts +20 -2
- package/es/components/UIShell/SideNavItem.d.ts +20 -2
- package/es/components/UIShell/SideNavItems.d.ts +22 -2
- package/es/components/UIShell/SideNavLink.d.ts +1 -1
- package/es/components/UIShell/SideNavLink.js +14 -14
- package/es/components/UIShell/SideNavMenu.d.ts +1 -1
- package/es/components/UIShell/SideNavMenu.js +2 -2
- package/es/components/UIShell/SideNavMenuItem.d.ts +2 -2
- package/es/components/UIShell/SideNavMenuItem.js +2 -2
- package/es/components/UIShell/SwitcherDivider.d.ts +10 -2
- package/es/internal/FloatingMenu.d.ts +1 -1
- package/es/internal/FloatingMenu.js +0 -2
- package/es/internal/PolymorphicProps.d.ts +3 -3
- package/es/internal/useNoInteractiveChildren.d.ts +1 -1
- package/es/internal/useNoInteractiveChildren.js +8 -10
- package/es/internal/useOutsideClick.d.ts +1 -1
- package/es/internal/useOutsideClick.js +0 -4
- package/lib/components/BadgeIndicator/index.d.ts +1 -1
- package/lib/components/BadgeIndicator/index.js +7 -5
- package/lib/components/Breadcrumb/BreadcrumbItem.d.ts +1 -1
- package/lib/components/Breadcrumb/BreadcrumbItem.js +5 -6
- package/lib/components/Button/Button.Skeleton.d.ts +28 -2
- package/lib/components/Button/Button.js +3 -2
- package/lib/components/ChatButton/ChatButton.d.ts +3 -2
- package/lib/components/CheckboxGroup/CheckboxGroup.d.ts +60 -2
- package/lib/components/ComboBox/ComboBox.d.ts +6 -7
- package/lib/components/ComboBox/ComboBox.js +22 -10
- package/lib/components/ComposedModal/ComposedModal.d.ts +2 -2
- package/lib/components/ContainedList/ContainedList.d.ts +35 -6
- package/lib/components/ContainedList/ContainedList.js +3 -1
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +32 -3
- package/lib/components/ContainedList/index.d.ts +1 -1
- package/lib/components/ContainedList/index.js +4 -1
- package/lib/components/DangerButton/DangerButton.d.ts +1 -1
- package/lib/components/DataTable/DataTable.d.ts +22 -5
- package/lib/components/DataTable/DataTable.js +1 -1
- package/lib/components/DataTable/TableExpandRow.d.ts +1 -1
- package/lib/components/DataTable/TableHeader.d.ts +1 -1
- package/lib/components/DataTable/TableHeader.js +17 -15
- package/lib/components/DataTable/TableToolbar.d.ts +25 -1
- package/lib/components/DataTable/TableToolbarMenu.d.ts +25 -5
- package/lib/components/DataTable/TableToolbarMenu.js +0 -3
- package/lib/components/DataTableSkeleton/DataTableSkeleton.d.ts +51 -2
- package/lib/components/DataTableSkeleton/DataTableSkeleton.js +6 -0
- package/lib/components/DatePicker/DatePicker.d.ts +2 -2
- package/lib/components/DatePicker/DatePicker.js +37 -52
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +28 -2
- package/lib/components/DatePickerInput/DatePickerInput.d.ts +1 -1
- package/lib/components/DatePickerInput/DatePickerInput.js +2 -1
- package/lib/components/Dialog/Dialog.d.ts +1 -1
- package/lib/components/Dropdown/Dropdown.Skeleton.d.ts +19 -2
- package/lib/components/Dropdown/Dropdown.d.ts +3 -4
- package/lib/components/Dropdown/Dropdown.js +16 -13
- package/lib/components/ExpandableSearch/ExpandableSearch.d.ts +1 -1
- package/lib/components/ExpandableSearch/ExpandableSearch.js +13 -11
- package/lib/components/FileUploader/FileUploader.d.ts +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.js +28 -10
- package/lib/components/FluidComboBox/FluidComboBox.Skeleton.d.ts +11 -3
- package/lib/components/FluidComboBox/FluidComboBox.d.ts +2 -7
- package/lib/components/FluidComboBox/FluidComboBox.js +1 -2
- package/lib/components/FluidDatePicker/FluidDatePicker.Skeleton.d.ts +15 -3
- package/lib/components/FluidDatePicker/FluidDatePicker.d.ts +2 -2
- package/lib/components/FluidDropdown/FluidDropdown.Skeleton.d.ts +11 -3
- package/lib/components/FluidDropdown/FluidDropdown.d.ts +1 -6
- package/lib/components/FluidDropdown/FluidDropdown.js +1 -2
- package/lib/components/FluidForm/FluidForm.d.ts +15 -2
- package/lib/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +2 -2
- package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.d.ts +11 -3
- package/lib/components/FluidMultiSelect/FluidMultiSelect.d.ts +1 -6
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +1 -2
- package/lib/components/FluidNumberInput/FluidNumberInput.Skeleton.d.ts +11 -3
- package/lib/components/FluidNumberInput/FluidNumberInput.d.ts +1 -1
- package/lib/components/FluidSearch/FluidSearch.Skeleton.d.ts +11 -3
- package/lib/components/FluidSearch/FluidSearch.d.ts +1 -1
- package/lib/components/FluidSearch/FluidSearch.js +2 -2
- package/lib/components/FluidSelect/FluidSelect.Skeleton.d.ts +11 -3
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +11 -3
- package/lib/components/FluidTextArea/FluidTextArea.d.ts +95 -1
- package/lib/components/FluidTextInput/FluidPasswordInput.d.ts +83 -2
- package/lib/components/FluidTextInput/FluidTextInput.Skeleton.d.ts +11 -3
- package/lib/components/Grid/GridContext.d.ts +19 -1
- package/lib/components/IconButton/index.d.ts +1 -1
- package/lib/components/InlineLoading/InlineLoading.js +5 -11
- package/lib/components/Link/Link.js +3 -0
- package/lib/components/ListBox/ListBoxField.d.ts +35 -2
- package/lib/components/ListBox/ListBoxMenuIcon.d.ts +16 -3
- package/lib/components/ListBox/ListBoxMenuItem.d.ts +1 -1
- package/lib/components/ListBox/ListBoxSelection.d.ts +34 -3
- package/lib/components/Menu/MenuItem.d.ts +2 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +2 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.js +22 -13
- package/lib/components/MultiSelect/MultiSelect.d.ts +3 -4
- package/lib/components/MultiSelect/MultiSelect.js +24 -22
- package/lib/components/Notification/Notification.d.ts +8 -7
- package/lib/components/Notification/Notification.js +4 -4
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +1 -1
- package/lib/components/OverflowMenu/OverflowMenu.js +0 -1
- package/lib/components/OverflowMenu/index.d.ts +1 -1
- package/lib/components/PageHeader/PageHeader.d.ts +3 -3
- package/lib/components/Popover/index.js +19 -10
- package/lib/components/Search/Search.d.ts +2 -2
- package/lib/components/Select/Select.d.ts +1 -1
- package/lib/components/SkeletonIcon/SkeletonIcon.d.ts +16 -2
- package/lib/components/SkeletonText/SkeletonText.d.ts +1 -1
- package/lib/components/Tag/Tag.d.ts +1 -1
- package/lib/components/Tag/Tag.js +2 -0
- package/lib/components/Text/Text.d.ts +1 -1
- package/lib/components/Text/Text.js +3 -2
- package/lib/components/Text/TextDirection.d.ts +1 -1
- package/lib/components/Text/TextDirection.js +1 -3
- package/lib/components/Text/TextDirectionContext.d.ts +3 -3
- package/lib/components/TextArea/TextArea.js +1 -3
- package/lib/components/TextInput/ControlledPasswordInput.d.ts +1 -1
- package/lib/components/TextInput/PasswordInput.d.ts +1 -1
- package/lib/components/TextInput/TextInput.d.ts +1 -1
- package/lib/components/Tile/Tile.d.ts +1 -1
- package/lib/components/Tile/Tile.js +35 -67
- package/lib/components/Toggle/Toggle.Skeleton.d.ts +9 -3
- package/lib/components/Toggletip/index.d.ts +1 -1
- package/lib/components/Toggletip/index.js +7 -5
- package/lib/components/Tooltip/DefinitionTooltip.d.ts +52 -1
- package/lib/components/Tooltip/Tooltip.js +2 -0
- package/lib/components/TreeView/TreeNode.d.ts +4 -4
- package/lib/components/UIShell/Header.d.ts +20 -3
- package/lib/components/UIShell/HeaderGlobalAction.d.ts +2 -2
- package/lib/components/UIShell/HeaderName.js +1 -1
- package/lib/components/UIShell/Link.d.ts +1 -1
- package/lib/components/UIShell/Link.js +13 -13
- package/lib/components/UIShell/SideNav.d.ts +3 -4
- package/lib/components/UIShell/SideNav.js +36 -26
- package/lib/components/UIShell/SideNavDivider.d.ts +11 -3
- package/lib/components/UIShell/SideNavHeader.d.ts +24 -1
- package/lib/components/UIShell/SideNavIcon.d.ts +20 -2
- package/lib/components/UIShell/SideNavItem.d.ts +20 -2
- package/lib/components/UIShell/SideNavItems.d.ts +22 -2
- package/lib/components/UIShell/SideNavLink.d.ts +1 -1
- package/lib/components/UIShell/SideNavLink.js +14 -14
- package/lib/components/UIShell/SideNavMenu.d.ts +1 -1
- package/lib/components/UIShell/SideNavMenuItem.d.ts +2 -2
- package/lib/components/UIShell/SwitcherDivider.d.ts +10 -2
- package/lib/internal/FloatingMenu.d.ts +1 -1
- package/lib/internal/FloatingMenu.js +0 -2
- package/lib/internal/PolymorphicProps.d.ts +3 -3
- package/lib/internal/useNoInteractiveChildren.d.ts +1 -1
- package/lib/internal/useNoInteractiveChildren.js +8 -10
- package/lib/internal/useOutsideClick.d.ts +1 -1
- package/lib/internal/useOutsideClick.js +0 -4
- package/package.json +7 -7
- package/scss/_carbon-utilities.scss +9 -0
- package/telemetry.yml +0 -1
- package/es/internal/createClassWrapper.d.ts +0 -12
- package/lib/internal/createClassWrapper.d.ts +0 -12
|
@@ -25,9 +25,7 @@ const TextDirection = ({
|
|
|
25
25
|
}, [dir]);
|
|
26
26
|
React.useEffect(() => {
|
|
27
27
|
savedCallback.current = getTextDirection;
|
|
28
|
-
|
|
29
|
-
// `getTextDirection`?
|
|
30
|
-
});
|
|
28
|
+
}, [getTextDirection]);
|
|
31
29
|
return /*#__PURE__*/React.createElement(TextDirectionContext.TextDirectionContext.Provider, {
|
|
32
30
|
value: value
|
|
33
31
|
}, children);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2026
|
|
3
3
|
*
|
|
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 { type
|
|
7
|
+
import { type RefObject } from 'react';
|
|
8
8
|
export type TextDir = 'ltr' | 'rtl' | 'auto' | string;
|
|
9
9
|
export type GetTextDirection = (text: string | string[] | undefined) => TextDir;
|
|
10
10
|
export interface TextDirectionContextType {
|
|
11
11
|
direction: TextDir;
|
|
12
|
-
getTextDirection:
|
|
12
|
+
getTextDirection: RefObject<GetTextDirection | undefined>;
|
|
13
13
|
}
|
|
14
14
|
export declare const TextDirectionContext: import("react").Context<TextDirectionContextType>;
|
|
@@ -148,9 +148,7 @@ const TextArea = frFn((props, forwardRef) => {
|
|
|
148
148
|
setTimeout(() => {
|
|
149
149
|
setTextCount(0);
|
|
150
150
|
}, 0);
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
if (enableCounter && typeof maxCount !== 'undefined' && textareaRef.current !== null) {
|
|
151
|
+
} else if (enableCounter && typeof maxCount !== 'undefined' && textareaRef.current !== null) {
|
|
154
152
|
const matchedWords = evt.target?.value?.match(/\p{L}+/gu);
|
|
155
153
|
if (matchedWords && matchedWords.length <= maxCount) {
|
|
156
154
|
textareaRef.current.removeAttribute('maxLength');
|
|
@@ -384,11 +384,8 @@ const ExpandableTile = /*#__PURE__*/React.forwardRef(({
|
|
|
384
384
|
hasRoundedCorners,
|
|
385
385
|
...rest
|
|
386
386
|
}, forwardRef) => {
|
|
387
|
-
const [
|
|
388
|
-
const [
|
|
389
|
-
const [prevExpanded, setPrevExpanded] = React.useState(expanded);
|
|
390
|
-
const [prevTileMaxHeight, setPrevTileMaxHeight] = React.useState(tileMaxHeight);
|
|
391
|
-
const [prevTilePadding, setPrevTilePadding] = React.useState(tilePadding);
|
|
387
|
+
const [measuredAboveHeight, setMeasuredAboveHeight] = React.useState(0);
|
|
388
|
+
const [measuredPadding, setMeasuredPadding] = React.useState(0);
|
|
392
389
|
const [isExpanded, setIsExpanded] = React.useState(expanded);
|
|
393
390
|
const [interactive, setInteractive] = React.useState(true);
|
|
394
391
|
const aboveTheFold = React.useRef(null);
|
|
@@ -398,105 +395,74 @@ const ExpandableTile = /*#__PURE__*/React.forwardRef(({
|
|
|
398
395
|
const tile = React.useRef(null);
|
|
399
396
|
const ref = useMergedRefs.useMergedRefs([forwardRef, tile]);
|
|
400
397
|
const prefix = usePrefix.usePrefix();
|
|
401
|
-
|
|
398
|
+
React.useEffect(() => {
|
|
402
399
|
setIsExpanded(expanded);
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
setPrevTileMaxHeight(tileMaxHeight);
|
|
409
|
-
}
|
|
410
|
-
if (tilePadding !== prevTilePadding) {
|
|
411
|
-
setIsTilePadding(tilePadding);
|
|
412
|
-
setPrevTilePadding(tilePadding);
|
|
413
|
-
}
|
|
414
|
-
function setMaxHeight() {
|
|
415
|
-
if (isExpanded && tileContent.current) {
|
|
416
|
-
setIsTileMaxHeight(tileContent.current.getBoundingClientRect()?.height);
|
|
417
|
-
}
|
|
418
|
-
if (aboveTheFold.current) {
|
|
419
|
-
setIsTileMaxHeight(aboveTheFold.current.getBoundingClientRect().height);
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
function handleClick(evt) {
|
|
423
|
-
evt?.persist?.();
|
|
424
|
-
setIsExpanded(!isExpanded);
|
|
425
|
-
setMaxHeight();
|
|
426
|
-
}
|
|
427
|
-
function handleKeyUp(evt) {
|
|
400
|
+
}, [expanded]);
|
|
401
|
+
const handleClick = () => {
|
|
402
|
+
setIsExpanded(prev => !prev);
|
|
403
|
+
};
|
|
404
|
+
const handleKeyUp = evt => {
|
|
428
405
|
if (evt.target !== tile.current && evt.target !== chevronInteractiveRef.current) {
|
|
429
406
|
if (match.matches(evt, [keys.Enter, keys.Space])) {
|
|
430
407
|
evt.preventDefault();
|
|
431
408
|
}
|
|
432
409
|
}
|
|
433
|
-
}
|
|
434
|
-
function getChildren() {
|
|
435
|
-
return React.Children.toArray(children);
|
|
436
|
-
}
|
|
410
|
+
};
|
|
437
411
|
const classNames = cx(`${prefix}--tile`, `${prefix}--tile--expandable`, {
|
|
438
412
|
[`${prefix}--tile--is-expanded`]: isExpanded,
|
|
439
413
|
[`${prefix}--tile--light`]: light
|
|
440
414
|
}, className);
|
|
441
|
-
const interactiveClassNames = cx(
|
|
442
|
-
[`${prefix}--tile--is-expanded`]: isExpanded,
|
|
443
|
-
[`${prefix}--tile--light`]: light,
|
|
415
|
+
const interactiveClassNames = cx(classNames, `${prefix}--tile--expandable--interactive`, {
|
|
444
416
|
[`${prefix}--tile--slug`]: slug,
|
|
445
417
|
[`${prefix}--tile--slug-rounded`]: slug && hasRoundedCorners,
|
|
446
418
|
[`${prefix}--tile--decorator`]: decorator,
|
|
447
419
|
[`${prefix}--tile--decorator-rounded`]: decorator && hasRoundedCorners
|
|
448
|
-
}
|
|
420
|
+
});
|
|
449
421
|
const chevronInteractiveClassNames = cx(`${prefix}--tile__chevron`, `${prefix}--tile__chevron--interactive`);
|
|
450
|
-
const childrenAsArray =
|
|
422
|
+
const childrenAsArray = React.Children.toArray(children);
|
|
451
423
|
useIsomorphicEffect.default(() => {
|
|
452
424
|
if (!tile.current || !aboveTheFold.current) {
|
|
453
425
|
return;
|
|
454
426
|
}
|
|
455
|
-
const
|
|
456
|
-
const
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
} = node.getBoundingClientRect();
|
|
462
|
-
const paddingTop = parseInt(getStyle.getPropertyValue('padding-top'), 10);
|
|
463
|
-
const paddingBottom = parseInt(getStyle.getPropertyValue('padding-bottom'), 10);
|
|
464
|
-
setIsTileMaxHeight(height);
|
|
465
|
-
setIsTilePadding(paddingTop + paddingBottom);
|
|
466
|
-
}, [isTileMaxHeight]);
|
|
427
|
+
const style = window.getComputedStyle(tile.current);
|
|
428
|
+
const paddingTop = parseInt(style.getPropertyValue('padding-top'), 10) || 0;
|
|
429
|
+
const paddingBottom = parseInt(style.getPropertyValue('padding-bottom'), 10) || 0;
|
|
430
|
+
setMeasuredPadding(paddingTop + paddingBottom);
|
|
431
|
+
setMeasuredAboveHeight(aboveTheFold.current.scrollHeight);
|
|
432
|
+
}, []);
|
|
467
433
|
useIsomorphicEffect.default(() => {
|
|
468
434
|
if (!aboveTheFold.current || !belowTheFold.current) {
|
|
469
435
|
return;
|
|
470
436
|
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
if (!useNoInteractiveChildren.getInteractiveContent(belowTheFold.current) && !useNoInteractiveChildren.getRoleContent(belowTheFold.current) && !useNoInteractiveChildren.getInteractiveContent(aboveTheFold.current) && !useNoInteractiveChildren.getRoleContent(aboveTheFold.current) && !(slug || decorator)) {
|
|
475
|
-
setInteractive(false);
|
|
476
|
-
}
|
|
477
|
-
}, [slug, decorator]);
|
|
437
|
+
const hasInteractive = Boolean(useNoInteractiveChildren.getInteractiveContent(aboveTheFold.current)) || Boolean(useNoInteractiveChildren.getRoleContent(aboveTheFold.current)) || Boolean(useNoInteractiveChildren.getInteractiveContent(belowTheFold.current)) || Boolean(useNoInteractiveChildren.getRoleContent(belowTheFold.current)) || Boolean(slug || decorator);
|
|
438
|
+
setInteractive(hasInteractive);
|
|
439
|
+
}, [slug, decorator, children]);
|
|
478
440
|
useIsomorphicEffect.default(() => {
|
|
479
441
|
if (!tile.current) {
|
|
480
442
|
return;
|
|
481
443
|
}
|
|
482
444
|
if (isExpanded) {
|
|
483
445
|
tile.current.style.maxHeight = '';
|
|
484
|
-
|
|
485
|
-
tile.current.style.maxHeight = isTileMaxHeight + isTilePadding + 'px';
|
|
446
|
+
return;
|
|
486
447
|
}
|
|
487
|
-
|
|
448
|
+
const measured = measuredAboveHeight || aboveTheFold.current?.scrollHeight || 0;
|
|
449
|
+
const baseHeight = tileMaxHeight > 0 ? tileMaxHeight : measured;
|
|
450
|
+
const pad = tilePadding > 0 ? tilePadding : measuredPadding;
|
|
451
|
+
tile.current.style.maxHeight = `${baseHeight + pad}px`;
|
|
452
|
+
}, [isExpanded, tileMaxHeight, tilePadding, measuredAboveHeight, measuredPadding]);
|
|
488
453
|
React.useEffect(() => {
|
|
489
454
|
if (!aboveTheFold.current) {
|
|
490
455
|
return;
|
|
491
456
|
}
|
|
492
|
-
const resizeObserver = new ResizeObserver(
|
|
493
|
-
|
|
494
|
-
|
|
457
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
458
|
+
if (aboveTheFold.current) {
|
|
459
|
+
setMeasuredAboveHeight(aboveTheFold.current.scrollHeight);
|
|
460
|
+
}
|
|
495
461
|
});
|
|
496
462
|
resizeObserver.observe(aboveTheFold.current);
|
|
497
463
|
return () => resizeObserver.disconnect();
|
|
498
|
-
}, [
|
|
499
|
-
const belowTheFoldId = useId.useId('expandable-tile-interactive');
|
|
464
|
+
}, []);
|
|
465
|
+
const belowTheFoldId = useId.useId(interactive ? 'expandable-tile-interactive' : 'expandable-tile');
|
|
500
466
|
|
|
501
467
|
// AILabel is always size `xs`
|
|
502
468
|
const candidate = slug ?? decorator;
|
|
@@ -531,6 +497,7 @@ const ExpandableTile = /*#__PURE__*/React.forwardRef(({
|
|
|
531
497
|
type: "button",
|
|
532
498
|
ref: ref,
|
|
533
499
|
className: classNames,
|
|
500
|
+
"aria-controls": belowTheFoldId,
|
|
534
501
|
"aria-expanded": isExpanded,
|
|
535
502
|
title: isExpanded ? tileExpandedIconText : tileCollapsedIconText
|
|
536
503
|
}, rest, {
|
|
@@ -546,6 +513,7 @@ const ExpandableTile = /*#__PURE__*/React.forwardRef(({
|
|
|
546
513
|
className: `${prefix}--tile__chevron`
|
|
547
514
|
}, /*#__PURE__*/React.createElement("span", null, isExpanded ? tileExpandedLabel : tileCollapsedLabel), _ChevronDown2 || (_ChevronDown2 = /*#__PURE__*/React.createElement(iconsReact.ChevronDown, null))), /*#__PURE__*/React.createElement("div", {
|
|
548
515
|
ref: belowTheFold,
|
|
516
|
+
id: belowTheFoldId,
|
|
549
517
|
className: `${prefix}--tile-content`
|
|
550
518
|
}, childrenAsArray[1])));
|
|
551
519
|
});
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
3
|
*
|
|
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
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
8
|
export interface ToggleSkeletonProps {
|
|
9
9
|
'aria-label'?: string;
|
|
10
10
|
className?: string;
|
|
11
11
|
}
|
|
12
|
-
declare const ToggleSkeleton:
|
|
12
|
+
declare const ToggleSkeleton: {
|
|
13
|
+
({ className, ...rest }: ToggleSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
propTypes: {
|
|
15
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
16
|
+
className: PropTypes.Requireable<string>;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
13
19
|
export default ToggleSkeleton;
|
|
14
20
|
export { ToggleSkeleton };
|
|
@@ -188,7 +188,6 @@ Toggletip.propTypes = {
|
|
|
188
188
|
* `ToggletipButton` controls the visibility of the Toggletip through mouse
|
|
189
189
|
* clicks and keyboard interactions.
|
|
190
190
|
*/
|
|
191
|
-
|
|
192
191
|
const ToggletipButton = /*#__PURE__*/React.forwardRef(function ToggletipButton({
|
|
193
192
|
children,
|
|
194
193
|
className: customClassName,
|
|
@@ -229,15 +228,18 @@ ToggletipButton.propTypes = {
|
|
|
229
228
|
label: PropTypes.string
|
|
230
229
|
};
|
|
231
230
|
ToggletipButton.displayName = 'ToggletipButton';
|
|
231
|
+
const frFn = React.forwardRef;
|
|
232
|
+
|
|
232
233
|
/**
|
|
233
234
|
* `ToggletipContent` is a wrapper around `PopoverContent`. It places the
|
|
234
235
|
* `children` passed in as a prop inside of `PopoverContent` so that they will
|
|
235
236
|
* be rendered inside of the popover for this component.
|
|
236
237
|
*/
|
|
237
|
-
const ToggletipContent =
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
238
|
+
const ToggletipContent = frFn((props, ref) => {
|
|
239
|
+
const {
|
|
240
|
+
children,
|
|
241
|
+
className: customClassName
|
|
242
|
+
} = props;
|
|
241
243
|
const toggletip = useToggletip();
|
|
242
244
|
const prefix = usePrefix.usePrefix();
|
|
243
245
|
return /*#__PURE__*/React.createElement(index.PopoverContent, _rollupPluginBabelHelpers.extends({
|
|
@@ -4,6 +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 PropTypes from 'prop-types';
|
|
7
8
|
import React from 'react';
|
|
8
9
|
import { PopoverAlignment } from '../Popover';
|
|
9
10
|
export interface DefinitionTooltipProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'id' | 'classname' | 'children' | 'type'> {
|
|
@@ -54,5 +55,55 @@ export interface DefinitionTooltipProps extends Omit<React.ButtonHTMLAttributes<
|
|
|
54
55
|
*/
|
|
55
56
|
triggerClassName?: string;
|
|
56
57
|
}
|
|
57
|
-
declare const DefinitionTooltip:
|
|
58
|
+
declare const DefinitionTooltip: {
|
|
59
|
+
({ align, autoAlign, className, children, definition, defaultOpen, id, openOnHover, tooltipText, triggerClassName, ...rest }: DefinitionTooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
60
|
+
propTypes: {
|
|
61
|
+
/**
|
|
62
|
+
* Specify how the trigger should align with the tooltip
|
|
63
|
+
*/
|
|
64
|
+
align: PropTypes.Requireable<string>;
|
|
65
|
+
/**
|
|
66
|
+
* Will auto-align the popover. This prop is currently experimental and is
|
|
67
|
+
* subject to future changes. Requires React v17+
|
|
68
|
+
* @see https://github.com/carbon-design-system/carbon/issues/18714
|
|
69
|
+
*/
|
|
70
|
+
autoAlign: PropTypes.Requireable<boolean>;
|
|
71
|
+
/**
|
|
72
|
+
* The `children` prop will be used as the value that is being defined
|
|
73
|
+
*/
|
|
74
|
+
children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
75
|
+
/**
|
|
76
|
+
* Specify an optional className to be applied to the container node
|
|
77
|
+
*/
|
|
78
|
+
className: PropTypes.Requireable<string>;
|
|
79
|
+
/**
|
|
80
|
+
* Specify whether the tooltip should be open when it first renders
|
|
81
|
+
*/
|
|
82
|
+
defaultOpen: PropTypes.Requireable<boolean>;
|
|
83
|
+
/**
|
|
84
|
+
* The `definition` prop is used as the content inside of the tooltip that
|
|
85
|
+
* appears when a user interacts with the element rendered by the `children`
|
|
86
|
+
* prop
|
|
87
|
+
*/
|
|
88
|
+
definition: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
89
|
+
/**
|
|
90
|
+
* Provide a value that will be assigned as the id of the tooltip
|
|
91
|
+
*/
|
|
92
|
+
id: PropTypes.Requireable<string>;
|
|
93
|
+
/**
|
|
94
|
+
* Specifies whether or not the `DefinitionTooltip` should open on hover or not
|
|
95
|
+
*/
|
|
96
|
+
openOnHover: PropTypes.Requireable<boolean>;
|
|
97
|
+
/**
|
|
98
|
+
* [Deprecated in v11] Please use the `definition` prop instead.
|
|
99
|
+
*
|
|
100
|
+
* Provide the text that will be displayed in the tooltip when it is rendered.
|
|
101
|
+
*/
|
|
102
|
+
tooltipText: (props: Record<string, any>, propName: string, componentName: string, ...rest: any[]) => any;
|
|
103
|
+
/**
|
|
104
|
+
* The CSS class name of the trigger element
|
|
105
|
+
*/
|
|
106
|
+
triggerClassName: PropTypes.Requireable<string>;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
58
109
|
export { DefinitionTooltip };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2026
|
|
3
3
|
*
|
|
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, { type
|
|
7
|
+
import React, { type ElementType } from 'react';
|
|
8
8
|
type UncontrolledOnToggle = (event: React.MouseEvent | React.KeyboardEvent, node: Pick<TreeNodeProps, 'id' | 'label' | 'value' | 'isExpanded'>) => void;
|
|
9
9
|
type ControlledOnToggle = (isExpanded: TreeNodeProps['isExpanded']) => void;
|
|
10
10
|
export type TreeNodeProps = {
|
|
@@ -78,7 +78,7 @@ export type TreeNodeProps = {
|
|
|
78
78
|
/**
|
|
79
79
|
* A component used to render an icon.
|
|
80
80
|
*/
|
|
81
|
-
renderIcon?:
|
|
81
|
+
renderIcon?: ElementType;
|
|
82
82
|
/**
|
|
83
83
|
* **Note:** this is controlled by the parent TreeView component, do not set manually.
|
|
84
84
|
* Array containing all selected node IDs in the tree
|
|
@@ -178,7 +178,7 @@ declare const TreeNode: React.ForwardRefExoticComponent<{
|
|
|
178
178
|
/**
|
|
179
179
|
* A component used to render an icon.
|
|
180
180
|
*/
|
|
181
|
-
renderIcon?:
|
|
181
|
+
renderIcon?: ElementType;
|
|
182
182
|
/**
|
|
183
183
|
* **Note:** this is controlled by the parent TreeView component, do not set manually.
|
|
184
184
|
* Array containing all selected node IDs in the tree
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
3
|
*
|
|
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
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { ReactNode } from 'react';
|
|
8
9
|
export interface HeaderProps {
|
|
9
10
|
children?: ReactNode;
|
|
10
11
|
/**
|
|
@@ -20,5 +21,21 @@ export interface HeaderProps {
|
|
|
20
21
|
*/
|
|
21
22
|
className?: string;
|
|
22
23
|
}
|
|
23
|
-
declare const Header:
|
|
24
|
+
declare const Header: {
|
|
25
|
+
({ className: customClassName, children, ...rest }: HeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
propTypes: {
|
|
27
|
+
/**
|
|
28
|
+
* Optionally provide aria-label
|
|
29
|
+
*/
|
|
30
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Optionally provide aria-labelledby
|
|
33
|
+
*/
|
|
34
|
+
'aria-labelledby': PropTypes.Requireable<string>;
|
|
35
|
+
/**
|
|
36
|
+
* Optionally provide a custom class name that is applied to the underlying header
|
|
37
|
+
*/
|
|
38
|
+
className: PropTypes.Requireable<string>;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
24
41
|
export default Header;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
3
|
*
|
|
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.
|
|
@@ -55,5 +55,5 @@ export interface HeaderGlobalActionProps {
|
|
|
55
55
|
*
|
|
56
56
|
* Note: children passed to this component should be an Icon.
|
|
57
57
|
*/
|
|
58
|
-
declare const HeaderGlobalAction: React.
|
|
58
|
+
declare const HeaderGlobalAction: React.ForwardRefExoticComponent<HeaderGlobalActionProps & React.RefAttributes<HTMLButtonElement>>;
|
|
59
59
|
export default HeaderGlobalAction;
|
|
@@ -28,7 +28,7 @@ function HeaderName({
|
|
|
28
28
|
className: className
|
|
29
29
|
}), prefix && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
30
30
|
className: `${selectorPrefix}--header__name--prefix`
|
|
31
|
-
}, prefix), "\xA0"), children);
|
|
31
|
+
}, prefix), "\xA0"), /*#__PURE__*/React.createElement("span", null, children));
|
|
32
32
|
}
|
|
33
33
|
HeaderName.propTypes = {
|
|
34
34
|
/**
|
|
@@ -16,24 +16,24 @@ var deprecate = require('../../prop-types/deprecate.js');
|
|
|
16
16
|
|
|
17
17
|
// First define the component without generics
|
|
18
18
|
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
const frFn = React.forwardRef;
|
|
20
|
+
const Link = frFn((props, ref) => {
|
|
21
|
+
const {
|
|
22
|
+
element,
|
|
23
|
+
as: BaseComponent,
|
|
24
|
+
// Captured here to prevent it from being passed into the created element.
|
|
25
|
+
// See https://github.com/carbon-design-system/carbon/issues/3970
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
27
|
+
isSideNavExpanded: _isSideNavExpanded,
|
|
28
|
+
...rest
|
|
29
|
+
} = props;
|
|
30
|
+
|
|
28
31
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
29
32
|
const BaseComponentAsAny = BaseComponent ?? element ?? 'a';
|
|
30
33
|
return /*#__PURE__*/React.createElement(BaseComponentAsAny, _rollupPluginBabelHelpers.extends({
|
|
31
34
|
ref: ref
|
|
32
35
|
}, rest));
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
// Use forwardRef with the non-generic function
|
|
36
|
-
const Link = /*#__PURE__*/React.forwardRef(LinkBase);
|
|
36
|
+
});
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Link is a custom component that allows us to supporting rendering elements
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2026
|
|
3
3
|
*
|
|
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.
|
|
@@ -9,7 +9,7 @@ export interface SideNavProps {
|
|
|
9
9
|
expanded?: boolean | undefined;
|
|
10
10
|
defaultExpanded?: boolean | undefined;
|
|
11
11
|
isChildOfHeader?: boolean | undefined;
|
|
12
|
-
onToggle?: (event: FocusEvent<HTMLElement> | KeyboardEvent<HTMLElement> | boolean, value: boolean) => void
|
|
12
|
+
onToggle?: (event: FocusEvent<HTMLElement> | KeyboardEvent<HTMLElement> | boolean, value: boolean) => void;
|
|
13
13
|
href?: string | undefined;
|
|
14
14
|
isFixedNav?: boolean | undefined;
|
|
15
15
|
isRail?: boolean | undefined;
|
|
@@ -17,9 +17,8 @@ export interface SideNavProps {
|
|
|
17
17
|
addFocusListeners?: boolean | undefined;
|
|
18
18
|
addMouseListeners?: boolean | undefined;
|
|
19
19
|
onOverlayClick?: MouseEventHandler<HTMLDivElement> | undefined;
|
|
20
|
-
onSideNavBlur?: () => void
|
|
20
|
+
onSideNavBlur?: () => void;
|
|
21
21
|
enterDelayMs?: number;
|
|
22
|
-
inert?: boolean;
|
|
23
22
|
}
|
|
24
23
|
interface SideNavContextData {
|
|
25
24
|
isRail?: boolean | undefined;
|
|
@@ -28,28 +28,30 @@ var useMatchMedia = require('../../internal/useMatchMedia.js');
|
|
|
28
28
|
// import SideNavFooter from './SideNavFooter';
|
|
29
29
|
|
|
30
30
|
const SideNavContext = /*#__PURE__*/React.createContext({});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
31
|
+
const frFn = React.forwardRef;
|
|
32
|
+
const SideNav = frFn((props, ref) => {
|
|
33
|
+
const {
|
|
34
|
+
expanded: expandedProp,
|
|
35
|
+
defaultExpanded = false,
|
|
36
|
+
isChildOfHeader = true,
|
|
37
|
+
'aria-label': ariaLabel,
|
|
38
|
+
'aria-labelledby': ariaLabelledBy,
|
|
39
|
+
children,
|
|
40
|
+
onToggle,
|
|
41
|
+
className: customClassName,
|
|
42
|
+
// TO-DO: comment back in when footer is added for rails
|
|
43
|
+
// translateById: t = (id) => translations[id],
|
|
44
|
+
href,
|
|
45
|
+
isFixedNav = false,
|
|
46
|
+
isRail,
|
|
47
|
+
isPersistent = true,
|
|
48
|
+
addFocusListeners = true,
|
|
49
|
+
addMouseListeners = true,
|
|
50
|
+
onOverlayClick,
|
|
51
|
+
onSideNavBlur,
|
|
52
|
+
enterDelayMs = 100,
|
|
53
|
+
...other
|
|
54
|
+
} = props;
|
|
53
55
|
const prefix = usePrefix.usePrefix();
|
|
54
56
|
const {
|
|
55
57
|
current: controlled
|
|
@@ -159,6 +161,16 @@ function SideNavRenderFunction({
|
|
|
159
161
|
});
|
|
160
162
|
const lgMediaQuery = `(min-width: ${layout.breakpoints.lg.width})`;
|
|
161
163
|
const isLg = useMatchMedia.useMatchMedia(lgMediaQuery);
|
|
164
|
+
const inertEnabled = !isRail ? !(expanded || isLg) : false;
|
|
165
|
+
React.useEffect(() => {
|
|
166
|
+
const node = sideNavRef.current;
|
|
167
|
+
if (!node) return;
|
|
168
|
+
if (inertEnabled) {
|
|
169
|
+
node.setAttribute('inert', '');
|
|
170
|
+
} else {
|
|
171
|
+
node.removeAttribute('inert');
|
|
172
|
+
}
|
|
173
|
+
}, [inertEnabled]);
|
|
162
174
|
return /*#__PURE__*/React.createElement(SideNavContext.Provider, {
|
|
163
175
|
value: {
|
|
164
176
|
isRail
|
|
@@ -172,11 +184,9 @@ function SideNavRenderFunction({
|
|
|
172
184
|
}), /*#__PURE__*/React.createElement("nav", _rollupPluginBabelHelpers.extends({
|
|
173
185
|
tabIndex: -1,
|
|
174
186
|
ref: navRef,
|
|
175
|
-
className: `${prefix}--side-nav__navigation ${className}
|
|
176
|
-
inert: !isRail ? !(expanded || isLg) : undefined
|
|
187
|
+
className: `${prefix}--side-nav__navigation ${className}`
|
|
177
188
|
}, accessibilityLabel, eventHandlers, other), childrenToRender));
|
|
178
|
-
}
|
|
179
|
-
const SideNav = /*#__PURE__*/React.forwardRef(SideNavRenderFunction);
|
|
189
|
+
});
|
|
180
190
|
SideNav.displayName = 'SideNav';
|
|
181
191
|
SideNav.propTypes = {
|
|
182
192
|
/**
|