@carbon/react 1.80.1 → 1.81.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 +781 -781
- package/es/components/Accordion/AccordionItem.d.ts +2 -2
- package/es/components/AspectRatio/AspectRatio.d.ts +2 -2
- package/es/components/Button/Button.js +3 -0
- package/es/components/Button/ButtonBase.d.ts +2 -2
- package/es/components/ChatButton/ChatButton.js +5 -3
- package/es/components/CodeSnippet/CodeSnippet.js +2 -0
- package/es/components/ComboBox/ComboBox.d.ts +1 -1
- package/es/components/ComposedModal/ComposedModal.d.ts +1 -1
- package/es/components/ComposedModal/ComposedModal.js +1 -2
- package/es/components/ComposedModal/ModalFooter.js +0 -1
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +0 -1
- package/es/components/ContentSwitcher/ContentSwitcher.d.ts +1 -1
- package/es/components/ContextMenu/useContextMenu.d.ts +1 -1
- package/es/components/DataTable/DataTable.d.ts +5 -5
- package/es/components/DataTable/DataTable.js +1 -1
- package/es/components/DataTable/TableActionList.d.ts +1 -1
- package/es/components/DataTable/TableExpandHeader.d.ts +1 -1
- package/es/components/DataTable/TableHead.d.ts +1 -1
- package/es/components/DataTable/TableToolbarContent.d.ts +1 -1
- package/es/components/DataTable/TableToolbarSearch.d.ts +1 -1
- package/es/components/DatePickerInput/DatePickerInput.d.ts +2 -2
- package/es/components/Dropdown/Dropdown.d.ts +1 -1
- package/es/components/FeatureFlags/index.d.ts +1 -1
- package/es/components/FileUploader/FileUploader.d.ts +6 -1
- package/es/components/FileUploader/FileUploader.js +3 -1
- package/es/components/FileUploader/FileUploaderButton.d.ts +1 -1
- package/es/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
- package/es/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +3 -3
- package/es/components/FluidMultiSelect/FluidMultiSelect.d.ts +2 -2
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +6 -4
- package/es/components/FluidNumberInput/FluidNumberInput.Skeleton.js +40 -0
- package/es/components/FluidNumberInput/FluidNumberInput.js +123 -0
- package/es/components/FluidTextInput/FluidTextInput.js +2 -2
- package/es/components/Grid/Column.js +1 -1
- package/es/components/Grid/GridTypes.d.ts +6 -1
- package/es/components/Layer/LayerLevel.d.ts +3 -3
- package/es/components/Layer/LayerLevel.js +4 -3
- package/es/components/Layer/index.d.ts +4 -2
- package/es/components/Layer/index.js +3 -2
- package/es/components/Link/Link.js +3 -1
- package/es/components/Menu/Menu.d.ts +1 -1
- package/es/components/Menu/MenuContext.d.ts +1 -1
- package/es/components/Modal/Modal.js +5 -2
- package/es/components/ModalWrapper/ModalWrapper.d.ts +2 -2
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +3 -3
- package/es/components/MultiSelect/FilterableMultiSelect.js +4 -3
- package/es/components/MultiSelect/MultiSelect.d.ts +2 -6
- package/es/components/MultiSelect/MultiSelect.js +18 -3
- package/es/components/MultiSelect/index.d.ts +2 -4
- package/es/components/NumberInput/NumberInput.js +2 -1
- package/es/components/OverflowMenu/OverflowMenu.d.ts +7 -1
- package/es/components/OverflowMenu/OverflowMenu.js +69 -17
- package/es/components/OverflowMenu/index.d.ts +3 -5
- package/es/components/OverflowMenu/index.js +9 -4
- package/es/components/OverflowMenu/next/index.js +0 -1
- package/es/components/OverflowMenuItem/OverflowMenuItem.d.ts +4 -0
- package/es/components/PageHeader/PageHeader.js +1 -1
- package/es/components/PaginationNav/PaginationNav.d.ts +1 -1
- package/es/components/PaginationNav/PaginationNav.js +2 -1
- package/es/components/Popover/index.d.ts +3 -2
- package/es/components/Popover/index.js +10 -5
- package/es/components/Portal/index.d.ts +1 -1
- package/es/components/Search/Search.js +0 -1
- package/es/components/SkeletonText/SkeletonText.js +3 -1
- package/es/components/Slider/Slider.d.ts +3 -13
- package/es/components/Slider/Slider.js +2 -14
- package/es/components/Tabs/Tabs.d.ts +2 -2
- package/es/components/Tabs/Tabs.js +8 -6
- package/es/components/Tabs/usePressable.js +1 -1
- package/es/components/Tag/Tag.js +9 -2
- package/es/components/Text/Text.js +3 -2
- package/es/components/TextInput/ControlledPasswordInput.d.ts +1 -1
- package/es/components/TextInput/ControlledPasswordInput.js +0 -6
- package/es/components/TextInput/TextInput.d.ts +1 -1
- package/es/components/TextInput/TextInput.js +0 -4
- package/es/components/TextInput/index.d.ts +6 -0
- package/es/components/TextInput/index.js +0 -8
- package/es/components/Tile/Tile.js +0 -1
- package/es/components/Toggle/Toggle.d.ts +1 -1
- package/es/components/ToggleSmall/ToggleSmall.Skeleton.d.ts +9 -14
- package/es/components/ToggleSmall/ToggleSmall.Skeleton.js +37 -41
- package/es/components/Toggletip/index.js +11 -8
- package/es/components/Tooltip/Tooltip.d.ts +1 -1
- package/es/components/TreeView/TreeView.d.ts +1 -1
- package/es/components/UIShell/Content.d.ts +14 -1
- package/es/components/UIShell/HeaderGlobalBar.d.ts +1 -1
- package/es/components/UIShell/HeaderMenu.d.ts +2 -99
- package/es/components/UIShell/HeaderMenu.js +10 -3
- package/es/components/UIShell/HeaderMenuButton.d.ts +1 -98
- package/es/components/UIShell/HeaderMenuItem.d.ts +3 -4
- package/es/components/UIShell/HeaderMenuItem.js +3 -3
- package/es/components/UIShell/HeaderName.js +1 -1
- package/es/components/UIShell/HeaderNavigation.d.ts +0 -97
- package/es/components/UIShell/Link.d.ts +8 -8
- package/es/components/UIShell/Link.js +8 -5
- package/es/components/UIShell/SideNav.d.ts +3 -3
- package/es/components/UIShell/SideNav.js +1 -1
- package/es/components/UIShell/SideNavHeader.js +0 -1
- package/es/components/UIShell/SideNavLink.d.ts +3 -4
- package/es/components/UIShell/SideNavLink.js +8 -3
- package/es/components/UIShell/SideNavMenu.js +0 -1
- package/es/components/UIShell/SideNavMenuItem.d.ts +1 -49
- package/es/components/UIShell/SideNavMenuItem.js +1 -1
- package/es/components/UIShell/SideNavSwitcher.js +0 -1
- package/es/components/UIShell/SwitcherItem.d.ts +2 -2
- package/es/components/UIShell/SwitcherItem.js +1 -1
- package/es/index.d.ts +2 -2
- package/es/index.js +7 -7
- package/es/internal/FloatingMenu.js +2 -1
- package/es/internal/clamp.d.ts +10 -0
- package/es/internal/clamp.js +13 -0
- package/es/internal/useEvent.d.ts +9 -0
- package/es/internal/useEvent.js +8 -49
- package/es/internal/useId.js +1 -1
- package/es/internal/useMatchMedia.d.ts +7 -2
- package/es/internal/useMatchMedia.js +9 -10
- package/es/internal/useNoInteractiveChildren.js +4 -2
- package/es/internal/useOutsideClick.d.ts +1 -1
- package/es/prop-types/AriaPropTypes.js +1 -1
- package/es/prop-types/isRequiredOneOf.d.ts +16 -0
- package/es/prop-types/isRequiredOneOf.js +11 -9
- package/es/tools/setupGetInstanceId.d.ts +12 -0
- package/es/tools/setupGetInstanceId.js +7 -8
- package/es/tools/toggleClass.d.ts +14 -0
- package/es/tools/toggleClass.js +9 -10
- package/es/tools/wrapComponent.d.ts +1 -1
- package/es/types/common.d.ts +1 -6
- package/lib/components/Accordion/AccordionItem.d.ts +2 -2
- package/lib/components/AspectRatio/AspectRatio.d.ts +2 -2
- package/lib/components/Button/Button.js +3 -0
- package/lib/components/Button/ButtonBase.d.ts +2 -2
- package/lib/components/ChatButton/ChatButton.js +5 -3
- package/lib/components/CodeSnippet/CodeSnippet.js +2 -0
- package/lib/components/ComboBox/ComboBox.d.ts +1 -1
- package/lib/components/ComposedModal/ComposedModal.d.ts +1 -1
- package/lib/components/ComposedModal/ComposedModal.js +2 -3
- package/lib/components/ComposedModal/ModalFooter.js +0 -1
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +0 -1
- package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +1 -1
- package/lib/components/ContextMenu/useContextMenu.d.ts +1 -1
- package/lib/components/DataTable/DataTable.d.ts +5 -5
- package/lib/components/DataTable/DataTable.js +1 -1
- package/lib/components/DataTable/TableActionList.d.ts +1 -1
- package/lib/components/DataTable/TableExpandHeader.d.ts +1 -1
- package/lib/components/DataTable/TableHead.d.ts +1 -1
- package/lib/components/DataTable/TableToolbarContent.d.ts +1 -1
- package/lib/components/DataTable/TableToolbarSearch.d.ts +1 -1
- package/lib/components/DatePickerInput/DatePickerInput.d.ts +2 -2
- package/lib/components/Dropdown/Dropdown.d.ts +1 -1
- package/lib/components/FeatureFlags/index.d.ts +1 -1
- package/lib/components/FileUploader/FileUploader.d.ts +6 -1
- package/lib/components/FileUploader/FileUploader.js +3 -1
- package/lib/components/FileUploader/FileUploaderButton.d.ts +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
- package/lib/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +3 -3
- package/lib/components/FluidMultiSelect/FluidMultiSelect.d.ts +2 -2
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +7 -5
- package/lib/components/FluidNumberInput/FluidNumberInput.Skeleton.js +50 -0
- package/lib/components/FluidNumberInput/FluidNumberInput.js +133 -0
- package/lib/components/FluidTextInput/FluidTextInput.js +2 -2
- package/lib/components/Grid/Column.js +1 -1
- package/lib/components/Grid/GridTypes.d.ts +6 -1
- package/lib/components/Layer/LayerLevel.d.ts +3 -3
- package/lib/components/Layer/LayerLevel.js +4 -2
- package/lib/components/Layer/index.d.ts +4 -2
- package/lib/components/Layer/index.js +2 -1
- package/lib/components/Link/Link.js +3 -1
- package/lib/components/Menu/Menu.d.ts +1 -1
- package/lib/components/Menu/MenuContext.d.ts +1 -1
- package/lib/components/Modal/Modal.js +6 -3
- package/lib/components/ModalWrapper/ModalWrapper.d.ts +2 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +3 -3
- package/lib/components/MultiSelect/FilterableMultiSelect.js +3 -2
- package/lib/components/MultiSelect/MultiSelect.d.ts +2 -6
- package/lib/components/MultiSelect/MultiSelect.js +17 -2
- package/lib/components/MultiSelect/index.d.ts +2 -4
- package/lib/components/NumberInput/NumberInput.js +2 -1
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +7 -1
- package/lib/components/OverflowMenu/OverflowMenu.js +69 -17
- package/lib/components/OverflowMenu/index.d.ts +3 -5
- package/lib/components/OverflowMenu/index.js +8 -3
- package/lib/components/OverflowMenu/next/index.js +0 -1
- package/lib/components/OverflowMenuItem/OverflowMenuItem.d.ts +4 -0
- package/lib/components/PageHeader/PageHeader.js +1 -1
- package/lib/components/PaginationNav/PaginationNav.d.ts +1 -1
- package/lib/components/PaginationNav/PaginationNav.js +2 -1
- package/lib/components/Popover/index.d.ts +3 -2
- package/lib/components/Popover/index.js +10 -5
- package/lib/components/Portal/index.d.ts +1 -1
- package/lib/components/Search/Search.js +0 -1
- package/lib/components/SkeletonText/SkeletonText.js +3 -1
- package/lib/components/Slider/Slider.d.ts +3 -13
- package/lib/components/Slider/Slider.js +2 -14
- package/lib/components/Tabs/Tabs.d.ts +2 -2
- package/lib/components/Tabs/Tabs.js +7 -5
- package/lib/components/Tabs/usePressable.js +1 -1
- package/lib/components/Tag/Tag.js +9 -2
- package/lib/components/Text/Text.js +2 -1
- package/lib/components/TextInput/ControlledPasswordInput.d.ts +1 -1
- package/lib/components/TextInput/ControlledPasswordInput.js +0 -6
- package/lib/components/TextInput/TextInput.d.ts +1 -1
- package/lib/components/TextInput/TextInput.js +0 -4
- package/lib/components/TextInput/index.d.ts +6 -0
- package/lib/components/TextInput/index.js +1 -7
- package/lib/components/Tile/Tile.js +0 -1
- package/lib/components/Toggle/Toggle.d.ts +1 -1
- package/lib/components/ToggleSmall/ToggleSmall.Skeleton.d.ts +9 -14
- package/lib/components/ToggleSmall/ToggleSmall.Skeleton.js +34 -39
- package/lib/components/Toggletip/index.js +11 -8
- package/lib/components/Tooltip/Tooltip.d.ts +1 -1
- package/lib/components/TreeView/TreeView.d.ts +1 -1
- package/lib/components/UIShell/Content.d.ts +14 -1
- package/lib/components/UIShell/HeaderGlobalBar.d.ts +1 -1
- package/lib/components/UIShell/HeaderMenu.d.ts +2 -99
- package/lib/components/UIShell/HeaderMenu.js +10 -3
- package/lib/components/UIShell/HeaderMenuButton.d.ts +1 -98
- package/lib/components/UIShell/HeaderMenuItem.d.ts +3 -4
- package/lib/components/UIShell/HeaderMenuItem.js +3 -3
- package/lib/components/UIShell/HeaderName.js +1 -1
- package/lib/components/UIShell/HeaderNavigation.d.ts +0 -97
- package/lib/components/UIShell/Link.d.ts +8 -8
- package/lib/components/UIShell/Link.js +7 -5
- package/lib/components/UIShell/SideNav.d.ts +3 -3
- package/lib/components/UIShell/SideNav.js +1 -1
- package/lib/components/UIShell/SideNavHeader.js +0 -1
- package/lib/components/UIShell/SideNavLink.d.ts +3 -4
- package/lib/components/UIShell/SideNavLink.js +8 -3
- package/lib/components/UIShell/SideNavMenu.js +0 -1
- package/lib/components/UIShell/SideNavMenuItem.d.ts +1 -49
- package/lib/components/UIShell/SideNavMenuItem.js +1 -1
- package/lib/components/UIShell/SideNavSwitcher.js +0 -1
- package/lib/components/UIShell/SwitcherItem.d.ts +2 -2
- package/lib/components/UIShell/SwitcherItem.js +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +13 -11
- package/lib/internal/FloatingMenu.js +2 -1
- package/lib/internal/clamp.d.ts +10 -0
- package/lib/internal/clamp.js +17 -0
- package/lib/internal/useEvent.d.ts +9 -0
- package/lib/internal/useEvent.js +8 -49
- package/lib/internal/useId.js +1 -1
- package/lib/internal/useMatchMedia.d.ts +7 -2
- package/lib/internal/useMatchMedia.js +9 -10
- package/lib/internal/useNoInteractiveChildren.js +4 -2
- package/lib/internal/useOutsideClick.d.ts +1 -1
- package/lib/prop-types/AriaPropTypes.js +1 -1
- package/lib/prop-types/isRequiredOneOf.d.ts +16 -0
- package/lib/prop-types/isRequiredOneOf.js +11 -9
- package/lib/tools/setupGetInstanceId.d.ts +12 -0
- package/lib/tools/setupGetInstanceId.js +7 -8
- package/lib/tools/toggleClass.d.ts +14 -0
- package/lib/tools/toggleClass.js +9 -10
- package/lib/tools/wrapComponent.d.ts +1 -1
- package/lib/types/common.d.ts +1 -6
- package/package.json +14 -14
- package/telemetry.yml +11 -12
- package/es/components/MultiSelect/index.js +0 -13
- package/es/internal/ClickListener.d.ts +0 -13
- package/es/internal/ClickListener.js +0 -47
- package/lib/components/MultiSelect/index.js +0 -19
- package/lib/internal/ClickListener.d.ts +0 -13
- package/lib/internal/ClickListener.js +0 -51
|
@@ -167,9 +167,15 @@ class HeaderMenu extends React__default["default"].Component {
|
|
|
167
167
|
onKeyDown,
|
|
168
168
|
...rest
|
|
169
169
|
} = this.props;
|
|
170
|
-
const hasActiveDescendant = childrenArg => React__default["default"].Children.toArray(childrenArg).some(child =>
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
const hasActiveDescendant = childrenArg => React__default["default"].Children.toArray(childrenArg).some(child => {
|
|
171
|
+
if (! /*#__PURE__*/React__default["default"].isValidElement(child)) {
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Explicitly type the element to access props safely
|
|
176
|
+
const element = child;
|
|
177
|
+
return element.props.isActive || element.props.isCurrentPage || Array.isArray(element.props.children) && hasActiveDescendant(element.props.children);
|
|
178
|
+
});
|
|
173
179
|
const accessibilityLabel = {
|
|
174
180
|
'aria-label': ariaLabel,
|
|
175
181
|
'aria-labelledby': ariaLabelledBy
|
|
@@ -213,6 +219,7 @@ class HeaderMenu extends React__default["default"].Component {
|
|
|
213
219
|
className: `${this.context}--header__menu-arrow`
|
|
214
220
|
})), /*#__PURE__*/React__default["default"].createElement("ul", _rollupPluginBabelHelpers["extends"]({}, accessibilityLabel, {
|
|
215
221
|
ref: this._subMenus,
|
|
222
|
+
onClick: this.handleOnClick,
|
|
216
223
|
className: `${prefix}--header__menu`
|
|
217
224
|
}), React__default["default"].Children.map(children, this._renderMenuItem)));
|
|
218
225
|
}
|
|
@@ -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 { type ComponentProps } from 'react';
|
|
7
|
+
import { type ComponentProps, type JSX } from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
type HeaderMenuButtonBaseProps = Omit<ComponentProps<'button'>, 'title' | 'type'>;
|
|
10
10
|
export interface HeaderMenuButtonProps extends HeaderMenuButtonBaseProps {
|
|
@@ -37,103 +37,6 @@ declare namespace HeaderMenuButton {
|
|
|
37
37
|
* button fires it's onclick event
|
|
38
38
|
*/
|
|
39
39
|
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
40
|
-
0: string;
|
|
41
|
-
length: 1;
|
|
42
|
-
toString(): string;
|
|
43
|
-
toLocaleString(): string;
|
|
44
|
-
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string;
|
|
45
|
-
pop(): string | undefined;
|
|
46
|
-
push(...items: string[]): number;
|
|
47
|
-
concat(...items: ConcatArray<string>[]): string[];
|
|
48
|
-
concat(...items: (string | ConcatArray<string>)[]): string[];
|
|
49
|
-
join(separator?: string): string;
|
|
50
|
-
reverse(): string[];
|
|
51
|
-
shift(): string | undefined;
|
|
52
|
-
slice(start?: number, end?: number): string[];
|
|
53
|
-
sort(compareFn?: ((a: string, b: string) => number) | undefined): [key: string];
|
|
54
|
-
splice(start: number, deleteCount?: number): string[];
|
|
55
|
-
splice(start: number, deleteCount: number, ...items: string[]): string[];
|
|
56
|
-
unshift(...items: string[]): number;
|
|
57
|
-
indexOf(searchElement: string, fromIndex?: number): number;
|
|
58
|
-
lastIndexOf(searchElement: string, fromIndex?: number): number;
|
|
59
|
-
every<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): this is S[];
|
|
60
|
-
every(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): boolean;
|
|
61
|
-
some(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): boolean;
|
|
62
|
-
forEach(callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any): void;
|
|
63
|
-
map<U>(callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any): U[];
|
|
64
|
-
filter<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S[];
|
|
65
|
-
filter(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[];
|
|
66
|
-
reduce(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
|
|
67
|
-
reduce(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
|
|
68
|
-
reduce<U>(callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U;
|
|
69
|
-
reduceRight(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
|
|
70
|
-
reduceRight(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
|
|
71
|
-
reduceRight<U>(callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U;
|
|
72
|
-
find<S extends string>(predicate: (value: string, index: number, obj: string[]) => value is S, thisArg?: any): S | undefined;
|
|
73
|
-
find(predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any): string | undefined;
|
|
74
|
-
findIndex(predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any): number;
|
|
75
|
-
fill(value: string, start?: number, end?: number): [key: string];
|
|
76
|
-
copyWithin(target: number, start: number, end?: number): [key: string];
|
|
77
|
-
entries(): ArrayIterator<[number, string]>;
|
|
78
|
-
keys(): ArrayIterator<number>;
|
|
79
|
-
values(): ArrayIterator<string>;
|
|
80
|
-
includes(searchElement: string, fromIndex?: number): boolean;
|
|
81
|
-
flatMap<U, This = undefined>(callback: (this: This, value: string, index: number, array: string[]) => U | readonly U[], thisArg?: This | undefined): U[];
|
|
82
|
-
flat<A, D extends number = 1>(this: A, depth?: D | undefined): FlatArray<A, D>[];
|
|
83
|
-
at(index: number): string | undefined;
|
|
84
|
-
findLast<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S | undefined;
|
|
85
|
-
findLast(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string | undefined;
|
|
86
|
-
findLastIndex(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): number;
|
|
87
|
-
toReversed(): string[];
|
|
88
|
-
toSorted(compareFn?: ((a: string, b: string) => number) | undefined): string[];
|
|
89
|
-
toSpliced(start: number, deleteCount: number, ...items: string[]): string[];
|
|
90
|
-
toSpliced(start: number, deleteCount?: number): string[];
|
|
91
|
-
with(index: number, value: string): string[];
|
|
92
|
-
[Symbol.iterator](): ArrayIterator<string>;
|
|
93
|
-
[Symbol.unscopables]: {
|
|
94
|
-
[x: number]: boolean | undefined;
|
|
95
|
-
length?: boolean | undefined;
|
|
96
|
-
toString?: boolean | undefined;
|
|
97
|
-
toLocaleString?: boolean | undefined;
|
|
98
|
-
pop?: boolean | undefined;
|
|
99
|
-
push?: boolean | undefined;
|
|
100
|
-
concat?: boolean | undefined;
|
|
101
|
-
join?: boolean | undefined;
|
|
102
|
-
reverse?: boolean | undefined;
|
|
103
|
-
shift?: boolean | undefined;
|
|
104
|
-
slice?: boolean | undefined;
|
|
105
|
-
sort?: boolean | undefined;
|
|
106
|
-
splice?: boolean | undefined;
|
|
107
|
-
unshift?: boolean | undefined;
|
|
108
|
-
indexOf?: boolean | undefined;
|
|
109
|
-
lastIndexOf?: boolean | undefined;
|
|
110
|
-
every?: boolean | undefined;
|
|
111
|
-
some?: boolean | undefined;
|
|
112
|
-
forEach?: boolean | undefined;
|
|
113
|
-
map?: boolean | undefined;
|
|
114
|
-
filter?: boolean | undefined;
|
|
115
|
-
reduce?: boolean | undefined;
|
|
116
|
-
reduceRight?: boolean | undefined;
|
|
117
|
-
find?: boolean | undefined;
|
|
118
|
-
findIndex?: boolean | undefined;
|
|
119
|
-
fill?: boolean | undefined;
|
|
120
|
-
copyWithin?: boolean | undefined;
|
|
121
|
-
entries?: boolean | undefined;
|
|
122
|
-
keys?: boolean | undefined;
|
|
123
|
-
values?: boolean | undefined;
|
|
124
|
-
includes?: boolean | undefined;
|
|
125
|
-
flatMap?: boolean | undefined;
|
|
126
|
-
flat?: boolean | undefined;
|
|
127
|
-
at?: boolean | undefined;
|
|
128
|
-
findLast?: boolean | undefined;
|
|
129
|
-
findLastIndex?: boolean | undefined;
|
|
130
|
-
toReversed?: boolean | undefined;
|
|
131
|
-
toSorted?: boolean | undefined;
|
|
132
|
-
toSpliced?: boolean | undefined;
|
|
133
|
-
with?: boolean | undefined;
|
|
134
|
-
[Symbol.iterator]?: boolean | undefined;
|
|
135
|
-
readonly [Symbol.unscopables]?: boolean | undefined;
|
|
136
|
-
};
|
|
137
40
|
};
|
|
138
41
|
}
|
|
139
42
|
export default HeaderMenuButton;
|
|
@@ -4,7 +4,8 @@
|
|
|
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 { WeakValidationMap } from 'prop-types';
|
|
8
|
+
import { type ComponentProps, type ReactNode, ElementType, JSX } from 'react';
|
|
8
9
|
import { PolymorphicComponentPropWithRef } from '../../internal/PolymorphicProps';
|
|
9
10
|
export interface HeaderMenuItemBaseProps {
|
|
10
11
|
className?: string | undefined;
|
|
@@ -17,9 +18,7 @@ export interface HeaderMenuItemBaseProps {
|
|
|
17
18
|
}
|
|
18
19
|
export type HeaderMenuItemProps<E extends ElementType = 'a'> = PolymorphicComponentPropWithRef<E, HeaderMenuItemBaseProps>;
|
|
19
20
|
export interface HeaderMenuItemComponent {
|
|
20
|
-
<E extends ElementType = 'a'>(props: HeaderMenuItemProps<E>
|
|
21
|
-
ref?: ForwardedRef<ElementType>;
|
|
22
|
-
}): JSX.Element | null;
|
|
21
|
+
<E extends ElementType = 'a'>(props: HeaderMenuItemProps<E>): JSX.Element | null;
|
|
23
22
|
displayName?: string;
|
|
24
23
|
propTypes?: WeakValidationMap<HeaderMenuItemProps<any>>;
|
|
25
24
|
}
|
|
@@ -23,7 +23,7 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
23
23
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
24
24
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
25
25
|
|
|
26
|
-
const HeaderMenuItem = /*#__PURE__*/React.forwardRef(function
|
|
26
|
+
const HeaderMenuItem = /*#__PURE__*/React.forwardRef(function HeaderMenuItem(_ref, ref) {
|
|
27
27
|
let {
|
|
28
28
|
className,
|
|
29
29
|
isActive,
|
|
@@ -31,7 +31,7 @@ const HeaderMenuItem = /*#__PURE__*/React.forwardRef(function HeaderMenuItemRend
|
|
|
31
31
|
'aria-current': ariaCurrent,
|
|
32
32
|
children,
|
|
33
33
|
role,
|
|
34
|
-
tabIndex
|
|
34
|
+
tabIndex,
|
|
35
35
|
...rest
|
|
36
36
|
} = _ref;
|
|
37
37
|
const prefix = usePrefix.usePrefix();
|
|
@@ -47,7 +47,7 @@ const HeaderMenuItem = /*#__PURE__*/React.forwardRef(function HeaderMenuItemRend
|
|
|
47
47
|
return /*#__PURE__*/React__default["default"].createElement("li", {
|
|
48
48
|
className: className,
|
|
49
49
|
role: role
|
|
50
|
-
}, /*#__PURE__*/React__default["default"].createElement(Link
|
|
50
|
+
}, /*#__PURE__*/React__default["default"].createElement(Link["default"], _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
51
51
|
"aria-current": ariaCurrent,
|
|
52
52
|
className: linkClassName,
|
|
53
53
|
ref: ref,
|
|
@@ -31,7 +31,7 @@ function HeaderName(_ref) {
|
|
|
31
31
|
} = _ref;
|
|
32
32
|
const selectorPrefix = usePrefix.usePrefix();
|
|
33
33
|
const className = cx__default["default"](`${selectorPrefix}--header__name`, customClassName);
|
|
34
|
-
return /*#__PURE__*/React__default["default"].createElement(Link
|
|
34
|
+
return /*#__PURE__*/React__default["default"].createElement(Link["default"], _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
35
35
|
className: className
|
|
36
36
|
}), prefix && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
37
37
|
className: `${selectorPrefix}--header__name--prefix`
|
|
@@ -19,103 +19,6 @@ declare namespace HeaderNavigation {
|
|
|
19
19
|
* Optionally provide a custom class to apply to the underlying <nav> node
|
|
20
20
|
*/
|
|
21
21
|
className: PropTypes.Requireable<string>;
|
|
22
|
-
0: string;
|
|
23
|
-
length: 1;
|
|
24
|
-
toString(): string;
|
|
25
|
-
toLocaleString(): string;
|
|
26
|
-
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string;
|
|
27
|
-
pop(): string | undefined;
|
|
28
|
-
push(...items: string[]): number;
|
|
29
|
-
concat(...items: ConcatArray<string>[]): string[];
|
|
30
|
-
concat(...items: (string | ConcatArray<string>)[]): string[];
|
|
31
|
-
join(separator?: string): string;
|
|
32
|
-
reverse(): string[];
|
|
33
|
-
shift(): string | undefined;
|
|
34
|
-
slice(start?: number, end?: number): string[];
|
|
35
|
-
sort(compareFn?: ((a: string, b: string) => number) | undefined): [key: string];
|
|
36
|
-
splice(start: number, deleteCount?: number): string[];
|
|
37
|
-
splice(start: number, deleteCount: number, ...items: string[]): string[];
|
|
38
|
-
unshift(...items: string[]): number;
|
|
39
|
-
indexOf(searchElement: string, fromIndex?: number): number;
|
|
40
|
-
lastIndexOf(searchElement: string, fromIndex?: number): number;
|
|
41
|
-
every<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): this is S[];
|
|
42
|
-
every(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): boolean;
|
|
43
|
-
some(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): boolean;
|
|
44
|
-
forEach(callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any): void;
|
|
45
|
-
map<U>(callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any): U[];
|
|
46
|
-
filter<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S[];
|
|
47
|
-
filter(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[];
|
|
48
|
-
reduce(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
|
|
49
|
-
reduce(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
|
|
50
|
-
reduce<U>(callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U;
|
|
51
|
-
reduceRight(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
|
|
52
|
-
reduceRight(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
|
|
53
|
-
reduceRight<U>(callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U;
|
|
54
|
-
find<S extends string>(predicate: (value: string, index: number, obj: string[]) => value is S, thisArg?: any): S | undefined;
|
|
55
|
-
find(predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any): string | undefined;
|
|
56
|
-
findIndex(predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any): number;
|
|
57
|
-
fill(value: string, start?: number, end?: number): [key: string];
|
|
58
|
-
copyWithin(target: number, start: number, end?: number): [key: string];
|
|
59
|
-
entries(): ArrayIterator<[number, string]>;
|
|
60
|
-
keys(): ArrayIterator<number>;
|
|
61
|
-
values(): ArrayIterator<string>;
|
|
62
|
-
includes(searchElement: string, fromIndex?: number): boolean;
|
|
63
|
-
flatMap<U, This = undefined>(callback: (this: This, value: string, index: number, array: string[]) => U | readonly U[], thisArg?: This | undefined): U[];
|
|
64
|
-
flat<A, D extends number = 1>(this: A, depth?: D | undefined): FlatArray<A, D>[];
|
|
65
|
-
at(index: number): string | undefined;
|
|
66
|
-
findLast<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S | undefined;
|
|
67
|
-
findLast(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string | undefined;
|
|
68
|
-
findLastIndex(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): number;
|
|
69
|
-
toReversed(): string[];
|
|
70
|
-
toSorted(compareFn?: ((a: string, b: string) => number) | undefined): string[];
|
|
71
|
-
toSpliced(start: number, deleteCount: number, ...items: string[]): string[];
|
|
72
|
-
toSpliced(start: number, deleteCount?: number): string[];
|
|
73
|
-
with(index: number, value: string): string[];
|
|
74
|
-
[Symbol.iterator](): ArrayIterator<string>;
|
|
75
|
-
[Symbol.unscopables]: {
|
|
76
|
-
[x: number]: boolean | undefined;
|
|
77
|
-
length?: boolean | undefined;
|
|
78
|
-
toString?: boolean | undefined;
|
|
79
|
-
toLocaleString?: boolean | undefined;
|
|
80
|
-
pop?: boolean | undefined;
|
|
81
|
-
push?: boolean | undefined;
|
|
82
|
-
concat?: boolean | undefined;
|
|
83
|
-
join?: boolean | undefined;
|
|
84
|
-
reverse?: boolean | undefined;
|
|
85
|
-
shift?: boolean | undefined;
|
|
86
|
-
slice?: boolean | undefined;
|
|
87
|
-
sort?: boolean | undefined;
|
|
88
|
-
splice?: boolean | undefined;
|
|
89
|
-
unshift?: boolean | undefined;
|
|
90
|
-
indexOf?: boolean | undefined;
|
|
91
|
-
lastIndexOf?: boolean | undefined;
|
|
92
|
-
every?: boolean | undefined;
|
|
93
|
-
some?: boolean | undefined;
|
|
94
|
-
forEach?: boolean | undefined;
|
|
95
|
-
map?: boolean | undefined;
|
|
96
|
-
filter?: boolean | undefined;
|
|
97
|
-
reduce?: boolean | undefined;
|
|
98
|
-
reduceRight?: boolean | undefined;
|
|
99
|
-
find?: boolean | undefined;
|
|
100
|
-
findIndex?: boolean | undefined;
|
|
101
|
-
fill?: boolean | undefined;
|
|
102
|
-
copyWithin?: boolean | undefined;
|
|
103
|
-
entries?: boolean | undefined;
|
|
104
|
-
keys?: boolean | undefined;
|
|
105
|
-
values?: boolean | undefined;
|
|
106
|
-
includes?: boolean | undefined;
|
|
107
|
-
flatMap?: boolean | undefined;
|
|
108
|
-
flat?: boolean | undefined;
|
|
109
|
-
at?: boolean | undefined;
|
|
110
|
-
findLast?: boolean | undefined;
|
|
111
|
-
findLastIndex?: boolean | undefined;
|
|
112
|
-
toReversed?: boolean | undefined;
|
|
113
|
-
toSorted?: boolean | undefined;
|
|
114
|
-
toSpliced?: boolean | undefined;
|
|
115
|
-
with?: boolean | undefined;
|
|
116
|
-
[Symbol.iterator]?: boolean | undefined;
|
|
117
|
-
readonly [Symbol.unscopables]?: boolean | undefined;
|
|
118
|
-
};
|
|
119
22
|
};
|
|
120
23
|
}
|
|
121
24
|
export default HeaderNavigation;
|
|
@@ -4,24 +4,24 @@
|
|
|
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';
|
|
8
|
-
import
|
|
7
|
+
import PropTypes, { WeakValidationMap } from 'prop-types';
|
|
8
|
+
import { JSX, type ElementType } from 'react';
|
|
9
9
|
import { PolymorphicProps } from '../../types/common';
|
|
10
|
-
import { HeaderMenuItemBaseProps } from './HeaderMenuItem';
|
|
11
10
|
export interface LinkBaseProps {
|
|
12
11
|
/**
|
|
13
12
|
* @deprecated Use `as` instead
|
|
14
13
|
*/
|
|
15
|
-
element?: undefined;
|
|
16
|
-
|
|
14
|
+
element?: ElementType | undefined;
|
|
15
|
+
as?: ElementType | undefined;
|
|
16
|
+
isSideNavExpanded?: boolean | undefined;
|
|
17
17
|
}
|
|
18
|
-
export type LinkProps<E extends
|
|
18
|
+
export type LinkProps<E extends ElementType = 'a'> = PolymorphicProps<E, LinkBaseProps>;
|
|
19
19
|
export interface LinkComponent {
|
|
20
|
-
<E extends ElementType = 'a'>(props: LinkProps<E>
|
|
20
|
+
<E extends ElementType = 'a'>(props: LinkProps<E>): JSX.Element | null;
|
|
21
21
|
displayName?: string;
|
|
22
22
|
propTypes?: WeakValidationMap<LinkProps<any>>;
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
declare const Link: LinkComponent;
|
|
25
25
|
/**
|
|
26
26
|
* Link is a custom component that allows us to supporting rendering elements
|
|
27
27
|
* other than `a` in our markup. The goal is to allow users to support passing
|
|
@@ -19,10 +19,9 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
19
19
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
20
20
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
21
21
|
|
|
22
|
-
//
|
|
23
|
-
// standard and is used in other places in this project.
|
|
22
|
+
// First define the component without generics
|
|
24
23
|
|
|
25
|
-
const
|
|
24
|
+
const LinkBase = (_ref, ref) => {
|
|
26
25
|
let {
|
|
27
26
|
element,
|
|
28
27
|
as: BaseComponent,
|
|
@@ -35,7 +34,11 @@ const Link = /*#__PURE__*/React__default["default"].forwardRef(function LinkRend
|
|
|
35
34
|
return /*#__PURE__*/React__default["default"].createElement(BaseComponentAsAny, _rollupPluginBabelHelpers["extends"]({
|
|
36
35
|
ref: ref
|
|
37
36
|
}, rest));
|
|
38
|
-
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// Use forwardRef with the non-generic function
|
|
40
|
+
const Link = /*#__PURE__*/React__default["default"].forwardRef(LinkBase);
|
|
41
|
+
|
|
39
42
|
/**
|
|
40
43
|
* Link is a custom component that allows us to supporting rendering elements
|
|
41
44
|
* other than `a` in our markup. The goal is to allow users to support passing
|
|
@@ -65,6 +68,5 @@ const LinkPropTypes = {
|
|
|
65
68
|
Link.displayName = 'Link';
|
|
66
69
|
Link.propTypes = LinkPropTypes;
|
|
67
70
|
|
|
68
|
-
exports.Link = Link;
|
|
69
71
|
exports.LinkPropTypes = LinkPropTypes;
|
|
70
72
|
exports["default"] = Link;
|
|
@@ -4,8 +4,8 @@
|
|
|
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
|
|
8
|
-
export interface SideNavProps
|
|
7
|
+
import React, { type FocusEvent, type KeyboardEvent, type MouseEventHandler } from 'react';
|
|
8
|
+
export interface SideNavProps {
|
|
9
9
|
expanded?: boolean | undefined;
|
|
10
10
|
defaultExpanded?: boolean | undefined;
|
|
11
11
|
isChildOfHeader?: boolean | undefined;
|
|
@@ -25,5 +25,5 @@ interface SideNavContextData {
|
|
|
25
25
|
isRail?: boolean | undefined;
|
|
26
26
|
}
|
|
27
27
|
export declare const SideNavContext: React.Context<SideNavContextData>;
|
|
28
|
-
declare const SideNav: React.ForwardRefExoticComponent<Omit<SideNavProps
|
|
28
|
+
declare const SideNav: React.ForwardRefExoticComponent<Omit<SideNavProps & React.ClassAttributes<HTMLElement> & React.HTMLAttributes<HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
29
29
|
export default SideNav;
|
|
@@ -181,7 +181,7 @@ function SideNavRenderFunction(_ref, ref) {
|
|
|
181
181
|
tabIndex: -1,
|
|
182
182
|
ref: navRef,
|
|
183
183
|
className: `${prefix}--side-nav__navigation ${className}`,
|
|
184
|
-
inert: !isRail ? expanded || isLg
|
|
184
|
+
inert: !isRail ? !(expanded || isLg) : undefined
|
|
185
185
|
}, accessibilityLabel, eventHandlers, other), childrenToRender));
|
|
186
186
|
}
|
|
187
187
|
const SideNav = /*#__PURE__*/React__default["default"].forwardRef(SideNavRenderFunction);
|
|
@@ -51,7 +51,6 @@ SideNavHeader.propTypes = {
|
|
|
51
51
|
/**
|
|
52
52
|
* A component used to render an icon.
|
|
53
53
|
*/
|
|
54
|
-
// @ts-expect-error - PropTypes are unable to cover this case.
|
|
55
54
|
renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object]).isRequired
|
|
56
55
|
};
|
|
57
56
|
|
|
@@ -4,7 +4,8 @@
|
|
|
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 { WeakValidationMap } from 'prop-types';
|
|
8
|
+
import { ComponentType, ElementType, JSX, ReactNode } from 'react';
|
|
8
9
|
import { LinkProps } from './Link';
|
|
9
10
|
export type SideNavLinkProps<E extends ElementType> = LinkProps<E> & {
|
|
10
11
|
/**
|
|
@@ -46,9 +47,7 @@ export type SideNavLinkProps<E extends ElementType> = LinkProps<E> & {
|
|
|
46
47
|
tabIndex?: number;
|
|
47
48
|
};
|
|
48
49
|
export interface SideNavLinkComponent {
|
|
49
|
-
<E extends ElementType = 'a'>(props: SideNavLinkProps<E>
|
|
50
|
-
ref?: ForwardedRef<ElementType>;
|
|
51
|
-
}): JSX.Element | null;
|
|
50
|
+
<E extends ElementType = 'a'>(props: SideNavLinkProps<E>): JSX.Element | null;
|
|
52
51
|
displayName?: string;
|
|
53
52
|
propTypes?: WeakValidationMap<SideNavLinkProps<any>>;
|
|
54
53
|
}
|
|
@@ -26,7 +26,9 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
26
26
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
27
27
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
// First define a non-generic base component to work with forwardRef
|
|
30
|
+
|
|
31
|
+
const SideNavLinkBase = (_ref, ref) => {
|
|
30
32
|
let {
|
|
31
33
|
children,
|
|
32
34
|
className: customClassName,
|
|
@@ -46,14 +48,17 @@ const SideNavLink = /*#__PURE__*/React.forwardRef(function SideNavLink(_ref, ref
|
|
|
46
48
|
});
|
|
47
49
|
return /*#__PURE__*/React__default["default"].createElement(SideNavItem["default"], {
|
|
48
50
|
large: large
|
|
49
|
-
}, /*#__PURE__*/React__default["default"].createElement(Link
|
|
51
|
+
}, /*#__PURE__*/React__default["default"].createElement(Link["default"], _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
50
52
|
className: className,
|
|
51
53
|
ref: ref,
|
|
52
54
|
tabIndex: tabIndex === undefined ? !isSideNavExpanded && !isRail ? -1 : 0 : tabIndex
|
|
53
55
|
}), IconElement && /*#__PURE__*/React__default["default"].createElement(SideNavIcon["default"], {
|
|
54
56
|
small: true
|
|
55
57
|
}, /*#__PURE__*/React__default["default"].createElement(IconElement, null)), /*#__PURE__*/React__default["default"].createElement(SideNavLinkText["default"], null, children)));
|
|
56
|
-
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// Use forwardRef with the non-generic function and cast to the generic component type
|
|
61
|
+
const SideNavLink = /*#__PURE__*/React.forwardRef(SideNavLinkBase);
|
|
57
62
|
SideNavLink.displayName = 'SideNavLink';
|
|
58
63
|
SideNavLink.propTypes = {
|
|
59
64
|
...Link.LinkPropTypes,
|
|
@@ -122,7 +122,6 @@ SideNavMenu.propTypes = {
|
|
|
122
122
|
/**
|
|
123
123
|
* A component used to render an icon.
|
|
124
124
|
*/
|
|
125
|
-
// @ts-expect-error - PropTypes are unable to cover this case.
|
|
126
125
|
renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object]),
|
|
127
126
|
/**
|
|
128
127
|
* Optional prop to specify the tabIndex of the button. If undefined, it will be applied default validation
|
|
@@ -30,53 +30,5 @@ export type SideNavMenuItemProps = ComponentProps<typeof Link> & {
|
|
|
30
30
|
*/
|
|
31
31
|
as?: ElementType;
|
|
32
32
|
};
|
|
33
|
-
declare const SideNavMenuItem: React.ForwardRefExoticComponent<
|
|
34
|
-
/**
|
|
35
|
-
* Specify the children to be rendered inside of the `SideNavMenuItem`
|
|
36
|
-
*/
|
|
37
|
-
children?: React.ReactNode;
|
|
38
|
-
/**
|
|
39
|
-
* Provide an optional class to be applied to the containing node
|
|
40
|
-
*/
|
|
41
|
-
className?: string;
|
|
42
|
-
/**
|
|
43
|
-
* Optionally specify whether the link is "active". An active link is one that
|
|
44
|
-
* has an href that is the same as the current page. Can also pass in
|
|
45
|
-
* `aria-current="page"`, as well.
|
|
46
|
-
*/
|
|
47
|
-
isActive?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Optionally provide an href for the underlying li`
|
|
50
|
-
*/
|
|
51
|
-
href?: string;
|
|
52
|
-
/**
|
|
53
|
-
* Optional component to render instead of default Link
|
|
54
|
-
*/
|
|
55
|
-
as?: ElementType;
|
|
56
|
-
}) | Omit<import("./Link").LinkBaseProps & Omit<any, "as"> & {
|
|
57
|
-
as?: React.ElementType | undefined;
|
|
58
|
-
} & {
|
|
59
|
-
/**
|
|
60
|
-
* Specify the children to be rendered inside of the `SideNavMenuItem`
|
|
61
|
-
*/
|
|
62
|
-
children?: React.ReactNode;
|
|
63
|
-
/**
|
|
64
|
-
* Provide an optional class to be applied to the containing node
|
|
65
|
-
*/
|
|
66
|
-
className?: string;
|
|
67
|
-
/**
|
|
68
|
-
* Optionally specify whether the link is "active". An active link is one that
|
|
69
|
-
* has an href that is the same as the current page. Can also pass in
|
|
70
|
-
* `aria-current="page"`, as well.
|
|
71
|
-
*/
|
|
72
|
-
isActive?: boolean;
|
|
73
|
-
/**
|
|
74
|
-
* Optionally provide an href for the underlying li`
|
|
75
|
-
*/
|
|
76
|
-
href?: string;
|
|
77
|
-
/**
|
|
78
|
-
* Optional component to render instead of default Link
|
|
79
|
-
*/
|
|
80
|
-
as?: ElementType;
|
|
81
|
-
}, "ref">) & React.RefAttributes<HTMLElement>>;
|
|
33
|
+
declare const SideNavMenuItem: React.ForwardRefExoticComponent<Omit<SideNavMenuItemProps, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
82
34
|
export default SideNavMenuItem;
|
|
@@ -83,7 +83,6 @@ SideNavSwitcher.propTypes = {
|
|
|
83
83
|
* `<option>`. The text value will be what is displayed to the user and is set
|
|
84
84
|
* as the `value` prop for each `<option>`.
|
|
85
85
|
*/
|
|
86
|
-
// @ts-expect-error
|
|
87
86
|
options: PropTypes__default["default"].arrayOf(PropTypes__default["default"].string).isRequired
|
|
88
87
|
};
|
|
89
88
|
|
|
@@ -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, { HTMLAttributeAnchorTarget, KeyboardEvent } from 'react';
|
|
7
|
+
import React, { HTMLAttributeAnchorTarget, KeyboardEvent, MouseEvent } from 'react';
|
|
8
8
|
export interface BaseSwitcherItemProps {
|
|
9
9
|
/**
|
|
10
10
|
* Specify the text content for the link
|
|
@@ -32,7 +32,7 @@ export interface BaseSwitcherItemProps {
|
|
|
32
32
|
/**
|
|
33
33
|
* event handlers
|
|
34
34
|
*/
|
|
35
|
-
onClick?: (event: MouseEvent) => void;
|
|
35
|
+
onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
|
|
36
36
|
/**
|
|
37
37
|
* Specify the tab index of the Link
|
|
38
38
|
*/
|
|
@@ -71,7 +71,7 @@ const SwitcherItem = /*#__PURE__*/React.forwardRef(function SwitcherItem(props,
|
|
|
71
71
|
}
|
|
72
72
|
return /*#__PURE__*/React__default["default"].createElement("li", {
|
|
73
73
|
className: classNames
|
|
74
|
-
}, /*#__PURE__*/React__default["default"].createElement(Link
|
|
74
|
+
}, /*#__PURE__*/React__default["default"].createElement(Link["default"], _rollupPluginBabelHelpers["extends"]({
|
|
75
75
|
onKeyDown: evt => {
|
|
76
76
|
setTabFocus(evt);
|
|
77
77
|
onKeyDown(evt);
|
package/lib/index.d.ts
CHANGED
|
@@ -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.
|
|
@@ -35,7 +35,6 @@ export { FeatureFlags, useFeatureFlag, useFeatureFlags, FeatureFlags as unstable
|
|
|
35
35
|
useFeatureFlag as unstable_useFeatureFlag, // this export can be removed in v12
|
|
36
36
|
useFeatureFlags as unstable_useFeatureFlags, } from './components/FeatureFlags';
|
|
37
37
|
export * from './components/FileUploader';
|
|
38
|
-
export * from './components/FilterableMultiSelect';
|
|
39
38
|
export * from './components/FluidForm';
|
|
40
39
|
export * from './components/Form';
|
|
41
40
|
export * from './components/FormGroup';
|
|
@@ -108,6 +107,7 @@ export { FluidSelect as unstable__FluidSelect, FluidSelectSkeleton as unstable__
|
|
|
108
107
|
export { FluidSearch as unstable__FluidSearch, FluidSearchSkeleton as unstable__FluidSearchSkeleton, } from './components/FluidSearch';
|
|
109
108
|
export { FluidTextArea as unstable__FluidTextArea, FluidTextAreaSkeleton as unstable__FluidTextAreaSkeleton, } from './components/FluidTextArea';
|
|
110
109
|
export { FluidTextInput as unstable__FluidTextInput, FluidTextInputSkeleton as unstable__FluidTextInputSkeleton, } from './components/FluidTextInput';
|
|
110
|
+
export { FluidNumberInput as unstable__FluidNumberInput, FluidNumberInputSkeleton as unstable__FluidNumberInputSkeleton, } from './components/FluidNumberInput';
|
|
111
111
|
export { FluidTimePicker as unstable__FluidTimePicker, FluidTimePickerSkeleton as unstable__FluidTimePickerSkeleton, } from './components/FluidTimePicker';
|
|
112
112
|
export { FluidTimePickerSelect as unstable__FluidTimePickerSelect } from './components/FluidTimePickerSelect';
|
|
113
113
|
export * from './components/Heading';
|