@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, { 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
|
*/
|
|
@@ -9,7 +9,7 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
|
|
|
9
9
|
import React__default, { forwardRef } from 'react';
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
|
-
import
|
|
12
|
+
import Link from './Link.js';
|
|
13
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
14
|
import { ArrowDown, ArrowUp } from '../../internal/keyboard/keys.js';
|
|
15
15
|
import { match } from '../../internal/keyboard/match.js';
|
package/es/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';
|
package/es/index.js
CHANGED
|
@@ -73,7 +73,8 @@ export { MenuItem, MenuItemDivider, MenuItemGroup, MenuItemRadioGroup, MenuItemS
|
|
|
73
73
|
export { MenuButton } from './components/MenuButton/index.js';
|
|
74
74
|
export { default as Modal } from './components/Modal/Modal.js';
|
|
75
75
|
export { default as ModalWrapper } from './components/ModalWrapper/ModalWrapper.js';
|
|
76
|
-
|
|
76
|
+
export { FilterableMultiSelect } from './components/MultiSelect/FilterableMultiSelect.js';
|
|
77
|
+
export { MultiSelect } from './components/MultiSelect/MultiSelect.js';
|
|
77
78
|
export { ActionableNotification, Callout, InlineNotification, NotificationActionButton, NotificationButton, StaticNotification, ToastNotification } from './components/Notification/Notification.js';
|
|
78
79
|
export { default as NumberInputSkeleton } from './components/NumberInput/NumberInput.Skeleton.js';
|
|
79
80
|
export { NumberInput } from './components/NumberInput/NumberInput.js';
|
|
@@ -122,14 +123,15 @@ export { default as SelectableTag } from './components/Tag/SelectableTag.js';
|
|
|
122
123
|
export { default as TagSkeleton } from './components/Tag/Tag.Skeleton.js';
|
|
123
124
|
export { default as TextArea } from './components/TextArea/TextArea.js';
|
|
124
125
|
export { default as TextAreaSkeleton } from './components/TextArea/TextArea.Skeleton.js';
|
|
125
|
-
|
|
126
|
+
export { default as TextInput } from './components/TextInput/TextInput.js';
|
|
127
|
+
export { default as TextInputSkeleton } from './components/TextInput/TextInput.Skeleton.js';
|
|
126
128
|
export { ClickableTile, ExpandableTile, SelectableTile, Tile, TileAboveTheFoldContent, TileBelowTheFoldContent } from './components/Tile/Tile.js';
|
|
127
129
|
export { default as TileGroup } from './components/TileGroup/TileGroup.js';
|
|
128
130
|
export { default as TimePicker } from './components/TimePicker/TimePicker.js';
|
|
129
131
|
export { default as TimePickerSelect } from './components/TimePickerSelect/TimePickerSelect.js';
|
|
130
132
|
export { Toggle } from './components/Toggle/Toggle.js';
|
|
131
133
|
export { default as ToggleSkeleton } from './components/Toggle/Toggle.Skeleton.js';
|
|
132
|
-
export {
|
|
134
|
+
export { ToggleSmallSkeleton } from './components/ToggleSmall/ToggleSmall.Skeleton.js';
|
|
133
135
|
export { Toggletip, ToggletipActions, ToggletipButton, ToggletipContent, ToggletipLabel } from './components/Toggletip/index.js';
|
|
134
136
|
export { default as TreeNode } from './components/TreeView/TreeNode.js';
|
|
135
137
|
export { default as TreeView } from './components/TreeView/TreeView.js';
|
|
@@ -181,6 +183,8 @@ export { default as unstable__FluidTextAreaSkeleton } from './components/FluidTe
|
|
|
181
183
|
export { default as unstable__FluidTextInput } from './components/FluidTextInput/FluidTextInput.js';
|
|
182
184
|
import './components/FluidTextInput/FluidPasswordInput.js';
|
|
183
185
|
export { default as unstable__FluidTextInputSkeleton } from './components/FluidTextInput/FluidTextInput.Skeleton.js';
|
|
186
|
+
export { default as unstable__FluidNumberInput } from './components/FluidNumberInput/FluidNumberInput.js';
|
|
187
|
+
export { default as unstable__FluidNumberInputSkeleton } from './components/FluidNumberInput/FluidNumberInput.Skeleton.js';
|
|
184
188
|
export { default as unstable__FluidTimePicker } from './components/FluidTimePicker/FluidTimePicker.js';
|
|
185
189
|
export { default as unstable__FluidTimePickerSkeleton } from './components/FluidTimePicker/FluidTimePicker.Skeleton.js';
|
|
186
190
|
export { default as unstable__FluidTimePickerSelect } from './components/FluidTimePickerSelect/FluidTimePickerSelect.js';
|
|
@@ -209,10 +213,7 @@ export { default as unstable_PageSelector } from './components/Pagination/experi
|
|
|
209
213
|
export { default as unstable_Pagination } from './components/Pagination/experimental/Pagination.js';
|
|
210
214
|
export { default as ContainedListItem } from './components/ContainedList/ContainedListItem/ContainedListItem.js';
|
|
211
215
|
export { default as ContainedList } from './components/ContainedList/ContainedList.js';
|
|
212
|
-
export { default as MultiSelect } from './components/MultiSelect/MultiSelect.js';
|
|
213
216
|
export { default as SliderSkeleton } from './components/Slider/Slider.Skeleton.js';
|
|
214
|
-
export { default as TextInputSkeleton } from './components/TextInput/TextInput.Skeleton.js';
|
|
215
|
-
export { default as TextInput } from './components/TextInput/TextInput.js';
|
|
216
217
|
export { LayoutDirection as unstable_LayoutDirection } from './components/LayoutDirection/LayoutDirection.js';
|
|
217
218
|
export { useLayoutDirection as unstable_useLayoutDirection } from './components/LayoutDirection/useLayoutDirection.js';
|
|
218
219
|
export { Text as unstable_Text } from './components/Text/Text.js';
|
|
@@ -240,4 +241,3 @@ export { default as TableToolbarAction } from './components/DataTable/TableToolb
|
|
|
240
241
|
export { default as TableToolbarContent } from './components/DataTable/TableToolbarContent.js';
|
|
241
242
|
export { default as TableToolbarSearch } from './components/DataTable/TableToolbarSearch.js';
|
|
242
243
|
export { default as TableToolbarMenu } from './components/DataTable/TableToolbarMenu.js';
|
|
243
|
-
export { default as FilterableMultiSelect } from './components/MultiSelect/FilterableMultiSelect.js';
|
|
@@ -230,7 +230,8 @@ const FloatingMenu = _ref2 => {
|
|
|
230
230
|
visibility: 'hidden',
|
|
231
231
|
top: '0px'
|
|
232
232
|
};
|
|
233
|
-
|
|
233
|
+
const child = children;
|
|
234
|
+
return /*#__PURE__*/cloneElement(child, {
|
|
234
235
|
ref: handleMenuRef,
|
|
235
236
|
style: {
|
|
236
237
|
...styles,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Clamps a number between a minimum and maximum value (inclusive).
|
|
9
|
+
*/
|
|
10
|
+
export declare const clamp: <T extends number>(num: number, min: T, max: T) => T;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Clamps a number between a minimum and maximum value (inclusive).
|
|
10
|
+
*/
|
|
11
|
+
const clamp = (num, min, max) => Math.min(max, Math.max(min, num));
|
|
12
|
+
|
|
13
|
+
export { clamp };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { type MutableRefObject } from 'react';
|
|
8
|
+
export declare const useEvent: <E extends keyof GlobalEventHandlersEventMap>(elementOrRef: HTMLElement | MutableRefObject<HTMLElement | null>, eventName: E, callback: (event: GlobalEventHandlersEventMap[E]) => void) => void;
|
|
9
|
+
export declare const useWindowEvent: <E extends keyof WindowEventMap>(eventName: E, callback: (event: WindowEventMap[E]) => void) => void;
|
package/es/internal/useEvent.js
CHANGED
|
@@ -7,81 +7,40 @@
|
|
|
7
7
|
|
|
8
8
|
import { useRef, useEffect } from 'react';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @template {keyof GlobalEventHandlersEventMap} E
|
|
14
|
-
* @typedef {(event: GlobalEventHandlersEventMap[E]) => void} GlobalEventCallback
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @template T
|
|
19
|
-
* @typedef {import('react').MutableRefObject<T>} MutableRefObject<T>
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @template {keyof GlobalEventHandlersEventMap} E
|
|
24
|
-
* @param {HTMLElement | MutableRefObject<HTMLElement | null>} elementOrRef
|
|
25
|
-
* @param {E} eventName
|
|
26
|
-
* @param {GlobalEventCallback<E>} callback
|
|
27
|
-
*/
|
|
28
|
-
function useEvent(elementOrRef, eventName, callback) {
|
|
29
|
-
/**
|
|
30
|
-
* @type {MutableRefObject<GlobalEventCallback<E> | null>}
|
|
31
|
-
*/
|
|
10
|
+
const useEvent = (elementOrRef, eventName, callback) => {
|
|
32
11
|
const savedCallback = useRef(null);
|
|
33
12
|
useEffect(() => {
|
|
34
13
|
savedCallback.current = callback;
|
|
35
14
|
}, [callback]);
|
|
36
15
|
useEffect(() => {
|
|
37
|
-
/**
|
|
38
|
-
* @type {GlobalEventCallback<E>}
|
|
39
|
-
*/
|
|
40
16
|
const handler = event => {
|
|
41
17
|
if (savedCallback.current) {
|
|
42
18
|
savedCallback.current(event);
|
|
43
19
|
}
|
|
44
20
|
};
|
|
45
21
|
const element = 'current' in elementOrRef ? elementOrRef.current : elementOrRef;
|
|
46
|
-
element?.addEventListener
|
|
22
|
+
element?.addEventListener(eventName, handler);
|
|
47
23
|
return () => {
|
|
48
|
-
element?.removeEventListener
|
|
24
|
+
element?.removeEventListener(eventName, handler);
|
|
49
25
|
};
|
|
50
26
|
}, [elementOrRef, eventName]);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* @template {keyof WindowEventMap} E
|
|
55
|
-
* @typedef {(event: WindowEventMap[E]) => void} WindowEventCallback
|
|
56
|
-
*/
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* @template {keyof WindowEventMap} E
|
|
60
|
-
* @param {E} eventName
|
|
61
|
-
* @param {WindowEventCallback<E>} callback
|
|
62
|
-
*/
|
|
63
|
-
function useWindowEvent(eventName, callback) {
|
|
64
|
-
/**
|
|
65
|
-
* @type {MutableRefObject<WindowEventCallback<E> | null>}
|
|
66
|
-
*/
|
|
27
|
+
};
|
|
28
|
+
const useWindowEvent = (eventName, callback) => {
|
|
67
29
|
const savedCallback = useRef(null);
|
|
68
30
|
useEffect(() => {
|
|
69
31
|
savedCallback.current = callback;
|
|
70
32
|
}, [callback]);
|
|
71
33
|
useEffect(() => {
|
|
72
|
-
|
|
73
|
-
* @type {WindowEventCallback<E>}
|
|
74
|
-
*/
|
|
75
|
-
function handler(event) {
|
|
34
|
+
const handler = event => {
|
|
76
35
|
if (savedCallback.current) {
|
|
77
36
|
savedCallback.current(event);
|
|
78
37
|
}
|
|
79
|
-
}
|
|
38
|
+
};
|
|
80
39
|
window.addEventListener(eventName, handler);
|
|
81
40
|
return () => {
|
|
82
41
|
window.removeEventListener(eventName, handler);
|
|
83
42
|
};
|
|
84
43
|
}, [eventName]);
|
|
85
|
-
}
|
|
44
|
+
};
|
|
86
45
|
|
|
87
46
|
export { useEvent, useWindowEvent };
|
package/es/internal/useId.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React__default, { useState, useEffect, useLayoutEffect } from 'react';
|
|
9
|
-
import setupGetInstanceId from '../tools/setupGetInstanceId.js';
|
|
9
|
+
import { setupGetInstanceId } from '../tools/setupGetInstanceId.js';
|
|
10
10
|
import { canUseDOM } from './environment.js';
|
|
11
11
|
import { useIdPrefix } from './useIdPrefix.js';
|
|
12
12
|
|
|
@@ -4,5 +4,10 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
/**
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Listens to changes in a media query and returns whether it matches.
|
|
9
|
+
* @param mediaQuery - The media query to listen to. For example, `(min-width: 600px)`.
|
|
10
|
+
* @param defaultState - The initial state to return before the media query is evaluated. Defaults to `false`.
|
|
11
|
+
* @returns Whether the media query matches.
|
|
12
|
+
*/
|
|
13
|
+
export declare const useMatchMedia: (mediaQuery: string, defaultState?: boolean) => boolean;
|
|
@@ -6,17 +6,16 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { useState, useEffect } from 'react';
|
|
9
|
-
import { canUseDOM } from './environment.js';
|
|
10
9
|
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Listens to changes in a media query and returns whether it matches.
|
|
12
|
+
* @param mediaQuery - The media query to listen to. For example, `(min-width: 600px)`.
|
|
13
|
+
* @param defaultState - The initial state to return before the media query is evaluated. Defaults to `false`.
|
|
14
|
+
* @returns Whether the media query matches.
|
|
15
|
+
*/
|
|
16
|
+
const useMatchMedia = function (mediaQuery) {
|
|
17
|
+
let defaultState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
18
|
+
const [matches, setMatches] = useState(defaultState);
|
|
20
19
|
useEffect(() => {
|
|
21
20
|
const listener = event => {
|
|
22
21
|
setMatches(event.matches);
|
|
@@ -14,9 +14,11 @@ function useNoInteractiveChildren(ref) {
|
|
|
14
14
|
useEffect(() => {
|
|
15
15
|
const node = ref.current ? getInteractiveContent(ref.current) : false;
|
|
16
16
|
if (node) {
|
|
17
|
-
|
|
17
|
+
const errorMessage = `Error: ${message}.\n\nInstead found: ${node.outerHTML}`;
|
|
18
|
+
console.error(errorMessage);
|
|
19
|
+
throw new Error(errorMessage);
|
|
18
20
|
}
|
|
19
|
-
});
|
|
21
|
+
}, []);
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
function useInteractiveChildrenNeedDescription(ref) {
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { type RefObject } from 'react';
|
|
8
|
-
export declare const useOutsideClick: <T extends HTMLElement>(ref: RefObject<T>, callback: (event: MouseEvent) => void) => void;
|
|
8
|
+
export declare const useOutsideClick: <T extends HTMLElement | null>(ref: RefObject<T>, callback: (event: MouseEvent) => void) => void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import type { Validator, ValidationMap } from 'prop-types';
|
|
8
|
+
/**
|
|
9
|
+
* Returns a set of prop-type validators that enforce at least one of the
|
|
10
|
+
* specified props must be provided.
|
|
11
|
+
*
|
|
12
|
+
* @param propTypes - An object of prop-type validators. The keys of the object
|
|
13
|
+
* are the names of the props, and the values are the prop-type validators.
|
|
14
|
+
* @returns A new object of wrapped prop-type validators.
|
|
15
|
+
*/
|
|
16
|
+
export declare const isRequiredOneOf: <T extends Record<string, Validator<any>>>(propTypes: T) => ValidationMap<any>;
|
|
@@ -6,12 +6,14 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* Returns a set of prop-type validators that enforce at least one of the
|
|
10
|
+
* specified props must be provided.
|
|
11
|
+
*
|
|
12
|
+
* @param propTypes - An object of prop-type validators. The keys of the object
|
|
13
|
+
* are the names of the props, and the values are the prop-type validators.
|
|
14
|
+
* @returns A new object of wrapped prop-type validators.
|
|
13
15
|
*/
|
|
14
|
-
|
|
16
|
+
const isRequiredOneOf = propTypes => {
|
|
15
17
|
const names = Object.keys(propTypes);
|
|
16
18
|
const checker = propType => function (props, propName, componentName) {
|
|
17
19
|
if (process.env.NODE_ENV !== 'production' && names.every(name => typeof props[name] === 'undefined')) {
|
|
@@ -22,10 +24,10 @@ function isRequiredOneOf(propTypes) {
|
|
|
22
24
|
}
|
|
23
25
|
return propType(props, propName, componentName, ...rest);
|
|
24
26
|
};
|
|
25
|
-
return names.reduce((
|
|
26
|
-
...
|
|
27
|
+
return names.reduce((acc, name) => ({
|
|
28
|
+
...acc,
|
|
27
29
|
[name]: checker(propTypes[name])
|
|
28
30
|
}), {});
|
|
29
|
-
}
|
|
31
|
+
};
|
|
30
32
|
|
|
31
|
-
export { isRequiredOneOf
|
|
33
|
+
export { isRequiredOneOf };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Creates an instance ID generator.
|
|
9
|
+
*
|
|
10
|
+
* @returns A function that returns a unique sequential ID on each call.
|
|
11
|
+
*/
|
|
12
|
+
export declare const setupGetInstanceId: () => () => number;
|
|
@@ -6,14 +6,13 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* Creates an instance ID generator.
|
|
10
|
+
*
|
|
11
|
+
* @returns A function that returns a unique sequential ID on each call.
|
|
11
12
|
*/
|
|
12
|
-
|
|
13
|
+
const setupGetInstanceId = () => {
|
|
13
14
|
let instanceId = 0;
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
}
|
|
15
|
+
return () => ++instanceId;
|
|
16
|
+
};
|
|
18
17
|
|
|
19
|
-
export { setupGetInstanceId
|
|
18
|
+
export { setupGetInstanceId };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2019, 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Toggles a class on an element.
|
|
9
|
+
*
|
|
10
|
+
* @param element - The target element.
|
|
11
|
+
* @param className - The class to toggle.
|
|
12
|
+
* @param add - `true` to add the class, `false` to remove it.
|
|
13
|
+
*/
|
|
14
|
+
export declare const toggleClass: (element: Element, className: string, add: boolean) => void;
|
package/es/tools/toggleClass.js
CHANGED
|
@@ -6,15 +6,14 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @param
|
|
12
|
-
* @param
|
|
9
|
+
* Toggles a class on an element.
|
|
10
|
+
*
|
|
11
|
+
* @param element - The target element.
|
|
12
|
+
* @param className - The class to toggle.
|
|
13
|
+
* @param add - `true` to add the class, `false` to remove it.
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
}
|
|
15
|
+
const toggleClass = (element, className, add) => {
|
|
16
|
+
element.classList.toggle(className, add);
|
|
17
|
+
};
|
|
19
18
|
|
|
20
|
-
export { toggleClass
|
|
19
|
+
export { toggleClass };
|
|
@@ -16,5 +16,5 @@ type WrapComponentArgs<T extends HTMLTagName> = {
|
|
|
16
16
|
* @param {{ name: string, type: string, className?: string | (prefix: string) => string }} props
|
|
17
17
|
* @returns
|
|
18
18
|
*/
|
|
19
|
-
declare const wrapComponent: <T extends HTMLTagName>({ name, className: getClassName, type, }: WrapComponentArgs<T>) => ((props: ReactAttr<T>) => React.ReactElement);
|
|
19
|
+
declare const wrapComponent: <T extends HTMLTagName>({ name, className: getClassName, type, }: WrapComponentArgs<T>) => ((props: ReactAttr<T>) => React.ReactElement<any>);
|
|
20
20
|
export default wrapComponent;
|
package/es/types/common.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2023,
|
|
2
|
+
* Copyright IBM Corp. 2023, 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.
|
|
@@ -22,8 +22,3 @@ export interface TranslateWithId<MID = string, ARGS = Record<string, unknown>> {
|
|
|
22
22
|
*/
|
|
23
23
|
translateWithId?(messageId: MID, args?: ARGS): string;
|
|
24
24
|
}
|
|
25
|
-
/**
|
|
26
|
-
* Alias of TranslateWithId. Will be removed in v12
|
|
27
|
-
* @deprecated Use TranslateWithId instead
|
|
28
|
-
*/
|
|
29
|
-
export type InternationalProps<MID = string, ARGS = Record<string, unknown>> = TranslateWithId<MID, ARGS>;
|
|
@@ -33,12 +33,12 @@ export interface AccordionItemProps {
|
|
|
33
33
|
* removed in the next major release of Carbon. Use the
|
|
34
34
|
* `renderToggle` prop instead.
|
|
35
35
|
*/
|
|
36
|
-
renderExpando?: (props: PropsWithChildren<AccordionToggleProps>) => ReactElement
|
|
36
|
+
renderExpando?: (props: PropsWithChildren<AccordionToggleProps>) => ReactElement<any>;
|
|
37
37
|
/**
|
|
38
38
|
* The callback function to render the expand button.
|
|
39
39
|
* Can be a React component class.
|
|
40
40
|
*/
|
|
41
|
-
renderToggle?: (props: PropsWithChildren<AccordionToggleProps>) => ReactElement
|
|
41
|
+
renderToggle?: (props: PropsWithChildren<AccordionToggleProps>) => ReactElement<any>;
|
|
42
42
|
/**
|
|
43
43
|
* The accordion title.
|
|
44
44
|
*/
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import { PropsWithChildren,
|
|
8
|
+
import { PropsWithChildren, HTMLElementType } from 'react';
|
|
9
9
|
export interface AspectRatioProps {
|
|
10
10
|
/**
|
|
11
11
|
* Provide a custom component or string to be rendered as
|
|
@@ -17,7 +17,7 @@ export interface AspectRatioProps {
|
|
|
17
17
|
* <AspectRatio as="article">My content</AspectRatio>
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
|
-
as?:
|
|
20
|
+
as?: HTMLElementType;
|
|
21
21
|
/**
|
|
22
22
|
* Specify a class name for the outermost node
|
|
23
23
|
* of the component.
|
|
@@ -53,6 +53,9 @@ const Button = /*#__PURE__*/React__default["default"].forwardRef((props, ref) =>
|
|
|
53
53
|
tooltipPosition = 'top',
|
|
54
54
|
...rest
|
|
55
55
|
} = props;
|
|
56
|
+
if (ButtonImageElement && !children && !iconDescription) {
|
|
57
|
+
console.error('Button: renderIcon property specified without also providing an iconDescription property. ' + 'This may impact accessibility for screen reader users.');
|
|
58
|
+
}
|
|
56
59
|
const handleClick = evt => {
|
|
57
60
|
// Prevent clicks on the tooltip from triggering the button click event
|
|
58
61
|
if (evt.target === tooltipRef.current) {
|
|
@@ -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 { ButtonProps } from './Button';
|
|
9
|
-
declare const ButtonBase: React.ForwardRefExoticComponent<Omit<ButtonProps<React.ElementType<any, keyof
|
|
9
|
+
declare const ButtonBase: React.ForwardRefExoticComponent<Omit<ButtonProps<React.ElementType<any, keyof JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<unknown>>;
|
|
10
10
|
export default ButtonBase;
|
|
@@ -47,8 +47,11 @@ const ChatButton = /*#__PURE__*/React__default["default"].forwardRef(function Ch
|
|
|
47
47
|
kind = 'ghost';
|
|
48
48
|
size = 'sm';
|
|
49
49
|
} else {
|
|
50
|
-
//
|
|
51
|
-
size
|
|
50
|
+
// Check if size is valid and warn if not
|
|
51
|
+
if (size && !allowedSizes.includes(size)) {
|
|
52
|
+
console.error(`Invalid size "${size}" provided to ChatButton. Size must be one of: ${allowedSizes.join(', ')}. Defaulting to "lg".`);
|
|
53
|
+
size = 'lg';
|
|
54
|
+
}
|
|
52
55
|
}
|
|
53
56
|
return /*#__PURE__*/React__default["default"].createElement(Button["default"], _rollupPluginBabelHelpers["extends"]({
|
|
54
57
|
disabled: disabled,
|
|
@@ -87,7 +90,6 @@ ChatButton.propTypes = {
|
|
|
87
90
|
/**
|
|
88
91
|
* A component used to render an icon.
|
|
89
92
|
*/
|
|
90
|
-
// @ts-expect-error: PropTypes are not expressive enough to cover this case
|
|
91
93
|
renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object]),
|
|
92
94
|
/**
|
|
93
95
|
* Specify the size of the `ChatButton`, from the following list of sizes:
|
|
@@ -125,6 +125,8 @@ function CodeSnippet(_ref) {
|
|
|
125
125
|
setHasRightOverflow(horizontalOverflow && codeScrollLeft + codeClientWidth !== codeScrollWidth);
|
|
126
126
|
}, [type, getCodeRefDimensions]);
|
|
127
127
|
useResizeObserver__default["default"]({
|
|
128
|
+
// Cast the ref until the hook supports React 19
|
|
129
|
+
// https://github.com/ZeeCoder/use-resize-observer/issues/108
|
|
128
130
|
ref: getCodeRef(),
|
|
129
131
|
onResize: () => {
|
|
130
132
|
if (codeContentRef?.current && type === 'multi') {
|
|
@@ -198,7 +198,7 @@ export interface ComboBoxProps<ItemType> extends Omit<InputHTMLAttributes<HTMLIn
|
|
|
198
198
|
}
|
|
199
199
|
type ComboboxComponentProps<ItemType> = PropsWithRef<PropsWithChildren<ComboBoxProps<ItemType>> & RefAttributes<HTMLInputElement>>;
|
|
200
200
|
export interface ComboBoxComponent {
|
|
201
|
-
<ItemType>(props: ComboboxComponentProps<ItemType>): ReactElement | null;
|
|
201
|
+
<ItemType>(props: ComboboxComponentProps<ItemType>): ReactElement<any> | null;
|
|
202
202
|
}
|
|
203
203
|
declare const _default: ComboBoxComponent;
|
|
204
204
|
export default _default;
|
|
@@ -56,7 +56,7 @@ export interface ComposedModalProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
56
56
|
/**
|
|
57
57
|
* Provide a ref to return focus to once the modal is closed.
|
|
58
58
|
*/
|
|
59
|
-
launcherButtonRef?: RefObject<HTMLButtonElement>;
|
|
59
|
+
launcherButtonRef?: RefObject<HTMLButtonElement | null>;
|
|
60
60
|
/**
|
|
61
61
|
* Specify an optional handler for closing modal.
|
|
62
62
|
* Returning `false` here prevents closing modal.
|
|
@@ -142,14 +142,14 @@ const ComposedModal = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
142
142
|
if (!enableDialogElement && open !== wasOpen) {
|
|
143
143
|
setIsOpen(!!open);
|
|
144
144
|
setWasOpen(!!open);
|
|
145
|
-
toggleClass
|
|
145
|
+
toggleClass.toggleClass(document.body, `${prefix}--body--with-modal-open`, !!open);
|
|
146
146
|
}
|
|
147
147
|
}, [open, wasOpen, prefix]);
|
|
148
148
|
// Remove the document.body className on unmount
|
|
149
149
|
React.useEffect(() => {
|
|
150
150
|
if (!enableDialogElement) {
|
|
151
151
|
return () => {
|
|
152
|
-
toggleClass
|
|
152
|
+
toggleClass.toggleClass(document.body, `${prefix}--body--with-modal-open`, false);
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
155
|
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
@@ -364,7 +364,6 @@ ComposedModal.propTypes = {
|
|
|
364
364
|
/**
|
|
365
365
|
* Provide a ref to return focus to once the modal is closed.
|
|
366
366
|
*/
|
|
367
|
-
// @ts-expect-error: Invalid derived type
|
|
368
367
|
launcherButtonRef: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].shape({
|
|
369
368
|
current: PropTypes__default["default"].any
|
|
370
369
|
})]),
|