@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
|
@@ -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 from 'react';
|
|
7
|
+
import React, { type JSX } from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
/**
|
|
10
10
|
* `HeaderMenu` is used to render submenu's in the `Header`. Most often children
|
|
@@ -117,106 +117,9 @@ declare class HeaderMenu extends React.Component<HeaderMenuProps, HeaderMenuStat
|
|
|
117
117
|
* Optionally provide a tabIndex for the underlying menu button
|
|
118
118
|
*/
|
|
119
119
|
tabIndex: PropTypes.Requireable<number>;
|
|
120
|
-
0: string;
|
|
121
|
-
length: 1;
|
|
122
|
-
toString(): string;
|
|
123
|
-
toLocaleString(): string;
|
|
124
|
-
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string;
|
|
125
|
-
pop(): string | undefined;
|
|
126
|
-
push(...items: string[]): number;
|
|
127
|
-
concat(...items: ConcatArray<string>[]): string[];
|
|
128
|
-
concat(...items: (string | ConcatArray<string>)[]): string[];
|
|
129
|
-
join(separator?: string): string;
|
|
130
|
-
reverse(): string[];
|
|
131
|
-
shift(): string | undefined;
|
|
132
|
-
slice(start?: number, end?: number): string[];
|
|
133
|
-
sort(compareFn?: ((a: string, b: string) => number) | undefined): [key: string];
|
|
134
|
-
splice(start: number, deleteCount?: number): string[];
|
|
135
|
-
splice(start: number, deleteCount: number, ...items: string[]): string[];
|
|
136
|
-
unshift(...items: string[]): number;
|
|
137
|
-
indexOf(searchElement: string, fromIndex?: number): number;
|
|
138
|
-
lastIndexOf(searchElement: string, fromIndex?: number): number;
|
|
139
|
-
every<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): this is S[];
|
|
140
|
-
every(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): boolean;
|
|
141
|
-
some(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): boolean;
|
|
142
|
-
forEach(callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any): void;
|
|
143
|
-
map<U>(callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any): U[];
|
|
144
|
-
filter<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S[];
|
|
145
|
-
filter(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[];
|
|
146
|
-
reduce(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
|
|
147
|
-
reduce(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
|
|
148
|
-
reduce<U>(callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U;
|
|
149
|
-
reduceRight(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
|
|
150
|
-
reduceRight(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
|
|
151
|
-
reduceRight<U>(callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U;
|
|
152
|
-
find<S extends string>(predicate: (value: string, index: number, obj: string[]) => value is S, thisArg?: any): S | undefined;
|
|
153
|
-
find(predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any): string | undefined;
|
|
154
|
-
findIndex(predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any): number;
|
|
155
|
-
fill(value: string, start?: number, end?: number): [key: string];
|
|
156
|
-
copyWithin(target: number, start: number, end?: number): [key: string];
|
|
157
|
-
entries(): ArrayIterator<[number, string]>;
|
|
158
|
-
keys(): ArrayIterator<number>;
|
|
159
|
-
values(): ArrayIterator<string>;
|
|
160
|
-
includes(searchElement: string, fromIndex?: number): boolean;
|
|
161
|
-
flatMap<U, This = undefined>(callback: (this: This, value: string, index: number, array: string[]) => U | readonly U[], thisArg?: This | undefined): U[];
|
|
162
|
-
flat<A, D extends number = 1>(this: A, depth?: D | undefined): FlatArray<A, D>[];
|
|
163
|
-
at(index: number): string | undefined;
|
|
164
|
-
findLast<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S | undefined;
|
|
165
|
-
findLast(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string | undefined;
|
|
166
|
-
findLastIndex(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): number;
|
|
167
|
-
toReversed(): string[];
|
|
168
|
-
toSorted(compareFn?: ((a: string, b: string) => number) | undefined): string[];
|
|
169
|
-
toSpliced(start: number, deleteCount: number, ...items: string[]): string[];
|
|
170
|
-
toSpliced(start: number, deleteCount?: number): string[];
|
|
171
|
-
with(index: number, value: string): string[];
|
|
172
|
-
[Symbol.iterator](): ArrayIterator<string>;
|
|
173
|
-
[Symbol.unscopables]: {
|
|
174
|
-
[x: number]: boolean | undefined;
|
|
175
|
-
length?: boolean | undefined;
|
|
176
|
-
toString?: boolean | undefined;
|
|
177
|
-
toLocaleString?: boolean | undefined;
|
|
178
|
-
pop?: boolean | undefined;
|
|
179
|
-
push?: boolean | undefined;
|
|
180
|
-
concat?: boolean | undefined;
|
|
181
|
-
join?: boolean | undefined;
|
|
182
|
-
reverse?: boolean | undefined;
|
|
183
|
-
shift?: boolean | undefined;
|
|
184
|
-
slice?: boolean | undefined;
|
|
185
|
-
sort?: boolean | undefined;
|
|
186
|
-
splice?: boolean | undefined;
|
|
187
|
-
unshift?: boolean | undefined;
|
|
188
|
-
indexOf?: boolean | undefined;
|
|
189
|
-
lastIndexOf?: boolean | undefined;
|
|
190
|
-
every?: boolean | undefined;
|
|
191
|
-
some?: boolean | undefined;
|
|
192
|
-
forEach?: boolean | undefined;
|
|
193
|
-
map?: boolean | undefined;
|
|
194
|
-
filter?: boolean | undefined;
|
|
195
|
-
reduce?: boolean | undefined;
|
|
196
|
-
reduceRight?: boolean | undefined;
|
|
197
|
-
find?: boolean | undefined;
|
|
198
|
-
findIndex?: boolean | undefined;
|
|
199
|
-
fill?: boolean | undefined;
|
|
200
|
-
copyWithin?: boolean | undefined;
|
|
201
|
-
entries?: boolean | undefined;
|
|
202
|
-
keys?: boolean | undefined;
|
|
203
|
-
values?: boolean | undefined;
|
|
204
|
-
includes?: boolean | undefined;
|
|
205
|
-
flatMap?: boolean | undefined;
|
|
206
|
-
flat?: boolean | undefined;
|
|
207
|
-
at?: boolean | undefined;
|
|
208
|
-
findLast?: boolean | undefined;
|
|
209
|
-
findLastIndex?: boolean | undefined;
|
|
210
|
-
toReversed?: boolean | undefined;
|
|
211
|
-
toSorted?: boolean | undefined;
|
|
212
|
-
toSpliced?: boolean | undefined;
|
|
213
|
-
with?: boolean | undefined;
|
|
214
|
-
[Symbol.iterator]?: boolean | undefined;
|
|
215
|
-
readonly [Symbol.unscopables]?: boolean | undefined;
|
|
216
|
-
};
|
|
217
120
|
};
|
|
218
121
|
static contextType: React.Context<string>;
|
|
219
|
-
_subMenus: React.RefObject<HTMLUListElement>;
|
|
122
|
+
_subMenus: React.RefObject<HTMLUListElement | null>;
|
|
220
123
|
private items;
|
|
221
124
|
private menuButtonRef;
|
|
222
125
|
constructor(props: any);
|
|
@@ -157,9 +157,15 @@ class HeaderMenu extends React__default.Component {
|
|
|
157
157
|
onKeyDown,
|
|
158
158
|
...rest
|
|
159
159
|
} = this.props;
|
|
160
|
-
const hasActiveDescendant = childrenArg => React__default.Children.toArray(childrenArg).some(child =>
|
|
161
|
-
|
|
162
|
-
|
|
160
|
+
const hasActiveDescendant = childrenArg => React__default.Children.toArray(childrenArg).some(child => {
|
|
161
|
+
if (! /*#__PURE__*/React__default.isValidElement(child)) {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Explicitly type the element to access props safely
|
|
166
|
+
const element = child;
|
|
167
|
+
return element.props.isActive || element.props.isCurrentPage || Array.isArray(element.props.children) && hasActiveDescendant(element.props.children);
|
|
168
|
+
});
|
|
163
169
|
const accessibilityLabel = {
|
|
164
170
|
'aria-label': ariaLabel,
|
|
165
171
|
'aria-labelledby': ariaLabelledBy
|
|
@@ -203,6 +209,7 @@ class HeaderMenu extends React__default.Component {
|
|
|
203
209
|
className: `${this.context}--header__menu-arrow`
|
|
204
210
|
})), /*#__PURE__*/React__default.createElement("ul", _extends({}, accessibilityLabel, {
|
|
205
211
|
ref: this._subMenus,
|
|
212
|
+
onClick: this.handleOnClick,
|
|
206
213
|
className: `${prefix}--header__menu`
|
|
207
214
|
}), React__default.Children.map(children, this._renderMenuItem)));
|
|
208
215
|
}
|
|
@@ -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
|
}
|
|
@@ -9,11 +9,11 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
|
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import React__default, { forwardRef } from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
|
-
import { LinkPropTypes
|
|
12
|
+
import Link, { LinkPropTypes } from './Link.js';
|
|
13
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
14
|
import deprecate from '../../prop-types/deprecate.js';
|
|
15
15
|
|
|
16
|
-
const HeaderMenuItem = /*#__PURE__*/forwardRef(function
|
|
16
|
+
const HeaderMenuItem = /*#__PURE__*/forwardRef(function HeaderMenuItem(_ref, ref) {
|
|
17
17
|
let {
|
|
18
18
|
className,
|
|
19
19
|
isActive,
|
|
@@ -21,7 +21,7 @@ const HeaderMenuItem = /*#__PURE__*/forwardRef(function HeaderMenuItemRenderFunc
|
|
|
21
21
|
'aria-current': ariaCurrent,
|
|
22
22
|
children,
|
|
23
23
|
role,
|
|
24
|
-
tabIndex
|
|
24
|
+
tabIndex,
|
|
25
25
|
...rest
|
|
26
26
|
} = _ref;
|
|
27
27
|
const prefix = usePrefix();
|
|
@@ -9,7 +9,7 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
|
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import React__default from 'react';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
|
-
import { LinkPropTypes
|
|
12
|
+
import Link, { LinkPropTypes } from './Link.js';
|
|
13
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
14
|
|
|
15
15
|
function HeaderName(_ref) {
|
|
@@ -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
|
|
@@ -10,10 +10,9 @@ import PropTypes from 'prop-types';
|
|
|
10
10
|
import React__default from 'react';
|
|
11
11
|
import deprecate from '../../prop-types/deprecate.js';
|
|
12
12
|
|
|
13
|
-
//
|
|
14
|
-
// standard and is used in other places in this project.
|
|
13
|
+
// First define the component without generics
|
|
15
14
|
|
|
16
|
-
const
|
|
15
|
+
const LinkBase = (_ref, ref) => {
|
|
17
16
|
let {
|
|
18
17
|
element,
|
|
19
18
|
as: BaseComponent,
|
|
@@ -26,7 +25,11 @@ const Link = /*#__PURE__*/React__default.forwardRef(function LinkRenderFunction(
|
|
|
26
25
|
return /*#__PURE__*/React__default.createElement(BaseComponentAsAny, _extends({
|
|
27
26
|
ref: ref
|
|
28
27
|
}, rest));
|
|
29
|
-
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// Use forwardRef with the non-generic function
|
|
31
|
+
const Link = /*#__PURE__*/React__default.forwardRef(LinkBase);
|
|
32
|
+
|
|
30
33
|
/**
|
|
31
34
|
* Link is a custom component that allows us to supporting rendering elements
|
|
32
35
|
* other than `a` in our markup. The goal is to allow users to support passing
|
|
@@ -56,4 +59,4 @@ const LinkPropTypes = {
|
|
|
56
59
|
Link.displayName = 'Link';
|
|
57
60
|
Link.propTypes = LinkPropTypes;
|
|
58
61
|
|
|
59
|
-
export {
|
|
62
|
+
export { LinkPropTypes, Link as default };
|
|
@@ -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;
|
|
@@ -171,7 +171,7 @@ function SideNavRenderFunction(_ref, ref) {
|
|
|
171
171
|
tabIndex: -1,
|
|
172
172
|
ref: navRef,
|
|
173
173
|
className: `${prefix}--side-nav__navigation ${className}`,
|
|
174
|
-
inert: !isRail ? expanded || isLg
|
|
174
|
+
inert: !isRail ? !(expanded || isLg) : undefined
|
|
175
175
|
}, accessibilityLabel, eventHandlers, other), childrenToRender));
|
|
176
176
|
}
|
|
177
177
|
const SideNav = /*#__PURE__*/React__default.forwardRef(SideNavRenderFunction);
|
|
@@ -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
|
}
|
|
@@ -9,14 +9,16 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
|
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import React__default, { forwardRef, useContext } from 'react';
|
|
12
|
-
import { LinkPropTypes
|
|
12
|
+
import Link, { LinkPropTypes } from './Link.js';
|
|
13
13
|
import SideNavIcon from './SideNavIcon.js';
|
|
14
14
|
import SideNavItem from './SideNavItem.js';
|
|
15
15
|
import SideNavLinkText from './SideNavLinkText.js';
|
|
16
16
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
17
17
|
import { SideNavContext } from './SideNav.js';
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
// First define a non-generic base component to work with forwardRef
|
|
20
|
+
|
|
21
|
+
const SideNavLinkBase = (_ref, ref) => {
|
|
20
22
|
let {
|
|
21
23
|
children,
|
|
22
24
|
className: customClassName,
|
|
@@ -43,7 +45,10 @@ const SideNavLink = /*#__PURE__*/forwardRef(function SideNavLink(_ref, ref) {
|
|
|
43
45
|
}), IconElement && /*#__PURE__*/React__default.createElement(SideNavIcon, {
|
|
44
46
|
small: true
|
|
45
47
|
}, /*#__PURE__*/React__default.createElement(IconElement, null)), /*#__PURE__*/React__default.createElement(SideNavLinkText, null, children)));
|
|
46
|
-
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// Use forwardRef with the non-generic function and cast to the generic component type
|
|
51
|
+
const SideNavLink = /*#__PURE__*/forwardRef(SideNavLinkBase);
|
|
47
52
|
SideNavLink.displayName = 'SideNavLink';
|
|
48
53
|
SideNavLink.propTypes = {
|
|
49
54
|
...LinkPropTypes,
|
|
@@ -112,7 +112,6 @@ SideNavMenu.propTypes = {
|
|
|
112
112
|
/**
|
|
113
113
|
* A component used to render an icon.
|
|
114
114
|
*/
|
|
115
|
-
// @ts-expect-error - PropTypes are unable to cover this case.
|
|
116
115
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
117
116
|
/**
|
|
118
117
|
* 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;
|
|
@@ -10,7 +10,7 @@ import cx from 'classnames';
|
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import React__default from 'react';
|
|
12
12
|
import SideNavLinkText from './SideNavLinkText.js';
|
|
13
|
-
import
|
|
13
|
+
import Link from './Link.js';
|
|
14
14
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
15
15
|
|
|
16
16
|
const SideNavMenuItem = /*#__PURE__*/React__default.forwardRef(function SideNavMenuItem(props, ref) {
|