@carbon/react 1.81.0-rc.0 → 1.82.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 +784 -784
- package/es/components/AILabel/index.d.ts +1 -1
- package/es/components/AILabel/index.js +2 -9
- package/es/components/Breadcrumb/Breadcrumb.d.ts +2 -3
- package/es/components/Breadcrumb/Breadcrumb.js +4 -4
- package/es/components/Breadcrumb/BreadcrumbItem.d.ts +3 -4
- package/es/components/Breadcrumb/BreadcrumbItem.js +5 -4
- package/es/components/Button/Button.js +2 -10
- package/es/components/ButtonSet/ButtonSet.d.ts +2 -3
- package/es/components/ButtonSet/ButtonSet.js +4 -4
- package/es/components/CodeSnippet/CodeSnippet.d.ts +1 -1
- package/es/components/CodeSnippet/CodeSnippet.js +3 -19
- package/es/components/ComboBox/ComboBox.d.ts +1 -1
- package/es/components/ComboBox/ComboBox.js +54 -32
- package/es/components/ComboButton/index.d.ts +1 -1
- package/es/components/ComboButton/index.js +2 -18
- package/es/components/ComposedModal/ComposedModal.js +5 -3
- package/es/components/Copy/Copy.d.ts +1 -1
- package/es/components/Copy/Copy.js +2 -18
- package/es/components/CopyButton/CopyButton.d.ts +1 -1
- package/es/components/CopyButton/CopyButton.js +2 -18
- package/es/components/DataTable/DataTable.d.ts +7 -12
- package/es/components/DataTable/DataTable.js +0 -5
- package/es/components/DataTable/TableCell.js +28 -4
- package/es/components/DataTable/TableToolbarAction.d.ts +2 -4
- package/es/components/DataTable/TableToolbarAction.js +5 -4
- 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/DataTable/tools/sorting.d.ts +42 -0
- package/es/components/DataTable/tools/sorting.js +24 -53
- package/es/components/DatePicker/DatePicker.d.ts +1 -1
- package/es/components/DatePicker/DatePicker.js +19 -19
- package/es/components/Dialog/index.d.ts +1 -1
- package/es/components/Dropdown/Dropdown.Skeleton.d.ts +2 -2
- package/es/components/Dropdown/Dropdown.Skeleton.js +2 -2
- package/es/components/Dropdown/Dropdown.d.ts +7 -6
- package/es/components/Dropdown/Dropdown.js +13 -9
- package/es/components/FileUploader/FileUploaderButton.d.ts +1 -1
- package/es/components/FileUploader/FileUploaderButton.js +1 -1
- package/es/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/es/components/FileUploader/FileUploaderItem.js +1 -1
- package/es/components/FluidDatePickerInput/FluidDatePickerInput.d.ts +1 -1
- package/es/components/FluidDatePickerInput/FluidDatePickerInput.js +5 -6
- package/es/components/FluidDropdown/FluidDropdown.d.ts +1 -1
- package/es/components/FluidSearch/FluidSearch.d.ts +3 -6
- package/es/components/IconButton/index.d.ts +1 -1
- package/es/components/IconButton/index.js +2 -18
- package/es/components/ListBox/ListBox.d.ts +4 -5
- package/es/components/ListBox/ListBox.js +8 -7
- package/es/components/ListBox/ListBoxMenu.d.ts +4 -4
- package/es/components/ListBox/ListBoxMenu.js +4 -2
- package/es/components/ListBox/ListBoxMenuItem.d.ts +9 -8
- package/es/components/ListBox/ListBoxPropTypes.d.ts +3 -3
- package/es/components/ListBox/ListBoxPropTypes.js +3 -3
- package/es/components/ListBox/index.d.ts +7 -5
- package/es/components/ListBox/index.js +1 -1
- package/es/components/Menu/Menu.js +9 -14
- package/es/components/Menu/MenuItem.js +15 -4
- package/es/components/Modal/Modal.js +9 -9
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +3 -2
- package/es/components/MultiSelect/FilterableMultiSelect.js +3 -2
- package/es/components/MultiSelect/MultiSelect.d.ts +8 -2
- package/es/components/MultiSelect/MultiSelect.js +7 -4
- package/es/components/Notification/Notification.js +1 -1
- package/es/components/OverflowMenu/OverflowMenu.js +2 -21
- package/es/components/OverflowMenu/index.d.ts +1 -1
- package/es/components/OverflowMenu/index.js +2 -3
- package/es/components/OverflowMenu/next/index.js +2 -18
- package/es/components/OverflowMenuItem/OverflowMenuItem.d.ts +2 -4
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +5 -4
- package/es/components/PageHeader/PageHeader.d.ts +160 -8
- package/es/components/PageHeader/PageHeader.js +155 -21
- package/es/components/PageHeader/index.d.ts +2 -2
- package/es/components/PageHeader/index.js +1 -1
- package/es/components/Popover/index.js +4 -21
- package/es/components/Search/Search.d.ts +2 -5
- package/es/components/Search/Search.js +24 -8
- package/es/components/Stack/HStack.d.ts +2 -3
- package/es/components/Stack/HStack.js +4 -7
- package/es/components/Stack/Stack.d.ts +3 -4
- package/es/components/Stack/Stack.js +3 -6
- package/es/components/Stack/VStack.d.ts +2 -3
- package/es/components/Stack/VStack.js +3 -2
- package/es/components/Stack/index.d.ts +4 -4
- package/es/components/TextArea/TextArea.js +3 -5
- package/es/components/TimePicker/TimePicker.d.ts +3 -4
- package/es/components/TimePicker/TimePicker.js +5 -4
- package/es/components/TimePickerSelect/TimePickerSelect.d.ts +23 -4
- package/es/components/TimePickerSelect/TimePickerSelect.js +5 -4
- package/es/components/TreeView/TreeNode.js +13 -1
- package/es/components/TreeView/TreeView.js +1 -1
- package/es/index.js +1 -1
- package/es/internal/FloatingMenu.js +9 -5
- package/es/internal/environment.js +7 -0
- package/es/internal/keyboard/navigation.d.ts +0 -10
- package/es/internal/keyboard/navigation.js +1 -13
- package/es/internal/useId.js +1 -1
- package/es/internal/useNoInteractiveChildren.js +7 -0
- package/es/internal/useOutsideClick.js +3 -0
- package/es/internal/wrapFocus.d.ts +49 -0
- package/es/internal/wrapFocus.js +64 -51
- package/es/tools/events.d.ts +17 -0
- package/es/tools/events.js +10 -13
- package/es/tools/mapPopoverAlign.d.ts +15 -0
- package/es/tools/mapPopoverAlign.js +28 -0
- package/es/tools/uniqueId.d.ts +7 -0
- package/es/tools/uniqueId.js +3 -3
- package/es/types/common.d.ts +0 -2
- package/lib/components/AILabel/index.d.ts +1 -1
- package/lib/components/AILabel/index.js +2 -9
- package/lib/components/Breadcrumb/Breadcrumb.d.ts +2 -3
- package/lib/components/Breadcrumb/Breadcrumb.js +3 -3
- package/lib/components/Breadcrumb/BreadcrumbItem.d.ts +3 -4
- package/lib/components/Breadcrumb/BreadcrumbItem.js +4 -3
- package/lib/components/Button/Button.js +1 -9
- package/lib/components/ButtonSet/ButtonSet.d.ts +2 -3
- package/lib/components/ButtonSet/ButtonSet.js +3 -3
- package/lib/components/CodeSnippet/CodeSnippet.d.ts +1 -1
- package/lib/components/CodeSnippet/CodeSnippet.js +3 -19
- package/lib/components/ComboBox/ComboBox.d.ts +1 -1
- package/lib/components/ComboBox/ComboBox.js +53 -31
- package/lib/components/ComboButton/index.d.ts +1 -1
- package/lib/components/ComboButton/index.js +2 -18
- package/lib/components/ComposedModal/ComposedModal.js +5 -3
- package/lib/components/Copy/Copy.d.ts +1 -1
- package/lib/components/Copy/Copy.js +2 -18
- package/lib/components/CopyButton/CopyButton.d.ts +1 -1
- package/lib/components/CopyButton/CopyButton.js +2 -18
- package/lib/components/DataTable/DataTable.d.ts +7 -12
- package/lib/components/DataTable/DataTable.js +0 -5
- package/lib/components/DataTable/TableCell.js +28 -3
- package/lib/components/DataTable/TableToolbarAction.d.ts +2 -4
- package/lib/components/DataTable/TableToolbarAction.js +4 -3
- 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/DataTable/tools/sorting.d.ts +42 -0
- package/lib/components/DataTable/tools/sorting.js +23 -53
- package/lib/components/DatePicker/DatePicker.d.ts +1 -1
- package/lib/components/DatePicker/DatePicker.js +19 -19
- package/lib/components/Dialog/index.d.ts +1 -1
- package/lib/components/Dropdown/Dropdown.Skeleton.d.ts +2 -2
- package/lib/components/Dropdown/Dropdown.Skeleton.js +1 -1
- package/lib/components/Dropdown/Dropdown.d.ts +7 -6
- package/lib/components/Dropdown/Dropdown.js +12 -8
- package/lib/components/FileUploader/FileUploaderButton.d.ts +1 -1
- package/lib/components/FileUploader/FileUploaderButton.js +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/lib/components/FileUploader/FileUploaderItem.js +1 -1
- package/lib/components/FluidDatePickerInput/FluidDatePickerInput.d.ts +1 -1
- package/lib/components/FluidDatePickerInput/FluidDatePickerInput.js +4 -5
- package/lib/components/FluidDropdown/FluidDropdown.d.ts +1 -1
- package/lib/components/FluidSearch/FluidSearch.d.ts +3 -6
- package/lib/components/IconButton/index.d.ts +1 -1
- package/lib/components/IconButton/index.js +2 -18
- package/lib/components/ListBox/ListBox.d.ts +4 -5
- package/lib/components/ListBox/ListBox.js +7 -6
- package/lib/components/ListBox/ListBoxMenu.d.ts +4 -4
- package/lib/components/ListBox/ListBoxMenu.js +3 -1
- package/lib/components/ListBox/ListBoxMenuItem.d.ts +9 -8
- package/lib/components/ListBox/ListBoxPropTypes.d.ts +3 -3
- package/lib/components/ListBox/ListBoxPropTypes.js +4 -4
- package/lib/components/ListBox/index.d.ts +7 -5
- package/lib/components/ListBox/index.js +2 -2
- package/lib/components/Menu/Menu.js +9 -14
- package/lib/components/Menu/MenuItem.js +15 -4
- package/lib/components/Modal/Modal.js +9 -9
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +3 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.js +2 -1
- package/lib/components/MultiSelect/MultiSelect.d.ts +8 -2
- package/lib/components/MultiSelect/MultiSelect.js +6 -3
- package/lib/components/Notification/Notification.js +1 -1
- package/lib/components/OverflowMenu/OverflowMenu.js +2 -21
- package/lib/components/OverflowMenu/index.d.ts +1 -1
- package/lib/components/OverflowMenu/index.js +2 -3
- package/lib/components/OverflowMenu/next/index.js +2 -18
- package/lib/components/OverflowMenuItem/OverflowMenuItem.d.ts +2 -4
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +4 -3
- package/lib/components/PageHeader/PageHeader.d.ts +160 -8
- package/lib/components/PageHeader/PageHeader.js +159 -19
- package/lib/components/PageHeader/index.d.ts +2 -2
- package/lib/components/PageHeader/index.js +6 -0
- package/lib/components/Popover/index.js +4 -21
- package/lib/components/Search/Search.d.ts +2 -5
- package/lib/components/Search/Search.js +24 -8
- package/lib/components/Stack/HStack.d.ts +2 -3
- package/lib/components/Stack/HStack.js +3 -6
- package/lib/components/Stack/Stack.d.ts +3 -4
- package/lib/components/Stack/Stack.js +2 -5
- package/lib/components/Stack/VStack.d.ts +2 -3
- package/lib/components/Stack/VStack.js +2 -1
- package/lib/components/Stack/index.d.ts +4 -4
- package/lib/components/TextArea/TextArea.js +2 -4
- package/lib/components/TimePicker/TimePicker.d.ts +3 -4
- package/lib/components/TimePicker/TimePicker.js +4 -3
- package/lib/components/TimePickerSelect/TimePickerSelect.d.ts +23 -4
- package/lib/components/TimePickerSelect/TimePickerSelect.js +4 -3
- package/lib/components/TreeView/TreeNode.js +13 -1
- package/lib/components/TreeView/TreeView.js +1 -1
- package/lib/index.js +2 -2
- package/lib/internal/FloatingMenu.js +9 -5
- package/lib/internal/environment.js +7 -0
- package/lib/internal/keyboard/navigation.d.ts +0 -10
- package/lib/internal/keyboard/navigation.js +0 -14
- package/lib/internal/useNoInteractiveChildren.js +7 -0
- package/lib/internal/useOutsideClick.js +3 -0
- package/lib/internal/wrapFocus.d.ts +49 -0
- package/lib/internal/wrapFocus.js +66 -53
- package/lib/tools/events.d.ts +17 -0
- package/lib/tools/events.js +10 -13
- package/lib/tools/mapPopoverAlign.d.ts +15 -0
- package/lib/tools/mapPopoverAlign.js +32 -0
- package/lib/tools/uniqueId.d.ts +7 -0
- package/lib/tools/uniqueId.js +3 -3
- package/lib/types/common.d.ts +0 -2
- package/package.json +9 -9
- package/telemetry.yml +3 -1
- package/es/tools/createPropAdapter.js +0 -40
- package/lib/tools/createPropAdapter.js +0 -44
|
@@ -18,7 +18,7 @@ var useIsomorphicEffect = require('../../internal/useIsomorphicEffect.js');
|
|
|
18
18
|
var useMergedRefs = require('../../internal/useMergedRefs.js');
|
|
19
19
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
20
20
|
var useEvent = require('../../internal/useEvent.js');
|
|
21
|
-
var
|
|
21
|
+
var mapPopoverAlign = require('../../tools/mapPopoverAlign.js');
|
|
22
22
|
var react = require('@floating-ui/react');
|
|
23
23
|
var index = require('../FeatureFlags/index.js');
|
|
24
24
|
|
|
@@ -43,19 +43,6 @@ const PopoverContext = /*#__PURE__*/React__default["default"].createContext({
|
|
|
43
43
|
* @deprecated Use NewPopoverAlignment instead.
|
|
44
44
|
*/
|
|
45
45
|
|
|
46
|
-
const propMappingFunction = deprecatedValue => {
|
|
47
|
-
const mapping = {
|
|
48
|
-
'top-left': 'top-start',
|
|
49
|
-
'top-right': 'top-end',
|
|
50
|
-
'bottom-left': 'bottom-start',
|
|
51
|
-
'bottom-right': 'bottom-end',
|
|
52
|
-
'left-bottom': 'left-end',
|
|
53
|
-
'left-top': 'left-start',
|
|
54
|
-
'right-bottom': 'right-end',
|
|
55
|
-
'right-top': 'right-start'
|
|
56
|
-
};
|
|
57
|
-
return mapping[deprecatedValue];
|
|
58
|
-
};
|
|
59
46
|
const Popover = /*#__PURE__*/React__default["default"].forwardRef(function PopoverRenderFunction(_ref,
|
|
60
47
|
//this is a workaround, have to come back and fix this.
|
|
61
48
|
forwardRef) {
|
|
@@ -80,7 +67,7 @@ forwardRef) {
|
|
|
80
67
|
const caretRef = React.useRef(null);
|
|
81
68
|
const popover = React.useRef(null);
|
|
82
69
|
const enableFloatingStyles = index.useFeatureFlag('enable-v12-dynamic-floating-styles') || autoAlign;
|
|
83
|
-
let align =
|
|
70
|
+
let align = mapPopoverAlign.mapPopoverAlign(initialAlign);
|
|
84
71
|
|
|
85
72
|
// If the `Popover` is the last focusable item in the tab order, it should also close when the browser window loses focus (#12922)
|
|
86
73
|
useEvent.useWindowEvent('blur', () => {
|
|
@@ -147,7 +134,7 @@ forwardRef) {
|
|
|
147
134
|
alignmentAxis: alignmentAxisOffset,
|
|
148
135
|
mainAxis: popoverDimensions?.current?.offset
|
|
149
136
|
} : 0), autoAlign && react.flip({
|
|
150
|
-
fallbackPlacements: align.includes('bottom') ? ['bottom', 'bottom-start', 'bottom-end', 'right', 'right-start', 'right-end', 'left', 'left-start', 'left-end', 'top', 'top-start', 'top-end'] : ['top', 'top-start', 'top-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end', 'bottom', 'bottom-start', 'bottom-end'],
|
|
137
|
+
fallbackPlacements: isTabTip ? align.includes('bottom') ? ['bottom-start', 'bottom-end', 'top-start', 'top-end'] : ['top-start', 'top-end', 'bottom-start', 'bottom-end'] : align.includes('bottom') ? ['bottom', 'bottom-start', 'bottom-end', 'right', 'right-start', 'right-end', 'left', 'left-start', 'left-end', 'top', 'top-start', 'top-end'] : ['top', 'top-start', 'top-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end', 'bottom', 'bottom-start', 'bottom-end'],
|
|
151
138
|
fallbackStrategy: 'initialPlacement',
|
|
152
139
|
fallbackAxisSideDirection: 'start',
|
|
153
140
|
boundary: autoAlignBoundary
|
|
@@ -307,11 +294,7 @@ Popover.propTypes = {
|
|
|
307
294
|
// deprecated use right-start instead
|
|
308
295
|
|
|
309
296
|
// new values to match floating-ui
|
|
310
|
-
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
311
|
-
//allowed prop values
|
|
312
|
-
['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
|
|
313
|
-
//optional mapper function
|
|
314
|
-
propMappingFunction),
|
|
297
|
+
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']), ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'], mapPopoverAlign.mapPopoverAlign),
|
|
315
298
|
/**
|
|
316
299
|
* Provide a custom element or component to render the top-level node for the
|
|
317
300
|
* component.
|
|
@@ -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, { type
|
|
7
|
+
import React, { type ChangeEvent, type ComponentType, type FunctionComponent, type HTMLAttributes, type KeyboardEvent, type MouseEvent, type ReactNode } from 'react';
|
|
8
8
|
type InputPropsBase = Omit<HTMLAttributes<HTMLInputElement>, 'onChange'>;
|
|
9
9
|
export interface SearchProps extends InputPropsBase {
|
|
10
10
|
/**
|
|
@@ -43,10 +43,7 @@ export interface SearchProps extends InputPropsBase {
|
|
|
43
43
|
/**
|
|
44
44
|
* Optional callback called when the search value changes.
|
|
45
45
|
*/
|
|
46
|
-
onChange
|
|
47
|
-
target: HTMLInputElement;
|
|
48
|
-
type: 'change';
|
|
49
|
-
}): void;
|
|
46
|
+
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
50
47
|
/**
|
|
51
48
|
* Optional callback called when the search value is cleared.
|
|
52
49
|
*/
|
|
@@ -23,6 +23,7 @@ var useMergedRefs = require('../../internal/useMergedRefs.js');
|
|
|
23
23
|
var deprecate = require('../../prop-types/deprecate.js');
|
|
24
24
|
require('../FluidForm/FluidForm.js');
|
|
25
25
|
var FormContext = require('../FluidForm/FormContext.js');
|
|
26
|
+
var noopFn = require('../../internal/noopFn.js');
|
|
26
27
|
|
|
27
28
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
28
29
|
|
|
@@ -89,14 +90,29 @@ const Search = /*#__PURE__*/React__default["default"].forwardRef(function Search
|
|
|
89
90
|
if (!value && inputRef.current) {
|
|
90
91
|
inputRef.current.value = '';
|
|
91
92
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
93
|
+
if (inputRef.current) {
|
|
94
|
+
const inputTarget = Object.assign({}, inputRef.current, {
|
|
95
|
+
value: ''
|
|
96
|
+
});
|
|
97
|
+
const syntheticEvent = {
|
|
98
|
+
bubbles: false,
|
|
99
|
+
cancelable: false,
|
|
100
|
+
currentTarget: inputRef.current,
|
|
101
|
+
defaultPrevented: false,
|
|
102
|
+
eventPhase: 0,
|
|
103
|
+
isDefaultPrevented: () => false,
|
|
104
|
+
isPropagationStopped: () => false,
|
|
105
|
+
isTrusted: false,
|
|
106
|
+
nativeEvent: new Event('change'),
|
|
107
|
+
persist: noopFn.noopFn,
|
|
108
|
+
preventDefault: noopFn.noopFn,
|
|
109
|
+
stopPropagation: noopFn.noopFn,
|
|
110
|
+
target: inputTarget,
|
|
111
|
+
timeStamp: 0,
|
|
112
|
+
type: 'change'
|
|
113
|
+
};
|
|
114
|
+
onChange(syntheticEvent);
|
|
115
|
+
}
|
|
100
116
|
onClear();
|
|
101
117
|
setHasContent(false);
|
|
102
118
|
inputRef.current?.focus();
|
|
@@ -1,10 +1,9 @@
|
|
|
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.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { StackProps } from './Stack';
|
|
9
|
-
declare const HStack: React.ForwardRefExoticComponent<StackProps & React.RefAttributes<
|
|
10
|
-
export { HStack };
|
|
9
|
+
export declare const HStack: React.ForwardRefExoticComponent<StackProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -17,15 +17,12 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
17
17
|
|
|
18
18
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
19
19
|
|
|
20
|
-
const HStack = /*#__PURE__*/
|
|
21
|
-
let {
|
|
22
|
-
children,
|
|
23
|
-
...props
|
|
24
|
-
} = _ref;
|
|
20
|
+
const HStack = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
25
21
|
return /*#__PURE__*/React__default["default"].createElement(Stack.Stack, _rollupPluginBabelHelpers["extends"]({}, props, {
|
|
26
22
|
ref: ref,
|
|
27
23
|
orientation: "horizontal"
|
|
28
|
-
})
|
|
24
|
+
}));
|
|
29
25
|
});
|
|
26
|
+
HStack.propTypes = Stack.Stack.propTypes;
|
|
30
27
|
|
|
31
28
|
exports.HStack = HStack;
|
|
@@ -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.
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
/**
|
|
9
9
|
* The steps in the spacing scale
|
|
10
|
-
* @type {Array<number>}
|
|
11
10
|
*/
|
|
12
11
|
declare const SPACING_STEPS: number[];
|
|
13
12
|
export interface StackProps extends React.HTMLAttributes<HTMLElement> {
|
|
@@ -54,5 +53,5 @@ export interface StackProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
54
53
|
* - https://paste.twilio.design/layout/stack/
|
|
55
54
|
* - https://github.com/Workday/canvas-kit/blob/f2f599654876700f483a1d8c5de82a41315c76f1/modules/labs-react/layout/lib/Stack.tsx
|
|
56
55
|
*/
|
|
57
|
-
declare const Stack: React.ForwardRefExoticComponent<StackProps & React.RefAttributes<
|
|
58
|
-
export {
|
|
56
|
+
export declare const Stack: React.ForwardRefExoticComponent<StackProps & React.RefAttributes<HTMLElement>>;
|
|
57
|
+
export {};
|
|
@@ -24,13 +24,10 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* The steps in the spacing scale
|
|
27
|
-
* @type {Array<number>}
|
|
28
27
|
*/
|
|
29
28
|
const SPACING_STEPS = Array.from({
|
|
30
29
|
length: layout.spacing.length - 1
|
|
31
|
-
}
|
|
32
|
-
return step + 1;
|
|
33
|
-
});
|
|
30
|
+
}, (_, step) => step + 1);
|
|
34
31
|
/**
|
|
35
32
|
* The Stack component is a useful layout utility in a component-based model.
|
|
36
33
|
* This allows components to not use margin and instead delegate the
|
|
@@ -48,7 +45,7 @@ const SPACING_STEPS = Array.from({
|
|
|
48
45
|
* - https://paste.twilio.design/layout/stack/
|
|
49
46
|
* - https://github.com/Workday/canvas-kit/blob/f2f599654876700f483a1d8c5de82a41315c76f1/modules/labs-react/layout/lib/Stack.tsx
|
|
50
47
|
*/
|
|
51
|
-
const Stack = /*#__PURE__*/
|
|
48
|
+
const Stack = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
52
49
|
const {
|
|
53
50
|
as: BaseComponent = 'div',
|
|
54
51
|
children,
|
|
@@ -1,10 +1,9 @@
|
|
|
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.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { StackProps } from './Stack';
|
|
9
|
-
declare const VStack: React.ForwardRefExoticComponent<StackProps & React.RefAttributes<
|
|
10
|
-
export { VStack };
|
|
9
|
+
export declare const VStack: React.ForwardRefExoticComponent<StackProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -17,11 +17,12 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
17
17
|
|
|
18
18
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
19
19
|
|
|
20
|
-
const VStack = /*#__PURE__*/
|
|
20
|
+
const VStack = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
21
21
|
return /*#__PURE__*/React__default["default"].createElement(Stack.Stack, _rollupPluginBabelHelpers["extends"]({}, props, {
|
|
22
22
|
ref: ref,
|
|
23
23
|
orientation: "vertical"
|
|
24
24
|
}));
|
|
25
25
|
});
|
|
26
|
+
VStack.propTypes = Stack.Stack.propTypes;
|
|
26
27
|
|
|
27
28
|
exports.VStack = VStack;
|
|
@@ -1,9 +1,9 @@
|
|
|
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.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
7
|
+
export * from './HStack';
|
|
8
|
+
export * from './Stack';
|
|
9
|
+
export * from './VStack';
|
|
@@ -32,10 +32,8 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
32
32
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
33
33
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const TextArea = /*#__PURE__*/React.forwardRef((props, forwardRef) => {
|
|
35
|
+
const frFn = React.forwardRef;
|
|
36
|
+
const TextArea = frFn((props, forwardRef) => {
|
|
39
37
|
const {
|
|
40
38
|
className,
|
|
41
39
|
decorator,
|
|
@@ -1,11 +1,11 @@
|
|
|
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.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import {
|
|
8
|
+
import { ReactAttr } from '../../types/common';
|
|
9
9
|
type ExcludedAttributes = 'id' | 'value';
|
|
10
10
|
export interface TimePickerProps extends Omit<ReactAttr<HTMLInputElement>, ExcludedAttributes> {
|
|
11
11
|
/**
|
|
@@ -99,6 +99,5 @@ export interface TimePickerProps extends Omit<ReactAttr<HTMLInputElement>, Exclu
|
|
|
99
99
|
*/
|
|
100
100
|
value?: string;
|
|
101
101
|
}
|
|
102
|
-
|
|
103
|
-
declare const TimePicker: TimePickerComponent;
|
|
102
|
+
declare const TimePicker: React.ForwardRefExoticComponent<TimePickerProps & React.RefAttributes<HTMLInputElement>>;
|
|
104
103
|
export default TimePicker;
|
|
@@ -23,8 +23,9 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
23
23
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
24
24
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
25
25
|
|
|
26
|
-
const
|
|
27
|
-
|
|
26
|
+
const frFn = React.forwardRef;
|
|
27
|
+
const TimePicker = frFn((props, ref) => {
|
|
28
|
+
const {
|
|
28
29
|
children,
|
|
29
30
|
className,
|
|
30
31
|
disabled = false,
|
|
@@ -47,7 +48,7 @@ const TimePicker = /*#__PURE__*/React__default["default"].forwardRef(function Ti
|
|
|
47
48
|
type = 'text',
|
|
48
49
|
value,
|
|
49
50
|
...rest
|
|
50
|
-
} =
|
|
51
|
+
} = props;
|
|
51
52
|
const prefix = usePrefix.usePrefix();
|
|
52
53
|
const [isValue, setValue] = React__default["default"].useState(value);
|
|
53
54
|
const [prevValue, setPrevValue] = React__default["default"].useState(value);
|
|
@@ -1,11 +1,10 @@
|
|
|
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.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import { ForwardRefReturn } from '../../types/common';
|
|
9
8
|
export type TimePickerSelectProps = {
|
|
10
9
|
/**
|
|
11
10
|
* Provide the contents of your TimePickerSelect
|
|
@@ -28,6 +27,26 @@ export type TimePickerSelectProps = {
|
|
|
28
27
|
*/
|
|
29
28
|
id: string;
|
|
30
29
|
} & React.SelectHTMLAttributes<HTMLSelectElement> & React.InputHTMLAttributes<HTMLSelectElement>;
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
declare const TimePickerSelect: React.ForwardRefExoticComponent<{
|
|
31
|
+
/**
|
|
32
|
+
* Provide the contents of your TimePickerSelect
|
|
33
|
+
*/
|
|
34
|
+
children?: React.ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* Specify an optional className to be applied to the node containing the label and the select box
|
|
37
|
+
*/
|
|
38
|
+
className?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Optionally provide the default value of the `<select>`
|
|
41
|
+
*/
|
|
42
|
+
defaultValue?: any;
|
|
43
|
+
/**
|
|
44
|
+
* Specify whether the control is disabled
|
|
45
|
+
*/
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Specify a custom `id` for the `<select>`
|
|
49
|
+
*/
|
|
50
|
+
id: string;
|
|
51
|
+
} & React.SelectHTMLAttributes<HTMLSelectElement> & React.InputHTMLAttributes<HTMLSelectElement> & React.RefAttributes<HTMLSelectElement>>;
|
|
33
52
|
export default TimePickerSelect;
|
|
@@ -22,15 +22,16 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
22
22
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
23
23
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
24
24
|
|
|
25
|
-
const
|
|
26
|
-
|
|
25
|
+
const frFn = React.forwardRef;
|
|
26
|
+
const TimePickerSelect = frFn((props, ref) => {
|
|
27
|
+
const {
|
|
27
28
|
['aria-label']: ariaLabel = 'open list of options',
|
|
28
29
|
children,
|
|
29
30
|
id,
|
|
30
31
|
disabled = false,
|
|
31
32
|
className,
|
|
32
33
|
...rest
|
|
33
|
-
} =
|
|
34
|
+
} = props;
|
|
34
35
|
const prefix = usePrefix.usePrefix();
|
|
35
36
|
const selectClasses = cx__default["default"]({
|
|
36
37
|
[`${prefix}--select`]: true,
|
|
@@ -54,7 +54,7 @@ const TreeNode = /*#__PURE__*/React__default["default"].forwardRef((_ref, forwar
|
|
|
54
54
|
const enableTreeviewControllable = index.useFeatureFlag('enable-treeview-controllable');
|
|
55
55
|
const {
|
|
56
56
|
current: id
|
|
57
|
-
} = React.useRef(nodeId || uniqueId
|
|
57
|
+
} = React.useRef(nodeId || uniqueId.uniqueId());
|
|
58
58
|
const controllableExpandedState = useControllableState.useControllableState({
|
|
59
59
|
value: isExpanded,
|
|
60
60
|
onChange: newValue => {
|
|
@@ -211,6 +211,18 @@ const TreeNode = /*#__PURE__*/React__default["default"].forwardRef((_ref, forwar
|
|
|
211
211
|
}
|
|
212
212
|
if (match.matches(event, [keys.Enter, keys.Space])) {
|
|
213
213
|
event.preventDefault();
|
|
214
|
+
if (match.match(event, keys.Enter) && children) {
|
|
215
|
+
// Toggle expansion state for parent nodes
|
|
216
|
+
if (!enableTreeviewControllable) {
|
|
217
|
+
onToggle?.(event, {
|
|
218
|
+
id,
|
|
219
|
+
isExpanded: !expanded,
|
|
220
|
+
label,
|
|
221
|
+
value
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
setExpanded(!expanded);
|
|
225
|
+
}
|
|
214
226
|
if (href) {
|
|
215
227
|
currentNode.current?.click();
|
|
216
228
|
}
|
|
@@ -44,7 +44,7 @@ const TreeView = _ref => {
|
|
|
44
44
|
const enableTreeviewControllable = index.useFeatureFlag('enable-treeview-controllable');
|
|
45
45
|
const {
|
|
46
46
|
current: treeId
|
|
47
|
-
} = React.useRef(rest.id || uniqueId
|
|
47
|
+
} = React.useRef(rest.id || uniqueId.uniqueId());
|
|
48
48
|
const prefix = usePrefix.usePrefix();
|
|
49
49
|
const treeClasses = cx__default["default"](className, `${prefix}--tree`, {
|
|
50
50
|
// @ts-ignore - will always be false according to prop types
|
package/lib/index.js
CHANGED
|
@@ -110,8 +110,8 @@ var SkeletonPlaceholder = require('./components/SkeletonPlaceholder/SkeletonPlac
|
|
|
110
110
|
var SkeletonText = require('./components/SkeletonText/SkeletonText.js');
|
|
111
111
|
var index$d = require('./components/Slider/index.js');
|
|
112
112
|
var HStack = require('./components/Stack/HStack.js');
|
|
113
|
-
var VStack = require('./components/Stack/VStack.js');
|
|
114
113
|
var Stack = require('./components/Stack/Stack.js');
|
|
114
|
+
var VStack = require('./components/Stack/VStack.js');
|
|
115
115
|
var StructuredList = require('./components/StructuredList/StructuredList.js');
|
|
116
116
|
var StructuredList_Skeleton = require('./components/StructuredList/StructuredList.Skeleton.js');
|
|
117
117
|
var Switch = require('./components/Switch/Switch.js');
|
|
@@ -366,8 +366,8 @@ exports.SkeletonPlaceholder = SkeletonPlaceholder["default"];
|
|
|
366
366
|
exports.SkeletonText = SkeletonText["default"];
|
|
367
367
|
exports.Slider = index$d["default"];
|
|
368
368
|
exports.HStack = HStack.HStack;
|
|
369
|
-
exports.VStack = VStack.VStack;
|
|
370
369
|
exports.Stack = Stack.Stack;
|
|
370
|
+
exports.VStack = VStack.VStack;
|
|
371
371
|
exports.StructuredListBody = StructuredList.StructuredListBody;
|
|
372
372
|
exports.StructuredListCell = StructuredList.StructuredListCell;
|
|
373
373
|
exports.StructuredListHead = StructuredList.StructuredListHead;
|
|
@@ -275,13 +275,17 @@ const FloatingMenu = _ref2 => {
|
|
|
275
275
|
* Blur handler used when focus trapping is enabled.
|
|
276
276
|
*/
|
|
277
277
|
const handleBlur = event => {
|
|
278
|
-
|
|
279
|
-
|
|
278
|
+
const {
|
|
279
|
+
target,
|
|
280
|
+
relatedTarget
|
|
281
|
+
} = event;
|
|
282
|
+
if (menuBodyRef.current && startSentinelRef.current && endSentinelRef.current && target instanceof HTMLElement && relatedTarget instanceof HTMLElement) {
|
|
283
|
+
wrapFocus.wrapFocus({
|
|
280
284
|
bodyNode: menuBodyRef.current,
|
|
281
285
|
startTrapNode: startSentinelRef.current,
|
|
282
286
|
endTrapNode: endSentinelRef.current,
|
|
283
|
-
currentActiveNode:
|
|
284
|
-
oldActiveNode:
|
|
287
|
+
currentActiveNode: relatedTarget,
|
|
288
|
+
oldActiveNode: target
|
|
285
289
|
});
|
|
286
290
|
}
|
|
287
291
|
};
|
|
@@ -290,7 +294,7 @@ const FloatingMenu = _ref2 => {
|
|
|
290
294
|
* Keydown handler for focus wrapping when experimental focus trap is enabled.
|
|
291
295
|
*/
|
|
292
296
|
const handleKeyDown = event => {
|
|
293
|
-
if (match.match(event, keys.Tab) && menuBodyRef.current) {
|
|
297
|
+
if (match.match(event, keys.Tab) && menuBodyRef.current && event.target instanceof HTMLElement) {
|
|
294
298
|
wrapFocus.wrapFocusWithoutSentinels({
|
|
295
299
|
containerNode: menuBodyRef.current,
|
|
296
300
|
currentActiveNode: event.target,
|
|
@@ -15,9 +15,16 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
15
15
|
* @see https://github.com/facebook/fbjs/blob/4d1751311d3f67af2dcce2e40df8512a23c7b9c6/packages/fbjs/src/core/ExecutionEnvironment.js#L12
|
|
16
16
|
*/
|
|
17
17
|
const canUseDOM = !!(typeof window !== 'undefined' &&
|
|
18
|
+
// TODO: `ssr-friendly` doesn't support ESLint v9.
|
|
19
|
+
// https://github.com/kopiro/eslint-plugin-ssr-friendly/issues/30
|
|
20
|
+
// https://github.com/carbon-design-system/carbon/issues/18991
|
|
21
|
+
/*
|
|
18
22
|
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
|
|
23
|
+
*/
|
|
19
24
|
window.document &&
|
|
25
|
+
/*
|
|
20
26
|
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
|
|
27
|
+
*/
|
|
21
28
|
window.document.createElement);
|
|
22
29
|
|
|
23
30
|
exports.canUseDOM = canUseDOM;
|
|
@@ -17,16 +17,6 @@ import { KeyboardEvent } from 'react';
|
|
|
17
17
|
* getNextIndex(keyCodes.RIGHT, 0, 4)
|
|
18
18
|
*/
|
|
19
19
|
export declare const getNextIndex: (key: KeyboardEvent | number | string, index: number, arrayLength: number) => number | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* A flag `node.compareDocumentPosition(target)` returns that indicates
|
|
22
|
-
* `target` is located earlier than `node` in the document or `target` contains `node`.
|
|
23
|
-
*/
|
|
24
|
-
export declare const DOCUMENT_POSITION_BROAD_PRECEDING: number;
|
|
25
|
-
/**
|
|
26
|
-
* A flag `node.compareDocumentPosition(target)` returns that indicates
|
|
27
|
-
* `target` is located later than `node` in the document or `node` contains `target`.
|
|
28
|
-
*/
|
|
29
|
-
export declare const DOCUMENT_POSITION_BROAD_FOLLOWING: number;
|
|
30
20
|
/**
|
|
31
21
|
* CSS selector that selects major nodes that are sequentially focusable.
|
|
32
22
|
*/
|
|
@@ -33,18 +33,6 @@ const getNextIndex = (key, index, arrayLength) => {
|
|
|
33
33
|
return;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
/**
|
|
37
|
-
* A flag `node.compareDocumentPosition(target)` returns that indicates
|
|
38
|
-
* `target` is located earlier than `node` in the document or `target` contains `node`.
|
|
39
|
-
*/
|
|
40
|
-
const DOCUMENT_POSITION_BROAD_PRECEDING = typeof Node !== 'undefined' ? Node.DOCUMENT_POSITION_PRECEDING | Node.DOCUMENT_POSITION_CONTAINS : 0;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* A flag `node.compareDocumentPosition(target)` returns that indicates
|
|
44
|
-
* `target` is located later than `node` in the document or `node` contains `target`.
|
|
45
|
-
*/
|
|
46
|
-
const DOCUMENT_POSITION_BROAD_FOLLOWING = typeof Node !== 'undefined' ? Node.DOCUMENT_POSITION_FOLLOWING | Node.DOCUMENT_POSITION_CONTAINED_BY : 0;
|
|
47
|
-
|
|
48
36
|
/**
|
|
49
37
|
* CSS selector that selects major nodes that are sequentially focusable.
|
|
50
38
|
*/
|
|
@@ -65,8 +53,6 @@ const selectorFocusable = `
|
|
|
65
53
|
iframe, object, embed, *[tabindex]:not([disabled]), *[contenteditable=true]
|
|
66
54
|
`;
|
|
67
55
|
|
|
68
|
-
exports.DOCUMENT_POSITION_BROAD_FOLLOWING = DOCUMENT_POSITION_BROAD_FOLLOWING;
|
|
69
|
-
exports.DOCUMENT_POSITION_BROAD_PRECEDING = DOCUMENT_POSITION_BROAD_PRECEDING;
|
|
70
56
|
exports.getNextIndex = getNextIndex;
|
|
71
57
|
exports.selectorFocusable = selectorFocusable;
|
|
72
58
|
exports.selectorTabbable = selectorTabbable;
|
|
@@ -14,11 +14,15 @@ var React = require('react');
|
|
|
14
14
|
function useNoInteractiveChildren(ref) {
|
|
15
15
|
let message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'component should have no interactive child nodes';
|
|
16
16
|
if (process.env.NODE_ENV !== 'production') {
|
|
17
|
+
// TODO: https://github.com/carbon-design-system/carbon/issues/19005
|
|
18
|
+
/*
|
|
17
19
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
20
|
+
*/
|
|
18
21
|
React.useEffect(() => {
|
|
19
22
|
const node = ref.current ? getInteractiveContent(ref.current) : false;
|
|
20
23
|
if (node) {
|
|
21
24
|
const errorMessage = `Error: ${message}.\n\nInstead found: ${node.outerHTML}`;
|
|
25
|
+
// eslint-disable-next-line no-console
|
|
22
26
|
console.error(errorMessage);
|
|
23
27
|
throw new Error(errorMessage);
|
|
24
28
|
}
|
|
@@ -28,7 +32,10 @@ function useNoInteractiveChildren(ref) {
|
|
|
28
32
|
function useInteractiveChildrenNeedDescription(ref) {
|
|
29
33
|
let message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : `interactive child node(s) should have an \`aria-describedby\` property`;
|
|
30
34
|
if (process.env.NODE_ENV !== 'production') {
|
|
35
|
+
// TODO: https://github.com/carbon-design-system/carbon/issues/19005
|
|
36
|
+
/*
|
|
31
37
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
38
|
+
*/
|
|
32
39
|
React.useEffect(() => {
|
|
33
40
|
const node = ref.current ? getInteractiveContent(ref.current) : false;
|
|
34
41
|
if (node && !node.hasAttribute('aria-describedby')) {
|
|
@@ -23,7 +23,10 @@ const useOutsideClick = (ref, callback) => {
|
|
|
23
23
|
// treated as a constant as it will be false when executed in a Node.js
|
|
24
24
|
// environment and true when executed in the browser
|
|
25
25
|
if (environment.canUseDOM) {
|
|
26
|
+
// TODO: https://github.com/carbon-design-system/carbon/issues/19005
|
|
27
|
+
/*
|
|
26
28
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
29
|
+
*/
|
|
27
30
|
useEvent.useWindowEvent('click', event => {
|
|
28
31
|
const {
|
|
29
32
|
target
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2020, 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
|
+
* Checks whether the given node or one of its ancestors matches any of the
|
|
9
|
+
* specified floating menu selectors.
|
|
10
|
+
*
|
|
11
|
+
* @param {Node} node - A DOM node.
|
|
12
|
+
* @param {string[]} selectorsFloatingMenus - Additional CSS selectors that
|
|
13
|
+
* match floating menus.
|
|
14
|
+
* @returns {boolean} Whether the node or one of its ancestors is in a floating
|
|
15
|
+
* menu.
|
|
16
|
+
*/
|
|
17
|
+
export declare const elementOrParentIsFloatingMenu: (node: Node, selectorsFloatingMenus?: string[]) => boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Ensures the focus is kept within the given container by implementing
|
|
20
|
+
* "focus-wrap" behavior.
|
|
21
|
+
*/
|
|
22
|
+
export declare const wrapFocus: ({ bodyNode, startTrapNode, endTrapNode, currentActiveNode, oldActiveNode, selectorsFloatingMenus, }: {
|
|
23
|
+
/** The DOM node of the container. */
|
|
24
|
+
bodyNode: HTMLElement | null;
|
|
25
|
+
/** The start sentinel node for focus trapping. */
|
|
26
|
+
startTrapNode: HTMLElement | null;
|
|
27
|
+
/** The end sentinel node for focus trapping. */
|
|
28
|
+
endTrapNode: HTMLElement | null;
|
|
29
|
+
/** The current active node (i.e., the one with focus). */
|
|
30
|
+
currentActiveNode: HTMLElement;
|
|
31
|
+
/** The previous active node (i.e., the one that had focus before). */
|
|
32
|
+
oldActiveNode: HTMLElement;
|
|
33
|
+
/** CSS selectors for floating menus. */
|
|
34
|
+
selectorsFloatingMenus?: string[];
|
|
35
|
+
}) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Ensures the focus is kept in the given container, implementing "focus-wrap"
|
|
38
|
+
* behavior.
|
|
39
|
+
*
|
|
40
|
+
* Note: This must be called *before* focus moves using `onKeyDown` or similar.
|
|
41
|
+
*/
|
|
42
|
+
export declare const wrapFocusWithoutSentinels: ({ containerNode, currentActiveNode, event, }: {
|
|
43
|
+
/** The container node within which to keep focus. */
|
|
44
|
+
containerNode: HTMLElement;
|
|
45
|
+
/** The current active node (i.e., the one with focus). */
|
|
46
|
+
currentActiveNode: HTMLElement;
|
|
47
|
+
/** The event that triggered this function. */
|
|
48
|
+
event: React.KeyboardEvent | KeyboardEvent;
|
|
49
|
+
}) => void;
|