@carbon/react 1.80.1 → 1.81.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 +785 -785
- 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/ComboBox/ComboBox.js +52 -30
- 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/TableCell.js +28 -4
- 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/DataTable/tools/cells.d.ts +13 -0
- package/es/components/DataTable/tools/cells.js +3 -6
- package/es/components/DataTable/tools/filter.d.ts +26 -0
- package/es/components/DataTable/tools/filter.js +8 -17
- package/es/components/DatePicker/DatePicker.js +1 -1
- package/es/components/DatePickerInput/DatePickerInput.d.ts +2 -2
- package/es/components/Dropdown/Dropdown.d.ts +1 -1
- package/es/components/Dropdown/Dropdown.js +6 -6
- 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/FluidDatePickerInput/FluidDatePickerInput.d.ts +1 -1
- package/es/components/FluidDatePickerInput/FluidDatePickerInput.js +5 -6
- 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/Menu.js +4 -14
- package/es/components/Menu/MenuContext.d.ts +1 -1
- package/es/components/Menu/MenuItem.js +15 -4
- 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 +22 -4
- 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 +2 -4
- package/es/components/OverflowMenu/index.js +10 -6
- package/es/components/OverflowMenu/next/index.js +0 -1
- package/es/components/OverflowMenuItem/OverflowMenuItem.d.ts +4 -0
- package/es/components/PageHeader/PageHeader.d.ts +9 -2
- package/es/components/PageHeader/PageHeader.js +16 -4
- package/es/components/PageHeader/index.d.ts +2 -2
- package/es/components/PageHeader/index.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/ComboBox/ComboBox.js +52 -30
- 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/TableCell.js +28 -3
- 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/DataTable/tools/cells.d.ts +13 -0
- package/lib/components/DataTable/tools/cells.js +3 -6
- package/lib/components/DataTable/tools/filter.d.ts +26 -0
- package/lib/components/DataTable/tools/filter.js +8 -17
- package/lib/components/DatePicker/DatePicker.js +1 -1
- package/lib/components/DatePickerInput/DatePickerInput.d.ts +2 -2
- package/lib/components/Dropdown/Dropdown.d.ts +1 -1
- package/lib/components/Dropdown/Dropdown.js +6 -6
- 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/FluidDatePickerInput/FluidDatePickerInput.d.ts +1 -1
- package/lib/components/FluidDatePickerInput/FluidDatePickerInput.js +4 -5
- 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/Menu.js +4 -14
- package/lib/components/Menu/MenuContext.d.ts +1 -1
- package/lib/components/Menu/MenuItem.js +15 -4
- 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 +21 -3
- 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 +2 -4
- package/lib/components/OverflowMenu/index.js +9 -5
- package/lib/components/OverflowMenu/next/index.js +0 -1
- package/lib/components/OverflowMenuItem/OverflowMenuItem.d.ts +4 -0
- package/lib/components/PageHeader/PageHeader.d.ts +9 -2
- package/lib/components/PageHeader/PageHeader.js +17 -3
- package/lib/components/PageHeader/index.d.ts +2 -2
- package/lib/components/PageHeader/index.js +2 -0
- 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 +15 -15
- 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
|
@@ -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.
|
|
@@ -44,6 +44,9 @@ const Button = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
44
44
|
tooltipPosition = 'top',
|
|
45
45
|
...rest
|
|
46
46
|
} = props;
|
|
47
|
+
if (ButtonImageElement && !children && !iconDescription) {
|
|
48
|
+
console.error('Button: renderIcon property specified without also providing an iconDescription property. ' + 'This may impact accessibility for screen reader users.');
|
|
49
|
+
}
|
|
47
50
|
const handleClick = evt => {
|
|
48
51
|
// Prevent clicks on the tooltip from triggering the button click event
|
|
49
52
|
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;
|
|
@@ -37,8 +37,11 @@ const ChatButton = /*#__PURE__*/React__default.forwardRef(function ChatButton(_r
|
|
|
37
37
|
kind = 'ghost';
|
|
38
38
|
size = 'sm';
|
|
39
39
|
} else {
|
|
40
|
-
//
|
|
41
|
-
size
|
|
40
|
+
// Check if size is valid and warn if not
|
|
41
|
+
if (size && !allowedSizes.includes(size)) {
|
|
42
|
+
console.error(`Invalid size "${size}" provided to ChatButton. Size must be one of: ${allowedSizes.join(', ')}. Defaulting to "lg".`);
|
|
43
|
+
size = 'lg';
|
|
44
|
+
}
|
|
42
45
|
}
|
|
43
46
|
return /*#__PURE__*/React__default.createElement(Button, _extends({
|
|
44
47
|
disabled: disabled,
|
|
@@ -77,7 +80,6 @@ ChatButton.propTypes = {
|
|
|
77
80
|
/**
|
|
78
81
|
* A component used to render an icon.
|
|
79
82
|
*/
|
|
80
|
-
// @ts-expect-error: PropTypes are not expressive enough to cover this case
|
|
81
83
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
82
84
|
/**
|
|
83
85
|
* Specify the size of the `ChatButton`, from the following list of sizes:
|
|
@@ -113,6 +113,8 @@ function CodeSnippet(_ref) {
|
|
|
113
113
|
setHasRightOverflow(horizontalOverflow && codeScrollLeft + codeClientWidth !== codeScrollWidth);
|
|
114
114
|
}, [type, getCodeRefDimensions]);
|
|
115
115
|
useResizeObserver({
|
|
116
|
+
// Cast the ref until the hook supports React 19
|
|
117
|
+
// https://github.com/ZeeCoder/use-resize-observer/issues/108
|
|
116
118
|
ref: getCodeRef(),
|
|
117
119
|
onResize: () => {
|
|
118
120
|
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;
|
|
@@ -37,7 +37,9 @@ const {
|
|
|
37
37
|
ItemMouseMove,
|
|
38
38
|
InputKeyDownArrowUp,
|
|
39
39
|
InputKeyDownArrowDown,
|
|
40
|
-
MenuMouseLeave
|
|
40
|
+
MenuMouseLeave,
|
|
41
|
+
ItemClick,
|
|
42
|
+
FunctionSelectItem
|
|
41
43
|
} = useCombobox.stateChangeTypes;
|
|
42
44
|
const defaultItemToString = item => {
|
|
43
45
|
if (typeof item === 'string') {
|
|
@@ -208,6 +210,8 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
208
210
|
prevInputLengthRef.current = inputValue.length;
|
|
209
211
|
}
|
|
210
212
|
}, [typeahead, inputValue, items, itemToString, autocompleteCustomFilter]);
|
|
213
|
+
const isManualClearingRef = useRef(false);
|
|
214
|
+
const [isClearing, setIsClearing] = useState(false);
|
|
211
215
|
const prefix = usePrefix();
|
|
212
216
|
const {
|
|
213
217
|
isFluid
|
|
@@ -217,6 +221,14 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
217
221
|
const [isFocused, setIsFocused] = useState(false);
|
|
218
222
|
const prevInputValue = useRef(inputValue);
|
|
219
223
|
const prevSelectedItemProp = useRef(selectedItemProp);
|
|
224
|
+
useEffect(() => {
|
|
225
|
+
isManualClearingRef.current = isClearing;
|
|
226
|
+
|
|
227
|
+
// Reset flag after render cycle
|
|
228
|
+
if (isClearing) {
|
|
229
|
+
setIsClearing(false);
|
|
230
|
+
}
|
|
231
|
+
}, [isClearing]);
|
|
220
232
|
|
|
221
233
|
// fully controlled combobox: handle changes to selectedItemProp
|
|
222
234
|
useEffect(() => {
|
|
@@ -302,31 +314,38 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
302
314
|
}
|
|
303
315
|
case InputKeyDownEnter:
|
|
304
316
|
if (!allowCustomValue) {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
317
|
+
if (state.highlightedIndex !== -1) {
|
|
318
|
+
const filteredList = filterItems(items, itemToString, inputValue);
|
|
319
|
+
const highlightedItem = filteredList[state.highlightedIndex];
|
|
320
|
+
if (highlightedItem && !highlightedItem.disabled) {
|
|
321
|
+
return {
|
|
322
|
+
...changes,
|
|
323
|
+
selectedItem: highlightedItem,
|
|
324
|
+
inputValue: itemToString(highlightedItem)
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
} else {
|
|
328
|
+
const autoIndex = indexToHighlight(inputValue);
|
|
329
|
+
if (autoIndex !== -1) {
|
|
330
|
+
const matchingItem = items[autoIndex];
|
|
331
|
+
if (matchingItem && !matchingItem.disabled) {
|
|
332
|
+
return {
|
|
333
|
+
...changes,
|
|
334
|
+
selectedItem: matchingItem,
|
|
335
|
+
inputValue: itemToString(matchingItem)
|
|
336
|
+
};
|
|
337
|
+
}
|
|
312
338
|
}
|
|
313
339
|
|
|
314
|
-
//
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
// selection, clear the selection.
|
|
324
|
-
if (state.selectedItem !== null) {
|
|
325
|
-
return {
|
|
326
|
-
...changes,
|
|
327
|
-
selectedItem: null,
|
|
328
|
-
inputValue
|
|
329
|
-
};
|
|
340
|
+
// If no matching item is found and there is an existing
|
|
341
|
+
// selection, clear the selection.
|
|
342
|
+
if (state.selectedItem !== null) {
|
|
343
|
+
return {
|
|
344
|
+
...changes,
|
|
345
|
+
selectedItem: null,
|
|
346
|
+
inputValue
|
|
347
|
+
};
|
|
348
|
+
}
|
|
330
349
|
}
|
|
331
350
|
}
|
|
332
351
|
|
|
@@ -491,13 +510,10 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
491
510
|
type,
|
|
492
511
|
selectedItem: newSelectedItem
|
|
493
512
|
});
|
|
494
|
-
if (
|
|
495
|
-
|
|
496
|
-
selectedItem: newSelectedItem
|
|
497
|
-
});
|
|
513
|
+
if (isManualClearingRef.current) {
|
|
514
|
+
return;
|
|
498
515
|
}
|
|
499
|
-
if ((type ===
|
|
500
|
-
) {
|
|
516
|
+
if ((type === ItemClick || type === FunctionSelectItem || type === InputKeyDownEnter) && typeof newSelectedItem !== 'undefined' && !isEqual(selectedItemProp, newSelectedItem)) {
|
|
501
517
|
onChange({
|
|
502
518
|
selectedItem: newSelectedItem
|
|
503
519
|
});
|
|
@@ -690,7 +706,13 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
690
706
|
className: `${prefix}--list-box__invalid-icon ${prefix}--list-box__invalid-icon--warning`
|
|
691
707
|
}), inputValue && /*#__PURE__*/React__default.createElement(ListBoxSelection, {
|
|
692
708
|
clearSelection: () => {
|
|
709
|
+
setIsClearing(true); // This updates the state which syncs to the ref
|
|
710
|
+
setInputValue('');
|
|
711
|
+
onChange({
|
|
712
|
+
selectedItem: null
|
|
713
|
+
});
|
|
693
714
|
selectItem(null);
|
|
715
|
+
handleSelectionClear();
|
|
694
716
|
},
|
|
695
717
|
translateWithId: translateWithId,
|
|
696
718
|
disabled: disabled || readOnly,
|
|
@@ -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.
|
|
@@ -15,7 +15,7 @@ import { ModalFooter } from './ModalFooter.js';
|
|
|
15
15
|
import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
|
|
16
16
|
import mergeRefs from '../../tools/mergeRefs.js';
|
|
17
17
|
import cx from 'classnames';
|
|
18
|
-
import toggleClass from '../../tools/toggleClass.js';
|
|
18
|
+
import { toggleClass } from '../../tools/toggleClass.js';
|
|
19
19
|
import requiredIfGivenPropIsTruthy from '../../prop-types/requiredIfGivenPropIsTruthy.js';
|
|
20
20
|
import wrapFocus, { wrapFocusWithoutSentinels, elementOrParentIsFloatingMenu } from '../../internal/wrapFocus.js';
|
|
21
21
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
@@ -354,7 +354,6 @@ ComposedModal.propTypes = {
|
|
|
354
354
|
/**
|
|
355
355
|
* Provide a ref to return focus to once the modal is closed.
|
|
356
356
|
*/
|
|
357
|
-
// @ts-expect-error: Invalid derived type
|
|
358
357
|
launcherButtonRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
359
358
|
current: PropTypes.any
|
|
360
359
|
})]),
|
|
@@ -16,7 +16,7 @@ export interface ContentSwitcherProps extends Omit<HTMLAttributes<HTMLElement>,
|
|
|
16
16
|
/**
|
|
17
17
|
* Pass in Switch components to be rendered in the ContentSwitcher
|
|
18
18
|
*/
|
|
19
|
-
children?: ReactElement[];
|
|
19
|
+
children?: ReactElement<any>[];
|
|
20
20
|
/**
|
|
21
21
|
* Specify an optional className to be added to the container node
|
|
22
22
|
*/
|
|
@@ -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
|
-
type TriggerType = Element | Document | Window | React.RefObject<Element>;
|
|
7
|
+
type TriggerType = Element | Document | Window | React.RefObject<Element | null>;
|
|
8
8
|
export interface ContextMenuProps {
|
|
9
9
|
open: boolean;
|
|
10
10
|
x: number;
|
|
@@ -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.
|
|
@@ -69,8 +69,8 @@ export interface DataTableRow<ColTypes extends any[]> {
|
|
|
69
69
|
export interface DataTableHeader {
|
|
70
70
|
key: string;
|
|
71
71
|
header: React.ReactNode;
|
|
72
|
-
slug?: React.ReactElement
|
|
73
|
-
decorator?: React.ReactElement
|
|
72
|
+
slug?: React.ReactElement<any>;
|
|
73
|
+
decorator?: React.ReactElement<any>;
|
|
74
74
|
}
|
|
75
75
|
export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
|
|
76
76
|
headers: Array<DataTableHeader>;
|
|
@@ -184,7 +184,7 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
|
|
|
184
184
|
radio: boolean | undefined;
|
|
185
185
|
}
|
|
186
186
|
export interface DataTableProps<RowType, ColTypes extends any[]> extends TranslateWithId<TranslationKey> {
|
|
187
|
-
children?: (renderProps: DataTableRenderProps<RowType, ColTypes>) => React.ReactElement
|
|
187
|
+
children?: (renderProps: DataTableRenderProps<RowType, ColTypes>) => React.ReactElement<any>;
|
|
188
188
|
experimentalAutoAlign?: boolean;
|
|
189
189
|
filterRows?: (filterRowsArgs: {
|
|
190
190
|
cellsById: Record<string, DataTableCell<ColTypes>>;
|
|
@@ -198,7 +198,7 @@ export interface DataTableProps<RowType, ColTypes extends any[]> extends Transla
|
|
|
198
198
|
locale?: string;
|
|
199
199
|
overflowMenuOnHover?: boolean;
|
|
200
200
|
radio?: boolean;
|
|
201
|
-
render?: (renderProps: DataTableRenderProps<RowType, ColTypes>) => React.ReactElement
|
|
201
|
+
render?: (renderProps: DataTableRenderProps<RowType, ColTypes>) => React.ReactElement<any>;
|
|
202
202
|
rows: Array<Omit<DataTableRow<ColTypes>, 'cells'>>;
|
|
203
203
|
size?: DataTableSize;
|
|
204
204
|
sortRow?: (cellA: any, cellB: any, sortRowOptions: {
|
|
@@ -15,7 +15,7 @@ import { getCellId } from './tools/cells.js';
|
|
|
15
15
|
import denormalize from './tools/denormalize.js';
|
|
16
16
|
import { composeEventHandlers } from '../../tools/events.js';
|
|
17
17
|
import { defaultFilterRows } from './tools/filter.js';
|
|
18
|
-
import setupGetInstanceId from '../../tools/setupGetInstanceId.js';
|
|
18
|
+
import { setupGetInstanceId } from '../../tools/setupGetInstanceId.js';
|
|
19
19
|
import { Table } from './Table.js';
|
|
20
20
|
import TableActionList from './TableActionList.js';
|
|
21
21
|
import TableBatchAction from './TableBatchAction.js';
|
|
@@ -4,5 +4,5 @@
|
|
|
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
|
-
declare const TableActionList: (props: import("../../types/common").ReactAttr<"div">) => React.ReactElement
|
|
7
|
+
declare const TableActionList: (props: import("../../types/common").ReactAttr<"div">) => React.ReactElement<any>;
|
|
8
8
|
export default TableActionList;
|
|
@@ -6,18 +6,20 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import React__default from 'react';
|
|
9
|
+
import React__default, { forwardRef } from 'react';
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
12
|
+
import PropTypes from 'prop-types';
|
|
12
13
|
|
|
13
|
-
const
|
|
14
|
-
|
|
14
|
+
const frFn = forwardRef;
|
|
15
|
+
const TableCell = frFn((props, ref) => {
|
|
16
|
+
const {
|
|
15
17
|
children,
|
|
16
18
|
className,
|
|
17
19
|
hasAILabelHeader,
|
|
18
20
|
colSpan,
|
|
19
21
|
...rest
|
|
20
|
-
} =
|
|
22
|
+
} = props;
|
|
21
23
|
const prefix = usePrefix();
|
|
22
24
|
const tableCellClassNames = cx(className, {
|
|
23
25
|
[`${prefix}--table-cell--column-slug`]: hasAILabelHeader
|
|
@@ -29,5 +31,27 @@ const TableCell = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
29
31
|
}, rest), children);
|
|
30
32
|
});
|
|
31
33
|
TableCell.displayName = 'TableCell';
|
|
34
|
+
TableCell.propTypes = {
|
|
35
|
+
/**
|
|
36
|
+
* Pass in children that will be embedded in the table header label
|
|
37
|
+
*/
|
|
38
|
+
children: PropTypes.node,
|
|
39
|
+
/**
|
|
40
|
+
* Specify an optional className to be applied to the container node
|
|
41
|
+
*/
|
|
42
|
+
className: PropTypes.string,
|
|
43
|
+
/**
|
|
44
|
+
* The width of the expanded row's internal cell
|
|
45
|
+
*/
|
|
46
|
+
colSpan: PropTypes.number,
|
|
47
|
+
/**
|
|
48
|
+
* Specify if the table cell is in an AI column
|
|
49
|
+
*/
|
|
50
|
+
hasAILabelHeader: PropTypes.bool,
|
|
51
|
+
/**
|
|
52
|
+
* The id of the matching th node in the table head. Addresses a11y concerns outlined here: https://www.ibm.com/able/guidelines/ci162/info_and_relationships.html and https://www.w3.org/TR/WCAG20-TECHS/H43
|
|
53
|
+
*/
|
|
54
|
+
headers: PropTypes.string
|
|
55
|
+
};
|
|
32
56
|
|
|
33
57
|
export { TableCell as default };
|
|
@@ -99,7 +99,7 @@ declare const TableExpandHeader: {
|
|
|
99
99
|
* Specify whether this row is expanded or not. This helps coordinate data
|
|
100
100
|
* attributes so that `TableExpandRow` and `TableExpandedRow` work together
|
|
101
101
|
*/
|
|
102
|
-
isExpanded:
|
|
102
|
+
isExpanded: React.Validator;
|
|
103
103
|
/**
|
|
104
104
|
* Hook for when a listener initiates a request to expand the given row
|
|
105
105
|
*/
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { ThHTMLAttributes } from 'react';
|
|
8
8
|
export type TableHeadProps = ThHTMLAttributes<HTMLTableSectionElement>;
|
|
9
|
-
declare const TableHead: (props: import("../../types/common").ReactAttr<"thead">) => React.ReactElement
|
|
9
|
+
declare const TableHead: (props: import("../../types/common").ReactAttr<"thead">) => React.ReactElement<any>;
|
|
10
10
|
export default TableHead;
|
|
@@ -4,5 +4,5 @@
|
|
|
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
|
-
declare const TableToolbarContent: (props: import("../../types/common").ReactAttr<"div">) => React.ReactElement
|
|
7
|
+
declare const TableToolbarContent: (props: import("../../types/common").ReactAttr<"div">) => React.ReactElement<any>;
|
|
8
8
|
export default TableToolbarContent;
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
* Generates a unique cell ID by combining the row ID and header.
|
|
9
|
+
*
|
|
10
|
+
* Generic helper used to consolidate all call sites for getting a cell ID into
|
|
11
|
+
* one method.
|
|
12
|
+
*/
|
|
13
|
+
export declare const getCellId: (rowId: string, header: string) => string;
|
|
@@ -6,13 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
* one method. The strategy currently is that a "cellId" is just the combination
|
|
11
|
-
* of the row id and the header key used to access this field in a row.
|
|
9
|
+
* Generates a unique cell ID by combining the row ID and header.
|
|
12
10
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* @returns {string}
|
|
11
|
+
* Generic helper used to consolidate all call sites for getting a cell ID into
|
|
12
|
+
* one method.
|
|
16
13
|
*/
|
|
17
14
|
const getCellId = (rowId, header) => `${rowId}:${header}`;
|
|
18
15
|
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
* Filters row IDs based on whether any of the cell values in the row include
|
|
9
|
+
* the input value as a substring. Boolean cell values are ignored.
|
|
10
|
+
*/
|
|
11
|
+
export declare const defaultFilterRows: ({ rowIds, headers, cellsById, inputValue, getCellId, }: {
|
|
12
|
+
/** Table row IDs. */
|
|
13
|
+
rowIds: string[];
|
|
14
|
+
/** Table headers. */
|
|
15
|
+
headers: {
|
|
16
|
+
key: string;
|
|
17
|
+
}[];
|
|
18
|
+
/** Mapping of cell IDs to their corresponding cells. */
|
|
19
|
+
cellsById: Record<string, {
|
|
20
|
+
value: unknown;
|
|
21
|
+
}>;
|
|
22
|
+
/** Input value to search for. */
|
|
23
|
+
inputValue: string;
|
|
24
|
+
/** Function that returns a cell ID given a row ID and a header. */
|
|
25
|
+
getCellId: (rowId: string, header: string) => string;
|
|
26
|
+
}) => string[];
|
|
@@ -6,18 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* individual cell values for a row. Then, we go through each cell value and see
|
|
12
|
-
* if any of them includes the given inputValue.
|
|
13
|
-
*
|
|
14
|
-
* @param {object} config
|
|
15
|
-
* @param {Array<string>} config.rowIds array of all the row ids in the table
|
|
16
|
-
* @param {Array<object>} config.headers
|
|
17
|
-
* @param {object} config.cellsById object containing a map of cell id to cell
|
|
18
|
-
* @param {string} config.inputValue the current input value in the Table Search
|
|
19
|
-
* @param {Function} config.getCellId
|
|
20
|
-
* @returns {Array<string>} rowIds
|
|
9
|
+
* Filters row IDs based on whether any of the cell values in the row include
|
|
10
|
+
* the input value as a substring. Boolean cell values are ignored.
|
|
21
11
|
*/
|
|
22
12
|
const defaultFilterRows = _ref => {
|
|
23
13
|
let {
|
|
@@ -27,15 +17,16 @@ const defaultFilterRows = _ref => {
|
|
|
27
17
|
inputValue,
|
|
28
18
|
getCellId
|
|
29
19
|
} = _ref;
|
|
20
|
+
const normalizedInput = inputValue.trim().toLowerCase();
|
|
21
|
+
if (!normalizedInput) return rowIds;
|
|
30
22
|
return rowIds.filter(rowId => headers.some(_ref2 => {
|
|
31
23
|
let {
|
|
32
24
|
key
|
|
33
25
|
} = _ref2;
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return ('' + cellsById[id].value).toLowerCase().includes(inputValue.toLowerCase());
|
|
26
|
+
const cellId = getCellId(rowId, key);
|
|
27
|
+
const cell = cellsById[cellId];
|
|
28
|
+
if (typeof cell.value === 'boolean') return false;
|
|
29
|
+
return String(cell.value).toLowerCase().includes(normalizedInput);
|
|
39
30
|
}));
|
|
40
31
|
};
|
|
41
32
|
|
|
@@ -461,7 +461,7 @@ const DatePicker = /*#__PURE__*/React__default.forwardRef(function DatePicker(_r
|
|
|
461
461
|
}
|
|
462
462
|
};
|
|
463
463
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
464
|
-
}, [savedOnChange, savedOnOpen, readOnly, closeOnSelect, hasInput]);
|
|
464
|
+
}, [savedOnChange, savedOnOpen, readOnly, closeOnSelect, hasInput, datePickerType]);
|
|
465
465
|
|
|
466
466
|
// this hook allows consumers to access the flatpickr calendar
|
|
467
467
|
// instance for cases where functions like open() or close()
|
|
@@ -4,11 +4,11 @@
|
|
|
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 { ReactElementLike
|
|
7
|
+
import { ReactElementLike } from 'prop-types';
|
|
8
8
|
import React, { ReactNode } from 'react';
|
|
9
9
|
import { ReactAttr } from '../../types/common';
|
|
10
10
|
type ExcludedAttributes = 'value' | 'onChange' | 'locale' | 'children';
|
|
11
|
-
export type ReactNodeLike = ReactElementLike |
|
|
11
|
+
export type ReactNodeLike = ReactElementLike | ReadonlyArray<ReactNode> | string | number | boolean | null | undefined;
|
|
12
12
|
export type func = (...args: any[]) => any;
|
|
13
13
|
export interface DatePickerInputProps extends Omit<ReactAttr<HTMLInputElement>, ExcludedAttributes> {
|
|
14
14
|
/**
|
|
@@ -149,7 +149,7 @@ export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>,
|
|
|
149
149
|
export type DropdownTranslationKey = ListBoxMenuIconTranslationKey;
|
|
150
150
|
type DropdownComponentProps<ItemType> = React.PropsWithoutRef<React.PropsWithChildren<DropdownProps<ItemType>> & React.RefAttributes<HTMLButtonElement>>;
|
|
151
151
|
export interface DropdownComponent {
|
|
152
|
-
<ItemType>(props: DropdownComponentProps<ItemType>): React.ReactElement | null;
|
|
152
|
+
<ItemType>(props: DropdownComponentProps<ItemType>): React.ReactElement<any> | null;
|
|
153
153
|
}
|
|
154
154
|
declare const _default: DropdownComponent;
|
|
155
155
|
export default _default;
|
|
@@ -246,9 +246,9 @@ const Dropdown = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
246
246
|
|
|
247
247
|
// needs to be Capitalized for react to render it correctly
|
|
248
248
|
const ItemToElement = itemToElement;
|
|
249
|
-
const toggleButtonProps =
|
|
249
|
+
const toggleButtonProps = getToggleButtonProps({
|
|
250
250
|
'aria-label': ariaLabel || deprecatedAriaLabel
|
|
251
|
-
})
|
|
251
|
+
});
|
|
252
252
|
const helper = helperText && !isFluid ? /*#__PURE__*/React__default.createElement("div", {
|
|
253
253
|
id: helperId,
|
|
254
254
|
className: helperClasses
|
|
@@ -320,7 +320,10 @@ const Dropdown = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
320
320
|
}
|
|
321
321
|
return /*#__PURE__*/React__default.isValidElement(element) ? element : null;
|
|
322
322
|
}, [slug, decorator]);
|
|
323
|
-
const
|
|
323
|
+
const allLabelProps = getLabelProps();
|
|
324
|
+
const labelProps = /*#__PURE__*/isValidElement(titleText) ? {
|
|
325
|
+
id: allLabelProps.id
|
|
326
|
+
} : allLabelProps;
|
|
324
327
|
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
325
328
|
className: wrapperClasses
|
|
326
329
|
}, other), titleText && /*#__PURE__*/React__default.createElement("label", _extends({
|
|
@@ -367,9 +370,6 @@ const Dropdown = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
367
370
|
item,
|
|
368
371
|
index
|
|
369
372
|
});
|
|
370
|
-
if (item !== null && typeof item === 'object' && Object.prototype.hasOwnProperty.call(item, 'id')) {
|
|
371
|
-
itemProps.id = item['id'];
|
|
372
|
-
}
|
|
373
373
|
const title = isObject && 'text' in item && itemToElement ? item.text : itemToString(item);
|
|
374
374
|
return /*#__PURE__*/React__default.createElement(ListBox.MenuItem, _extends({
|
|
375
375
|
key: itemProps.id,
|
|
@@ -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 React, { ReactNode } from 'react';
|
|
8
|
+
import React, { ReactNode, type JSX } from 'react';
|
|
9
9
|
export interface FeatureFlagsProps {
|
|
10
10
|
children?: ReactNode;
|
|
11
11
|
flags?: Record<string, boolean>;
|
|
@@ -79,5 +79,10 @@ export interface FileUploaderHandle {
|
|
|
79
79
|
*/
|
|
80
80
|
clearFiles: () => void;
|
|
81
81
|
}
|
|
82
|
-
declare const FileUploader:
|
|
82
|
+
declare const FileUploader: {
|
|
83
|
+
<ItemType>(props: FileUploaderProps): React.ReactElement<any>;
|
|
84
|
+
propTypes?: any;
|
|
85
|
+
contextTypes?: any;
|
|
86
|
+
defaultProps?: any;
|
|
87
|
+
};
|
|
83
88
|
export default FileUploader;
|