@carbon/react 1.99.0 → 1.100.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +978 -978
- package/es/components/BadgeIndicator/index.d.ts +1 -1
- package/es/components/BadgeIndicator/index.js +8 -6
- package/es/components/Breadcrumb/BreadcrumbItem.d.ts +1 -1
- package/es/components/Breadcrumb/BreadcrumbItem.js +6 -7
- package/es/components/Button/Button.Skeleton.d.ts +28 -2
- package/es/components/Button/Button.js +3 -2
- package/es/components/ChatButton/ChatButton.d.ts +3 -2
- package/es/components/CheckboxGroup/CheckboxGroup.d.ts +60 -2
- package/es/components/ComboBox/ComboBox.d.ts +6 -7
- package/es/components/ComboBox/ComboBox.js +22 -10
- package/es/components/ComposedModal/ComposedModal.d.ts +2 -2
- package/es/components/ContainedList/ContainedList.d.ts +35 -6
- package/es/components/ContainedList/ContainedList.js +3 -1
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +32 -3
- package/es/components/ContainedList/index.d.ts +1 -1
- package/es/components/ContainedList/index.js +4 -1
- package/es/components/DangerButton/DangerButton.d.ts +1 -1
- package/es/components/DataTable/DataTable.d.ts +22 -5
- package/es/components/DataTable/DataTable.js +1 -1
- package/es/components/DataTable/TableExpandRow.d.ts +1 -1
- package/es/components/DataTable/TableExpandRow.js +2 -2
- package/es/components/DataTable/TableHeader.d.ts +1 -1
- package/es/components/DataTable/TableHeader.js +18 -16
- package/es/components/DataTable/TableToolbar.d.ts +25 -1
- package/es/components/DataTable/TableToolbarMenu.d.ts +25 -5
- package/es/components/DataTable/TableToolbarMenu.js +0 -3
- package/es/components/DataTableSkeleton/DataTableSkeleton.d.ts +51 -2
- package/es/components/DataTableSkeleton/DataTableSkeleton.js +6 -0
- package/es/components/DatePicker/DatePicker.d.ts +2 -2
- package/es/components/DatePicker/DatePicker.js +38 -53
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +28 -2
- package/es/components/DatePickerInput/DatePickerInput.d.ts +1 -1
- package/es/components/DatePickerInput/DatePickerInput.js +3 -2
- package/es/components/Dialog/Dialog.d.ts +1 -1
- package/es/components/Dropdown/Dropdown.Skeleton.d.ts +19 -2
- package/es/components/Dropdown/Dropdown.d.ts +3 -4
- package/es/components/Dropdown/Dropdown.js +16 -13
- package/es/components/ExpandableSearch/ExpandableSearch.d.ts +1 -1
- package/es/components/ExpandableSearch/ExpandableSearch.js +14 -12
- package/es/components/FileUploader/FileUploader.d.ts +1 -1
- package/es/components/FileUploader/FileUploader.js +2 -2
- package/es/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
- package/es/components/FileUploader/FileUploaderDropContainer.js +28 -10
- package/es/components/FluidComboBox/FluidComboBox.Skeleton.d.ts +11 -3
- package/es/components/FluidComboBox/FluidComboBox.d.ts +2 -7
- package/es/components/FluidComboBox/FluidComboBox.js +1 -2
- package/es/components/FluidDatePicker/FluidDatePicker.Skeleton.d.ts +15 -3
- package/es/components/FluidDatePicker/FluidDatePicker.d.ts +2 -2
- package/es/components/FluidDropdown/FluidDropdown.Skeleton.d.ts +11 -3
- package/es/components/FluidDropdown/FluidDropdown.d.ts +1 -6
- package/es/components/FluidDropdown/FluidDropdown.js +1 -2
- package/es/components/FluidForm/FluidForm.d.ts +15 -2
- package/es/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +2 -2
- package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.d.ts +11 -3
- package/es/components/FluidMultiSelect/FluidMultiSelect.d.ts +1 -6
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +1 -2
- package/es/components/FluidNumberInput/FluidNumberInput.Skeleton.d.ts +11 -3
- package/es/components/FluidNumberInput/FluidNumberInput.d.ts +1 -1
- package/es/components/FluidSearch/FluidSearch.Skeleton.d.ts +11 -3
- package/es/components/FluidSearch/FluidSearch.d.ts +1 -1
- package/es/components/FluidSearch/FluidSearch.js +3 -3
- package/es/components/FluidSelect/FluidSelect.Skeleton.d.ts +11 -3
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +11 -3
- package/es/components/FluidTextArea/FluidTextArea.d.ts +95 -1
- package/es/components/FluidTextInput/FluidPasswordInput.d.ts +83 -2
- package/es/components/FluidTextInput/FluidTextInput.Skeleton.d.ts +11 -3
- package/es/components/Grid/GridContext.d.ts +19 -1
- package/es/components/IconButton/index.d.ts +1 -1
- package/es/components/IconButton/index.js +2 -2
- package/es/components/InlineLoading/InlineLoading.js +5 -11
- package/es/components/Link/Link.js +3 -0
- package/es/components/ListBox/ListBoxField.d.ts +35 -2
- package/es/components/ListBox/ListBoxMenuIcon.d.ts +16 -3
- package/es/components/ListBox/ListBoxMenuItem.d.ts +1 -1
- package/es/components/ListBox/ListBoxSelection.d.ts +34 -3
- package/es/components/Menu/MenuItem.d.ts +2 -2
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +2 -2
- package/es/components/MultiSelect/FilterableMultiSelect.js +22 -13
- package/es/components/MultiSelect/MultiSelect.d.ts +3 -4
- package/es/components/MultiSelect/MultiSelect.js +24 -22
- package/es/components/Notification/Notification.d.ts +8 -7
- package/es/components/Notification/Notification.js +4 -4
- package/es/components/OverflowMenu/OverflowMenu.d.ts +1 -1
- package/es/components/OverflowMenu/OverflowMenu.js +0 -1
- package/es/components/OverflowMenu/index.d.ts +1 -1
- package/es/components/PageHeader/PageHeader.d.ts +3 -3
- package/es/components/Popover/index.js +21 -12
- package/es/components/Search/Search.d.ts +2 -2
- package/es/components/Select/Select.d.ts +1 -1
- package/es/components/Select/Select.js +2 -2
- package/es/components/SkeletonIcon/SkeletonIcon.d.ts +16 -2
- package/es/components/SkeletonText/SkeletonText.d.ts +1 -1
- package/es/components/Tag/Tag.d.ts +1 -1
- package/es/components/Tag/Tag.js +2 -0
- package/es/components/Text/Text.d.ts +1 -1
- package/es/components/Text/Text.js +4 -3
- package/es/components/Text/TextDirection.d.ts +1 -1
- package/es/components/Text/TextDirection.js +1 -3
- package/es/components/Text/TextDirectionContext.d.ts +3 -3
- package/es/components/TextArea/TextArea.js +1 -3
- package/es/components/TextInput/ControlledPasswordInput.d.ts +1 -1
- package/es/components/TextInput/ControlledPasswordInput.js +2 -2
- package/es/components/TextInput/PasswordInput.d.ts +1 -1
- package/es/components/TextInput/PasswordInput.js +2 -2
- package/es/components/TextInput/TextInput.d.ts +1 -1
- package/es/components/TextInput/TextInput.js +2 -2
- package/es/components/Tile/Tile.d.ts +1 -1
- package/es/components/Tile/Tile.js +37 -69
- package/es/components/Toggle/Toggle.Skeleton.d.ts +9 -3
- package/es/components/Toggletip/index.d.ts +1 -1
- package/es/components/Toggletip/index.js +9 -7
- package/es/components/Tooltip/DefinitionTooltip.d.ts +52 -1
- package/es/components/Tooltip/Tooltip.js +2 -0
- package/es/components/TreeView/TreeNode.d.ts +4 -4
- package/es/components/UIShell/Header.d.ts +20 -3
- package/es/components/UIShell/HeaderGlobalAction.d.ts +2 -2
- package/es/components/UIShell/HeaderName.js +1 -1
- package/es/components/UIShell/Link.d.ts +1 -1
- package/es/components/UIShell/Link.js +14 -14
- package/es/components/UIShell/SideNav.d.ts +3 -4
- package/es/components/UIShell/SideNav.js +37 -27
- package/es/components/UIShell/SideNavDivider.d.ts +11 -3
- package/es/components/UIShell/SideNavHeader.d.ts +24 -1
- package/es/components/UIShell/SideNavIcon.d.ts +20 -2
- package/es/components/UIShell/SideNavItem.d.ts +20 -2
- package/es/components/UIShell/SideNavItems.d.ts +22 -2
- package/es/components/UIShell/SideNavLink.d.ts +1 -1
- package/es/components/UIShell/SideNavLink.js +14 -14
- package/es/components/UIShell/SideNavMenu.d.ts +1 -1
- package/es/components/UIShell/SideNavMenu.js +2 -2
- package/es/components/UIShell/SideNavMenuItem.d.ts +2 -2
- package/es/components/UIShell/SideNavMenuItem.js +2 -2
- package/es/components/UIShell/SwitcherDivider.d.ts +10 -2
- package/es/internal/FloatingMenu.d.ts +1 -1
- package/es/internal/FloatingMenu.js +0 -2
- package/es/internal/PolymorphicProps.d.ts +3 -3
- package/es/internal/useNoInteractiveChildren.d.ts +1 -1
- package/es/internal/useNoInteractiveChildren.js +8 -10
- package/es/internal/useOutsideClick.d.ts +1 -1
- package/es/internal/useOutsideClick.js +0 -4
- package/lib/components/BadgeIndicator/index.d.ts +1 -1
- package/lib/components/BadgeIndicator/index.js +7 -5
- package/lib/components/Breadcrumb/BreadcrumbItem.d.ts +1 -1
- package/lib/components/Breadcrumb/BreadcrumbItem.js +5 -6
- package/lib/components/Button/Button.Skeleton.d.ts +28 -2
- package/lib/components/Button/Button.js +3 -2
- package/lib/components/ChatButton/ChatButton.d.ts +3 -2
- package/lib/components/CheckboxGroup/CheckboxGroup.d.ts +60 -2
- package/lib/components/ComboBox/ComboBox.d.ts +6 -7
- package/lib/components/ComboBox/ComboBox.js +22 -10
- package/lib/components/ComposedModal/ComposedModal.d.ts +2 -2
- package/lib/components/ContainedList/ContainedList.d.ts +35 -6
- package/lib/components/ContainedList/ContainedList.js +3 -1
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +32 -3
- package/lib/components/ContainedList/index.d.ts +1 -1
- package/lib/components/ContainedList/index.js +4 -1
- package/lib/components/DangerButton/DangerButton.d.ts +1 -1
- package/lib/components/DataTable/DataTable.d.ts +22 -5
- package/lib/components/DataTable/DataTable.js +1 -1
- package/lib/components/DataTable/TableExpandRow.d.ts +1 -1
- package/lib/components/DataTable/TableHeader.d.ts +1 -1
- package/lib/components/DataTable/TableHeader.js +17 -15
- package/lib/components/DataTable/TableToolbar.d.ts +25 -1
- package/lib/components/DataTable/TableToolbarMenu.d.ts +25 -5
- package/lib/components/DataTable/TableToolbarMenu.js +0 -3
- package/lib/components/DataTableSkeleton/DataTableSkeleton.d.ts +51 -2
- package/lib/components/DataTableSkeleton/DataTableSkeleton.js +6 -0
- package/lib/components/DatePicker/DatePicker.d.ts +2 -2
- package/lib/components/DatePicker/DatePicker.js +37 -52
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +28 -2
- package/lib/components/DatePickerInput/DatePickerInput.d.ts +1 -1
- package/lib/components/DatePickerInput/DatePickerInput.js +2 -1
- package/lib/components/Dialog/Dialog.d.ts +1 -1
- package/lib/components/Dropdown/Dropdown.Skeleton.d.ts +19 -2
- package/lib/components/Dropdown/Dropdown.d.ts +3 -4
- package/lib/components/Dropdown/Dropdown.js +16 -13
- package/lib/components/ExpandableSearch/ExpandableSearch.d.ts +1 -1
- package/lib/components/ExpandableSearch/ExpandableSearch.js +13 -11
- package/lib/components/FileUploader/FileUploader.d.ts +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.d.ts +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.js +28 -10
- package/lib/components/FluidComboBox/FluidComboBox.Skeleton.d.ts +11 -3
- package/lib/components/FluidComboBox/FluidComboBox.d.ts +2 -7
- package/lib/components/FluidComboBox/FluidComboBox.js +1 -2
- package/lib/components/FluidDatePicker/FluidDatePicker.Skeleton.d.ts +15 -3
- package/lib/components/FluidDatePicker/FluidDatePicker.d.ts +2 -2
- package/lib/components/FluidDropdown/FluidDropdown.Skeleton.d.ts +11 -3
- package/lib/components/FluidDropdown/FluidDropdown.d.ts +1 -6
- package/lib/components/FluidDropdown/FluidDropdown.js +1 -2
- package/lib/components/FluidForm/FluidForm.d.ts +15 -2
- package/lib/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +2 -2
- package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.d.ts +11 -3
- package/lib/components/FluidMultiSelect/FluidMultiSelect.d.ts +1 -6
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +1 -2
- package/lib/components/FluidNumberInput/FluidNumberInput.Skeleton.d.ts +11 -3
- package/lib/components/FluidNumberInput/FluidNumberInput.d.ts +1 -1
- package/lib/components/FluidSearch/FluidSearch.Skeleton.d.ts +11 -3
- package/lib/components/FluidSearch/FluidSearch.d.ts +1 -1
- package/lib/components/FluidSearch/FluidSearch.js +2 -2
- package/lib/components/FluidSelect/FluidSelect.Skeleton.d.ts +11 -3
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +11 -3
- package/lib/components/FluidTextArea/FluidTextArea.d.ts +95 -1
- package/lib/components/FluidTextInput/FluidPasswordInput.d.ts +83 -2
- package/lib/components/FluidTextInput/FluidTextInput.Skeleton.d.ts +11 -3
- package/lib/components/Grid/GridContext.d.ts +19 -1
- package/lib/components/IconButton/index.d.ts +1 -1
- package/lib/components/InlineLoading/InlineLoading.js +5 -11
- package/lib/components/Link/Link.js +3 -0
- package/lib/components/ListBox/ListBoxField.d.ts +35 -2
- package/lib/components/ListBox/ListBoxMenuIcon.d.ts +16 -3
- package/lib/components/ListBox/ListBoxMenuItem.d.ts +1 -1
- package/lib/components/ListBox/ListBoxSelection.d.ts +34 -3
- package/lib/components/Menu/MenuItem.d.ts +2 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +2 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.js +22 -13
- package/lib/components/MultiSelect/MultiSelect.d.ts +3 -4
- package/lib/components/MultiSelect/MultiSelect.js +24 -22
- package/lib/components/Notification/Notification.d.ts +8 -7
- package/lib/components/Notification/Notification.js +4 -4
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +1 -1
- package/lib/components/OverflowMenu/OverflowMenu.js +0 -1
- package/lib/components/OverflowMenu/index.d.ts +1 -1
- package/lib/components/PageHeader/PageHeader.d.ts +3 -3
- package/lib/components/Popover/index.js +19 -10
- package/lib/components/Search/Search.d.ts +2 -2
- package/lib/components/Select/Select.d.ts +1 -1
- package/lib/components/SkeletonIcon/SkeletonIcon.d.ts +16 -2
- package/lib/components/SkeletonText/SkeletonText.d.ts +1 -1
- package/lib/components/Tag/Tag.d.ts +1 -1
- package/lib/components/Tag/Tag.js +2 -0
- package/lib/components/Text/Text.d.ts +1 -1
- package/lib/components/Text/Text.js +3 -2
- package/lib/components/Text/TextDirection.d.ts +1 -1
- package/lib/components/Text/TextDirection.js +1 -3
- package/lib/components/Text/TextDirectionContext.d.ts +3 -3
- package/lib/components/TextArea/TextArea.js +1 -3
- package/lib/components/TextInput/ControlledPasswordInput.d.ts +1 -1
- package/lib/components/TextInput/PasswordInput.d.ts +1 -1
- package/lib/components/TextInput/TextInput.d.ts +1 -1
- package/lib/components/Tile/Tile.d.ts +1 -1
- package/lib/components/Tile/Tile.js +35 -67
- package/lib/components/Toggle/Toggle.Skeleton.d.ts +9 -3
- package/lib/components/Toggletip/index.d.ts +1 -1
- package/lib/components/Toggletip/index.js +7 -5
- package/lib/components/Tooltip/DefinitionTooltip.d.ts +52 -1
- package/lib/components/Tooltip/Tooltip.js +2 -0
- package/lib/components/TreeView/TreeNode.d.ts +4 -4
- package/lib/components/UIShell/Header.d.ts +20 -3
- package/lib/components/UIShell/HeaderGlobalAction.d.ts +2 -2
- package/lib/components/UIShell/HeaderName.js +1 -1
- package/lib/components/UIShell/Link.d.ts +1 -1
- package/lib/components/UIShell/Link.js +13 -13
- package/lib/components/UIShell/SideNav.d.ts +3 -4
- package/lib/components/UIShell/SideNav.js +36 -26
- package/lib/components/UIShell/SideNavDivider.d.ts +11 -3
- package/lib/components/UIShell/SideNavHeader.d.ts +24 -1
- package/lib/components/UIShell/SideNavIcon.d.ts +20 -2
- package/lib/components/UIShell/SideNavItem.d.ts +20 -2
- package/lib/components/UIShell/SideNavItems.d.ts +22 -2
- package/lib/components/UIShell/SideNavLink.d.ts +1 -1
- package/lib/components/UIShell/SideNavLink.js +14 -14
- package/lib/components/UIShell/SideNavMenu.d.ts +1 -1
- package/lib/components/UIShell/SideNavMenuItem.d.ts +2 -2
- package/lib/components/UIShell/SwitcherDivider.d.ts +10 -2
- package/lib/internal/FloatingMenu.d.ts +1 -1
- package/lib/internal/FloatingMenu.js +0 -2
- package/lib/internal/PolymorphicProps.d.ts +3 -3
- package/lib/internal/useNoInteractiveChildren.d.ts +1 -1
- package/lib/internal/useNoInteractiveChildren.js +8 -10
- package/lib/internal/useOutsideClick.d.ts +1 -1
- package/lib/internal/useOutsideClick.js +0 -4
- package/package.json +7 -7
- package/scss/_carbon-utilities.scss +9 -0
- package/telemetry.yml +0 -1
- package/es/internal/createClassWrapper.d.ts +0 -12
- package/lib/internal/createClassWrapper.d.ts +0 -12
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
|
-
import React, { useRef, cloneElement } from 'react';
|
|
11
|
+
import React, { forwardRef, useRef, cloneElement } from 'react';
|
|
12
12
|
import { ArrowUp, ArrowsVertical } from '@carbon/icons-react';
|
|
13
13
|
import { useId } from '../../internal/useId.js';
|
|
14
14
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
@@ -45,21 +45,23 @@ const sortDirections = {
|
|
|
45
45
|
[sortStates.ASC]: 'ascending',
|
|
46
46
|
[sortStates.DESC]: 'descending'
|
|
47
47
|
};
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
48
|
+
const frFn = forwardRef;
|
|
49
|
+
const TableHeader = frFn((props, ref) => {
|
|
50
|
+
const {
|
|
51
|
+
className: headerClassName,
|
|
52
|
+
children,
|
|
53
|
+
colSpan,
|
|
54
|
+
decorator,
|
|
55
|
+
isSortable = false,
|
|
56
|
+
isSortHeader,
|
|
57
|
+
onClick,
|
|
58
|
+
scope = defaultScope,
|
|
59
|
+
sortDirection,
|
|
60
|
+
translateWithId: t = defaultTranslateWithId,
|
|
61
|
+
slug,
|
|
62
|
+
id,
|
|
63
|
+
...rest
|
|
64
|
+
} = props;
|
|
63
65
|
const prefix = usePrefix();
|
|
64
66
|
const uniqueId = useId('table-sort');
|
|
65
67
|
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
7
8
|
import React from 'react';
|
|
8
9
|
export interface TableToolbarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
9
10
|
/**
|
|
@@ -25,5 +26,28 @@ export interface TableToolbarProps extends React.HTMLAttributes<HTMLDivElement>
|
|
|
25
26
|
*/
|
|
26
27
|
size?: 'sm' | 'lg';
|
|
27
28
|
}
|
|
28
|
-
declare const TableToolbar:
|
|
29
|
+
declare const TableToolbar: {
|
|
30
|
+
({ ["aria-label"]: ariaLabel, ariaLabel: deprecatedAriaLabel, children, size, ...rest }: TableToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
propTypes: {
|
|
32
|
+
/**
|
|
33
|
+
* 'aria-label' of the TableToolbar component.
|
|
34
|
+
* Specify a label to be read by screen readers on the container node
|
|
35
|
+
*/
|
|
36
|
+
"aria-label": PropTypes.Requireable<string>;
|
|
37
|
+
/**
|
|
38
|
+
* Deprecated, please use `aria-label` instead.
|
|
39
|
+
* Specify a label to be read by screen readers on the container node.
|
|
40
|
+
* 'aria-label' of the TableToolbar component.
|
|
41
|
+
*/
|
|
42
|
+
ariaLabel: (props: Record<string, any>, propName: string, componentName: string, ...rest: any[]) => any;
|
|
43
|
+
/**
|
|
44
|
+
* Pass in the children that will be rendered inside the TableToolbar
|
|
45
|
+
*/
|
|
46
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
47
|
+
/**
|
|
48
|
+
* `lg` Change the row height of table
|
|
49
|
+
*/
|
|
50
|
+
size: PropTypes.Requireable<string>;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
29
53
|
export default TableToolbar;
|
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2026
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
8
|
import { OverflowMenuProps } from '../OverflowMenu';
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
export type TableToolbarMenuProps = OverflowMenuProps;
|
|
10
|
+
declare const TableToolbarMenu: {
|
|
11
|
+
({ className, renderIcon, iconDescription, children, menuOptionsClass, ...rest }: TableToolbarMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
propTypes: {
|
|
13
|
+
children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
14
|
+
/**
|
|
15
|
+
* Provide an optional class name for the toolbar menu
|
|
16
|
+
*/
|
|
17
|
+
className: PropTypes.Requireable<string>;
|
|
18
|
+
/**
|
|
19
|
+
* The description of the menu icon.
|
|
20
|
+
*/
|
|
21
|
+
iconDescription: PropTypes.Requireable<string>;
|
|
22
|
+
/**
|
|
23
|
+
* Provide an optional class name for the toolbar menu
|
|
24
|
+
*/
|
|
25
|
+
menuOptionsClass: PropTypes.Requireable<string>;
|
|
26
|
+
/**
|
|
27
|
+
* A component used to render an icon.
|
|
28
|
+
*/
|
|
29
|
+
renderIcon: PropTypes.Requireable<object>;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
12
32
|
export default TableToolbarMenu;
|
|
@@ -14,9 +14,6 @@ import { usePrefix } from '../../internal/usePrefix.js';
|
|
|
14
14
|
import OverflowMenu from '../OverflowMenu/index.js';
|
|
15
15
|
|
|
16
16
|
const defaultIconDescription = 'Settings';
|
|
17
|
-
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
19
|
-
|
|
20
17
|
const TableToolbarMenu = ({
|
|
21
18
|
className,
|
|
22
19
|
renderIcon = Settings,
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import React, { type TableHTMLAttributes } from 'react';
|
|
9
|
+
import { DataTableSize } from '../DataTable/DataTable';
|
|
8
10
|
export interface DataTableSkeletonHeader {
|
|
9
11
|
/**
|
|
10
12
|
* Specify header label
|
|
@@ -41,6 +43,10 @@ export interface DataTableSkeletonProps extends TableHTMLAttributes<HTMLTableEle
|
|
|
41
43
|
* Specify if the table toolbar should be rendered as part of the skeleton.
|
|
42
44
|
*/
|
|
43
45
|
showToolbar?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Changes the row height of table.
|
|
48
|
+
*/
|
|
49
|
+
size?: DataTableSize;
|
|
44
50
|
/**
|
|
45
51
|
* Optionally specify whether you want the DataTable to be zebra striped
|
|
46
52
|
*/
|
|
@@ -50,5 +56,48 @@ export interface DataTableSkeletonProps extends TableHTMLAttributes<HTMLTableEle
|
|
|
50
56
|
*/
|
|
51
57
|
className?: string;
|
|
52
58
|
}
|
|
53
|
-
declare const DataTableSkeleton:
|
|
59
|
+
declare const DataTableSkeleton: {
|
|
60
|
+
({ headers, rowCount, columnCount, zebra, compact, className, showHeader, showToolbar, size, ...rest }: DataTableSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
61
|
+
propTypes: {
|
|
62
|
+
/**
|
|
63
|
+
* Specify an optional className to add.
|
|
64
|
+
*/
|
|
65
|
+
className: PropTypes.Requireable<string>;
|
|
66
|
+
/**
|
|
67
|
+
* Specify the number of columns that you want to render in the skeleton state
|
|
68
|
+
*/
|
|
69
|
+
columnCount: PropTypes.Requireable<number>;
|
|
70
|
+
/**
|
|
71
|
+
* Optionally specify whether you want the Skeleton to be rendered as a
|
|
72
|
+
* compact DataTable
|
|
73
|
+
*/
|
|
74
|
+
compact: PropTypes.Requireable<boolean>;
|
|
75
|
+
/**
|
|
76
|
+
* Optionally specify the displayed headers
|
|
77
|
+
*/
|
|
78
|
+
headers: PropTypes.Requireable<NonNullable<PropTypes.InferProps<{
|
|
79
|
+
header: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
80
|
+
}>>[]>;
|
|
81
|
+
/**
|
|
82
|
+
* Specify the number of rows that you want to render in the skeleton state
|
|
83
|
+
*/
|
|
84
|
+
rowCount: PropTypes.Requireable<number>;
|
|
85
|
+
/**
|
|
86
|
+
* Specify if the table header should be rendered as part of the skeleton.
|
|
87
|
+
*/
|
|
88
|
+
showHeader: PropTypes.Requireable<boolean>;
|
|
89
|
+
/**
|
|
90
|
+
* Specify if the table toolbar should be rendered as part of the skeleton.
|
|
91
|
+
*/
|
|
92
|
+
showToolbar: PropTypes.Requireable<boolean>;
|
|
93
|
+
/**
|
|
94
|
+
* Changes the row height of table.
|
|
95
|
+
*/
|
|
96
|
+
size: PropTypes.Requireable<string>;
|
|
97
|
+
/**
|
|
98
|
+
* Optionally specify whether you want the DataTable to be zebra striped
|
|
99
|
+
*/
|
|
100
|
+
zebra: PropTypes.Requireable<boolean>;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
54
103
|
export default DataTableSkeleton;
|
|
@@ -21,12 +21,14 @@ const DataTableSkeleton = ({
|
|
|
21
21
|
className,
|
|
22
22
|
showHeader = true,
|
|
23
23
|
showToolbar = true,
|
|
24
|
+
size = 'lg',
|
|
24
25
|
...rest
|
|
25
26
|
}) => {
|
|
26
27
|
const prefix = usePrefix();
|
|
27
28
|
const dataTableSkeletonClasses = cx(className, {
|
|
28
29
|
[`${prefix}--skeleton`]: true,
|
|
29
30
|
[`${prefix}--data-table`]: true,
|
|
31
|
+
[`${prefix}--data-table--${size}`]: size,
|
|
30
32
|
[`${prefix}--data-table--zebra`]: zebra,
|
|
31
33
|
[`${prefix}--data-table--compact`]: compact
|
|
32
34
|
});
|
|
@@ -97,6 +99,10 @@ DataTableSkeleton.propTypes = {
|
|
|
97
99
|
* Specify if the table toolbar should be rendered as part of the skeleton.
|
|
98
100
|
*/
|
|
99
101
|
showToolbar: PropTypes.bool,
|
|
102
|
+
/**
|
|
103
|
+
* Changes the row height of table.
|
|
104
|
+
*/
|
|
105
|
+
size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),
|
|
100
106
|
/**
|
|
101
107
|
* Optionally specify whether you want the DataTable to be zebra striped
|
|
102
108
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2026
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import React, { ReactNode } from 'react';
|
|
7
|
+
import React, { type ReactNode } from 'react';
|
|
8
8
|
import flatpickr from 'flatpickr';
|
|
9
9
|
import { DateLimit, DateOption } from 'flatpickr/dist/types/options';
|
|
10
10
|
import { type SupportedLocale } from './DatePickerLocales';
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
|
-
import React, { useContext, useState, useCallback, useRef, useEffect, useImperativeHandle } from 'react';
|
|
10
|
+
import React, { forwardRef, useContext, useState, useCallback, useRef, useEffect, useImperativeHandle } from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import flatpickr from 'flatpickr';
|
|
13
13
|
import l10n from 'flatpickr/dist/l10n/index';
|
|
@@ -139,36 +139,38 @@ function updateClassNames(calendar, prefix) {
|
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
142
|
+
// eslint-disable-next-line react/display-name
|
|
143
|
+
const DatePicker = /*#__PURE__*/forwardRef((props, ref) => {
|
|
144
|
+
const {
|
|
145
|
+
allowInput,
|
|
146
|
+
appendTo,
|
|
147
|
+
children,
|
|
148
|
+
className,
|
|
149
|
+
closeOnSelect = true,
|
|
150
|
+
dateFormat = 'm/d/Y',
|
|
151
|
+
datePickerType,
|
|
152
|
+
disable,
|
|
153
|
+
enable,
|
|
154
|
+
inline,
|
|
155
|
+
invalid,
|
|
156
|
+
invalidText,
|
|
157
|
+
warn,
|
|
158
|
+
warnText,
|
|
159
|
+
light = false,
|
|
160
|
+
locale = 'en',
|
|
161
|
+
maxDate,
|
|
162
|
+
minDate,
|
|
163
|
+
onChange,
|
|
164
|
+
onClose,
|
|
165
|
+
onOpen,
|
|
166
|
+
readOnly = false,
|
|
167
|
+
short = false,
|
|
168
|
+
value,
|
|
169
|
+
parseDate: parseDateProp,
|
|
170
|
+
nextMonthAriaLabel = 'Next month',
|
|
171
|
+
prevMonthAriaLabel = 'Previous month',
|
|
172
|
+
...rest
|
|
173
|
+
} = props;
|
|
172
174
|
const prefix = usePrefix();
|
|
173
175
|
const {
|
|
174
176
|
isFluid
|
|
@@ -197,7 +199,6 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
197
199
|
},
|
|
198
200
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
199
201
|
[onClose]);
|
|
200
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
201
202
|
const onCalendarClose = (selectedDates, dateStr, instance, e) => {
|
|
202
203
|
if (e && e.type === 'clickOutside') {
|
|
203
204
|
return;
|
|
@@ -224,6 +225,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
224
225
|
const savedOnChange = useSavedCallback(onChange);
|
|
225
226
|
const savedOnOpen = useSavedCallback(onOpen);
|
|
226
227
|
const effectiveWarn = warn && !invalid;
|
|
228
|
+
const wrapperRef = useRef(null);
|
|
227
229
|
const datePickerClasses = cx(`${prefix}--date-picker`, {
|
|
228
230
|
[`${prefix}--date-picker--short`]: short,
|
|
229
231
|
[`${prefix}--date-picker--light`]: light,
|
|
@@ -389,7 +391,8 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
389
391
|
}), carbonFlatpickrFixEventsPlugin({
|
|
390
392
|
inputFrom: startInputField.current,
|
|
391
393
|
inputTo: endInputField.current,
|
|
392
|
-
lastStartValue
|
|
394
|
+
lastStartValue,
|
|
395
|
+
container: wrapperRef.current
|
|
393
396
|
})],
|
|
394
397
|
clickOpens: !readOnly,
|
|
395
398
|
noCalendar: readOnly,
|
|
@@ -596,25 +599,6 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
596
599
|
}
|
|
597
600
|
}
|
|
598
601
|
}, [value, startInputField]);
|
|
599
|
-
useEffect(() => {
|
|
600
|
-
const handleMouseDown = event => {
|
|
601
|
-
if (calendarRef.current && calendarRef.current.isOpen && !calendarRef.current.calendarContainer.contains(event.target) && !startInputField.current.contains(event.target) && !endInputField.current?.contains(event.target)) {
|
|
602
|
-
// Close the calendar immediately on mousedown
|
|
603
|
-
closeCalendar();
|
|
604
|
-
}
|
|
605
|
-
};
|
|
606
|
-
const closeCalendar = () => {
|
|
607
|
-
calendarRef.current?.close();
|
|
608
|
-
// Remove focus from endDate calendar input
|
|
609
|
-
onCalendarClose(calendarRef.current?.selectedDates, '', calendarRef.current, {
|
|
610
|
-
type: 'clickOutside'
|
|
611
|
-
});
|
|
612
|
-
};
|
|
613
|
-
document.addEventListener('mousedown', handleMouseDown, true);
|
|
614
|
-
return () => {
|
|
615
|
-
document.removeEventListener('mousedown', handleMouseDown, true);
|
|
616
|
-
};
|
|
617
|
-
}, [calendarRef, startInputField, endInputField, onCalendarClose]);
|
|
618
602
|
useEffect(() => {
|
|
619
603
|
if (calendarRef.current?.set) {
|
|
620
604
|
if (value !== undefined) {
|
|
@@ -658,7 +642,8 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
658
642
|
className: wrapperClasses,
|
|
659
643
|
ref: ref
|
|
660
644
|
}, rest), /*#__PURE__*/React.createElement("div", {
|
|
661
|
-
className: datePickerClasses
|
|
645
|
+
className: datePickerClasses,
|
|
646
|
+
ref: wrapperRef
|
|
662
647
|
}, childrenWithProps), fluidError);
|
|
663
648
|
});
|
|
664
649
|
DatePicker.propTypes = {
|
|
@@ -16,17 +16,41 @@ var carbonFlatpickrFixEventsPlugin = config => fp => {
|
|
|
16
16
|
const {
|
|
17
17
|
inputFrom,
|
|
18
18
|
inputTo,
|
|
19
|
-
lastStartValue
|
|
19
|
+
lastStartValue,
|
|
20
|
+
container
|
|
20
21
|
} = config;
|
|
22
|
+
// Avoid closing when mousedown starts inside but click lands outside after
|
|
23
|
+
// scroll or blur (e.g., scrollable modal masks).
|
|
24
|
+
let mouseDownInside = false;
|
|
25
|
+
const getEventPath = event => typeof event.composedPath === 'function' ? event.composedPath() : [];
|
|
26
|
+
const isEventInside = event => {
|
|
27
|
+
const path = getEventPath(event);
|
|
28
|
+
return Boolean(container && (path.includes(container) || container.contains(event.target)) || fp.calendarContainer && (path.includes(fp.calendarContainer) || fp.calendarContainer.contains(event.target)) || inputFrom && (path.includes(inputFrom) || inputFrom.contains(event.target)) || inputTo && (path.includes(inputTo) || inputTo.contains(event.target)));
|
|
29
|
+
};
|
|
30
|
+
|
|
21
31
|
/**
|
|
22
32
|
* Handles `click` outside to close calendar
|
|
23
33
|
*/
|
|
24
34
|
const handleClickOutside = event => {
|
|
25
|
-
if (
|
|
35
|
+
if (mouseDownInside) {
|
|
36
|
+
mouseDownInside = false;
|
|
26
37
|
return;
|
|
27
38
|
}
|
|
39
|
+
if (!fp.isOpen || isEventInside(event)) {
|
|
40
|
+
mouseDownInside = false;
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
mouseDownInside = false;
|
|
28
44
|
fp.close();
|
|
29
45
|
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Tracks the initial mouse target to avoid closing on click after scroll.
|
|
49
|
+
*/
|
|
50
|
+
const handleMouseDown = event => {
|
|
51
|
+
mouseDownInside = isEventInside(event);
|
|
52
|
+
};
|
|
53
|
+
|
|
30
54
|
/**
|
|
31
55
|
* Handles `keydown` event.
|
|
32
56
|
*/
|
|
@@ -120,6 +144,7 @@ var carbonFlatpickrFixEventsPlugin = config => fp => {
|
|
|
120
144
|
inputTo.removeEventListener('blur', handleBlur, true);
|
|
121
145
|
}
|
|
122
146
|
inputFrom.removeEventListener('keydown', handleKeydown, true);
|
|
147
|
+
document.removeEventListener('mousedown', handleMouseDown, true);
|
|
123
148
|
document.removeEventListener('click', handleClickOutside, true);
|
|
124
149
|
};
|
|
125
150
|
|
|
@@ -137,6 +162,7 @@ var carbonFlatpickrFixEventsPlugin = config => fp => {
|
|
|
137
162
|
inputTo.addEventListener('keydown', handleKeydown, true);
|
|
138
163
|
inputTo.addEventListener('blur', handleBlur, true);
|
|
139
164
|
}
|
|
165
|
+
document.addEventListener('mousedown', handleMouseDown, true);
|
|
140
166
|
document.addEventListener('click', handleClickOutside, true);
|
|
141
167
|
};
|
|
142
168
|
|
|
@@ -9,7 +9,7 @@ import { Calendar, WarningFilled, WarningAltFilled } from '@carbon/icons-react';
|
|
|
9
9
|
import { warning } from '../../internal/warning.js';
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
|
-
import React, { useContext, cloneElement } from 'react';
|
|
12
|
+
import React, { forwardRef, useContext, cloneElement } from 'react';
|
|
13
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
14
|
import '../FluidForm/FluidForm.js';
|
|
15
15
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
@@ -24,7 +24,8 @@ import { useNormalizedInputProps } from '../../internal/useNormalizedInputProps.
|
|
|
24
24
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
25
25
|
|
|
26
26
|
let didWarnAboutDatePickerInputValue = false;
|
|
27
|
-
const
|
|
27
|
+
const frFn = forwardRef;
|
|
28
|
+
const DatePickerInput = frFn((props, ref) => {
|
|
28
29
|
const {
|
|
29
30
|
datePickerType,
|
|
30
31
|
decorator,
|
|
@@ -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 PropTypes from 'prop-types';
|
|
8
|
+
import { type HTMLAttributes } from 'react';
|
|
8
9
|
import { type ListBoxSize } from '../ListBox';
|
|
9
10
|
export interface DropdownSkeletonProps extends HTMLAttributes<HTMLDivElement> {
|
|
10
11
|
/**
|
|
@@ -20,6 +21,22 @@ export interface DropdownSkeletonProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
20
21
|
*/
|
|
21
22
|
size?: ListBoxSize;
|
|
22
23
|
}
|
|
23
|
-
declare const DropdownSkeleton:
|
|
24
|
+
declare const DropdownSkeleton: {
|
|
25
|
+
({ className, size, hideLabel, ...rest }: DropdownSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
propTypes: {
|
|
27
|
+
/**
|
|
28
|
+
* Specify an optional className to add.
|
|
29
|
+
*/
|
|
30
|
+
className: PropTypes.Requireable<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Specify whether the label should be hidden, or not
|
|
33
|
+
*/
|
|
34
|
+
hideLabel: PropTypes.Requireable<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* Specify the size of the ListBox.
|
|
37
|
+
*/
|
|
38
|
+
size: PropTypes.Requireable<"sm" | "md" | "lg">;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
24
41
|
export default DropdownSkeleton;
|
|
25
42
|
export { DropdownSkeleton };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2022,
|
|
2
|
+
* Copyright IBM Corp. 2022, 2026
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -78,10 +78,9 @@ export interface DropdownProps<ItemType> extends Omit<HTMLAttributes<HTMLDivElem
|
|
|
78
78
|
*/
|
|
79
79
|
invalidText?: ReactNode;
|
|
80
80
|
/**
|
|
81
|
-
*
|
|
82
|
-
* Defaults to null and is overridden by a getter
|
|
81
|
+
* Renders an item as a custom React node instead of a string.
|
|
83
82
|
*/
|
|
84
|
-
itemToElement?:
|
|
83
|
+
itemToElement?: ((item: ItemType) => NonNullable<ReactNode>) | null;
|
|
85
84
|
/**
|
|
86
85
|
* Helper function passed to downshift that allows the library to render a
|
|
87
86
|
* given item to a string label. By default, it extracts the `label` field
|
|
@@ -252,9 +252,6 @@ const Dropdown = /*#__PURE__*/React.forwardRef(({
|
|
|
252
252
|
[`${prefix}--list-box__wrapper--slug`]: slug,
|
|
253
253
|
[`${prefix}--list-box__wrapper--decorator`]: decorator
|
|
254
254
|
});
|
|
255
|
-
|
|
256
|
-
// needs to be Capitalized for react to render it correctly
|
|
257
|
-
const ItemToElement = itemToElement;
|
|
258
255
|
const toggleButtonProps = getToggleButtonProps({
|
|
259
256
|
'aria-label': ariaLabel || deprecatedAriaLabel
|
|
260
257
|
});
|
|
@@ -270,10 +267,20 @@ const Dropdown = /*#__PURE__*/React.forwardRef(({
|
|
|
270
267
|
const [currTimer, setCurrTimer] = useState();
|
|
271
268
|
const [isTyping, setIsTyping] = useState(false);
|
|
272
269
|
const onKeyDownHandler = useCallback(evt => {
|
|
273
|
-
|
|
270
|
+
const navigationKeys = ['ArrowDown', 'ArrowUp', ' ', 'Enter'];
|
|
271
|
+
|
|
272
|
+
// If the key is not a navigation key, the user is typing
|
|
273
|
+
if (!navigationKeys.includes(evt.key)) {
|
|
274
274
|
setIsTyping(true);
|
|
275
|
-
|
|
276
|
-
|
|
275
|
+
// Reset the timer for typing timeout
|
|
276
|
+
if (currTimer) {
|
|
277
|
+
clearTimeout(currTimer);
|
|
278
|
+
}
|
|
279
|
+
setCurrTimer(setTimeout(() => {
|
|
280
|
+
setIsTyping(false);
|
|
281
|
+
}, 3000));
|
|
282
|
+
} else if (isTyping && evt.key === ' ') {
|
|
283
|
+
// If user is typing and presses space, reset the timer
|
|
277
284
|
if (currTimer) {
|
|
278
285
|
clearTimeout(currTimer);
|
|
279
286
|
}
|
|
@@ -377,21 +384,18 @@ const Dropdown = /*#__PURE__*/React.forwardRef(({
|
|
|
377
384
|
})), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React.createElement("div", {
|
|
378
385
|
className: `${prefix}--list-box__inner-wrapper--decorator`
|
|
379
386
|
}, normalizedDecorator) : '', /*#__PURE__*/React.createElement(ListBox.Menu, menuProps, isOpen && items.map((item, index) => {
|
|
380
|
-
const isObject = item !== null && typeof item === 'object';
|
|
381
387
|
const itemProps = getItemProps({
|
|
382
388
|
item,
|
|
383
389
|
index
|
|
384
390
|
});
|
|
385
|
-
const title =
|
|
391
|
+
const title = itemToString(item);
|
|
386
392
|
return /*#__PURE__*/React.createElement(ListBox.MenuItem, _extends({
|
|
387
393
|
key: itemProps.id,
|
|
388
394
|
isActive: selectedItem === item,
|
|
389
395
|
isHighlighted: highlightedIndex === index,
|
|
390
396
|
title: title,
|
|
391
397
|
disabled: itemProps['aria-disabled']
|
|
392
|
-
}, itemProps),
|
|
393
|
-
key: itemProps.id
|
|
394
|
-
}, item)) : itemToString(item), selectedItem === item && /*#__PURE__*/React.createElement(Checkmark, {
|
|
398
|
+
}, itemProps), itemToElement ? itemToElement(item) : itemToString(item), selectedItem === item && /*#__PURE__*/React.createElement(Checkmark, {
|
|
395
399
|
className: `${prefix}--list-box__menu-item__selected-icon`
|
|
396
400
|
}));
|
|
397
401
|
}))), !inline && !isFluid && !normalizedProps.validation && helper, !inline && !isFluid && normalizedProps.validation);
|
|
@@ -471,8 +475,7 @@ Dropdown.propTypes = {
|
|
|
471
475
|
*/
|
|
472
476
|
invalidText: PropTypes.node,
|
|
473
477
|
/**
|
|
474
|
-
*
|
|
475
|
-
* Defaults to null and is overridden by a getter
|
|
478
|
+
* Renders an item as a custom React node instead of a string.
|
|
476
479
|
*/
|
|
477
480
|
itemToElement: PropTypes.func,
|
|
478
481
|
/**
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import React, { useState, useRef, useEffect } from 'react';
|
|
9
|
+
import React, { forwardRef, useState, useRef, useEffect } from 'react';
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import Search from '../Search/Search.js';
|
|
12
12
|
import '../Search/Search.Skeleton.js';
|
|
@@ -16,15 +16,17 @@ import { Escape } from '../../internal/keyboard/keys.js';
|
|
|
16
16
|
import { match } from '../../internal/keyboard/match.js';
|
|
17
17
|
import { mergeRefs } from '../../tools/mergeRefs.js';
|
|
18
18
|
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
const frFn = forwardRef;
|
|
20
|
+
const ExpandableSearch = frFn((props, forwardedRef) => {
|
|
21
|
+
const {
|
|
22
|
+
onBlur,
|
|
23
|
+
onChange,
|
|
24
|
+
onExpand,
|
|
25
|
+
onKeyDown,
|
|
26
|
+
defaultValue,
|
|
27
|
+
isExpanded,
|
|
28
|
+
...rest
|
|
29
|
+
} = props;
|
|
28
30
|
const [expanded, setExpanded] = useState(isExpanded || false);
|
|
29
31
|
const [hasContent, setHasContent] = useState(defaultValue ? true : false);
|
|
30
32
|
const searchRef = useRef(null);
|
|
@@ -57,8 +59,8 @@ const ExpandableSearch = /*#__PURE__*/React.forwardRef(function ExpandableSearch
|
|
|
57
59
|
}
|
|
58
60
|
const classes = cx(`${prefix}--search--expandable`, {
|
|
59
61
|
[`${prefix}--search--expanded`]: expanded
|
|
60
|
-
},
|
|
61
|
-
return /*#__PURE__*/React.createElement(Search, _extends({},
|
|
62
|
+
}, rest.className);
|
|
63
|
+
return /*#__PURE__*/React.createElement(Search, _extends({}, rest, {
|
|
62
64
|
defaultValue: defaultValue,
|
|
63
65
|
isExpanded: expanded,
|
|
64
66
|
ref: mergeRefs(searchRef, forwardedRef),
|