@carbon/react 1.93.0-rc.0 → 1.94.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 +1048 -1053
- package/es/components/CodeSnippet/CodeSnippet.d.ts +1 -1
- package/es/components/CodeSnippet/CodeSnippet.js +9 -50
- 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 +3 -1
- package/es/components/DataTable/DataTable.js +7 -5
- package/es/components/DataTable/Table.d.ts +1 -1
- package/es/components/DataTable/Table.js +2 -21
- package/es/components/DataTable/TableExpandRow.d.ts +4 -0
- package/es/components/DataTable/TableRow.js +2 -0
- 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 +22 -8
- package/es/components/FluidComboBox/FluidComboBox.d.ts +0 -5
- package/es/components/FluidComboBox/FluidComboBox.js +0 -5
- package/es/components/Popover/index.js +2 -1
- package/es/components/Slider/Slider.js +1 -1
- package/es/components/Tabs/Tabs.js +3 -45
- package/es/components/TreeView/TreeNode.js +5 -0
- package/es/components/UIShell/Content.d.ts +1 -1
- package/es/tools/events.d.ts +1 -1
- package/lib/components/CodeSnippet/CodeSnippet.d.ts +1 -1
- package/lib/components/CodeSnippet/CodeSnippet.js +8 -49
- 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 +3 -1
- package/lib/components/DataTable/DataTable.js +7 -5
- package/lib/components/DataTable/Table.d.ts +1 -1
- package/lib/components/DataTable/Table.js +1 -20
- package/lib/components/DataTable/TableExpandRow.d.ts +4 -0
- package/lib/components/DataTable/TableRow.js +2 -0
- 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 +22 -8
- package/lib/components/FluidComboBox/FluidComboBox.d.ts +0 -5
- package/lib/components/FluidComboBox/FluidComboBox.js +0 -5
- package/lib/components/Popover/index.js +2 -1
- package/lib/components/Slider/Slider.js +1 -1
- package/lib/components/Tabs/Tabs.js +2 -44
- package/lib/components/TreeView/TreeNode.js +5 -0
- package/lib/components/UIShell/Content.d.ts +1 -1
- package/lib/tools/events.d.ts +1 -1
- package/package.json +8 -8
- package/telemetry.yml +2 -0
|
@@ -64,8 +64,6 @@ function CodeSnippet({
|
|
|
64
64
|
const codeContentRef = React.useRef(null);
|
|
65
65
|
const codeContainerRef = React.useRef(null);
|
|
66
66
|
const innerCodeRef = React.useRef(null);
|
|
67
|
-
const [hasLeftOverflow, setHasLeftOverflow] = React.useState(false);
|
|
68
|
-
const [hasRightOverflow, setHasRightOverflow] = React.useState(false);
|
|
69
67
|
const getCodeRef = React.useCallback(() => {
|
|
70
68
|
if (type === 'single') {
|
|
71
69
|
return codeContainerRef;
|
|
@@ -77,39 +75,13 @@ function CodeSnippet({
|
|
|
77
75
|
}
|
|
78
76
|
}, [type]);
|
|
79
77
|
const prefix = usePrefix.usePrefix();
|
|
80
|
-
const getCodeRefDimensions = React.useCallback(() => {
|
|
81
|
-
const {
|
|
82
|
-
clientWidth: codeClientWidth = 0,
|
|
83
|
-
scrollLeft: codeScrollLeft = 0,
|
|
84
|
-
scrollWidth: codeScrollWidth = 0
|
|
85
|
-
} = getCodeRef().current || {};
|
|
86
|
-
return {
|
|
87
|
-
horizontalOverflow: codeScrollWidth > codeClientWidth,
|
|
88
|
-
codeClientWidth,
|
|
89
|
-
codeScrollWidth,
|
|
90
|
-
codeScrollLeft
|
|
91
|
-
};
|
|
92
|
-
}, [getCodeRef]);
|
|
93
|
-
const handleScroll = React.useCallback(() => {
|
|
94
|
-
if (type === 'inline' || type === 'single' && !codeContainerRef?.current || type === 'multi' && !codeContentRef?.current) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
const {
|
|
98
|
-
horizontalOverflow,
|
|
99
|
-
codeClientWidth,
|
|
100
|
-
codeScrollWidth,
|
|
101
|
-
codeScrollLeft
|
|
102
|
-
} = getCodeRefDimensions();
|
|
103
|
-
setHasLeftOverflow(horizontalOverflow && !!codeScrollLeft);
|
|
104
|
-
setHasRightOverflow(horizontalOverflow && codeScrollLeft + codeClientWidth !== codeScrollWidth);
|
|
105
|
-
}, [type, getCodeRefDimensions]);
|
|
106
78
|
useResizeObserver.useResizeObserver({
|
|
107
79
|
ref: getCodeRef(),
|
|
108
80
|
onResize: () => {
|
|
109
|
-
if (
|
|
81
|
+
if (innerCodeRef?.current && type === 'multi') {
|
|
110
82
|
const {
|
|
111
83
|
height
|
|
112
|
-
} =
|
|
84
|
+
} = innerCodeRef.current.getBoundingClientRect();
|
|
113
85
|
if (maxCollapsedNumberOfRows > 0 && (maxExpandedNumberOfRows <= 0 || maxExpandedNumberOfRows > maxCollapsedNumberOfRows) && height > maxCollapsedNumberOfRows * rowHeightInPixels) {
|
|
114
86
|
setShouldShowMoreLessBtn(true);
|
|
115
87
|
} else {
|
|
@@ -119,14 +91,8 @@ function CodeSnippet({
|
|
|
119
91
|
setExpandedCode(false);
|
|
120
92
|
}
|
|
121
93
|
}
|
|
122
|
-
if (codeContentRef?.current && type === 'multi' || codeContainerRef?.current && type === 'single') {
|
|
123
|
-
handleScroll();
|
|
124
|
-
}
|
|
125
94
|
}
|
|
126
95
|
});
|
|
127
|
-
React.useEffect(() => {
|
|
128
|
-
handleScroll();
|
|
129
|
-
}, [handleScroll]);
|
|
130
96
|
const handleCopyClick = evt => {
|
|
131
97
|
if (copyText || innerCodeRef?.current) {
|
|
132
98
|
copy(copyText ?? innerCodeRef?.current?.innerText ?? '');
|
|
@@ -141,8 +107,7 @@ function CodeSnippet({
|
|
|
141
107
|
[`${prefix}--snippet--expand`]: expandedCode,
|
|
142
108
|
[`${prefix}--snippet--light`]: light,
|
|
143
109
|
[`${prefix}--snippet--no-copy`]: hideCopyButton,
|
|
144
|
-
[`${prefix}--snippet--wraptext`]: wrapText
|
|
145
|
-
[`${prefix}--snippet--has-right-overflow`]: type == 'multi' && hasRightOverflow
|
|
110
|
+
[`${prefix}--snippet--wraptext`]: wrapText
|
|
146
111
|
});
|
|
147
112
|
const expandCodeBtnText = expandedCode ? showLessText : showMoreText;
|
|
148
113
|
if (type === 'inline') {
|
|
@@ -200,18 +165,12 @@ function CodeSnippet({
|
|
|
200
165
|
className: `${prefix}--snippet-container`,
|
|
201
166
|
"aria-label": deprecatedAriaLabel || ariaLabel || 'code-snippet',
|
|
202
167
|
"aria-readonly": type === 'single' || type === 'multi' ? true : undefined,
|
|
203
|
-
"aria-multiline": type === 'multi' ? true : undefined
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
onScroll: type === 'multi' && handleScroll || undefined
|
|
208
|
-
}, /*#__PURE__*/React.createElement("code", {
|
|
168
|
+
"aria-multiline": type === 'multi' ? true : undefined
|
|
169
|
+
}, containerStyle), /*#__PURE__*/React.createElement("pre", _rollupPluginBabelHelpers.extends({
|
|
170
|
+
ref: codeContentRef
|
|
171
|
+
}, containerStyle), /*#__PURE__*/React.createElement("code", {
|
|
209
172
|
ref: innerCodeRef
|
|
210
|
-
}, children))),
|
|
211
|
-
className: `${prefix}--snippet__overflow-indicator--left`
|
|
212
|
-
}), hasRightOverflow && type !== 'multi' && /*#__PURE__*/React.createElement("div", {
|
|
213
|
-
className: `${prefix}--snippet__overflow-indicator--right`
|
|
214
|
-
}), !hideCopyButton && /*#__PURE__*/React.createElement(CopyButton.default, {
|
|
173
|
+
}, children))), !hideCopyButton && /*#__PURE__*/React.createElement(CopyButton.default, {
|
|
215
174
|
align: align,
|
|
216
175
|
autoAlign: autoAlign,
|
|
217
176
|
size: type === 'multi' ? 'sm' : 'md',
|
|
@@ -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+
|
|
@@ -92,6 +92,7 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
|
|
|
92
92
|
isExpanded: boolean;
|
|
93
93
|
onExpand: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
94
94
|
[key: string]: unknown;
|
|
95
|
+
id: string;
|
|
95
96
|
};
|
|
96
97
|
getRowProps: (options: {
|
|
97
98
|
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
@@ -105,6 +106,7 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
|
|
|
105
106
|
key: string;
|
|
106
107
|
onExpand: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
107
108
|
[key: string]: unknown;
|
|
109
|
+
expandHeader: string;
|
|
108
110
|
};
|
|
109
111
|
getExpandedRowProps: (options: {
|
|
110
112
|
row: DataTableRow<ColTypes>;
|
|
@@ -234,7 +236,7 @@ export interface DataTableProps<RowType, ColTypes extends any[]> extends Transla
|
|
|
234
236
|
export declare const DataTable: {
|
|
235
237
|
<RowType, ColTypes extends any[]>(props: DataTableProps<RowType, ColTypes>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
|
|
236
238
|
Table: {
|
|
237
|
-
({ 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;
|
|
238
240
|
propTypes: {
|
|
239
241
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
240
242
|
className: PropTypes.Requireable<string>;
|
|
@@ -196,9 +196,10 @@ const DataTable = props => {
|
|
|
196
196
|
...rest,
|
|
197
197
|
'aria-label': t(translationKey),
|
|
198
198
|
// Provide a string of all expanded row IDs, separated by a space.
|
|
199
|
-
'aria-controls': rowIds.map(id =>
|
|
199
|
+
'aria-controls': rowIds.map(id => `${getTablePrefix()}-expanded-row-${id}`).join(' '),
|
|
200
200
|
isExpanded,
|
|
201
|
-
onExpand: events.composeEventHandlers(handlers)
|
|
201
|
+
onExpand: events.composeEventHandlers(handlers),
|
|
202
|
+
id: `${getTablePrefix()}-expand`
|
|
202
203
|
};
|
|
203
204
|
};
|
|
204
205
|
|
|
@@ -230,9 +231,10 @@ const DataTable = props => {
|
|
|
230
231
|
onExpand: events.composeEventHandlers([handleOnExpandRow(row.id), onClick]),
|
|
231
232
|
isExpanded: row.isExpanded,
|
|
232
233
|
'aria-label': t(translationKey),
|
|
233
|
-
'aria-controls':
|
|
234
|
+
'aria-controls': `${getTablePrefix()}-expanded-row-${row.id}`,
|
|
234
235
|
isSelected: row.isSelected,
|
|
235
|
-
disabled: row.disabled
|
|
236
|
+
disabled: row.disabled,
|
|
237
|
+
expandHeader: `${getTablePrefix()}-expand`
|
|
236
238
|
};
|
|
237
239
|
};
|
|
238
240
|
const getExpandedRowProps = ({
|
|
@@ -241,7 +243,7 @@ const DataTable = props => {
|
|
|
241
243
|
}) => {
|
|
242
244
|
return {
|
|
243
245
|
...rest,
|
|
244
|
-
id:
|
|
246
|
+
id: `${getTablePrefix()}-expanded-row-${row.id}`
|
|
245
247
|
};
|
|
246
248
|
};
|
|
247
249
|
|
|
@@ -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
|
|
@@ -57,7 +57,6 @@ const Table = ({
|
|
|
57
57
|
stickyHeader,
|
|
58
58
|
overflowMenuOnHover = true,
|
|
59
59
|
experimentalAutoAlign = false,
|
|
60
|
-
tabIndex,
|
|
61
60
|
...other
|
|
62
61
|
}) => {
|
|
63
62
|
const {
|
|
@@ -65,7 +64,6 @@ const Table = ({
|
|
|
65
64
|
descriptionId
|
|
66
65
|
} = React.useContext(TableContext.TableContext);
|
|
67
66
|
const prefix = usePrefix.usePrefix();
|
|
68
|
-
const [isScrollable, setIsScrollable] = React.useState(false);
|
|
69
67
|
const tableRef = React.useRef(null);
|
|
70
68
|
const componentClass = cx(`${prefix}--data-table`, className, {
|
|
71
69
|
[`${prefix}--data-table--${size}`]: size,
|
|
@@ -104,22 +102,6 @@ const Table = ({
|
|
|
104
102
|
const debouncedSetTableAlignment = debounce.debounce(setTableAlignment, 100);
|
|
105
103
|
useEvent.useWindowEvent('resize', debouncedSetTableAlignment);
|
|
106
104
|
|
|
107
|
-
// Used to set a tabIndex when the Table is horizontally scrollable
|
|
108
|
-
const setTabIndex = React.useCallback(() => {
|
|
109
|
-
const tableContainer = tableRef?.current?.parentNode;
|
|
110
|
-
const tableHeader = tableRef?.current?.firstChild;
|
|
111
|
-
if (tableHeader?.scrollWidth > tableContainer?.clientWidth) {
|
|
112
|
-
setIsScrollable(true);
|
|
113
|
-
} else {
|
|
114
|
-
setIsScrollable(false);
|
|
115
|
-
}
|
|
116
|
-
}, []);
|
|
117
|
-
const debouncedSetTabIndex = debounce.debounce(setTabIndex, 100);
|
|
118
|
-
useEvent.useWindowEvent('resize', debouncedSetTabIndex);
|
|
119
|
-
useIsomorphicEffect.default(() => {
|
|
120
|
-
setTabIndex();
|
|
121
|
-
}, [setTabIndex]);
|
|
122
|
-
|
|
123
105
|
// recalculate table alignment once fonts have loaded
|
|
124
106
|
if (typeof document !== 'undefined' && document?.fonts?.status && document.fonts.status !== 'loaded') {
|
|
125
107
|
document.fonts.ready.then(() => {
|
|
@@ -130,8 +112,7 @@ const Table = ({
|
|
|
130
112
|
setTableAlignment();
|
|
131
113
|
}, [setTableAlignment, size]);
|
|
132
114
|
const table = /*#__PURE__*/React.createElement("div", {
|
|
133
|
-
className: `${prefix}--data-table-content
|
|
134
|
-
tabIndex: tabIndex ?? (isScrollable ? 0 : undefined)
|
|
115
|
+
className: `${prefix}--data-table-content`
|
|
135
116
|
}, /*#__PURE__*/React.createElement("table", _rollupPluginBabelHelpers.extends({
|
|
136
117
|
"aria-labelledby": titleId,
|
|
137
118
|
"aria-describedby": descriptionId
|
|
@@ -33,6 +33,10 @@ export interface TableRowExpandInteropProps {
|
|
|
33
33
|
* Specify if the row is selected.
|
|
34
34
|
*/
|
|
35
35
|
isSelected?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* 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
|
|
38
|
+
*/
|
|
39
|
+
expandHeader?: string;
|
|
36
40
|
}
|
|
37
41
|
export interface TableExpandRowProps extends PropsWithChildren<Omit<HTMLAttributes<HTMLTableRowElement>, 'onClick'>>, Omit<TableRowExpandInteropProps, 'aria-label' | 'onExpand'> {
|
|
38
42
|
/**
|
|
@@ -35,6 +35,8 @@ const TableRow = frFn((props, ref) => {
|
|
|
35
35
|
isExpanded,
|
|
36
36
|
// eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
37
37
|
isSelected,
|
|
38
|
+
expandHeader,
|
|
39
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
38
40
|
...cleanProps
|
|
39
41
|
} = props;
|
|
40
42
|
const prefix = usePrefix.usePrefix();
|
|
@@ -29,6 +29,7 @@ const TableToolbar = ({
|
|
|
29
29
|
[`${prefix}--table-toolbar--${size}`]: size
|
|
30
30
|
});
|
|
31
31
|
return /*#__PURE__*/React.createElement("section", _rollupPluginBabelHelpers.extends({
|
|
32
|
+
role: "group",
|
|
32
33
|
"aria-label": deprecatedAriaLabel || ariaLabel
|
|
33
34
|
}, rest, {
|
|
34
35
|
className: className
|
|
@@ -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;
|
|
@@ -109,12 +109,6 @@ const carbonFlatpickrMonthSelectPlugin = config => fp => {
|
|
|
109
109
|
function isLabelTextEmpty(children) {
|
|
110
110
|
return children.every(child => !child.props.labelText);
|
|
111
111
|
}
|
|
112
|
-
const rightArrowHTML = `<svg width="16px" height="16px" viewBox="0 0 16 16">
|
|
113
|
-
<polygon points="11,8 6,13 5.3,12.3 9.6,8 5.3,3.7 6,3 "/>
|
|
114
|
-
</svg>`;
|
|
115
|
-
const leftArrowHTML = `<svg width="16px" height="16px" viewBox="0 0 16 16">
|
|
116
|
-
<polygon points="5,8 10,3 10.7,3.7 6.4,8 10.7,12.3 10,13 "/>
|
|
117
|
-
</svg>`;
|
|
118
112
|
function updateClassNames(calendar, prefix) {
|
|
119
113
|
const calendarContainer = calendar.calendarContainer;
|
|
120
114
|
const daysContainer = calendar.days;
|
|
@@ -166,6 +160,8 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
166
160
|
short = false,
|
|
167
161
|
value,
|
|
168
162
|
parseDate: parseDateProp,
|
|
163
|
+
nextMonthAriaLabel = 'Next month',
|
|
164
|
+
prevMonthAriaLabel = 'Previous month',
|
|
169
165
|
...rest
|
|
170
166
|
}, ref) {
|
|
171
167
|
const prefix = usePrefix.usePrefix();
|
|
@@ -346,6 +342,16 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
346
342
|
} else if (parseDateProp) {
|
|
347
343
|
parseDate = parseDateProp;
|
|
348
344
|
}
|
|
345
|
+
|
|
346
|
+
// Accessible arrow icons (localized manually)
|
|
347
|
+
// Flatpickr does not currently support localization of next/previous month
|
|
348
|
+
// labels, so we inject translated aria-labels based on the provided locale.
|
|
349
|
+
const rightArrowHTML = `<svg aria-label="${nextMonthAriaLabel}" role="img" width="16px" height="16px" viewBox="0 0 16 16">
|
|
350
|
+
<polygon points="11,8 6,13 5.3,12.3 9.6,8 5.3,3.7 6,3 "/>
|
|
351
|
+
</svg>`;
|
|
352
|
+
const leftArrowHTML = `<svg aria-label="${prevMonthAriaLabel}" role="img" width="16px" height="16px" viewBox="0 0 16 16">
|
|
353
|
+
<polygon points="5,8 10,3 10.7,3.7 6.4,8 10.7,12.3 10,13 "/>
|
|
354
|
+
</svg>`;
|
|
349
355
|
const {
|
|
350
356
|
current: start
|
|
351
357
|
} = startInputField;
|
|
@@ -523,7 +529,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
|
|
|
523
529
|
}
|
|
524
530
|
};
|
|
525
531
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
526
|
-
}, [savedOnChange, savedOnOpen, readOnly, closeOnSelect, hasInput, datePickerType]);
|
|
532
|
+
}, [savedOnChange, savedOnOpen, readOnly, closeOnSelect, hasInput, datePickerType, nextMonthAriaLabel, prevMonthAriaLabel]);
|
|
527
533
|
|
|
528
534
|
// this hook allows consumers to access the flatpickr calendar
|
|
529
535
|
// instance for cases where functions like open() or close()
|
|
@@ -878,7 +884,15 @@ DatePicker.propTypes = {
|
|
|
878
884
|
/**
|
|
879
885
|
* Provide the text that is displayed when the control is in warning state (Fluid only)
|
|
880
886
|
*/
|
|
881
|
-
warnText: PropTypes.node
|
|
887
|
+
warnText: PropTypes.node,
|
|
888
|
+
/**
|
|
889
|
+
* Accessible aria-label for the "next month" arrow icon.
|
|
890
|
+
*/
|
|
891
|
+
nextMonthAriaLabel: PropTypes.string,
|
|
892
|
+
/**
|
|
893
|
+
* Accessible aria-label for the "previous month" arrow icon.
|
|
894
|
+
*/
|
|
895
|
+
prevMonthAriaLabel: PropTypes.string
|
|
882
896
|
};
|
|
883
897
|
|
|
884
898
|
exports.default = DatePicker;
|
|
@@ -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
|
* */
|
|
@@ -95,11 +95,6 @@ FluidComboBox.propTypes = {
|
|
|
95
95
|
* consuming component what kind of internal state changes are occurring.
|
|
96
96
|
*/
|
|
97
97
|
onChange: PropTypes.func.isRequired,
|
|
98
|
-
/**
|
|
99
|
-
* An optional callback to render the currently selected item as a react element instead of only
|
|
100
|
-
* as a string.
|
|
101
|
-
*/
|
|
102
|
-
renderSelectedItem: PropTypes.func,
|
|
103
98
|
/**
|
|
104
99
|
* In the case you want to control the dropdown selection entirely.
|
|
105
100
|
*/
|
|
@@ -151,7 +151,8 @@ forwardRef) {
|
|
|
151
151
|
fallbackAxisSideDirection: 'start',
|
|
152
152
|
boundary: autoAlignBoundary
|
|
153
153
|
}), react.arrow({
|
|
154
|
-
element: caretRef
|
|
154
|
+
element: caretRef,
|
|
155
|
+
padding: 16
|
|
155
156
|
}), autoAlign && react.hide()],
|
|
156
157
|
whileElementsMounted: react.autoUpdate
|
|
157
158
|
} : {}
|
|
@@ -757,7 +757,7 @@ const Slider = props => {
|
|
|
757
757
|
* as the step.
|
|
758
758
|
*/
|
|
759
759
|
const calcValueForDelta = (currentValue, delta, step = 1) => {
|
|
760
|
-
const base = delta > 0 ? Math.
|
|
760
|
+
const base = delta > 0 ? Math.round(currentValue / step) * step : currentValue;
|
|
761
761
|
const newValue = base + delta;
|
|
762
762
|
// TODO: Why is the logical OR needed here?
|
|
763
763
|
const decimals = (step.toString().split('.')[1] || '').length;
|
|
@@ -26,7 +26,6 @@ var useControllableState = require('../../internal/useControllableState.js');
|
|
|
26
26
|
var useId = require('../../internal/useId.js');
|
|
27
27
|
var useIsomorphicEffect = require('../../internal/useIsomorphicEffect.js');
|
|
28
28
|
var useMergedRefs = require('../../internal/useMergedRefs.js');
|
|
29
|
-
var useNoInteractiveChildren = require('../../internal/useNoInteractiveChildren.js');
|
|
30
29
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
31
30
|
var keys = require('../../internal/keyboard/keys.js');
|
|
32
31
|
var match = require('../../internal/keyboard/match.js');
|
|
@@ -1112,10 +1111,6 @@ const TabPanel = /*#__PURE__*/React.forwardRef(({
|
|
|
1112
1111
|
...rest
|
|
1113
1112
|
}, forwardRef) => {
|
|
1114
1113
|
const prefix = usePrefix.usePrefix();
|
|
1115
|
-
const panel = React.useRef(null);
|
|
1116
|
-
const ref = useMergedRefs.useMergedRefs([forwardRef, panel]);
|
|
1117
|
-
const [tabIndex, setTabIndex] = React.useState(0);
|
|
1118
|
-
const [interactiveContent, setInteractiveContent] = React.useState(false);
|
|
1119
1114
|
const {
|
|
1120
1115
|
selectedIndex,
|
|
1121
1116
|
baseId
|
|
@@ -1123,50 +1118,13 @@ const TabPanel = /*#__PURE__*/React.forwardRef(({
|
|
|
1123
1118
|
const index = React.useContext(TabPanelContext);
|
|
1124
1119
|
const id = `${baseId}-tabpanel-${index}`;
|
|
1125
1120
|
const tabId = `${baseId}-tab-${index}`;
|
|
1126
|
-
const className = cx(`${prefix}--tab-content`, customClassName
|
|
1127
|
-
[`${prefix}--tab-content--interactive`]: interactiveContent
|
|
1128
|
-
});
|
|
1129
|
-
React.useEffect(() => {
|
|
1130
|
-
if (!panel.current) {
|
|
1131
|
-
return;
|
|
1132
|
-
}
|
|
1133
|
-
const content = useNoInteractiveChildren.getInteractiveContent(panel.current);
|
|
1134
|
-
if (content) {
|
|
1135
|
-
setInteractiveContent(true);
|
|
1136
|
-
setTabIndex(-1);
|
|
1137
|
-
}
|
|
1138
|
-
}, []);
|
|
1139
|
-
|
|
1140
|
-
// tabindex should only be 0 if no interactive content in children
|
|
1141
|
-
React.useEffect(() => {
|
|
1142
|
-
const node = panel.current;
|
|
1143
|
-
if (!node) {
|
|
1144
|
-
return;
|
|
1145
|
-
}
|
|
1146
|
-
function callback() {
|
|
1147
|
-
const content = useNoInteractiveChildren.getInteractiveContent(node);
|
|
1148
|
-
if (content) {
|
|
1149
|
-
setInteractiveContent(true);
|
|
1150
|
-
setTabIndex(-1);
|
|
1151
|
-
} else {
|
|
1152
|
-
setInteractiveContent(false);
|
|
1153
|
-
setTabIndex(0);
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
const observer = new MutationObserver(callback);
|
|
1157
|
-
observer.observe(node, {
|
|
1158
|
-
childList: true,
|
|
1159
|
-
subtree: true
|
|
1160
|
-
});
|
|
1161
|
-
return () => observer.disconnect();
|
|
1162
|
-
}, []);
|
|
1121
|
+
const className = cx(`${prefix}--tab-content`, customClassName);
|
|
1163
1122
|
return /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({}, rest, {
|
|
1164
1123
|
"aria-labelledby": tabId,
|
|
1165
1124
|
id: id,
|
|
1166
1125
|
className: className,
|
|
1167
|
-
ref:
|
|
1126
|
+
ref: forwardRef,
|
|
1168
1127
|
role: "tabpanel",
|
|
1169
|
-
tabIndex: tabIndex,
|
|
1170
1128
|
hidden: selectedIndex !== index
|
|
1171
1129
|
}), children);
|
|
1172
1130
|
});
|
|
@@ -146,6 +146,7 @@ const TreeNode = /*#__PURE__*/React.forwardRef(({
|
|
|
146
146
|
const currentNode = React.useRef(null);
|
|
147
147
|
const currentNodeLabel = React.useRef(null);
|
|
148
148
|
const prefix = usePrefix.usePrefix();
|
|
149
|
+
const nodeLabelId = `${id}__label`;
|
|
149
150
|
const renderLabelText = () => {
|
|
150
151
|
if (isEllipsisApplied && tooltipText) {
|
|
151
152
|
return /*#__PURE__*/React.createElement(index$1.IconButton, {
|
|
@@ -156,11 +157,13 @@ const TreeNode = /*#__PURE__*/React.forwardRef(({
|
|
|
156
157
|
className: `${prefix}--tree-node__label__text-button`,
|
|
157
158
|
wrapperClasses: `${prefix}--popover-container`
|
|
158
159
|
}, /*#__PURE__*/React.createElement("span", {
|
|
160
|
+
id: nodeLabelId,
|
|
159
161
|
ref: labelTextRef,
|
|
160
162
|
className: `${prefix}--tree-node__label__text`
|
|
161
163
|
}, label));
|
|
162
164
|
}
|
|
163
165
|
return /*#__PURE__*/React.createElement("span", {
|
|
166
|
+
id: nodeLabelId,
|
|
164
167
|
ref: labelTextRef,
|
|
165
168
|
className: `${prefix}--tree-node__label__text`
|
|
166
169
|
}, label);
|
|
@@ -399,6 +402,7 @@ const TreeNode = /*#__PURE__*/React.forwardRef(({
|
|
|
399
402
|
}), nodeContent), children && /*#__PURE__*/React.createElement("ul", {
|
|
400
403
|
id: `${id}-subtree`,
|
|
401
404
|
role: "group",
|
|
405
|
+
"aria-labelledby": nodeLabelId,
|
|
402
406
|
className: cx(`${prefix}--tree-node__children`, {
|
|
403
407
|
[`${prefix}--tree-node--hidden`]: !expanded
|
|
404
408
|
})
|
|
@@ -412,6 +416,7 @@ const TreeNode = /*#__PURE__*/React.forwardRef(({
|
|
|
412
416
|
}), nodeContent, children && /*#__PURE__*/React.createElement("ul", {
|
|
413
417
|
id: `${id}-subtree`,
|
|
414
418
|
role: "group",
|
|
419
|
+
"aria-labelledby": nodeLabelId,
|
|
415
420
|
className: cx(`${prefix}--tree-node__children`, {
|
|
416
421
|
[`${prefix}--tree-node--hidden`]: !expanded
|
|
417
422
|
})
|
|
@@ -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/lib/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;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/react",
|
|
3
3
|
"description": "React components for the Carbon Design System",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.94.0-rc.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@babel/runtime": "^7.27.3",
|
|
55
55
|
"@carbon/feature-flags": "^0.31.0",
|
|
56
|
-
"@carbon/icons-react": "^11.
|
|
57
|
-
"@carbon/layout": "^11.43.0
|
|
58
|
-
"@carbon/styles": "^1.
|
|
59
|
-
"@carbon/utilities": "^0.11.0
|
|
56
|
+
"@carbon/icons-react": "^11.70.0-rc.0",
|
|
57
|
+
"@carbon/layout": "^11.43.0",
|
|
58
|
+
"@carbon/styles": "^1.93.0-rc.0",
|
|
59
|
+
"@carbon/utilities": "^0.11.0",
|
|
60
60
|
"@floating-ui/react": "^0.27.4",
|
|
61
61
|
"@ibm/telemetry-js": "^1.5.0",
|
|
62
62
|
"classnames": "2.5.1",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"@babel/preset-react": "^7.27.1",
|
|
81
81
|
"@babel/preset-typescript": "^7.27.1",
|
|
82
82
|
"@carbon/test-utils": "^10.38.0",
|
|
83
|
-
"@carbon/themes": "^11.62.0
|
|
83
|
+
"@carbon/themes": "^11.62.0",
|
|
84
84
|
"@figma/code-connect": "^1.3.5",
|
|
85
85
|
"@rollup/plugin-babel": "^6.0.0",
|
|
86
86
|
"@rollup/plugin-commonjs": "^28.0.3",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"storybook": "^9.0.5",
|
|
124
124
|
"stream-browserify": "^3.0.0",
|
|
125
125
|
"style-loader": "^4.0.0",
|
|
126
|
-
"typescript-config-carbon": "^0.8.0
|
|
126
|
+
"typescript-config-carbon": "^0.8.0",
|
|
127
127
|
"use-sync-external-store": "^1.5.0",
|
|
128
128
|
"webpack": "^5.65.0",
|
|
129
129
|
"webpack-dev-server": "^5.0.0"
|
|
@@ -139,5 +139,5 @@
|
|
|
139
139
|
"**/*.scss",
|
|
140
140
|
"**/*.css"
|
|
141
141
|
],
|
|
142
|
-
"gitHead": "
|
|
142
|
+
"gitHead": "dff507858b43de91b300a98fa1bec24d38aaeb48"
|
|
143
143
|
}
|