@carbon/react 1.81.0-rc.0 → 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 +808 -808
- package/es/components/ComboBox/ComboBox.js +52 -30
- package/es/components/DataTable/TableCell.js +28 -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/DatePicker/DatePicker.js +1 -1
- package/es/components/Dropdown/Dropdown.js +6 -6
- package/es/components/FluidDatePickerInput/FluidDatePickerInput.d.ts +1 -1
- package/es/components/FluidDatePickerInput/FluidDatePickerInput.js +5 -6
- package/es/components/Menu/Menu.js +4 -14
- package/es/components/Menu/MenuItem.js +15 -4
- package/es/components/MultiSelect/MultiSelect.js +4 -1
- package/es/components/OverflowMenu/index.d.ts +1 -1
- package/es/components/OverflowMenu/index.js +2 -3
- package/es/components/PageHeader/PageHeader.d.ts +9 -2
- package/es/components/PageHeader/PageHeader.js +15 -3
- package/es/components/PageHeader/index.d.ts +2 -2
- package/es/components/PageHeader/index.js +1 -1
- package/lib/components/ComboBox/ComboBox.js +52 -30
- package/lib/components/DataTable/TableCell.js +28 -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/DatePicker/DatePicker.js +1 -1
- package/lib/components/Dropdown/Dropdown.js +6 -6
- package/lib/components/FluidDatePickerInput/FluidDatePickerInput.d.ts +1 -1
- package/lib/components/FluidDatePickerInput/FluidDatePickerInput.js +4 -5
- package/lib/components/Menu/Menu.js +4 -14
- package/lib/components/Menu/MenuItem.js +15 -4
- package/lib/components/MultiSelect/MultiSelect.js +4 -1
- package/lib/components/OverflowMenu/index.d.ts +1 -1
- package/lib/components/OverflowMenu/index.js +2 -3
- package/lib/components/PageHeader/PageHeader.d.ts +9 -2
- package/lib/components/PageHeader/PageHeader.js +16 -2
- package/lib/components/PageHeader/index.d.ts +2 -2
- package/lib/components/PageHeader/index.js +2 -0
- package/package.json +8 -8
|
@@ -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,
|
|
@@ -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 };
|
|
@@ -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()
|
|
@@ -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,
|
|
@@ -6,21 +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 DatePickerInput from '../DatePickerInput/DatePickerInput.js';
|
|
11
11
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
12
12
|
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
...other
|
|
16
|
-
} = _ref;
|
|
13
|
+
const frFn = forwardRef;
|
|
14
|
+
const FluidDatePickerInput = frFn((props, ref) => {
|
|
17
15
|
return /*#__PURE__*/React__default.createElement(FormContext.Provider, {
|
|
18
16
|
value: {
|
|
19
17
|
isFluid: true
|
|
20
18
|
}
|
|
21
19
|
}, /*#__PURE__*/React__default.createElement(DatePickerInput, _extends({
|
|
22
20
|
ref: ref
|
|
23
|
-
},
|
|
21
|
+
}, props)));
|
|
24
22
|
});
|
|
23
|
+
FluidDatePickerInput.propTypes = DatePickerInput.propTypes;
|
|
25
24
|
|
|
26
25
|
export { FluidDatePickerInput as default };
|
|
@@ -101,18 +101,8 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(_ref, forwardRef) {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
function handleClose(
|
|
105
|
-
|
|
106
|
-
window.addEventListener('keyup', returnFocus, {
|
|
107
|
-
once: true
|
|
108
|
-
});
|
|
109
|
-
} else if (e.type === 'click' && menu.current) {
|
|
110
|
-
menu.current.addEventListener('focusout', returnFocus, {
|
|
111
|
-
once: true
|
|
112
|
-
});
|
|
113
|
-
} else {
|
|
114
|
-
returnFocus();
|
|
115
|
-
}
|
|
104
|
+
function handleClose() {
|
|
105
|
+
returnFocus();
|
|
116
106
|
if (onClose) {
|
|
117
107
|
onClose();
|
|
118
108
|
}
|
|
@@ -123,7 +113,7 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(_ref, forwardRef) {
|
|
|
123
113
|
// if the user presses escape or this is a submenu
|
|
124
114
|
// and the user presses ArrowLeft, close it
|
|
125
115
|
if ((match(e, Escape) || !isRoot && match(e, ArrowLeft)) && onClose) {
|
|
126
|
-
handleClose(
|
|
116
|
+
handleClose();
|
|
127
117
|
} else {
|
|
128
118
|
focusItem(e);
|
|
129
119
|
}
|
|
@@ -158,7 +148,7 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(_ref, forwardRef) {
|
|
|
158
148
|
}
|
|
159
149
|
function handleBlur(e) {
|
|
160
150
|
if (open && onClose && isRoot && !menu.current?.contains(e.relatedTarget)) {
|
|
161
|
-
handleClose(
|
|
151
|
+
handleClose();
|
|
162
152
|
}
|
|
163
153
|
}
|
|
164
154
|
function fitValue(range, axis) {
|
|
@@ -98,18 +98,28 @@ const MenuItem = /*#__PURE__*/forwardRef(function MenuItem(_ref, forwardRef) {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
+
|
|
102
|
+
// Avoid stray keyup event from MenuButton affecting MenuItem, and vice versa.
|
|
103
|
+
// Keyboard click is handled differently for <button> vs. <li> and for Enter vs. Space. See
|
|
104
|
+
// https://www.stefanjudis.com/today-i-learned/keyboard-button-clicks-with-space-and-enter-behave-differently/.
|
|
105
|
+
const pendingKeyboardClick = useRef(false);
|
|
106
|
+
const keyboardClickEvent = e => match(e, Enter) || match(e, Space);
|
|
101
107
|
function handleKeyDown(e) {
|
|
102
108
|
if (hasChildren && match(e, ArrowRight)) {
|
|
103
109
|
openSubmenu();
|
|
104
110
|
e.stopPropagation();
|
|
105
111
|
}
|
|
106
|
-
|
|
107
|
-
handleClick(e);
|
|
108
|
-
}
|
|
112
|
+
pendingKeyboardClick.current = keyboardClickEvent(e);
|
|
109
113
|
if (rest.onKeyDown) {
|
|
110
114
|
rest.onKeyDown(e);
|
|
111
115
|
}
|
|
112
116
|
}
|
|
117
|
+
function handleKeyUp(e) {
|
|
118
|
+
if (pendingKeyboardClick.current && keyboardClickEvent(e)) {
|
|
119
|
+
handleClick(e);
|
|
120
|
+
}
|
|
121
|
+
pendingKeyboardClick.current = false;
|
|
122
|
+
}
|
|
113
123
|
const classNames = cx(className, `${prefix}--menu-item`, {
|
|
114
124
|
[`${prefix}--menu-item--disabled`]: isDisabled,
|
|
115
125
|
[`${prefix}--menu-item--danger`]: isDanger
|
|
@@ -162,7 +172,8 @@ const MenuItem = /*#__PURE__*/forwardRef(function MenuItem(_ref, forwardRef) {
|
|
|
162
172
|
"aria-haspopup": hasChildren ?? undefined,
|
|
163
173
|
"aria-expanded": hasChildren ? submenuOpen : undefined,
|
|
164
174
|
onClick: handleClick,
|
|
165
|
-
onKeyDown: handleKeyDown
|
|
175
|
+
onKeyDown: handleKeyDown,
|
|
176
|
+
onKeyUp: handleKeyUp
|
|
166
177
|
}, getReferenceProps()), /*#__PURE__*/React__default.createElement("div", {
|
|
167
178
|
className: `${prefix}--menu-item__selection-icon`
|
|
168
179
|
}, rest['aria-checked'] && (_Checkmark || (_Checkmark = /*#__PURE__*/React__default.createElement(Checkmark, null)))), /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -424,7 +424,10 @@ const MultiSelect = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
424
424
|
const menuProps = useMemo(() => getMenuProps({
|
|
425
425
|
ref: enableFloatingStyles ? refs.setFloating : null
|
|
426
426
|
}), [enableFloatingStyles, getMenuProps, refs.setFloating]);
|
|
427
|
-
const
|
|
427
|
+
const allLabelProps = getLabelProps();
|
|
428
|
+
const labelProps = /*#__PURE__*/isValidElement(titleText) ? {
|
|
429
|
+
id: allLabelProps.id
|
|
430
|
+
} : allLabelProps;
|
|
428
431
|
const getSelectionStats = useCallback((selectedItems, filteredItems) => {
|
|
429
432
|
const hasIndividualSelections = selectedItems.some(selected => !selected.isSelectAll);
|
|
430
433
|
const nonSelectAllSelectedCount = selectedItems.filter(selected => !selected.isSelectAll).length;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import type
|
|
8
|
+
import { type OverflowMenuProps } from './OverflowMenu';
|
|
9
9
|
declare const OverflowMenu: React.ForwardRefExoticComponent<OverflowMenuProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
10
|
export default OverflowMenu;
|
|
11
11
|
export { OverflowMenu, type OverflowMenuProps };
|
|
@@ -10,17 +10,16 @@ import React__default, { forwardRef } from 'react';
|
|
|
10
10
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
11
11
|
import { OverflowMenu as OverflowMenu$2 } from './next/index.js';
|
|
12
12
|
import { OverflowMenu as OverflowMenu$1 } from './OverflowMenu.js';
|
|
13
|
-
import { createClassWrapper } from '../../internal/createClassWrapper.js';
|
|
14
13
|
|
|
15
|
-
const OverflowMenuV11 = createClassWrapper(OverflowMenu$1);
|
|
16
14
|
const OverflowMenu = /*#__PURE__*/forwardRef((props, ref) => {
|
|
17
15
|
const enableV12OverflowMenu = useFeatureFlag('enable-v12-overflowmenu');
|
|
18
16
|
return enableV12OverflowMenu ? /*#__PURE__*/React__default.createElement(OverflowMenu$2, _extends({}, props, {
|
|
19
17
|
ref: ref
|
|
20
|
-
})) : /*#__PURE__*/React__default.createElement(
|
|
18
|
+
})) : /*#__PURE__*/React__default.createElement(OverflowMenu$1, _extends({}, props, {
|
|
21
19
|
ref: ref
|
|
22
20
|
}));
|
|
23
21
|
});
|
|
24
22
|
OverflowMenu.displayName = 'OverflowMenu';
|
|
23
|
+
OverflowMenu.propTypes = OverflowMenu$1.propTypes;
|
|
25
24
|
|
|
26
25
|
export { OverflowMenu, OverflowMenu as default };
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React, { type ComponentType, type FunctionComponent } from 'react';
|
|
8
|
+
import { Tabs as BaseTabs } from '../Tabs/Tabs';
|
|
8
9
|
/**
|
|
9
10
|
* ----------
|
|
10
11
|
* PageHeader
|
|
@@ -87,6 +88,11 @@ interface PageHeaderTabBarProps {
|
|
|
87
88
|
className?: string;
|
|
88
89
|
}
|
|
89
90
|
declare const PageHeaderTabBar: React.ForwardRefExoticComponent<PageHeaderTabBarProps & React.RefAttributes<HTMLDivElement>>;
|
|
91
|
+
interface PageHeaderTabsProps extends React.ComponentProps<typeof BaseTabs> {
|
|
92
|
+
children?: React.ReactNode;
|
|
93
|
+
className?: string;
|
|
94
|
+
}
|
|
95
|
+
declare const PageHeaderTabs: React.ForwardRefExoticComponent<PageHeaderTabsProps & React.RefAttributes<HTMLDivElement>>;
|
|
90
96
|
/**
|
|
91
97
|
* -------
|
|
92
98
|
* Exports
|
|
@@ -97,5 +103,6 @@ declare const BreadcrumbBar: React.ForwardRefExoticComponent<PageHeaderBreadcrum
|
|
|
97
103
|
declare const Content: React.ForwardRefExoticComponent<PageHeaderContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
98
104
|
declare const HeroImage: React.ForwardRefExoticComponent<PageHeaderHeroImageProps & React.RefAttributes<HTMLDivElement>>;
|
|
99
105
|
declare const TabBar: React.ForwardRefExoticComponent<PageHeaderTabBarProps & React.RefAttributes<HTMLDivElement>>;
|
|
100
|
-
|
|
101
|
-
export
|
|
106
|
+
declare const Tabs: React.ForwardRefExoticComponent<PageHeaderTabsProps & React.RefAttributes<HTMLDivElement>>;
|
|
107
|
+
export { PageHeader, PageHeaderBreadcrumbBar, PageHeaderContent, PageHeaderHeroImage, PageHeaderTabBar, PageHeaderTabs, Root, BreadcrumbBar, Content, HeroImage, TabBar, Tabs, };
|
|
108
|
+
export type { PageHeaderProps, PageHeaderBreadcrumbBarProps, PageHeaderContentProps, PageHeaderHeroImageProps, PageHeaderTabBarProps, PageHeaderTabsProps, };
|
|
@@ -16,9 +16,10 @@ import '../Text/index.js';
|
|
|
16
16
|
import { DefinitionTooltip } from '../Tooltip/DefinitionTooltip.js';
|
|
17
17
|
import '../Tooltip/Tooltip.js';
|
|
18
18
|
import AspectRatio from '../AspectRatio/AspectRatio.js';
|
|
19
|
+
import { Tabs as Tabs$1 } from '../Tabs/Tabs.js';
|
|
19
20
|
import { Text } from '../Text/Text.js';
|
|
20
21
|
|
|
21
|
-
var _p, _p2
|
|
22
|
+
var _p, _p2;
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* ----------
|
|
@@ -218,9 +219,18 @@ const PageHeaderTabBar = /*#__PURE__*/React__default.forwardRef(function PageHea
|
|
|
218
219
|
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
219
220
|
className: classNames,
|
|
220
221
|
ref: ref
|
|
221
|
-
}, other),
|
|
222
|
+
}, other), children);
|
|
222
223
|
});
|
|
223
224
|
PageHeaderTabBar.displayName = 'PageHeaderTabBar';
|
|
225
|
+
const PageHeaderTabs = /*#__PURE__*/React__default.forwardRef(function PageHeaderTabs(_ref6, ref) {
|
|
226
|
+
let {
|
|
227
|
+
className,
|
|
228
|
+
children,
|
|
229
|
+
...other
|
|
230
|
+
} = _ref6;
|
|
231
|
+
return /*#__PURE__*/React__default.createElement(Tabs$1, other, children);
|
|
232
|
+
});
|
|
233
|
+
PageHeaderTabs.displayName = 'PageHeaderTabs';
|
|
224
234
|
|
|
225
235
|
/**
|
|
226
236
|
* -------
|
|
@@ -237,5 +247,7 @@ const HeroImage = PageHeaderHeroImage;
|
|
|
237
247
|
HeroImage.displayName = 'PageHeaderHeroImage';
|
|
238
248
|
const TabBar = PageHeaderTabBar;
|
|
239
249
|
TabBar.displayName = 'PageHeaderTabBar';
|
|
250
|
+
const Tabs = PageHeaderTabs;
|
|
251
|
+
Tabs.displayName = 'PageHeader.Tabs';
|
|
240
252
|
|
|
241
|
-
export { BreadcrumbBar, Content, HeroImage, PageHeader, PageHeaderBreadcrumbBar, PageHeaderContent, PageHeaderHeroImage, PageHeaderTabBar, Root, TabBar };
|
|
253
|
+
export { BreadcrumbBar, Content, HeroImage, PageHeader, PageHeaderBreadcrumbBar, PageHeaderContent, PageHeaderHeroImage, PageHeaderTabBar, PageHeaderTabs, Root, TabBar, Tabs };
|
|
@@ -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
|
-
export { PageHeader, PageHeaderBreadcrumbBar, PageHeaderContent, PageHeaderTabBar, PageHeaderHeroImage, Root, BreadcrumbBar, Content, TabBar, HeroImage, } from './PageHeader';
|
|
8
|
-
export type { PageHeaderProps, PageHeaderBreadcrumbBarProps, PageHeaderContentProps, PageHeaderTabBarProps, PageHeaderHeroImageProps, } from './PageHeader';
|
|
7
|
+
export { PageHeader, PageHeaderBreadcrumbBar, PageHeaderContent, PageHeaderTabBar, PageHeaderHeroImage, PageHeaderTabs, Root, BreadcrumbBar, Content, TabBar, HeroImage, Tabs, } from './PageHeader';
|
|
8
|
+
export type { PageHeaderProps, PageHeaderBreadcrumbBarProps, PageHeaderContentProps, PageHeaderTabBarProps, PageHeaderHeroImageProps, PageHeaderTabsProps, } from './PageHeader';
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
export { BreadcrumbBar, Content, HeroImage, PageHeader, PageHeaderBreadcrumbBar, PageHeaderContent, PageHeaderHeroImage, PageHeaderTabBar, Root, TabBar } from './PageHeader.js';
|
|
8
|
+
export { BreadcrumbBar, Content, HeroImage, PageHeader, PageHeaderBreadcrumbBar, PageHeaderContent, PageHeaderHeroImage, PageHeaderTabBar, PageHeaderTabs, Root, TabBar, Tabs } from './PageHeader.js';
|