@carbon/react 1.64.1 → 1.65.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 +1429 -1649
- package/es/components/DataTable/DataTable.d.ts +18 -18
- package/es/components/DataTable/DataTable.js +2 -2
- package/es/components/DataTable/TableExpandRow.d.ts +1 -1
- package/es/components/DataTable/TableExpandRow.js +1 -1
- package/es/components/DataTable/TableSelectAll.d.ts +2 -2
- package/es/components/DataTable/TableSelectAll.js +1 -1
- package/es/components/DataTable/TableSelectRow.d.ts +2 -2
- package/es/components/DataTable/TableSelectRow.js +1 -1
- package/es/components/FileUploader/FileUploaderItem.js +5 -3
- package/es/components/Menu/Menu.js +1 -1
- package/es/components/OverflowMenu/next/index.js +11 -5
- package/es/components/PaginationNav/PaginationNav.d.ts +4 -0
- package/es/components/PaginationNav/PaginationNav.js +8 -1
- package/es/components/Tag/Tag.js +2 -1
- package/es/components/Text/Text.d.ts +1 -19
- package/es/components/Text/Text.js +5 -3
- package/es/components/TextInput/PasswordInput.js +7 -1
- package/es/components/TileGroup/TileGroup.js +2 -2
- package/es/components/UIShell/Content.d.ts +3 -3
- package/lib/components/DataTable/DataTable.d.ts +18 -18
- package/lib/components/DataTable/DataTable.js +2 -2
- package/lib/components/DataTable/TableExpandRow.d.ts +1 -1
- package/lib/components/DataTable/TableExpandRow.js +1 -1
- package/lib/components/DataTable/TableSelectAll.d.ts +2 -2
- package/lib/components/DataTable/TableSelectAll.js +1 -1
- package/lib/components/DataTable/TableSelectRow.d.ts +2 -2
- package/lib/components/DataTable/TableSelectRow.js +1 -1
- package/lib/components/FileUploader/FileUploaderItem.js +4 -2
- package/lib/components/Menu/Menu.js +1 -1
- package/lib/components/OverflowMenu/next/index.js +11 -5
- package/lib/components/PaginationNav/PaginationNav.d.ts +4 -0
- package/lib/components/PaginationNav/PaginationNav.js +8 -1
- package/lib/components/Tag/Tag.js +2 -1
- package/lib/components/Text/Text.d.ts +1 -19
- package/lib/components/Text/Text.js +5 -3
- package/lib/components/TextInput/PasswordInput.js +7 -1
- package/lib/components/TileGroup/TileGroup.js +2 -2
- package/lib/components/UIShell/Content.d.ts +3 -3
- package/package.json +13 -13
|
@@ -77,7 +77,7 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
|
|
|
77
77
|
getHeaderProps: (getHeaderPropsArgs: {
|
|
78
78
|
header: DataTableHeader;
|
|
79
79
|
isSortable?: boolean;
|
|
80
|
-
onClick?: (e: React.MouseEvent
|
|
80
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement>, sortState: {
|
|
81
81
|
sortHeaderKey: string;
|
|
82
82
|
sortDirection: DataTableSortState;
|
|
83
83
|
}) => void;
|
|
@@ -86,25 +86,25 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
|
|
|
86
86
|
isSortable: boolean | undefined;
|
|
87
87
|
isSortHeader: boolean;
|
|
88
88
|
key: string;
|
|
89
|
-
onClick: (e: MouseEvent) => void;
|
|
89
|
+
onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
90
90
|
sortDirection: DataTableSortState;
|
|
91
91
|
[key: string]: unknown;
|
|
92
92
|
};
|
|
93
93
|
getExpandHeaderProps: (getExpandHeaderPropsArgs?: {
|
|
94
|
-
onClick?: (e: MouseEvent
|
|
94
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement>, expandState: {
|
|
95
95
|
isExpanded?: boolean;
|
|
96
96
|
}) => void;
|
|
97
|
-
onExpand?: (e: MouseEvent) => void;
|
|
97
|
+
onExpand?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
98
98
|
[key: string]: unknown;
|
|
99
99
|
}) => {
|
|
100
100
|
ariaLabel: string;
|
|
101
101
|
['aria-label']: string;
|
|
102
102
|
isExpanded: boolean;
|
|
103
|
-
onExpand: (e: MouseEvent) => void;
|
|
103
|
+
onExpand: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
104
104
|
[key: string]: unknown;
|
|
105
105
|
};
|
|
106
106
|
getRowProps: (getRowPropsArgs: {
|
|
107
|
-
onClick?: (e: MouseEvent) => void;
|
|
107
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
108
108
|
row: DataTableRow<ColTypes>;
|
|
109
109
|
[key: string]: unknown;
|
|
110
110
|
}) => {
|
|
@@ -114,7 +114,7 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
|
|
|
114
114
|
isExpanded?: boolean;
|
|
115
115
|
isSelected?: boolean;
|
|
116
116
|
key: string;
|
|
117
|
-
onExpand: (e: MouseEvent) => void;
|
|
117
|
+
onExpand: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
118
118
|
[key: string]: unknown;
|
|
119
119
|
};
|
|
120
120
|
getExpandedRowProps: (getExpandedRowPropsArgs: {
|
|
@@ -124,20 +124,20 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
|
|
|
124
124
|
['id']: string;
|
|
125
125
|
[key: string]: unknown;
|
|
126
126
|
};
|
|
127
|
-
getSelectionProps: (getSelectionPropsArgs
|
|
128
|
-
onClick?: (e: MouseEvent) => void;
|
|
127
|
+
getSelectionProps: (getSelectionPropsArgs?: {
|
|
128
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
129
129
|
row: DataTableRow<ColTypes>;
|
|
130
130
|
[key: string]: unknown;
|
|
131
131
|
}) => {
|
|
132
132
|
ariaLabel: string;
|
|
133
133
|
'aria-label': string;
|
|
134
|
-
checked
|
|
134
|
+
checked?: boolean;
|
|
135
135
|
disabled?: boolean | undefined;
|
|
136
136
|
id: string;
|
|
137
137
|
indeterminate?: boolean;
|
|
138
138
|
name: string;
|
|
139
|
-
onSelect: (e: MouseEvent) => void;
|
|
140
|
-
radio?: boolean
|
|
139
|
+
onSelect: (e: React.MouseEvent<HTMLInputElement>) => void;
|
|
140
|
+
radio?: boolean;
|
|
141
141
|
[key: string]: unknown;
|
|
142
142
|
};
|
|
143
143
|
getToolbarProps: (getToolbarPropsArgs?: {
|
|
@@ -346,7 +346,7 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
|
|
|
346
346
|
getHeaderProps: ({ header, onClick, isSortable, ...rest }: {
|
|
347
347
|
[key: string]: unknown;
|
|
348
348
|
header: DataTableHeader;
|
|
349
|
-
onClick?: ((e: React.MouseEvent
|
|
349
|
+
onClick?: ((e: React.MouseEvent<HTMLButtonElement>, sortState: {
|
|
350
350
|
sortHeaderKey: string;
|
|
351
351
|
sortDirection: DataTableSortState;
|
|
352
352
|
}) => void) | undefined;
|
|
@@ -369,10 +369,10 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
|
|
|
369
369
|
*/
|
|
370
370
|
getExpandHeaderProps: ({ onClick, onExpand, ...rest }?: {
|
|
371
371
|
[key: string]: unknown;
|
|
372
|
-
onClick?: ((e: MouseEvent
|
|
372
|
+
onClick?: ((e: React.MouseEvent<HTMLButtonElement>, expandState: {
|
|
373
373
|
isExpanded: boolean;
|
|
374
374
|
}) => void) | undefined;
|
|
375
|
-
onExpand?: ((e: MouseEvent) => void) | undefined;
|
|
375
|
+
onExpand?: ((e: React.MouseEvent<HTMLButtonElement>) => void) | undefined;
|
|
376
376
|
}) => {
|
|
377
377
|
ariaLabel: any;
|
|
378
378
|
'aria-label': any;
|
|
@@ -406,7 +406,7 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
|
|
|
406
406
|
*/
|
|
407
407
|
getRowProps: ({ row, onClick, ...rest }: {
|
|
408
408
|
[key: string]: unknown;
|
|
409
|
-
onClick?: ((e: MouseEvent) => void) | undefined;
|
|
409
|
+
onClick?: ((e: React.MouseEvent<HTMLButtonElement>) => void) | undefined;
|
|
410
410
|
row: DataTableRow<ColTypes>;
|
|
411
411
|
}) => {
|
|
412
412
|
key: string;
|
|
@@ -443,7 +443,7 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
|
|
|
443
443
|
*/
|
|
444
444
|
getSelectionProps: ({ onClick, row, ...rest }?: {
|
|
445
445
|
[key: string]: unknown;
|
|
446
|
-
onClick?: ((e: MouseEvent) => void) | undefined;
|
|
446
|
+
onClick?: ((e: React.MouseEvent<HTMLButtonElement>) => void) | undefined;
|
|
447
447
|
row: DataTableRow<ColTypes>;
|
|
448
448
|
}) => {
|
|
449
449
|
checked: boolean | undefined;
|
|
@@ -453,7 +453,7 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
|
|
|
453
453
|
ariaLabel: any;
|
|
454
454
|
'aria-label': any;
|
|
455
455
|
disabled: boolean | undefined;
|
|
456
|
-
radio:
|
|
456
|
+
radio: boolean | undefined;
|
|
457
457
|
} | {
|
|
458
458
|
ariaLabel: any;
|
|
459
459
|
'aria-label': any;
|
|
@@ -259,12 +259,12 @@ class DataTable extends React__default.Component {
|
|
|
259
259
|
checked: row.isSelected,
|
|
260
260
|
onSelect: composeEventHandlers([_this.handleOnSelectRow(row.id), onClick]),
|
|
261
261
|
id: `${_this.getTablePrefix()}__select-row-${row.id}`,
|
|
262
|
-
name: `select-row`,
|
|
262
|
+
name: `select-row-${_this.instanceId}`,
|
|
263
263
|
ariaLabel: t(translationKey),
|
|
264
264
|
// TODO remove in v12
|
|
265
265
|
'aria-label': t(translationKey),
|
|
266
266
|
disabled: row.disabled,
|
|
267
|
-
radio: _this.props.radio
|
|
267
|
+
radio: _this.props.radio
|
|
268
268
|
};
|
|
269
269
|
}
|
|
270
270
|
|
|
@@ -34,7 +34,7 @@ interface TableExpandRowProps extends PropsWithChildren<TableRowProps> {
|
|
|
34
34
|
* Specify whether this row is expanded or not. This helps coordinate data
|
|
35
35
|
* attributes so that `TableExpandRow` and `TableExpandedRow` work together
|
|
36
36
|
*/
|
|
37
|
-
isExpanded
|
|
37
|
+
isExpanded?: boolean;
|
|
38
38
|
/**
|
|
39
39
|
* Hook for when a listener initiates a request to expand the given row
|
|
40
40
|
*/
|
|
@@ -104,7 +104,7 @@ TableExpandRow.propTypes = {
|
|
|
104
104
|
* Specify whether this row is expanded or not. This helps coordinate data
|
|
105
105
|
* attributes so that `TableExpandRow` and `TableExpandedRow` work together
|
|
106
106
|
*/
|
|
107
|
-
isExpanded: PropTypes.bool
|
|
107
|
+
isExpanded: PropTypes.bool,
|
|
108
108
|
/**
|
|
109
109
|
* Specify if the row is selected
|
|
110
110
|
*/
|
|
@@ -20,7 +20,7 @@ interface TableSelectAllProps {
|
|
|
20
20
|
/**
|
|
21
21
|
* Specify whether all items are selected, or not
|
|
22
22
|
*/
|
|
23
|
-
checked
|
|
23
|
+
checked?: boolean;
|
|
24
24
|
/**
|
|
25
25
|
* The CSS class names of the cell that wraps the underlying input control
|
|
26
26
|
*/
|
|
@@ -61,7 +61,7 @@ declare const TableSelectAll: {
|
|
|
61
61
|
/**
|
|
62
62
|
* Specify whether all items are selected, or not
|
|
63
63
|
*/
|
|
64
|
-
checked: PropTypes.
|
|
64
|
+
checked: PropTypes.Requireable<boolean>;
|
|
65
65
|
/**
|
|
66
66
|
* The CSS class names of the cell that wraps the underlying input control
|
|
67
67
|
*/
|
|
@@ -21,7 +21,7 @@ export interface TableSelectRowProps {
|
|
|
21
21
|
/**
|
|
22
22
|
* Specify whether this row is selected, or not
|
|
23
23
|
*/
|
|
24
|
-
checked
|
|
24
|
+
checked?: boolean;
|
|
25
25
|
/**
|
|
26
26
|
* The CSS class names of the cell that wraps the underlying input control
|
|
27
27
|
*/
|
|
@@ -66,7 +66,7 @@ declare const TableSelectRow: {
|
|
|
66
66
|
/**
|
|
67
67
|
* Specify whether this row is selected, or not
|
|
68
68
|
*/
|
|
69
|
-
checked: PropTypes.
|
|
69
|
+
checked: PropTypes.Requireable<boolean>;
|
|
70
70
|
/**
|
|
71
71
|
* The CSS class names of the cell that wraps the underlying input control
|
|
72
72
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
|
-
import React__default, {
|
|
11
|
+
import React__default, { useRef, useState, useLayoutEffect } from 'react';
|
|
12
12
|
import Filename from './Filename.js';
|
|
13
13
|
import uniqueId from '../../tools/uniqueId.js';
|
|
14
14
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
@@ -34,6 +34,7 @@ function FileUploaderItem(_ref) {
|
|
|
34
34
|
className,
|
|
35
35
|
...other
|
|
36
36
|
} = _ref;
|
|
37
|
+
const textRef = useRef(null);
|
|
37
38
|
const [isEllipsisApplied, setIsEllipsisApplied] = useState(false);
|
|
38
39
|
const prefix = usePrefix();
|
|
39
40
|
const {
|
|
@@ -53,8 +54,7 @@ function FileUploaderItem(_ref) {
|
|
|
53
54
|
return element.offsetWidth < element.scrollWidth;
|
|
54
55
|
};
|
|
55
56
|
useLayoutEffect(() => {
|
|
56
|
-
|
|
57
|
-
isEllipsisActive(element);
|
|
57
|
+
isEllipsisActive(textRef.current);
|
|
58
58
|
}, [prefix, name]);
|
|
59
59
|
return /*#__PURE__*/React__default.createElement("span", _extends({
|
|
60
60
|
className: classes
|
|
@@ -68,11 +68,13 @@ function FileUploaderItem(_ref) {
|
|
|
68
68
|
className: `${prefix}--file-filename-button`,
|
|
69
69
|
type: "button"
|
|
70
70
|
}, /*#__PURE__*/React__default.createElement(Text, {
|
|
71
|
+
ref: textRef,
|
|
71
72
|
as: "p",
|
|
72
73
|
title: name,
|
|
73
74
|
className: `${prefix}--file-filename-button`,
|
|
74
75
|
id: filterSpaceName(name)
|
|
75
76
|
}, name)))) : /*#__PURE__*/React__default.createElement(Text, {
|
|
77
|
+
ref: textRef,
|
|
76
78
|
as: "p",
|
|
77
79
|
title: name,
|
|
78
80
|
className: `${prefix}--file-filename`,
|
|
@@ -157,7 +157,7 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(_ref, forwardRef) {
|
|
|
157
157
|
}
|
|
158
158
|
if (indexToFocus !== currentItem) {
|
|
159
159
|
const nodeToFocus = focusableItems[indexToFocus];
|
|
160
|
-
nodeToFocus.ref
|
|
160
|
+
nodeToFocus.ref?.current?.focus();
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
function handleBlur(e) {
|
|
@@ -38,16 +38,22 @@ const OverflowMenu = /*#__PURE__*/React__default.forwardRef(function OverflowMen
|
|
|
38
38
|
placement,
|
|
39
39
|
middlewareData
|
|
40
40
|
} = useFloating(autoAlign ? {
|
|
41
|
+
// Computing the position starts with initial positioning
|
|
42
|
+
// via `placement`.
|
|
41
43
|
placement: menuAlignment,
|
|
42
44
|
// The floating element is positioned relative to its nearest
|
|
43
|
-
// containing block (usually the viewport). It will in many cases
|
|
44
|
-
// “break” the floating element out of a clipping ancestor.
|
|
45
|
+
// containing block (usually the viewport). It will in many cases
|
|
46
|
+
// also “break” the floating element out of a clipping ancestor.
|
|
45
47
|
// https://floating-ui.com/docs/misc#clipping
|
|
46
48
|
strategy: 'fixed',
|
|
47
|
-
// Middleware
|
|
49
|
+
// Middleware are executed as an in-between “middle” step of the
|
|
50
|
+
// initial `placement` computation and eventual return of data for
|
|
51
|
+
// rendering. Each middleware is executed in order.
|
|
48
52
|
middleware: [flip({
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
// An explicit array of placements to try if the initial
|
|
54
|
+
// `placement` doesn’t fit on the axes in which overflow
|
|
55
|
+
// is checked.
|
|
56
|
+
fallbackPlacements: menuAlignment.includes('bottom') ? ['bottom-start', 'bottom-end', 'top-start', 'top-end'] : ['top-start', 'top-end', 'bottom-start', 'bottom-end']
|
|
51
57
|
})],
|
|
52
58
|
whileElementsMounted: autoUpdate
|
|
53
59
|
} : {} // When autoAlign is turned off, floating-ui will not be used
|
|
@@ -43,6 +43,10 @@ interface PaginationNavProps extends Omit<React.HTMLAttributes<HTMLElement>, 'on
|
|
|
43
43
|
* The index of current page.
|
|
44
44
|
*/
|
|
45
45
|
page?: number;
|
|
46
|
+
/**
|
|
47
|
+
* Specify the size of the PaginationNav.
|
|
48
|
+
*/
|
|
49
|
+
size?: 'sm' | 'md' | 'lg';
|
|
46
50
|
/**
|
|
47
51
|
* The total number of items.
|
|
48
52
|
*/
|
|
@@ -175,6 +175,7 @@ const PaginationNav = /*#__PURE__*/React__default.forwardRef(function Pagination
|
|
|
175
175
|
itemsShown = 10,
|
|
176
176
|
page = 0,
|
|
177
177
|
loop = false,
|
|
178
|
+
size = 'lg',
|
|
178
179
|
translateWithId: t = translateWithId,
|
|
179
180
|
...rest
|
|
180
181
|
} = _ref4;
|
|
@@ -245,7 +246,9 @@ const PaginationNav = /*#__PURE__*/React__default.forwardRef(function Pagination
|
|
|
245
246
|
useEffect(() => {
|
|
246
247
|
setIsOverFlowDisabled(disableOverflow);
|
|
247
248
|
}, [disableOverflow]);
|
|
248
|
-
const classNames = cx(`${prefix}--pagination-nav`, className
|
|
249
|
+
const classNames = cx(`${prefix}--pagination-nav`, className, {
|
|
250
|
+
[`${prefix}--layout--size-${size}`]: size
|
|
251
|
+
});
|
|
249
252
|
const backwardButtonDisabled = !loop && currentPage === 0;
|
|
250
253
|
const forwardButtonDisabled = !loop && currentPage === totalItems - 1;
|
|
251
254
|
const startOffset = itemsDisplayedOnPage <= 4 && currentPage > 1 ? 0 : 1;
|
|
@@ -398,6 +401,10 @@ PaginationNav.propTypes = {
|
|
|
398
401
|
* The index of current page.
|
|
399
402
|
*/
|
|
400
403
|
page: PropTypes.number,
|
|
404
|
+
/**
|
|
405
|
+
* Specify the size of the PaginationNav.
|
|
406
|
+
*/
|
|
407
|
+
size: PropTypes.oneOf(['sm', 'md', 'lg']),
|
|
401
408
|
/**
|
|
402
409
|
* The total number of items.
|
|
403
410
|
*/
|
package/es/components/Tag/Tag.js
CHANGED
|
@@ -122,7 +122,8 @@ const Tag = /*#__PURE__*/React__default.forwardRef(function Tag(_ref, forwardRef
|
|
|
122
122
|
ref: ref,
|
|
123
123
|
disabled: disabled,
|
|
124
124
|
className: tagClasses,
|
|
125
|
-
id: tagId
|
|
125
|
+
id: tagId,
|
|
126
|
+
type: ComponentTag === 'button' ? 'button' : undefined
|
|
126
127
|
}, other), CustomIconElement && size !== 'sm' ? /*#__PURE__*/React__default.createElement("div", {
|
|
127
128
|
className: `${prefix}--tag__custom-icon`
|
|
128
129
|
}, /*#__PURE__*/React__default.createElement(CustomIconElement, null)) : '', isEllipsisApplied && !isInteractiveTag ? /*#__PURE__*/React__default.createElement(DefinitionTooltip, {
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
7
|
import React from 'react';
|
|
9
8
|
import { PolymorphicProps } from '../../types/common';
|
|
10
9
|
import { TextDir } from './TextDirection';
|
|
@@ -12,22 +11,5 @@ export interface TextBaseProps {
|
|
|
12
11
|
dir?: TextDir | undefined;
|
|
13
12
|
}
|
|
14
13
|
export type TextProps<T extends React.ElementType> = PolymorphicProps<T, TextBaseProps>;
|
|
15
|
-
declare
|
|
16
|
-
declare namespace Text {
|
|
17
|
-
var propTypes: {
|
|
18
|
-
/**
|
|
19
|
-
* Provide a custom element type used to render the outermost node
|
|
20
|
-
*/
|
|
21
|
-
as: PropTypes.Requireable<NonNullable<((...args: any[]) => any) | PropTypes.ReactComponentLike | null | undefined>>;
|
|
22
|
-
/**
|
|
23
|
-
* Provide child elements or text to be rendered inside of this component
|
|
24
|
-
*/
|
|
25
|
-
children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
26
|
-
/**
|
|
27
|
-
* Specify the text direction to be used for this component and any of its
|
|
28
|
-
* children
|
|
29
|
-
*/
|
|
30
|
-
dir: PropTypes.Requireable<string>;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
14
|
+
declare const Text: React.ForwardRefExoticComponent<Omit<TextProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
33
15
|
export { Text };
|
|
@@ -10,7 +10,7 @@ import PropTypes from 'prop-types';
|
|
|
10
10
|
import React__default, { useContext } from 'react';
|
|
11
11
|
import { TextDirectionContext } from './TextDirectionContext.js';
|
|
12
12
|
|
|
13
|
-
function Text(_ref) {
|
|
13
|
+
const Text = /*#__PURE__*/React__default.forwardRef(function Text(_ref, ref) {
|
|
14
14
|
let {
|
|
15
15
|
as,
|
|
16
16
|
children,
|
|
@@ -50,8 +50,10 @@ function Text(_ref) {
|
|
|
50
50
|
}
|
|
51
51
|
return /*#__PURE__*/React__default.createElement(TextDirectionContext.Provider, {
|
|
52
52
|
value: value
|
|
53
|
-
}, /*#__PURE__*/React__default.createElement(BaseComponent, _extends({
|
|
54
|
-
|
|
53
|
+
}, /*#__PURE__*/React__default.createElement(BaseComponent, _extends({
|
|
54
|
+
ref: ref
|
|
55
|
+
}, rest, textProps), children));
|
|
56
|
+
});
|
|
55
57
|
Text.propTypes = {
|
|
56
58
|
/**
|
|
57
59
|
* Provide a custom element type used to render the outermost node
|
|
@@ -87,10 +87,12 @@ const PasswordInput = /*#__PURE__*/React__default.forwardRef(function PasswordIn
|
|
|
87
87
|
placeholder,
|
|
88
88
|
type: inputType,
|
|
89
89
|
className: textInputClasses,
|
|
90
|
+
readOnly,
|
|
90
91
|
ref,
|
|
91
92
|
...rest
|
|
92
93
|
};
|
|
93
94
|
const inputWrapperClasses = cx(`${prefix}--form-item`, `${prefix}--text-input-wrapper`, `${prefix}--password-input-wrapper`, {
|
|
95
|
+
[`${prefix}--text-input-wrapper--readonly`]: readOnly,
|
|
94
96
|
[`${prefix}--text-input-wrapper--light`]: light,
|
|
95
97
|
[`${prefix}--text-input-wrapper--inline`]: inline,
|
|
96
98
|
[`${prefix}--text-input--fluid`]: isFluid
|
|
@@ -173,7 +175,7 @@ const PasswordInput = /*#__PURE__*/React__default.forwardRef(function PasswordIn
|
|
|
173
175
|
}, /*#__PURE__*/React__default.createElement("button", {
|
|
174
176
|
type: "button",
|
|
175
177
|
className: passwordVisibilityToggleClasses,
|
|
176
|
-
disabled: disabled,
|
|
178
|
+
disabled: disabled || readOnly,
|
|
177
179
|
onClick: handleTogglePasswordVisibility
|
|
178
180
|
}, passwordVisibilityIcon)));
|
|
179
181
|
useEffect(() => {
|
|
@@ -232,6 +234,10 @@ PasswordInput.propTypes = {
|
|
|
232
234
|
* Specify whether the control is currently invalid
|
|
233
235
|
*/
|
|
234
236
|
invalid: PropTypes.bool,
|
|
237
|
+
/**
|
|
238
|
+
* Whether the PasswordInput should be read-only
|
|
239
|
+
*/
|
|
240
|
+
readOnly: PropTypes.bool,
|
|
235
241
|
/**
|
|
236
242
|
* Provide the text that is displayed when the control is in an invalid state
|
|
237
243
|
*/
|
|
@@ -40,7 +40,7 @@ const TileGroup = props => {
|
|
|
40
40
|
const traverseAndModifyChildren = children => {
|
|
41
41
|
return React__default.Children.map(children, child => {
|
|
42
42
|
// If RadioTile found, return it with necessary props
|
|
43
|
-
if (child
|
|
43
|
+
if (child?.type === RadioTile) {
|
|
44
44
|
const {
|
|
45
45
|
value,
|
|
46
46
|
...otherProps
|
|
@@ -53,7 +53,7 @@ const TileGroup = props => {
|
|
|
53
53
|
onChange: handleChange,
|
|
54
54
|
checked: value === selected
|
|
55
55
|
}));
|
|
56
|
-
} else if (child
|
|
56
|
+
} else if (child?.props?.children) {
|
|
57
57
|
// If the child is not RadioTile and has children, recheck the children
|
|
58
58
|
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
59
59
|
...child.props,
|
|
@@ -82,12 +82,12 @@ declare const Content: {
|
|
|
82
82
|
"aria-colindextext"?: string | undefined;
|
|
83
83
|
"aria-colspan"?: number | undefined;
|
|
84
84
|
"aria-controls"?: string | undefined;
|
|
85
|
-
"aria-current"?: boolean | "true" | "false" | "time" | "
|
|
85
|
+
"aria-current"?: boolean | "true" | "false" | "time" | "date" | "step" | "page" | "location" | undefined;
|
|
86
86
|
"aria-describedby"?: string | undefined;
|
|
87
87
|
"aria-description"?: string | undefined;
|
|
88
88
|
"aria-details"?: string | undefined;
|
|
89
89
|
"aria-disabled"?: (boolean | "true" | "false") | undefined;
|
|
90
|
-
"aria-dropeffect"?: "link" | "none" | "copy" | "
|
|
90
|
+
"aria-dropeffect"?: "link" | "none" | "copy" | "move" | "execute" | "popup" | undefined;
|
|
91
91
|
"aria-errormessage"?: string | undefined;
|
|
92
92
|
"aria-expanded"?: (boolean | "true" | "false") | undefined;
|
|
93
93
|
"aria-flowto"?: string | undefined;
|
|
@@ -109,7 +109,7 @@ declare const Content: {
|
|
|
109
109
|
"aria-posinset"?: number | undefined;
|
|
110
110
|
"aria-pressed"?: boolean | "true" | "false" | "mixed" | undefined;
|
|
111
111
|
"aria-readonly"?: (boolean | "true" | "false") | undefined;
|
|
112
|
-
"aria-relevant"?: "text" | "
|
|
112
|
+
"aria-relevant"?: "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
|
|
113
113
|
"aria-required"?: (boolean | "true" | "false") | undefined;
|
|
114
114
|
"aria-roledescription"?: string | undefined;
|
|
115
115
|
"aria-rowcount"?: number | undefined;
|
|
@@ -77,7 +77,7 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
|
|
|
77
77
|
getHeaderProps: (getHeaderPropsArgs: {
|
|
78
78
|
header: DataTableHeader;
|
|
79
79
|
isSortable?: boolean;
|
|
80
|
-
onClick?: (e: React.MouseEvent
|
|
80
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement>, sortState: {
|
|
81
81
|
sortHeaderKey: string;
|
|
82
82
|
sortDirection: DataTableSortState;
|
|
83
83
|
}) => void;
|
|
@@ -86,25 +86,25 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
|
|
|
86
86
|
isSortable: boolean | undefined;
|
|
87
87
|
isSortHeader: boolean;
|
|
88
88
|
key: string;
|
|
89
|
-
onClick: (e: MouseEvent) => void;
|
|
89
|
+
onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
90
90
|
sortDirection: DataTableSortState;
|
|
91
91
|
[key: string]: unknown;
|
|
92
92
|
};
|
|
93
93
|
getExpandHeaderProps: (getExpandHeaderPropsArgs?: {
|
|
94
|
-
onClick?: (e: MouseEvent
|
|
94
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement>, expandState: {
|
|
95
95
|
isExpanded?: boolean;
|
|
96
96
|
}) => void;
|
|
97
|
-
onExpand?: (e: MouseEvent) => void;
|
|
97
|
+
onExpand?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
98
98
|
[key: string]: unknown;
|
|
99
99
|
}) => {
|
|
100
100
|
ariaLabel: string;
|
|
101
101
|
['aria-label']: string;
|
|
102
102
|
isExpanded: boolean;
|
|
103
|
-
onExpand: (e: MouseEvent) => void;
|
|
103
|
+
onExpand: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
104
104
|
[key: string]: unknown;
|
|
105
105
|
};
|
|
106
106
|
getRowProps: (getRowPropsArgs: {
|
|
107
|
-
onClick?: (e: MouseEvent) => void;
|
|
107
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
108
108
|
row: DataTableRow<ColTypes>;
|
|
109
109
|
[key: string]: unknown;
|
|
110
110
|
}) => {
|
|
@@ -114,7 +114,7 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
|
|
|
114
114
|
isExpanded?: boolean;
|
|
115
115
|
isSelected?: boolean;
|
|
116
116
|
key: string;
|
|
117
|
-
onExpand: (e: MouseEvent) => void;
|
|
117
|
+
onExpand: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
118
118
|
[key: string]: unknown;
|
|
119
119
|
};
|
|
120
120
|
getExpandedRowProps: (getExpandedRowPropsArgs: {
|
|
@@ -124,20 +124,20 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
|
|
|
124
124
|
['id']: string;
|
|
125
125
|
[key: string]: unknown;
|
|
126
126
|
};
|
|
127
|
-
getSelectionProps: (getSelectionPropsArgs
|
|
128
|
-
onClick?: (e: MouseEvent) => void;
|
|
127
|
+
getSelectionProps: (getSelectionPropsArgs?: {
|
|
128
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
129
129
|
row: DataTableRow<ColTypes>;
|
|
130
130
|
[key: string]: unknown;
|
|
131
131
|
}) => {
|
|
132
132
|
ariaLabel: string;
|
|
133
133
|
'aria-label': string;
|
|
134
|
-
checked
|
|
134
|
+
checked?: boolean;
|
|
135
135
|
disabled?: boolean | undefined;
|
|
136
136
|
id: string;
|
|
137
137
|
indeterminate?: boolean;
|
|
138
138
|
name: string;
|
|
139
|
-
onSelect: (e: MouseEvent) => void;
|
|
140
|
-
radio?: boolean
|
|
139
|
+
onSelect: (e: React.MouseEvent<HTMLInputElement>) => void;
|
|
140
|
+
radio?: boolean;
|
|
141
141
|
[key: string]: unknown;
|
|
142
142
|
};
|
|
143
143
|
getToolbarProps: (getToolbarPropsArgs?: {
|
|
@@ -346,7 +346,7 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
|
|
|
346
346
|
getHeaderProps: ({ header, onClick, isSortable, ...rest }: {
|
|
347
347
|
[key: string]: unknown;
|
|
348
348
|
header: DataTableHeader;
|
|
349
|
-
onClick?: ((e: React.MouseEvent
|
|
349
|
+
onClick?: ((e: React.MouseEvent<HTMLButtonElement>, sortState: {
|
|
350
350
|
sortHeaderKey: string;
|
|
351
351
|
sortDirection: DataTableSortState;
|
|
352
352
|
}) => void) | undefined;
|
|
@@ -369,10 +369,10 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
|
|
|
369
369
|
*/
|
|
370
370
|
getExpandHeaderProps: ({ onClick, onExpand, ...rest }?: {
|
|
371
371
|
[key: string]: unknown;
|
|
372
|
-
onClick?: ((e: MouseEvent
|
|
372
|
+
onClick?: ((e: React.MouseEvent<HTMLButtonElement>, expandState: {
|
|
373
373
|
isExpanded: boolean;
|
|
374
374
|
}) => void) | undefined;
|
|
375
|
-
onExpand?: ((e: MouseEvent) => void) | undefined;
|
|
375
|
+
onExpand?: ((e: React.MouseEvent<HTMLButtonElement>) => void) | undefined;
|
|
376
376
|
}) => {
|
|
377
377
|
ariaLabel: any;
|
|
378
378
|
'aria-label': any;
|
|
@@ -406,7 +406,7 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
|
|
|
406
406
|
*/
|
|
407
407
|
getRowProps: ({ row, onClick, ...rest }: {
|
|
408
408
|
[key: string]: unknown;
|
|
409
|
-
onClick?: ((e: MouseEvent) => void) | undefined;
|
|
409
|
+
onClick?: ((e: React.MouseEvent<HTMLButtonElement>) => void) | undefined;
|
|
410
410
|
row: DataTableRow<ColTypes>;
|
|
411
411
|
}) => {
|
|
412
412
|
key: string;
|
|
@@ -443,7 +443,7 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
|
|
|
443
443
|
*/
|
|
444
444
|
getSelectionProps: ({ onClick, row, ...rest }?: {
|
|
445
445
|
[key: string]: unknown;
|
|
446
|
-
onClick?: ((e: MouseEvent) => void) | undefined;
|
|
446
|
+
onClick?: ((e: React.MouseEvent<HTMLButtonElement>) => void) | undefined;
|
|
447
447
|
row: DataTableRow<ColTypes>;
|
|
448
448
|
}) => {
|
|
449
449
|
checked: boolean | undefined;
|
|
@@ -453,7 +453,7 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
|
|
|
453
453
|
ariaLabel: any;
|
|
454
454
|
'aria-label': any;
|
|
455
455
|
disabled: boolean | undefined;
|
|
456
|
-
radio:
|
|
456
|
+
radio: boolean | undefined;
|
|
457
457
|
} | {
|
|
458
458
|
ariaLabel: any;
|
|
459
459
|
'aria-label': any;
|
|
@@ -269,12 +269,12 @@ class DataTable extends React__default["default"].Component {
|
|
|
269
269
|
checked: row.isSelected,
|
|
270
270
|
onSelect: events.composeEventHandlers([_this.handleOnSelectRow(row.id), onClick]),
|
|
271
271
|
id: `${_this.getTablePrefix()}__select-row-${row.id}`,
|
|
272
|
-
name: `select-row`,
|
|
272
|
+
name: `select-row-${_this.instanceId}`,
|
|
273
273
|
ariaLabel: t(translationKey),
|
|
274
274
|
// TODO remove in v12
|
|
275
275
|
'aria-label': t(translationKey),
|
|
276
276
|
disabled: row.disabled,
|
|
277
|
-
radio: _this.props.radio
|
|
277
|
+
radio: _this.props.radio
|
|
278
278
|
};
|
|
279
279
|
}
|
|
280
280
|
|
|
@@ -34,7 +34,7 @@ interface TableExpandRowProps extends PropsWithChildren<TableRowProps> {
|
|
|
34
34
|
* Specify whether this row is expanded or not. This helps coordinate data
|
|
35
35
|
* attributes so that `TableExpandRow` and `TableExpandedRow` work together
|
|
36
36
|
*/
|
|
37
|
-
isExpanded
|
|
37
|
+
isExpanded?: boolean;
|
|
38
38
|
/**
|
|
39
39
|
* Hook for when a listener initiates a request to expand the given row
|
|
40
40
|
*/
|
|
@@ -114,7 +114,7 @@ TableExpandRow.propTypes = {
|
|
|
114
114
|
* Specify whether this row is expanded or not. This helps coordinate data
|
|
115
115
|
* attributes so that `TableExpandRow` and `TableExpandedRow` work together
|
|
116
116
|
*/
|
|
117
|
-
isExpanded: PropTypes__default["default"].bool
|
|
117
|
+
isExpanded: PropTypes__default["default"].bool,
|
|
118
118
|
/**
|
|
119
119
|
* Specify if the row is selected
|
|
120
120
|
*/
|