@carbon/react 1.56.0-rc.1 → 1.57.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 +848 -848
- package/es/components/ContainedList/ContainedList.d.ts +41 -0
- package/es/components/ContainedList/ContainedList.js +18 -4
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +35 -0
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +5 -3
- package/es/components/DataTable/TableToolbarSearch.js +1 -1
- package/es/components/ExpandableSearch/ExpandableSearch.d.ts +1 -5
- package/es/components/ExpandableSearch/ExpandableSearch.js +4 -3
- package/es/components/OverflowMenu/OverflowMenu.d.ts +300 -0
- package/es/components/OverflowMenu/OverflowMenu.js +22 -14
- package/es/components/OverflowMenu/next/index.d.ts +39 -0
- package/es/components/OverflowMenu/next/index.js +4 -3
- package/es/components/RadioTile/RadioTile.d.ts +4 -0
- package/es/components/RadioTile/RadioTile.js +7 -1
- package/es/components/Slider/Slider.js +9 -5
- package/es/components/StructuredList/StructuredList.js +6 -2
- package/es/components/TextInput/PasswordInput.js +25 -7
- package/es/components/TileGroup/TileGroup.d.ts +8 -0
- package/es/components/TileGroup/TileGroup.js +7 -1
- package/es/index.js +1 -1
- package/es/internal/Selection.js +4 -1
- package/lib/components/ContainedList/ContainedList.d.ts +41 -0
- package/lib/components/ContainedList/ContainedList.js +18 -4
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +35 -0
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +5 -3
- package/lib/components/DataTable/TableToolbarSearch.js +1 -1
- package/lib/components/ExpandableSearch/ExpandableSearch.d.ts +1 -5
- package/lib/components/ExpandableSearch/ExpandableSearch.js +4 -3
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +300 -0
- package/lib/components/OverflowMenu/OverflowMenu.js +21 -13
- package/lib/components/OverflowMenu/next/index.d.ts +39 -0
- package/lib/components/OverflowMenu/next/index.js +4 -3
- package/lib/components/RadioTile/RadioTile.d.ts +4 -0
- package/lib/components/RadioTile/RadioTile.js +7 -1
- package/lib/components/Slider/Slider.js +9 -5
- package/lib/components/StructuredList/StructuredList.js +6 -2
- package/lib/components/TextInput/PasswordInput.js +25 -7
- package/lib/components/TileGroup/TileGroup.d.ts +8 -0
- package/lib/components/TileGroup/TileGroup.js +7 -1
- package/lib/index.js +2 -2
- package/lib/internal/Selection.js +4 -1
- package/package.json +8 -8
- package/telemetry.yml +1 -1
|
@@ -50,6 +50,10 @@ export interface RadioTileProps {
|
|
|
50
50
|
* Specify the value of the underlying `<input>`.
|
|
51
51
|
*/
|
|
52
52
|
value: string | number;
|
|
53
|
+
/**
|
|
54
|
+
* `true` to specify if the input is required.
|
|
55
|
+
*/
|
|
56
|
+
required?: boolean;
|
|
53
57
|
}
|
|
54
58
|
declare const RadioTile: React.ForwardRefExoticComponent<RadioTileProps & React.RefAttributes<HTMLInputElement>>;
|
|
55
59
|
export default RadioTile;
|
|
@@ -33,6 +33,7 @@ const RadioTile = /*#__PURE__*/React__default.forwardRef(function RadioTile(_ref
|
|
|
33
33
|
id,
|
|
34
34
|
onChange = noopFn,
|
|
35
35
|
tabIndex = 0,
|
|
36
|
+
required,
|
|
36
37
|
...rest
|
|
37
38
|
} = _ref;
|
|
38
39
|
const prefix = usePrefix();
|
|
@@ -74,7 +75,8 @@ const RadioTile = /*#__PURE__*/React__default.forwardRef(function RadioTile(_ref
|
|
|
74
75
|
tabIndex: !disabled ? tabIndex : undefined,
|
|
75
76
|
type: "radio",
|
|
76
77
|
value: value,
|
|
77
|
-
ref: ref
|
|
78
|
+
ref: ref,
|
|
79
|
+
required: required
|
|
78
80
|
}), /*#__PURE__*/React__default.createElement("label", _extends({}, rest, {
|
|
79
81
|
htmlFor: inputId,
|
|
80
82
|
className: className
|
|
@@ -120,6 +122,10 @@ RadioTile.propTypes = {
|
|
|
120
122
|
* the underlying `<input>` changes.
|
|
121
123
|
*/
|
|
122
124
|
onChange: PropTypes.func,
|
|
125
|
+
/**
|
|
126
|
+
* `true` to specify if the control is required.
|
|
127
|
+
*/
|
|
128
|
+
required: PropTypes.bool,
|
|
123
129
|
/**
|
|
124
130
|
* Specify the tab index of the underlying `<input>`.
|
|
125
131
|
*/
|
|
@@ -427,6 +427,10 @@ class Slider extends PureComponent {
|
|
|
427
427
|
}
|
|
428
428
|
});
|
|
429
429
|
_defineProperty(this, "processNewInputValue", input => {
|
|
430
|
+
this.setState({
|
|
431
|
+
correctedValue: null,
|
|
432
|
+
correctedPosition: null
|
|
433
|
+
});
|
|
430
434
|
const targetValue = Number.parseFloat(input.value);
|
|
431
435
|
const validity = !isNaN(targetValue);
|
|
432
436
|
|
|
@@ -507,7 +511,7 @@ class Slider extends PureComponent {
|
|
|
507
511
|
if (clientX) {
|
|
508
512
|
const leftOffset = this.state.isRtl ? (boundingRect?.right ?? 0) - clientX : clientX - (boundingRect?.left ?? 0);
|
|
509
513
|
return leftOffset / width;
|
|
510
|
-
} else if (value && range) {
|
|
514
|
+
} else if (value !== null && value !== undefined && range) {
|
|
511
515
|
// Prevent NaN calculation if the range is 0.
|
|
512
516
|
return range === 0 ? 0 : (value - this.props.min) / range;
|
|
513
517
|
}
|
|
@@ -978,8 +982,8 @@ class Slider extends PureComponent {
|
|
|
978
982
|
correctedPosition,
|
|
979
983
|
isRtl
|
|
980
984
|
} = this.state;
|
|
981
|
-
const showWarning = !readOnly && warn
|
|
982
|
-
const showWarningUpper = !readOnly && warn
|
|
985
|
+
const showWarning = !readOnly && warn || typeof correctedValue !== null && correctedPosition === HandlePosition.LOWER && isValid;
|
|
986
|
+
const showWarningUpper = !readOnly && warn || typeof correctedValue !== null && correctedPosition === (twoHandles ? HandlePosition.UPPER : HandlePosition.LOWER) && (twoHandles ? isValidUpper : isValid);
|
|
983
987
|
return /*#__PURE__*/React__default.createElement(PrefixContext.Consumer, null, prefix => {
|
|
984
988
|
const labelId = `${id}-label`;
|
|
985
989
|
const labelClasses = cx(`${prefix}--label`, {
|
|
@@ -1089,7 +1093,7 @@ class Slider extends PureComponent {
|
|
|
1089
1093
|
hasTooltip: hideTextInput,
|
|
1090
1094
|
className: lowerThumbWrapperClasses,
|
|
1091
1095
|
label: `${value}`,
|
|
1092
|
-
align:
|
|
1096
|
+
align: "top"
|
|
1093
1097
|
}, lowerThumbWrapperProps), /*#__PURE__*/React__default.createElement("div", {
|
|
1094
1098
|
className: lowerThumbClasses,
|
|
1095
1099
|
role: "slider",
|
|
@@ -1108,7 +1112,7 @@ class Slider extends PureComponent {
|
|
|
1108
1112
|
hasTooltip: hideTextInput,
|
|
1109
1113
|
className: upperThumbWrapperClasses,
|
|
1110
1114
|
label: `${valueUpper}`,
|
|
1111
|
-
align: "top
|
|
1115
|
+
align: "top"
|
|
1112
1116
|
}, upperThumbWrapperProps), /*#__PURE__*/React__default.createElement("div", {
|
|
1113
1117
|
className: upperThumbClasses,
|
|
1114
1118
|
role: "slider",
|
|
@@ -17,7 +17,7 @@ import { RadioButtonChecked, RadioButton } from '@carbon/icons-react';
|
|
|
17
17
|
import { useOutsideClick } from '../../internal/useOutsideClick.js';
|
|
18
18
|
import { Text } from '../Text/Text.js';
|
|
19
19
|
|
|
20
|
-
var _StructuredListCell
|
|
20
|
+
var _StructuredListCell;
|
|
21
21
|
const GridSelectedRowStateContext = /*#__PURE__*/React__default.createContext(null);
|
|
22
22
|
const GridSelectedRowDispatchContext = /*#__PURE__*/React__default.createContext(null);
|
|
23
23
|
function StructuredListWrapper(props) {
|
|
@@ -192,7 +192,11 @@ function StructuredListRow(props) {
|
|
|
192
192
|
onKeyDown: onKeyDown
|
|
193
193
|
}), /*#__PURE__*/React__default.createElement(GridRowContext.Provider, {
|
|
194
194
|
value: value
|
|
195
|
-
}, selection && /*#__PURE__*/React__default.createElement(StructuredListCell, null, selectedRow === id ?
|
|
195
|
+
}, selection && /*#__PURE__*/React__default.createElement(StructuredListCell, null, selectedRow === id ? /*#__PURE__*/React__default.createElement(RadioButtonChecked, {
|
|
196
|
+
className: `${prefix}--structured-list__icon`
|
|
197
|
+
}) : /*#__PURE__*/React__default.createElement(RadioButton, {
|
|
198
|
+
className: `${prefix}--structured-list__icon`
|
|
199
|
+
})), children));
|
|
196
200
|
}
|
|
197
201
|
StructuredListRow.propTypes = {
|
|
198
202
|
/**
|
|
@@ -14,6 +14,8 @@ import { useNormalizedInputProps } from '../../internal/useNormalizedInputProps.
|
|
|
14
14
|
import { textInputProps } from './util.js';
|
|
15
15
|
import '../FluidForm/FluidForm.js';
|
|
16
16
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
17
|
+
import '../Tooltip/DefinitionTooltip.js';
|
|
18
|
+
import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
17
19
|
import deprecate from '../../prop-types/deprecate.js';
|
|
18
20
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
19
21
|
|
|
@@ -38,7 +40,7 @@ const PasswordInput = /*#__PURE__*/React__default.forwardRef(function PasswordIn
|
|
|
38
40
|
size = 'md',
|
|
39
41
|
showPasswordLabel = 'Show password',
|
|
40
42
|
tooltipPosition = 'bottom',
|
|
41
|
-
tooltipAlignment = '
|
|
43
|
+
tooltipAlignment = 'end',
|
|
42
44
|
type = 'password',
|
|
43
45
|
warn = false,
|
|
44
46
|
warnText,
|
|
@@ -127,11 +129,25 @@ const PasswordInput = /*#__PURE__*/React__default.forwardRef(function PasswordIn
|
|
|
127
129
|
}) : /*#__PURE__*/React__default.createElement(View, {
|
|
128
130
|
className: `${prefix}--icon-visibility-on`
|
|
129
131
|
});
|
|
130
|
-
const passwordVisibilityToggleClasses = cx(`${prefix}--text-input--password__visibility__toggle`, `${prefix}--btn`, `${prefix}--
|
|
131
|
-
[`${prefix}--btn--disabled`]: disabled,
|
|
132
|
+
const passwordVisibilityToggleClasses = cx(`${prefix}--text-input--password__visibility__toggle`, `${prefix}--btn`, `${prefix}--tooltip__trigger`, `${prefix}--tooltip--a11y`, {
|
|
132
133
|
[`${prefix}--tooltip--${tooltipPosition}`]: tooltipPosition,
|
|
133
134
|
[`${prefix}--tooltip--align-${tooltipAlignment}`]: tooltipAlignment
|
|
134
135
|
});
|
|
136
|
+
let align = undefined;
|
|
137
|
+
if (tooltipPosition === 'top' || tooltipPosition === 'bottom') {
|
|
138
|
+
if (tooltipAlignment === 'center') {
|
|
139
|
+
align = tooltipPosition;
|
|
140
|
+
}
|
|
141
|
+
if (tooltipAlignment === 'end') {
|
|
142
|
+
align = `${tooltipPosition}-right`;
|
|
143
|
+
}
|
|
144
|
+
if (tooltipAlignment === 'start') {
|
|
145
|
+
align = `${tooltipPosition}-left`;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (tooltipPosition === 'right' || tooltipPosition === 'left') {
|
|
149
|
+
align = tooltipPosition;
|
|
150
|
+
}
|
|
135
151
|
const input = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("input", _extends({}, textInputProps({
|
|
136
152
|
sharedTextInputProps,
|
|
137
153
|
invalid: normalizedProps.invalid,
|
|
@@ -145,14 +161,16 @@ const PasswordInput = /*#__PURE__*/React__default.forwardRef(function PasswordIn
|
|
|
145
161
|
"data-toggle-password-visibility": inputType === 'password'
|
|
146
162
|
})), isFluid && /*#__PURE__*/React__default.createElement("hr", {
|
|
147
163
|
className: `${prefix}--text-input__divider`
|
|
148
|
-
}), /*#__PURE__*/React__default.createElement(
|
|
164
|
+
}), /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
165
|
+
align: align,
|
|
166
|
+
className: `${prefix}--toggle-password-tooltip`,
|
|
167
|
+
label: passwordIsVisible ? hidePasswordLabel : showPasswordLabel
|
|
168
|
+
}, /*#__PURE__*/React__default.createElement("button", {
|
|
149
169
|
type: "button",
|
|
150
170
|
className: passwordVisibilityToggleClasses,
|
|
151
171
|
disabled: disabled,
|
|
152
172
|
onClick: handleTogglePasswordVisibility
|
|
153
|
-
},
|
|
154
|
-
className: `${prefix}--assistive-text`
|
|
155
|
-
}, passwordIsVisible ? hidePasswordLabel : showPasswordLabel), passwordVisibilityIcon));
|
|
173
|
+
}, passwordVisibilityIcon)));
|
|
156
174
|
useEffect(() => {
|
|
157
175
|
setInputType(type);
|
|
158
176
|
}, [type]);
|
|
@@ -40,6 +40,10 @@ export interface TileGroupProps extends Omit<ReactAttr<HTMLFieldSetElement>, Exc
|
|
|
40
40
|
* Specify the value that is currently selected in the group
|
|
41
41
|
*/
|
|
42
42
|
valueSelected?: string | number;
|
|
43
|
+
/**
|
|
44
|
+
* `true` to specify if input selection in group is required.
|
|
45
|
+
*/
|
|
46
|
+
required?: boolean;
|
|
43
47
|
}
|
|
44
48
|
declare const TileGroup: {
|
|
45
49
|
(props: any): import("react/jsx-runtime").JSX.Element;
|
|
@@ -73,6 +77,10 @@ declare const TileGroup: {
|
|
|
73
77
|
* the group changes
|
|
74
78
|
*/
|
|
75
79
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
80
|
+
/**
|
|
81
|
+
* `true` to specify if input selection in group is required.
|
|
82
|
+
*/
|
|
83
|
+
required: PropTypes.Requireable<boolean>;
|
|
76
84
|
/**
|
|
77
85
|
* Specify the value that is currently selected in the group
|
|
78
86
|
*/
|
|
@@ -21,7 +21,8 @@ const TileGroup = props => {
|
|
|
21
21
|
legend,
|
|
22
22
|
name,
|
|
23
23
|
onChange = noopFn,
|
|
24
|
-
valueSelected
|
|
24
|
+
valueSelected,
|
|
25
|
+
required
|
|
25
26
|
} = props;
|
|
26
27
|
const prefix = usePrefix();
|
|
27
28
|
const [selected, setSelected] = useState(valueSelected ?? defaultSelected);
|
|
@@ -45,6 +46,7 @@ const TileGroup = props => {
|
|
|
45
46
|
...otherProps
|
|
46
47
|
} = child.props;
|
|
47
48
|
return /*#__PURE__*/React__default.createElement(RadioTile, _extends({}, otherProps, {
|
|
49
|
+
required: required,
|
|
48
50
|
name: name,
|
|
49
51
|
key: value,
|
|
50
52
|
value: value,
|
|
@@ -113,6 +115,10 @@ TileGroup.propTypes = {
|
|
|
113
115
|
* the group changes
|
|
114
116
|
*/
|
|
115
117
|
onChange: PropTypes.func,
|
|
118
|
+
/**
|
|
119
|
+
* `true` to specify if input selection in group is required.
|
|
120
|
+
*/
|
|
121
|
+
required: PropTypes.bool,
|
|
116
122
|
/**
|
|
117
123
|
* Specify the value that is currently selected in the group
|
|
118
124
|
*/
|
package/es/index.js
CHANGED
|
@@ -179,7 +179,6 @@ export { default as unstable_PageSelector } from './components/Pagination/experi
|
|
|
179
179
|
export { default as unstable_Pagination } from './components/Pagination/experimental/Pagination.js';
|
|
180
180
|
export { default as CheckboxGroup } from './components/CheckboxGroup/CheckboxGroup.js';
|
|
181
181
|
export { default as ContainedListItem } from './components/ContainedList/ContainedListItem/ContainedListItem.js';
|
|
182
|
-
export { default as ContainedList } from './components/ContainedList/ContainedList.js';
|
|
183
182
|
export { default as useContextMenu } from './components/ContextMenu/useContextMenu.js';
|
|
184
183
|
export { default as SliderSkeleton } from './components/Slider/Slider.Skeleton.js';
|
|
185
184
|
export { default as TextInputSkeleton } from './components/TextInput/TextInput.Skeleton.js';
|
|
@@ -204,6 +203,7 @@ export { default as unstable__ChatButton } from './components/ChatButton/ChatBut
|
|
|
204
203
|
export { default as unstable__ChatButtonSkeleton } from './components/ChatButton/ChatButton.Skeleton.js';
|
|
205
204
|
export { Text as unstable_Text } from './components/Text/Text.js';
|
|
206
205
|
export { TextDirection as unstable_TextDirection } from './components/Text/TextDirection.js';
|
|
206
|
+
export { default as ContainedList } from './components/ContainedList/ContainedList.js';
|
|
207
207
|
export { default as DataTable } from './components/DataTable/DataTable.js';
|
|
208
208
|
export { Table } from './components/DataTable/Table.js';
|
|
209
209
|
export { default as TableActionList } from './components/DataTable/TableActionList.js';
|
package/es/internal/Selection.js
CHANGED
|
@@ -40,6 +40,9 @@ function useSelection(_ref2) {
|
|
|
40
40
|
const [uncontrolledItems, setUncontrolledItems] = useState(initialSelectedItems);
|
|
41
41
|
const isControlled = !!controlledItems;
|
|
42
42
|
const [selectedItems, setSelectedItems] = useState(isControlled ? controlledItems : uncontrolledItems);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
setSelectedItems(isControlled ? controlledItems : uncontrolledItems);
|
|
45
|
+
}, [isControlled, controlledItems, uncontrolledItems]);
|
|
43
46
|
useEffect(() => {
|
|
44
47
|
callOnChangeHandler({
|
|
45
48
|
isControlled,
|
|
@@ -74,7 +77,7 @@ function useSelection(_ref2) {
|
|
|
74
77
|
isMounted: isMounted.current,
|
|
75
78
|
onChangeHandlerControlled: savedOnChange.current,
|
|
76
79
|
onChangeHandlerUncontrolled: setUncontrolledItems,
|
|
77
|
-
selectedItems:
|
|
80
|
+
selectedItems: []
|
|
78
81
|
});
|
|
79
82
|
}, [disabled, isControlled]);
|
|
80
83
|
useEffect(() => {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2022
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React, { ReactNode } from 'react';
|
|
8
|
+
declare const variants: readonly ["on-page", "disclosed"];
|
|
9
|
+
type Variants = (typeof variants)[number];
|
|
10
|
+
interface ContainedListProps {
|
|
11
|
+
/**
|
|
12
|
+
* A slot for a possible interactive element to render.
|
|
13
|
+
*/
|
|
14
|
+
action?: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* A collection of ContainedListItems to be rendered in the ContainedList
|
|
17
|
+
*/
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Additional CSS class names.
|
|
21
|
+
*/
|
|
22
|
+
className?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Specify whether the dividing lines in between list items should be inset.
|
|
25
|
+
*/
|
|
26
|
+
isInset?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The kind of ContainedList you want to display
|
|
29
|
+
*/
|
|
30
|
+
kind?: Variants;
|
|
31
|
+
/**
|
|
32
|
+
* A label describing the contained list.
|
|
33
|
+
*/
|
|
34
|
+
label: string | ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* Specify the size of the contained list.
|
|
37
|
+
*/
|
|
38
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
39
|
+
}
|
|
40
|
+
declare const ContainedList: React.FC<ContainedListProps>;
|
|
41
|
+
export default ContainedList;
|
|
@@ -47,7 +47,7 @@ function renderChildren(children) {
|
|
|
47
47
|
}
|
|
48
48
|
return children;
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
const ContainedList = _ref => {
|
|
51
51
|
let {
|
|
52
52
|
action,
|
|
53
53
|
children,
|
|
@@ -67,7 +67,20 @@ function ContainedList(_ref) {
|
|
|
67
67
|
[`${prefix}--layout--size-${size}`]: size
|
|
68
68
|
}, `${prefix}--contained-list--${kind}`, className);
|
|
69
69
|
const filteredChildren = filterChildren(children);
|
|
70
|
-
|
|
70
|
+
function isSearchAction(action) {
|
|
71
|
+
if (! /*#__PURE__*/React__default["default"].isValidElement(action)) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
const actionTypes = ['Search', 'ExpandableSearch'];
|
|
75
|
+
let actionType = '';
|
|
76
|
+
if (typeof action.type === 'string') {
|
|
77
|
+
actionType = action.type;
|
|
78
|
+
} else {
|
|
79
|
+
actionType = action.type.displayName || '';
|
|
80
|
+
}
|
|
81
|
+
return actionTypes.includes(actionType);
|
|
82
|
+
}
|
|
83
|
+
const isActionSearch = isSearchAction(action);
|
|
71
84
|
const renderedChildren = renderChildren(children);
|
|
72
85
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
73
86
|
className: classes
|
|
@@ -96,7 +109,7 @@ function ContainedList(_ref) {
|
|
|
96
109
|
role: "list",
|
|
97
110
|
"aria-labelledby": labelId
|
|
98
111
|
}, isActionSearch ? filteredChildren : renderedChildren));
|
|
99
|
-
}
|
|
112
|
+
};
|
|
100
113
|
ContainedList.propTypes = {
|
|
101
114
|
/**
|
|
102
115
|
* A slot for a possible interactive element to render.
|
|
@@ -127,5 +140,6 @@ ContainedList.propTypes = {
|
|
|
127
140
|
*/
|
|
128
141
|
size: PropTypes__default["default"].oneOf(['sm', 'md', 'lg', 'xl'])
|
|
129
142
|
};
|
|
143
|
+
var ContainedList$1 = ContainedList;
|
|
130
144
|
|
|
131
|
-
exports["default"] = ContainedList;
|
|
145
|
+
exports["default"] = ContainedList$1;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2022
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React, { type ComponentType, type FunctionComponent, ReactNode } from 'react';
|
|
8
|
+
interface ContainedListItemProps {
|
|
9
|
+
/**
|
|
10
|
+
* A slot for a possible interactive element to render within the item.
|
|
11
|
+
*/
|
|
12
|
+
action?: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* The content of this item. Must not contain any interactive elements. Use props.action to include those.
|
|
15
|
+
*/
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Additional CSS class names.
|
|
19
|
+
*/
|
|
20
|
+
className?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Whether this item is disabled.
|
|
23
|
+
*/
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Provide an optional function to be called when the item is clicked.
|
|
27
|
+
*/
|
|
28
|
+
onClick?: () => void;
|
|
29
|
+
/**
|
|
30
|
+
* Provide an optional icon to render in front of the item's content.
|
|
31
|
+
*/
|
|
32
|
+
renderIcon?: ComponentType | FunctionComponent;
|
|
33
|
+
}
|
|
34
|
+
declare const ContainedListItem: React.FC<ContainedListItemProps>;
|
|
35
|
+
export default ContainedListItem;
|
|
@@ -22,7 +22,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
22
22
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
23
23
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
const ContainedListItem = _ref => {
|
|
26
26
|
let {
|
|
27
27
|
action,
|
|
28
28
|
children,
|
|
@@ -58,7 +58,7 @@ function ContainedListItem(_ref) {
|
|
|
58
58
|
},
|
|
59
59
|
className: `${prefix}--contained-list-item__action`
|
|
60
60
|
}, action));
|
|
61
|
-
}
|
|
61
|
+
};
|
|
62
62
|
ContainedListItem.propTypes = {
|
|
63
63
|
/**
|
|
64
64
|
* A slot for a possible interactive element to render within the item.
|
|
@@ -83,7 +83,9 @@ ContainedListItem.propTypes = {
|
|
|
83
83
|
/**
|
|
84
84
|
* Provide an optional icon to render in front of the item's content.
|
|
85
85
|
*/
|
|
86
|
+
// @ts-expect-error: PropTypes are not expressive enough to cover this case
|
|
86
87
|
renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object])
|
|
87
88
|
};
|
|
89
|
+
var ContainedListItem$1 = ContainedListItem;
|
|
88
90
|
|
|
89
|
-
exports["default"] = ContainedListItem;
|
|
91
|
+
exports["default"] = ContainedListItem$1;
|
|
@@ -108,7 +108,7 @@ const TableToolbarSearch = _ref => {
|
|
|
108
108
|
disabled: disabled,
|
|
109
109
|
className: searchClasses,
|
|
110
110
|
value: value,
|
|
111
|
-
id: typeof id !== 'undefined' ? id : uniqueId.toString()
|
|
111
|
+
id: typeof id !== 'undefined' ? id : `table-toolbar-search-${uniqueId.toString()}`,
|
|
112
112
|
labelText: labelText || t('carbon.table.toolbar.search.label'),
|
|
113
113
|
placeholder: placeholder || t('carbon.table.toolbar.search.placeholder'),
|
|
114
114
|
onChange: onChange,
|
|
@@ -6,9 +6,5 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { type SearchProps } from '../Search';
|
|
9
|
-
declare
|
|
10
|
-
declare namespace ExpandableSearch {
|
|
11
|
-
var propTypes: React.WeakValidationMap<SearchProps & React.RefAttributes<HTMLInputElement>> | undefined;
|
|
12
|
-
var displayName: string;
|
|
13
|
-
}
|
|
9
|
+
declare const ExpandableSearch: React.ForwardRefExoticComponent<SearchProps & React.RefAttributes<HTMLInputElement>>;
|
|
14
10
|
export default ExpandableSearch;
|
|
@@ -16,6 +16,7 @@ var Search = require('../Search/Search.js');
|
|
|
16
16
|
require('../Search/Search.Skeleton.js');
|
|
17
17
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
18
|
var events = require('../../tools/events.js');
|
|
19
|
+
var mergeRefs = require('../../tools/mergeRefs.js');
|
|
19
20
|
var match = require('../../internal/keyboard/match.js');
|
|
20
21
|
var keys = require('../../internal/keyboard/keys.js');
|
|
21
22
|
|
|
@@ -24,7 +25,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
24
25
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
25
26
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
26
27
|
|
|
27
|
-
function ExpandableSearch(_ref) {
|
|
28
|
+
const ExpandableSearch = /*#__PURE__*/React__default["default"].forwardRef(function ExpandableSearch(_ref, forwardedRef) {
|
|
28
29
|
let {
|
|
29
30
|
onBlur,
|
|
30
31
|
onChange,
|
|
@@ -70,14 +71,14 @@ function ExpandableSearch(_ref) {
|
|
|
70
71
|
return /*#__PURE__*/React__default["default"].createElement(Search["default"], _rollupPluginBabelHelpers["extends"]({}, props, {
|
|
71
72
|
defaultValue: defaultValue,
|
|
72
73
|
isExpanded: expanded,
|
|
73
|
-
ref: searchRef,
|
|
74
|
+
ref: mergeRefs["default"](searchRef, forwardedRef),
|
|
74
75
|
className: classes,
|
|
75
76
|
onBlur: events.composeEventHandlers([onBlur, handleBlur]),
|
|
76
77
|
onChange: events.composeEventHandlers([onChange, handleChange]),
|
|
77
78
|
onExpand: events.composeEventHandlers([onExpand, handleExpand]),
|
|
78
79
|
onKeyDown: events.composeEventHandlers([onKeyDown, handleKeyDown])
|
|
79
80
|
}));
|
|
80
|
-
}
|
|
81
|
+
});
|
|
81
82
|
ExpandableSearch.propTypes = Search["default"].propTypes;
|
|
82
83
|
ExpandableSearch.displayName = 'ExpandableSearch';
|
|
83
84
|
|