@carbon/react 1.93.0 → 1.94.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 +1034 -1009
- package/es/components/CodeSnippet/CodeSnippet.d.ts +1 -1
- package/es/components/ComposedModal/ComposedModal.js +3 -1
- package/es/components/Copy/Copy.d.ts +1 -1
- package/es/components/CopyButton/CopyButton.d.ts +1 -1
- package/es/components/DataTable/DataTable.d.ts +1 -1
- package/es/components/DataTable/Table.d.ts +1 -1
- package/es/components/DataTable/Table.js +2 -21
- package/es/components/DataTable/TableToolbar.js +1 -0
- package/es/components/DataTable/state/sorting.d.ts +4 -2
- package/es/components/DatePicker/DatePicker.d.ts +8 -0
- package/es/components/DatePicker/DatePicker.js +33 -10
- package/es/components/FeatureFlags/index.d.ts +4 -1
- package/es/components/FeatureFlags/index.js +5 -1
- package/es/components/FluidComboBox/FluidComboBox.d.ts +0 -5
- package/es/components/FluidComboBox/FluidComboBox.js +0 -5
- package/es/components/Modal/Modal.js +3 -1
- package/es/components/MultiSelect/FilterableMultiSelect.js +1 -1
- package/es/components/Notification/Notification.js +3 -1
- package/es/components/Popover/index.d.ts +8 -0
- package/es/components/Popover/index.js +13 -1
- package/es/components/Slider/Slider.js +1 -1
- package/es/components/Tabs/Tabs.js +3 -45
- package/es/components/Toggletip/index.d.ts +2 -0
- package/es/components/TreeView/TreeNode.js +5 -0
- package/es/components/UIShell/Content.d.ts +1 -1
- package/es/feature-flags.js +1 -0
- package/es/internal/FloatingMenu.js +3 -1
- package/es/tools/events.d.ts +1 -1
- package/lib/components/CodeSnippet/CodeSnippet.d.ts +1 -1
- package/lib/components/ComposedModal/ComposedModal.js +3 -1
- package/lib/components/Copy/Copy.d.ts +1 -1
- package/lib/components/CopyButton/CopyButton.d.ts +1 -1
- package/lib/components/DataTable/DataTable.d.ts +1 -1
- package/lib/components/DataTable/Table.d.ts +1 -1
- package/lib/components/DataTable/Table.js +1 -20
- package/lib/components/DataTable/TableToolbar.js +1 -0
- package/lib/components/DataTable/state/sorting.d.ts +4 -2
- package/lib/components/DatePicker/DatePicker.d.ts +8 -0
- package/lib/components/DatePicker/DatePicker.js +33 -10
- package/lib/components/FeatureFlags/index.d.ts +4 -1
- package/lib/components/FeatureFlags/index.js +5 -1
- package/lib/components/FluidComboBox/FluidComboBox.d.ts +0 -5
- package/lib/components/FluidComboBox/FluidComboBox.js +0 -5
- package/lib/components/Modal/Modal.js +3 -1
- package/lib/components/MultiSelect/FilterableMultiSelect.js +1 -1
- package/lib/components/Notification/Notification.js +3 -1
- package/lib/components/Popover/index.d.ts +8 -0
- package/lib/components/Popover/index.js +13 -1
- package/lib/components/Slider/Slider.js +1 -1
- package/lib/components/Tabs/Tabs.js +2 -44
- package/lib/components/Toggletip/index.d.ts +2 -0
- package/lib/components/TreeView/TreeNode.js +5 -0
- package/lib/components/UIShell/Content.d.ts +1 -1
- package/lib/feature-flags.js +1 -0
- package/lib/internal/FloatingMenu.js +3 -1
- package/lib/tools/events.d.ts +1 -1
- package/package.json +6 -6
- package/telemetry.yml +8 -1
|
@@ -111,7 +111,7 @@ declare namespace CodeSnippet {
|
|
|
111
111
|
/**
|
|
112
112
|
* Specify how the trigger should align with the tooltip
|
|
113
113
|
*/
|
|
114
|
-
align: PropTypes.Requireable<
|
|
114
|
+
align: PropTypes.Requireable<import("@floating-ui/utils").Placement | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "left-bottom" | "left-top" | "right-bottom" | "right-top"> | PropTypes.Validator<import("@floating-ui/utils").Placement | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "left-bottom" | "left-top" | "right-bottom" | "right-top">;
|
|
115
115
|
/**
|
|
116
116
|
* Specify a label to be read by screen readers on the containing textbox
|
|
117
117
|
* node
|
|
@@ -155,7 +155,9 @@ const ComposedModalDialog = /*#__PURE__*/React.forwardRef(function ComposedModal
|
|
|
155
155
|
const modalState = useComposedModalState(open);
|
|
156
156
|
const [isOpen, setIsOpen] = presenceContext?.modalState ?? modalState;
|
|
157
157
|
const enableDialogElement = useFeatureFlag('enable-dialog-element');
|
|
158
|
-
const
|
|
158
|
+
const deprecatedFlag = useFeatureFlag('enable-experimental-focus-wrap-without-sentinels');
|
|
159
|
+
const focusTrapWithoutSentinelsFlag = useFeatureFlag('enable-focus-wrap-without-sentinels');
|
|
160
|
+
const focusTrapWithoutSentinels = deprecatedFlag || focusTrapWithoutSentinelsFlag;
|
|
159
161
|
process.env.NODE_ENV !== "production" ? warning(!(focusTrapWithoutSentinels && enableDialogElement), '`<Modal>` detected both `focusTrapWithoutSentinels` and ' + '`enableDialogElement` feature flags are enabled. The native dialog ' + 'element handles focus, so `enableDialogElement` must be off for ' + '`focusTrapWithoutSentinels` to have any effect.') : void 0;
|
|
160
162
|
|
|
161
163
|
// Propagate open/close state to the document.body
|
|
@@ -50,7 +50,7 @@ declare namespace Copy {
|
|
|
50
50
|
/**
|
|
51
51
|
* Specify how the trigger should align with the tooltip
|
|
52
52
|
*/
|
|
53
|
-
align: PropTypes.Requireable<
|
|
53
|
+
align: PropTypes.Requireable<import("@floating-ui/utils").Placement | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "left-bottom" | "left-top" | "right-bottom" | "right-top"> | PropTypes.Validator<import("@floating-ui/utils").Placement | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "left-bottom" | "left-top" | "right-bottom" | "right-top">;
|
|
54
54
|
/**
|
|
55
55
|
* **Experimental**: Will attempt to automatically align the tooltip. Requires
|
|
56
56
|
* React v17+
|
|
@@ -51,7 +51,7 @@ declare namespace CopyButton {
|
|
|
51
51
|
/**
|
|
52
52
|
* Specify how the trigger should align with the tooltip
|
|
53
53
|
*/
|
|
54
|
-
align: PropTypes.Requireable<
|
|
54
|
+
align: PropTypes.Requireable<import("@floating-ui/utils").Placement | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "left-bottom" | "left-top" | "right-bottom" | "right-top"> | PropTypes.Validator<import("@floating-ui/utils").Placement | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "left-bottom" | "left-top" | "right-bottom" | "right-top">;
|
|
55
55
|
/**
|
|
56
56
|
* **Experimental**: Will attempt to automatically align the tooltip. Requires
|
|
57
57
|
* React v17+
|
|
@@ -236,7 +236,7 @@ export interface DataTableProps<RowType, ColTypes extends any[]> extends Transla
|
|
|
236
236
|
export declare const DataTable: {
|
|
237
237
|
<RowType, ColTypes extends any[]>(props: DataTableProps<RowType, ColTypes>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
|
|
238
238
|
Table: {
|
|
239
|
-
({ className, children, useZebraStyles, size, isSortable, useStaticWidth, stickyHeader, overflowMenuOnHover, experimentalAutoAlign,
|
|
239
|
+
({ className, children, useZebraStyles, size, isSortable, useStaticWidth, stickyHeader, overflowMenuOnHover, experimentalAutoAlign, ...other }: React.PropsWithChildren<import("./Table").TableProps>): import("react/jsx-runtime").JSX.Element;
|
|
240
240
|
propTypes: {
|
|
241
241
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
242
242
|
className: PropTypes.Requireable<string>;
|
|
@@ -39,7 +39,7 @@ export interface TableProps {
|
|
|
39
39
|
tabIndex?: number;
|
|
40
40
|
}
|
|
41
41
|
export declare const Table: {
|
|
42
|
-
({ className, children, useZebraStyles, size, isSortable, useStaticWidth, stickyHeader, overflowMenuOnHover, experimentalAutoAlign,
|
|
42
|
+
({ className, children, useZebraStyles, size, isSortable, useStaticWidth, stickyHeader, overflowMenuOnHover, experimentalAutoAlign, ...other }: PropsWithChildren<TableProps>): import("react/jsx-runtime").JSX.Element;
|
|
43
43
|
propTypes: {
|
|
44
44
|
/**
|
|
45
45
|
* Pass in the children that will be rendered within the Table
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import React, { useContext,
|
|
9
|
+
import React, { useContext, useRef, useCallback } from 'react';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
@@ -53,7 +53,6 @@ const Table = ({
|
|
|
53
53
|
stickyHeader,
|
|
54
54
|
overflowMenuOnHover = true,
|
|
55
55
|
experimentalAutoAlign = false,
|
|
56
|
-
tabIndex,
|
|
57
56
|
...other
|
|
58
57
|
}) => {
|
|
59
58
|
const {
|
|
@@ -61,7 +60,6 @@ const Table = ({
|
|
|
61
60
|
descriptionId
|
|
62
61
|
} = useContext(TableContext);
|
|
63
62
|
const prefix = usePrefix();
|
|
64
|
-
const [isScrollable, setIsScrollable] = useState(false);
|
|
65
63
|
const tableRef = useRef(null);
|
|
66
64
|
const componentClass = cx(`${prefix}--data-table`, className, {
|
|
67
65
|
[`${prefix}--data-table--${size}`]: size,
|
|
@@ -100,22 +98,6 @@ const Table = ({
|
|
|
100
98
|
const debouncedSetTableAlignment = debounce(setTableAlignment, 100);
|
|
101
99
|
useWindowEvent('resize', debouncedSetTableAlignment);
|
|
102
100
|
|
|
103
|
-
// Used to set a tabIndex when the Table is horizontally scrollable
|
|
104
|
-
const setTabIndex = useCallback(() => {
|
|
105
|
-
const tableContainer = tableRef?.current?.parentNode;
|
|
106
|
-
const tableHeader = tableRef?.current?.firstChild;
|
|
107
|
-
if (tableHeader?.scrollWidth > tableContainer?.clientWidth) {
|
|
108
|
-
setIsScrollable(true);
|
|
109
|
-
} else {
|
|
110
|
-
setIsScrollable(false);
|
|
111
|
-
}
|
|
112
|
-
}, []);
|
|
113
|
-
const debouncedSetTabIndex = debounce(setTabIndex, 100);
|
|
114
|
-
useWindowEvent('resize', debouncedSetTabIndex);
|
|
115
|
-
useIsomorphicEffect(() => {
|
|
116
|
-
setTabIndex();
|
|
117
|
-
}, [setTabIndex]);
|
|
118
|
-
|
|
119
101
|
// recalculate table alignment once fonts have loaded
|
|
120
102
|
if (typeof document !== 'undefined' && document?.fonts?.status && document.fonts.status !== 'loaded') {
|
|
121
103
|
document.fonts.ready.then(() => {
|
|
@@ -126,8 +108,7 @@ const Table = ({
|
|
|
126
108
|
setTableAlignment();
|
|
127
109
|
}, [setTableAlignment, size]);
|
|
128
110
|
const table = /*#__PURE__*/React.createElement("div", {
|
|
129
|
-
className: `${prefix}--data-table-content
|
|
130
|
-
tabIndex: tabIndex ?? (isScrollable ? 0 : undefined)
|
|
111
|
+
className: `${prefix}--data-table-content`
|
|
131
112
|
}, /*#__PURE__*/React.createElement("table", _extends({
|
|
132
113
|
"aria-labelledby": titleId,
|
|
133
114
|
"aria-describedby": descriptionId
|
|
@@ -43,7 +43,8 @@ export declare const getNextSortDirection: (prevHeader: string, currentHeader: s
|
|
|
43
43
|
* @param state - Current table state.
|
|
44
44
|
* @param key - Header key to sort by.
|
|
45
45
|
*/
|
|
46
|
-
export declare const getNextSortState: <ColTypes extends any[]>(
|
|
46
|
+
export declare const getNextSortState: <ColTypes extends any[]>(// eslint-disable-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
47
|
+
props: Props, state: State<ColTypes>, { key }: {
|
|
47
48
|
key: string;
|
|
48
49
|
}) => Pick<State<ColTypes>, "sortHeaderKey" | "sortDirection" | "rowIds">;
|
|
49
50
|
/**
|
|
@@ -54,5 +55,6 @@ export declare const getNextSortState: <ColTypes extends any[]>(props: Props, st
|
|
|
54
55
|
* @param key - Header key to sort by.
|
|
55
56
|
* @param sortDirection - Sort direction to apply.
|
|
56
57
|
*/
|
|
57
|
-
export declare const getSortedState: <ColTypes extends any[]>(
|
|
58
|
+
export declare const getSortedState: <ColTypes extends any[]>(// eslint-disable-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
59
|
+
{ locale, sortRow }: Props, { rowIds, cellsById, initialRowOrder }: State<ColTypes>, key: string, sortDirection: DataTableSortState) => Pick<State<ColTypes>, "rowIds" | "sortDirection" | "sortHeaderKey">;
|
|
58
60
|
export {};
|
|
@@ -117,6 +117,14 @@ export interface DatePickerProps {
|
|
|
117
117
|
* Provide the text that is displayed when the control is in warning state (Fluid only)
|
|
118
118
|
*/
|
|
119
119
|
warnText?: ReactNode;
|
|
120
|
+
/**
|
|
121
|
+
* Accessible aria-label for the "next month" arrow icon.
|
|
122
|
+
*/
|
|
123
|
+
nextMonthAriaLabel?: string;
|
|
124
|
+
/**
|
|
125
|
+
* Accessible aria-label for the "previous month" arrow icon.
|
|
126
|
+
*/
|
|
127
|
+
prevMonthAriaLabel?: string;
|
|
120
128
|
}
|
|
121
129
|
declare const DatePicker: React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<HTMLDivElement>>;
|
|
122
130
|
export default DatePicker;
|
|
@@ -23,6 +23,7 @@ import { useSavedCallback } from '../../internal/useSavedCallback.js';
|
|
|
23
23
|
import '../FluidForm/FluidForm.js';
|
|
24
24
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
25
25
|
import { WarningFilled, WarningAltFilled } from '@carbon/icons-react';
|
|
26
|
+
import { datePartsOrder } from '@carbon/utilities';
|
|
26
27
|
|
|
27
28
|
// Weekdays shorthand for English locale
|
|
28
29
|
// Ensure localization exists before trying to access it
|
|
@@ -55,6 +56,7 @@ const monthToStr = (monthNumber, shorthand, locale) => locale.months[shorthand ?
|
|
|
55
56
|
* @param {string} config.selectorFlatpickrYearContainer The CSS selector for the container of year selection UI.
|
|
56
57
|
* @param {string} config.selectorFlatpickrCurrentMonth The CSS selector for the text-based month selection UI.
|
|
57
58
|
* @param {string} config.classFlatpickrCurrentMonth The CSS class for the text-based month selection UI.
|
|
59
|
+
* @param {string} config.locale The locale code.
|
|
58
60
|
* @returns {Plugin} A Flatpickr plugin to use text instead of `<select>` for month picker.
|
|
59
61
|
*/
|
|
60
62
|
const carbonFlatpickrMonthSelectPlugin = config => fp => {
|
|
@@ -71,7 +73,13 @@ const carbonFlatpickrMonthSelectPlugin = config => fp => {
|
|
|
71
73
|
fp.monthElements.splice(0, fp.monthElements.length, ...fp.monthElements.map(() => {
|
|
72
74
|
const monthElement = fp._createElement('span', config.classFlatpickrCurrentMonth);
|
|
73
75
|
monthElement.textContent = monthToStr(fp.currentMonth, config.shorthand === true, fp.l10n);
|
|
74
|
-
|
|
76
|
+
|
|
77
|
+
// Depending on the locale, toggle the order of the month and year
|
|
78
|
+
if (datePartsOrder.isMonthFirst(config.locale)) {
|
|
79
|
+
fp.yearElements[0].closest(config.selectorFlatpickrMonthYearContainer).insertBefore(monthElement, fp.yearElements[0].closest(config.selectorFlatpickrYearContainer));
|
|
80
|
+
} else {
|
|
81
|
+
fp.yearElements[0].closest(config.selectorFlatpickrMonthYearContainer).insertAdjacentElement('afterend', monthElement);
|
|
82
|
+
}
|
|
75
83
|
return monthElement;
|
|
76
84
|
}));
|
|
77
85
|
};
|
|
@@ -105,12 +113,6 @@ const carbonFlatpickrMonthSelectPlugin = config => fp => {
|
|
|
105
113
|
function isLabelTextEmpty(children) {
|
|
106
114
|
return children.every(child => !child.props.labelText);
|
|
107
115
|
}
|
|
108
|
-
const rightArrowHTML = `<svg width="16px" height="16px" viewBox="0 0 16 16">
|
|
109
|
-
<polygon points="11,8 6,13 5.3,12.3 9.6,8 5.3,3.7 6,3 "/>
|
|
110
|
-
</svg>`;
|
|
111
|
-
const leftArrowHTML = `<svg width="16px" height="16px" viewBox="0 0 16 16">
|
|
112
|
-
<polygon points="5,8 10,3 10.7,3.7 6.4,8 10.7,12.3 10,13 "/>
|
|
113
|
-
</svg>`;
|
|
114
116
|
function updateClassNames(calendar, prefix) {
|
|
115
117
|
const calendarContainer = calendar.calendarContainer;
|
|
116
118
|
const daysContainer = calendar.days;
|
|
@@ -162,6 +164,8 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
162
164
|
short = false,
|
|
163
165
|
value,
|
|
164
166
|
parseDate: parseDateProp,
|
|
167
|
+
nextMonthAriaLabel = 'Next month',
|
|
168
|
+
prevMonthAriaLabel = 'Previous month',
|
|
165
169
|
...rest
|
|
166
170
|
}, ref) {
|
|
167
171
|
const prefix = usePrefix();
|
|
@@ -342,6 +346,16 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
342
346
|
} else if (parseDateProp) {
|
|
343
347
|
parseDate = parseDateProp;
|
|
344
348
|
}
|
|
349
|
+
|
|
350
|
+
// Accessible arrow icons (localized manually)
|
|
351
|
+
// Flatpickr does not currently support localization of next/previous month
|
|
352
|
+
// labels, so we inject translated aria-labels based on the provided locale.
|
|
353
|
+
const rightArrowHTML = `<svg aria-label="${nextMonthAriaLabel}" role="img" width="16px" height="16px" viewBox="0 0 16 16">
|
|
354
|
+
<polygon points="11,8 6,13 5.3,12.3 9.6,8 5.3,3.7 6,3 "/>
|
|
355
|
+
</svg>`;
|
|
356
|
+
const leftArrowHTML = `<svg aria-label="${prevMonthAriaLabel}" role="img" width="16px" height="16px" viewBox="0 0 16 16">
|
|
357
|
+
<polygon points="5,8 10,3 10.7,3.7 6.4,8 10.7,12.3 10,13 "/>
|
|
358
|
+
</svg>`;
|
|
345
359
|
const {
|
|
346
360
|
current: start
|
|
347
361
|
} = startInputField;
|
|
@@ -370,7 +384,8 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
370
384
|
}) : () => {}, carbonFlatpickrMonthSelectPlugin({
|
|
371
385
|
selectorFlatpickrMonthYearContainer: '.flatpickr-current-month',
|
|
372
386
|
selectorFlatpickrYearContainer: '.numInputWrapper',
|
|
373
|
-
classFlatpickrCurrentMonth: 'cur-month'
|
|
387
|
+
classFlatpickrCurrentMonth: 'cur-month',
|
|
388
|
+
locale: locale
|
|
374
389
|
}), carbonFlatpickrFixEventsPlugin({
|
|
375
390
|
inputFrom: startInputField.current,
|
|
376
391
|
inputTo: endInputField.current,
|
|
@@ -519,7 +534,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
519
534
|
}
|
|
520
535
|
};
|
|
521
536
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
522
|
-
}, [savedOnChange, savedOnOpen, readOnly, closeOnSelect, hasInput, datePickerType]);
|
|
537
|
+
}, [savedOnChange, savedOnOpen, readOnly, closeOnSelect, hasInput, datePickerType, nextMonthAriaLabel, prevMonthAriaLabel]);
|
|
523
538
|
|
|
524
539
|
// this hook allows consumers to access the flatpickr calendar
|
|
525
540
|
// instance for cases where functions like open() or close()
|
|
@@ -874,7 +889,15 @@ DatePicker.propTypes = {
|
|
|
874
889
|
/**
|
|
875
890
|
* Provide the text that is displayed when the control is in warning state (Fluid only)
|
|
876
891
|
*/
|
|
877
|
-
warnText: PropTypes.node
|
|
892
|
+
warnText: PropTypes.node,
|
|
893
|
+
/**
|
|
894
|
+
* Accessible aria-label for the "next month" arrow icon.
|
|
895
|
+
*/
|
|
896
|
+
nextMonthAriaLabel: PropTypes.string,
|
|
897
|
+
/**
|
|
898
|
+
* Accessible aria-label for the "previous month" arrow icon.
|
|
899
|
+
*/
|
|
900
|
+
prevMonthAriaLabel: PropTypes.string
|
|
878
901
|
};
|
|
879
902
|
|
|
880
903
|
export { DatePicker as default };
|
|
@@ -14,6 +14,7 @@ export interface FeatureFlagsProps {
|
|
|
14
14
|
enableV12Overflowmenu?: boolean;
|
|
15
15
|
enableTreeviewControllable?: boolean;
|
|
16
16
|
enableExperimentalFocusWrapWithoutSentinels?: boolean;
|
|
17
|
+
enableFocusWrapWithoutSentinels?: boolean;
|
|
17
18
|
enableDialogElement?: boolean;
|
|
18
19
|
enableV12DynamicFloatingStyles?: boolean;
|
|
19
20
|
enableEnhancedFileUploader?: boolean;
|
|
@@ -29,7 +30,7 @@ declare const FeatureFlagContext: React.Context<any>;
|
|
|
29
30
|
* along with the current `FeatureFlagContext` to provide consumers to check if
|
|
30
31
|
* a feature flag is enabled or disabled in a given React tree
|
|
31
32
|
*/
|
|
32
|
-
declare function FeatureFlags({ children, flags, enableV12TileDefaultIcons, enableV12TileRadioIcons, enableV12Overflowmenu, enableTreeviewControllable, enableExperimentalFocusWrapWithoutSentinels, enableDialogElement, enableV12DynamicFloatingStyles, enableEnhancedFileUploader, enablePresence, }: FeatureFlagsProps): JSX.Element;
|
|
33
|
+
declare function FeatureFlags({ children, flags, enableV12TileDefaultIcons, enableV12TileRadioIcons, enableV12Overflowmenu, enableTreeviewControllable, enableExperimentalFocusWrapWithoutSentinels, enableFocusWrapWithoutSentinels, enableDialogElement, enableV12DynamicFloatingStyles, enableEnhancedFileUploader, enablePresence, }: FeatureFlagsProps): JSX.Element;
|
|
33
34
|
declare namespace FeatureFlags {
|
|
34
35
|
var propTypes: {
|
|
35
36
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
@@ -42,9 +43,11 @@ declare namespace FeatureFlags {
|
|
|
42
43
|
enableV12Overflowmenu: PropTypes.Requireable<boolean>;
|
|
43
44
|
enableTreeviewControllable: PropTypes.Requireable<boolean>;
|
|
44
45
|
enableExperimentalFocusWrapWithoutSentinels: PropTypes.Requireable<boolean>;
|
|
46
|
+
enableFocusWrapWithoutSentinels: PropTypes.Requireable<boolean>;
|
|
45
47
|
enableDialogElement: PropTypes.Requireable<boolean>;
|
|
46
48
|
enableV12DynamicFloatingStyles: PropTypes.Requireable<boolean>;
|
|
47
49
|
enableEnhancedFileUploader: PropTypes.Requireable<boolean>;
|
|
50
|
+
enablePresence: PropTypes.Requireable<boolean>;
|
|
48
51
|
};
|
|
49
52
|
}
|
|
50
53
|
/**
|
|
@@ -30,6 +30,7 @@ function FeatureFlags({
|
|
|
30
30
|
enableV12Overflowmenu = false,
|
|
31
31
|
enableTreeviewControllable = false,
|
|
32
32
|
enableExperimentalFocusWrapWithoutSentinels = false,
|
|
33
|
+
enableFocusWrapWithoutSentinels = false,
|
|
33
34
|
enableDialogElement = false,
|
|
34
35
|
enableV12DynamicFloatingStyles = false,
|
|
35
36
|
enableEnhancedFileUploader = false,
|
|
@@ -43,6 +44,7 @@ function FeatureFlags({
|
|
|
43
44
|
'enable-v12-overflowmenu': enableV12Overflowmenu,
|
|
44
45
|
'enable-treeview-controllable': enableTreeviewControllable,
|
|
45
46
|
'enable-experimental-focus-wrap-without-sentinels': enableExperimentalFocusWrapWithoutSentinels,
|
|
47
|
+
'enable-focus-wrap-without-sentinels': enableFocusWrapWithoutSentinels,
|
|
46
48
|
'enable-dialog-element': enableDialogElement,
|
|
47
49
|
'enable-v12-dynamic-floating-styles': enableV12DynamicFloatingStyles,
|
|
48
50
|
'enable-enhanced-file-uploader': enableEnhancedFileUploader,
|
|
@@ -84,9 +86,11 @@ FeatureFlags.propTypes = {
|
|
|
84
86
|
enableV12Overflowmenu: PropTypes.bool,
|
|
85
87
|
enableTreeviewControllable: PropTypes.bool,
|
|
86
88
|
enableExperimentalFocusWrapWithoutSentinels: PropTypes.bool,
|
|
89
|
+
enableFocusWrapWithoutSentinels: PropTypes.bool,
|
|
87
90
|
enableDialogElement: PropTypes.bool,
|
|
88
91
|
enableV12DynamicFloatingStyles: PropTypes.bool,
|
|
89
|
-
enableEnhancedFileUploader: PropTypes.bool
|
|
92
|
+
enableEnhancedFileUploader: PropTypes.bool,
|
|
93
|
+
enablePresence: PropTypes.bool
|
|
90
94
|
};
|
|
91
95
|
|
|
92
96
|
/**
|
|
@@ -72,11 +72,6 @@ export interface FluidComboBoxProps<ItemType> extends ComboBoxProps<ItemType>, P
|
|
|
72
72
|
* consuming component what kind of internal state changes are occurring.
|
|
73
73
|
*/
|
|
74
74
|
onChange: (data: OnChangeData<ItemType>) => void;
|
|
75
|
-
/**
|
|
76
|
-
* An optional callback to render the currently selected item as a react element instead of only
|
|
77
|
-
* as a string.
|
|
78
|
-
*/
|
|
79
|
-
renderSelectedItem?: (selectedItem: ItemType) => React.ReactNode;
|
|
80
75
|
/**
|
|
81
76
|
* In the case you want to control the dropdown selection entirely.
|
|
82
77
|
* */
|
|
@@ -91,11 +91,6 @@ FluidComboBox.propTypes = {
|
|
|
91
91
|
* consuming component what kind of internal state changes are occurring.
|
|
92
92
|
*/
|
|
93
93
|
onChange: PropTypes.func.isRequired,
|
|
94
|
-
/**
|
|
95
|
-
* An optional callback to render the currently selected item as a react element instead of only
|
|
96
|
-
* as a string.
|
|
97
|
-
*/
|
|
98
|
-
renderSelectedItem: PropTypes.func,
|
|
99
94
|
/**
|
|
100
95
|
* In the case you want to control the dropdown selection entirely.
|
|
101
96
|
*/
|
|
@@ -127,7 +127,9 @@ const ModalDialog = /*#__PURE__*/React.forwardRef(function ModalDialog({
|
|
|
127
127
|
// always mark as open when mounted with presence
|
|
128
128
|
const open = externalOpen || enablePresence;
|
|
129
129
|
const prevOpen = usePreviousValue(open);
|
|
130
|
-
const
|
|
130
|
+
const deprecatedFlag = useFeatureFlag('enable-experimental-focus-wrap-without-sentinels');
|
|
131
|
+
const focusTrapWithoutSentinelsFlag = useFeatureFlag('enable-focus-wrap-without-sentinels');
|
|
132
|
+
const focusTrapWithoutSentinels = focusTrapWithoutSentinelsFlag || deprecatedFlag;
|
|
131
133
|
const enableDialogElement = useFeatureFlag('enable-dialog-element');
|
|
132
134
|
process.env.NODE_ENV !== "production" ? warning(!(focusTrapWithoutSentinels && enableDialogElement), '`<Modal>` detected both `focusTrapWithoutSentinels` and ' + '`enableDialogElement` feature flags are enabled. The native dialog ' + 'element handles focus, so `enableDialogElement` must be off for ' + '`focusTrapWithoutSentinels` to have any effect.') : void 0;
|
|
133
135
|
process.env.NODE_ENV !== "production" ? warning(!(!passiveModal && preventCloseOnClickOutside === false), invalidOutsideClickMessage) : void 0;
|
|
@@ -552,7 +552,7 @@ const FilterableMultiSelect = /*#__PURE__*/forwardRef(function FilterableMultiSe
|
|
|
552
552
|
});
|
|
553
553
|
const inputProp = getInputProps(getDropdownProps({
|
|
554
554
|
'aria-controls': isOpen ? menuId : undefined,
|
|
555
|
-
'aria-describedby': helperText ? helperId : undefined,
|
|
555
|
+
'aria-describedby': helperText && !invalid && !warn ? helperId : undefined,
|
|
556
556
|
'aria-haspopup': 'listbox',
|
|
557
557
|
// Remove excess aria `aria-labelledby`. HTML <label for>
|
|
558
558
|
// provides this aria information.
|
|
@@ -504,7 +504,9 @@ function ActionableNotification({
|
|
|
504
504
|
const startTrap = useRef(null);
|
|
505
505
|
const endTrap = useRef(null);
|
|
506
506
|
const ref = useRef(null);
|
|
507
|
-
const
|
|
507
|
+
const deprecatedFlag = useFeatureFlag('enable-experimental-focus-wrap-without-sentinels');
|
|
508
|
+
const focusTrapWithoutSentinelsFlag = useFeatureFlag('enable-focus-wrap-without-sentinels');
|
|
509
|
+
const focusTrapWithoutSentinels = focusTrapWithoutSentinelsFlag || deprecatedFlag;
|
|
508
510
|
useIsomorphicEffect(() => {
|
|
509
511
|
if (hasFocus && role === 'alertdialog') {
|
|
510
512
|
const button = document.querySelector('button.cds--actionable-notification__action-button');
|
|
@@ -29,6 +29,10 @@ export interface PopoverBaseProps {
|
|
|
29
29
|
* **Experimental:** Provide an offset value for alignment axis. Only takes effect when `autoalign` is enabled.
|
|
30
30
|
*/
|
|
31
31
|
alignmentAxisOffset?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Specify the background token to use. Default is 'layer'.
|
|
34
|
+
*/
|
|
35
|
+
backgroundToken?: 'layer' | 'background';
|
|
32
36
|
/**
|
|
33
37
|
* Will auto-align the popover on first render if it is not visible. This prop
|
|
34
38
|
* is currently experimental and is subject to future changes. Requires
|
|
@@ -44,6 +48,10 @@ export interface PopoverBaseProps {
|
|
|
44
48
|
* Specify whether a caret should be rendered
|
|
45
49
|
*/
|
|
46
50
|
caret?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Specify whether a border should be rendered on the popover
|
|
53
|
+
*/
|
|
54
|
+
border?: boolean;
|
|
47
55
|
/**
|
|
48
56
|
* Provide elements to be rendered inside of the component
|
|
49
57
|
*/
|
|
@@ -39,9 +39,11 @@ const Popover = /*#__PURE__*/React.forwardRef(function PopoverRenderFunction({
|
|
|
39
39
|
as: BaseComponent = 'span',
|
|
40
40
|
autoAlign = false,
|
|
41
41
|
autoAlignBoundary,
|
|
42
|
+
backgroundToken = 'layer',
|
|
42
43
|
caret = isTabTip ? false : true,
|
|
43
44
|
className: customClassName,
|
|
44
45
|
children,
|
|
46
|
+
border = false,
|
|
45
47
|
dropShadow = true,
|
|
46
48
|
highContrast = false,
|
|
47
49
|
onRequestClose,
|
|
@@ -211,11 +213,13 @@ forwardRef) {
|
|
|
211
213
|
[`${prefix}--popover-container`]: true,
|
|
212
214
|
[`${prefix}--popover--caret`]: caret,
|
|
213
215
|
[`${prefix}--popover--drop-shadow`]: dropShadow,
|
|
216
|
+
[`${prefix}--popover--border`]: border,
|
|
214
217
|
[`${prefix}--popover--high-contrast`]: highContrast,
|
|
215
218
|
[`${prefix}--popover--open`]: open,
|
|
216
219
|
[`${prefix}--popover--auto-align ${prefix}--autoalign`]: enableFloatingStyles,
|
|
217
220
|
[`${prefix}--popover--${currentAlignment}`]: true,
|
|
218
|
-
[`${prefix}--popover--tab-tip`]: isTabTip
|
|
221
|
+
[`${prefix}--popover--tab-tip`]: isTabTip,
|
|
222
|
+
[`${prefix}--popover--background-token__background`]: backgroundToken === 'background' && !highContrast
|
|
219
223
|
}, customClassName);
|
|
220
224
|
const mappedChildren = React.Children.map(children, child => {
|
|
221
225
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
@@ -327,6 +331,10 @@ Popover.propTypes = {
|
|
|
327
331
|
* @see https://github.com/carbon-design-system/carbon/issues/18714
|
|
328
332
|
*/
|
|
329
333
|
autoAlign: PropTypes.bool,
|
|
334
|
+
/**
|
|
335
|
+
* Specify the background token to use. Default is 'layer'.
|
|
336
|
+
*/
|
|
337
|
+
backgroundToken: PropTypes.oneOf(['layer', 'background']),
|
|
330
338
|
/**
|
|
331
339
|
* Specify a bounding element to be used for autoAlign calculations. The viewport is used by default. This prop is currently experimental and is subject to future changes.
|
|
332
340
|
*/
|
|
@@ -340,6 +348,10 @@ Popover.propTypes = {
|
|
|
340
348
|
* Specify whether a caret should be rendered
|
|
341
349
|
*/
|
|
342
350
|
caret: PropTypes.bool,
|
|
351
|
+
/**
|
|
352
|
+
* Specify whether a border should be rendered on the popover
|
|
353
|
+
*/
|
|
354
|
+
border: PropTypes.bool,
|
|
343
355
|
/**
|
|
344
356
|
* Provide elements to be rendered inside of the component
|
|
345
357
|
*/
|
|
@@ -755,7 +755,7 @@ const Slider = props => {
|
|
|
755
755
|
* as the step.
|
|
756
756
|
*/
|
|
757
757
|
const calcValueForDelta = (currentValue, delta, step = 1) => {
|
|
758
|
-
const base = delta > 0 ? Math.
|
|
758
|
+
const base = delta > 0 ? Math.round(currentValue / step) * step : currentValue;
|
|
759
759
|
const newValue = base + delta;
|
|
760
760
|
// TODO: Why is the logical OR needed here?
|
|
761
761
|
const decimals = (step.toString().split('.')[1] || '').length;
|
|
@@ -10,7 +10,7 @@ import { Close, ChevronLeft, ChevronRight } from '@carbon/icons-react';
|
|
|
10
10
|
import { breakpoints } from '@carbon/layout';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import PropTypes from 'prop-types';
|
|
13
|
-
import React, { forwardRef, createContext, useRef, useState, useMemo, isValidElement,
|
|
13
|
+
import React, { forwardRef, createContext, useRef, useState, useMemo, isValidElement, useCallback, useEffect } from 'react';
|
|
14
14
|
import '../Grid/FlexGrid.js';
|
|
15
15
|
import { Grid as GridAsGridComponent } from '../Grid/Grid.js';
|
|
16
16
|
import '../Grid/Row.js';
|
|
@@ -24,7 +24,6 @@ import { useControllableState } from '../../internal/useControllableState.js';
|
|
|
24
24
|
import { useId } from '../../internal/useId.js';
|
|
25
25
|
import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
|
|
26
26
|
import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
27
|
-
import { getInteractiveContent } from '../../internal/useNoInteractiveChildren.js';
|
|
28
27
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
29
28
|
import { Delete, ArrowRight, ArrowLeft, Home, End, ArrowDown, ArrowUp } from '../../internal/keyboard/keys.js';
|
|
30
29
|
import { match, matches } from '../../internal/keyboard/match.js';
|
|
@@ -1110,10 +1109,6 @@ const TabPanel = /*#__PURE__*/React.forwardRef(({
|
|
|
1110
1109
|
...rest
|
|
1111
1110
|
}, forwardRef) => {
|
|
1112
1111
|
const prefix = usePrefix();
|
|
1113
|
-
const panel = useRef(null);
|
|
1114
|
-
const ref = useMergedRefs([forwardRef, panel]);
|
|
1115
|
-
const [tabIndex, setTabIndex] = useState(0);
|
|
1116
|
-
const [interactiveContent, setInteractiveContent] = useState(false);
|
|
1117
1112
|
const {
|
|
1118
1113
|
selectedIndex,
|
|
1119
1114
|
baseId
|
|
@@ -1121,50 +1116,13 @@ const TabPanel = /*#__PURE__*/React.forwardRef(({
|
|
|
1121
1116
|
const index = React.useContext(TabPanelContext);
|
|
1122
1117
|
const id = `${baseId}-tabpanel-${index}`;
|
|
1123
1118
|
const tabId = `${baseId}-tab-${index}`;
|
|
1124
|
-
const className = cx(`${prefix}--tab-content`, customClassName
|
|
1125
|
-
[`${prefix}--tab-content--interactive`]: interactiveContent
|
|
1126
|
-
});
|
|
1127
|
-
useEffect(() => {
|
|
1128
|
-
if (!panel.current) {
|
|
1129
|
-
return;
|
|
1130
|
-
}
|
|
1131
|
-
const content = getInteractiveContent(panel.current);
|
|
1132
|
-
if (content) {
|
|
1133
|
-
setInteractiveContent(true);
|
|
1134
|
-
setTabIndex(-1);
|
|
1135
|
-
}
|
|
1136
|
-
}, []);
|
|
1137
|
-
|
|
1138
|
-
// tabindex should only be 0 if no interactive content in children
|
|
1139
|
-
useEffect(() => {
|
|
1140
|
-
const node = panel.current;
|
|
1141
|
-
if (!node) {
|
|
1142
|
-
return;
|
|
1143
|
-
}
|
|
1144
|
-
function callback() {
|
|
1145
|
-
const content = getInteractiveContent(node);
|
|
1146
|
-
if (content) {
|
|
1147
|
-
setInteractiveContent(true);
|
|
1148
|
-
setTabIndex(-1);
|
|
1149
|
-
} else {
|
|
1150
|
-
setInteractiveContent(false);
|
|
1151
|
-
setTabIndex(0);
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
const observer = new MutationObserver(callback);
|
|
1155
|
-
observer.observe(node, {
|
|
1156
|
-
childList: true,
|
|
1157
|
-
subtree: true
|
|
1158
|
-
});
|
|
1159
|
-
return () => observer.disconnect();
|
|
1160
|
-
}, []);
|
|
1119
|
+
const className = cx(`${prefix}--tab-content`, customClassName);
|
|
1161
1120
|
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
1162
1121
|
"aria-labelledby": tabId,
|
|
1163
1122
|
id: id,
|
|
1164
1123
|
className: className,
|
|
1165
|
-
ref:
|
|
1124
|
+
ref: forwardRef,
|
|
1166
1125
|
role: "tabpanel",
|
|
1167
|
-
tabIndex: tabIndex,
|
|
1168
1126
|
hidden: selectedIndex !== index
|
|
1169
1127
|
}), children);
|
|
1170
1128
|
});
|
|
@@ -54,9 +54,11 @@ export declare namespace Toggletip {
|
|
|
54
54
|
defaultOpen: PropTypes.Requireable<boolean>;
|
|
55
55
|
align?: PopoverAlignment;
|
|
56
56
|
alignmentAxisOffset?: number;
|
|
57
|
+
backgroundToken?: "layer" | "background";
|
|
57
58
|
autoAlign?: boolean;
|
|
58
59
|
autoAlignBoundary?: import("@floating-ui/dom").Boundary;
|
|
59
60
|
caret?: boolean;
|
|
61
|
+
border?: boolean;
|
|
60
62
|
children?: React.ReactNode;
|
|
61
63
|
className?: string;
|
|
62
64
|
dropShadow?: boolean;
|
|
@@ -142,6 +142,7 @@ const TreeNode = /*#__PURE__*/React.forwardRef(({
|
|
|
142
142
|
const currentNode = useRef(null);
|
|
143
143
|
const currentNodeLabel = useRef(null);
|
|
144
144
|
const prefix = usePrefix();
|
|
145
|
+
const nodeLabelId = `${id}__label`;
|
|
145
146
|
const renderLabelText = () => {
|
|
146
147
|
if (isEllipsisApplied && tooltipText) {
|
|
147
148
|
return /*#__PURE__*/React.createElement(IconButton, {
|
|
@@ -152,11 +153,13 @@ const TreeNode = /*#__PURE__*/React.forwardRef(({
|
|
|
152
153
|
className: `${prefix}--tree-node__label__text-button`,
|
|
153
154
|
wrapperClasses: `${prefix}--popover-container`
|
|
154
155
|
}, /*#__PURE__*/React.createElement("span", {
|
|
156
|
+
id: nodeLabelId,
|
|
155
157
|
ref: labelTextRef,
|
|
156
158
|
className: `${prefix}--tree-node__label__text`
|
|
157
159
|
}, label));
|
|
158
160
|
}
|
|
159
161
|
return /*#__PURE__*/React.createElement("span", {
|
|
162
|
+
id: nodeLabelId,
|
|
160
163
|
ref: labelTextRef,
|
|
161
164
|
className: `${prefix}--tree-node__label__text`
|
|
162
165
|
}, label);
|
|
@@ -395,6 +398,7 @@ const TreeNode = /*#__PURE__*/React.forwardRef(({
|
|
|
395
398
|
}), nodeContent), children && /*#__PURE__*/React.createElement("ul", {
|
|
396
399
|
id: `${id}-subtree`,
|
|
397
400
|
role: "group",
|
|
401
|
+
"aria-labelledby": nodeLabelId,
|
|
398
402
|
className: cx(`${prefix}--tree-node__children`, {
|
|
399
403
|
[`${prefix}--tree-node--hidden`]: !expanded
|
|
400
404
|
})
|
|
@@ -408,6 +412,7 @@ const TreeNode = /*#__PURE__*/React.forwardRef(({
|
|
|
408
412
|
}), nodeContent, children && /*#__PURE__*/React.createElement("ul", {
|
|
409
413
|
id: `${id}-subtree`,
|
|
410
414
|
role: "group",
|
|
415
|
+
"aria-labelledby": nodeLabelId,
|
|
411
416
|
className: cx(`${prefix}--tree-node__children`, {
|
|
412
417
|
[`${prefix}--tree-node--hidden`]: !expanded
|
|
413
418
|
})
|
|
@@ -69,7 +69,7 @@ declare const Content: {
|
|
|
69
69
|
results?: number | undefined;
|
|
70
70
|
security?: string | undefined;
|
|
71
71
|
unselectable?: "on" | "off" | undefined;
|
|
72
|
-
popover?: "" | "auto" | "manual" | undefined;
|
|
72
|
+
popover?: "" | "auto" | "manual" | "hint" | undefined;
|
|
73
73
|
popoverTargetAction?: "toggle" | "show" | "hide" | undefined;
|
|
74
74
|
popoverTarget?: string | undefined;
|
|
75
75
|
inert?: boolean | undefined;
|
package/es/feature-flags.js
CHANGED
|
@@ -12,6 +12,7 @@ FeatureFlags.merge({
|
|
|
12
12
|
'enable-css-grid': true,
|
|
13
13
|
'enable-v11-release': true,
|
|
14
14
|
'enable-experimental-tile-contrast': false,
|
|
15
|
+
'enable-tile-contrast': false,
|
|
15
16
|
'enable-v12-tile-radio-icons': false,
|
|
16
17
|
'enable-v12-structured-list-visible-icons': false,
|
|
17
18
|
'enable-v12-dynamic-floating-styles': false
|
|
@@ -274,7 +274,9 @@ const FloatingMenu = ({
|
|
|
274
274
|
});
|
|
275
275
|
}
|
|
276
276
|
};
|
|
277
|
-
const
|
|
277
|
+
const deprecatedFlag = FeatureFlags.enabled('enable-experimental-focus-wrap-without-sentinels');
|
|
278
|
+
const focusTrapWithoutSentinelsFlag = FeatureFlags.enabled('enable-focus-wrap-without-sentinels');
|
|
279
|
+
const focusTrapWithoutSentinels = deprecatedFlag || focusTrapWithoutSentinelsFlag;
|
|
278
280
|
if (typeof document !== 'undefined') {
|
|
279
281
|
const portalTarget = target ? target() : document.body;
|
|
280
282
|
return /*#__PURE__*/ReactDOM.createPortal(
|
package/es/tools/events.d.ts
CHANGED
|
@@ -14,4 +14,4 @@ import type { SyntheticEvent } from 'react';
|
|
|
14
14
|
* @param handlers - An array of event handler functions.
|
|
15
15
|
* @returns A composite event handler.
|
|
16
16
|
*/
|
|
17
|
-
export declare const composeEventHandlers: <E extends SyntheticEvent = SyntheticEvent
|
|
17
|
+
export declare const composeEventHandlers: <E extends SyntheticEvent = SyntheticEvent>(handlers: (((event: E, ...args: any[]) => void) | undefined)[]) => (event: E, ...args: any[]) => void;
|