@carbon/react 1.70.0 → 1.71.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 +972 -947
- package/es/components/AILabel/index.js +15 -15
- package/es/components/Checkbox/Checkbox.d.ts +5 -0
- package/es/components/Checkbox/Checkbox.js +16 -7
- package/es/components/CheckboxGroup/CheckboxGroup.d.ts +5 -0
- package/es/components/CheckboxGroup/CheckboxGroup.js +16 -7
- package/es/components/CodeSnippet/CodeSnippet.d.ts +5 -2
- package/es/components/CodeSnippet/CodeSnippet.js +40 -1
- package/es/components/ComboBox/ComboBox.d.ts +1 -1
- package/es/components/ComboBox/ComboBox.js +19 -22
- package/es/components/ComboButton/index.js +40 -1
- package/es/components/ComposedModal/ComposedModal.d.ts +5 -0
- package/es/components/ComposedModal/ComposedModal.js +16 -10
- package/es/components/ContentSwitcher/ContentSwitcher.d.ts +2 -2
- package/es/components/ContentSwitcher/ContentSwitcher.js +1 -1
- package/es/components/Copy/Copy.d.ts +5 -2
- package/es/components/Copy/Copy.js +40 -1
- package/es/components/CopyButton/CopyButton.d.ts +5 -2
- package/es/components/CopyButton/CopyButton.js +40 -1
- package/es/components/DataTable/TableSelectRow.js +14 -6
- package/es/components/DataTable/TableToolbarSearch.js +1 -1
- package/es/components/DataTable/stories/examples/TableToolbarFilter.d.ts +1 -1
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +2 -2
- package/es/components/DatePickerInput/DatePickerInput.d.ts +6 -1
- package/es/components/DatePickerInput/DatePickerInput.js +16 -10
- package/es/components/Dropdown/Dropdown.d.ts +5 -0
- package/es/components/Dropdown/Dropdown.js +132 -92
- package/es/components/FeatureFlags/index.js +1 -2
- package/es/components/FluidNumberInput/FluidNumberInput.d.ts +4 -0
- package/es/components/FluidSelect/FluidSelect.d.ts +4 -0
- package/es/components/FluidSelect/FluidSelect.js +5 -1
- package/es/components/FluidTextArea/FluidTextArea.d.ts +4 -0
- package/es/components/FluidTextArea/FluidTextArea.js +5 -1
- package/es/components/FluidTextInput/FluidPasswordInput.d.ts +4 -0
- package/es/components/FluidTextInput/FluidPasswordInput.js +5 -1
- package/es/components/FluidTextInput/FluidTextInput.d.ts +4 -0
- package/es/components/FluidTextInput/FluidTextInput.js +5 -1
- package/es/components/FluidTimePicker/FluidTimePicker.d.ts +4 -0
- package/es/components/FluidTimePicker/FluidTimePicker.js +23 -7
- package/es/components/IconButton/index.d.ts +4 -1
- package/es/components/IconButton/index.js +40 -1
- package/es/components/InlineCheckbox/InlineCheckbox.d.ts +50 -0
- package/es/components/InlineCheckbox/InlineCheckbox.js +3 -6
- package/es/components/InlineCheckbox/index.d.ts +9 -0
- package/es/components/LayoutDirection/LayoutDirection.d.ts +44 -0
- package/es/components/LayoutDirection/LayoutDirectionContext.d.ts +10 -0
- package/es/components/LayoutDirection/useLayoutDirection.d.ts +12 -0
- package/es/components/Menu/MenuItem.js +0 -3
- package/es/components/Modal/Modal.d.ts +5 -0
- package/es/components/Modal/Modal.js +16 -10
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +1 -1
- package/es/components/MultiSelect/FilterableMultiSelect.js +1 -2
- package/es/components/MultiSelect/MultiSelect.js +1 -1
- package/es/components/Notification/Notification.d.ts +9 -2
- package/es/components/Notification/Notification.js +16 -2
- package/es/components/NumberInput/NumberInput.d.ts +5 -0
- package/es/components/NumberInput/NumberInput.js +17 -9
- package/es/components/OverflowMenu/next/index.js +40 -1
- package/es/components/Pagination/Pagination.js +1 -1
- package/es/components/PaginationNav/PaginationNav.d.ts +1 -1
- package/es/components/PaginationNav/PaginationNav.js +22 -5
- package/es/components/RadioButton/RadioButton.d.ts +5 -0
- package/es/components/RadioButton/RadioButton.js +16 -7
- package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +5 -0
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +16 -7
- package/es/components/RadioTile/RadioTile.d.ts +5 -0
- package/es/components/RadioTile/RadioTile.js +17 -8
- package/es/components/Tabs/Tabs.js +46 -29
- package/es/components/Tag/DismissibleTag.d.ts +11 -2
- package/es/components/Tag/DismissibleTag.js +13 -5
- package/es/components/Tag/Tag.d.ts +5 -0
- package/es/components/Tag/Tag.js +14 -7
- package/es/components/TextArea/TextArea.d.ts +5 -0
- package/es/components/TextArea/TextArea.js +15 -7
- package/es/components/TextInput/TextInput.d.ts +5 -0
- package/es/components/TextInput/TextInput.js +15 -7
- package/es/components/Tile/Tile.d.ts +21 -1
- package/es/components/Tile/Tile.js +68 -48
- package/es/components/UIShell/SideNavMenuItem.d.ts +5 -1
- package/es/components/UIShell/SideNavMenuItem.js +7 -2
- package/lib/components/AILabel/index.js +15 -15
- package/lib/components/Checkbox/Checkbox.d.ts +5 -0
- package/lib/components/Checkbox/Checkbox.js +16 -7
- package/lib/components/CheckboxGroup/CheckboxGroup.d.ts +5 -0
- package/lib/components/CheckboxGroup/CheckboxGroup.js +16 -7
- package/lib/components/CodeSnippet/CodeSnippet.d.ts +5 -2
- package/lib/components/CodeSnippet/CodeSnippet.js +40 -1
- package/lib/components/ComboBox/ComboBox.d.ts +1 -1
- package/lib/components/ComboBox/ComboBox.js +19 -22
- package/lib/components/ComboButton/index.js +40 -1
- package/lib/components/ComposedModal/ComposedModal.d.ts +5 -0
- package/lib/components/ComposedModal/ComposedModal.js +16 -10
- package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +2 -2
- package/lib/components/ContentSwitcher/ContentSwitcher.js +1 -1
- package/lib/components/Copy/Copy.d.ts +5 -2
- package/lib/components/Copy/Copy.js +40 -1
- package/lib/components/CopyButton/CopyButton.d.ts +5 -2
- package/lib/components/CopyButton/CopyButton.js +40 -1
- package/lib/components/DataTable/TableSelectRow.js +14 -6
- package/lib/components/DataTable/TableToolbarSearch.js +1 -1
- package/lib/components/DataTable/stories/examples/TableToolbarFilter.d.ts +1 -1
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +2 -2
- package/lib/components/DatePickerInput/DatePickerInput.d.ts +6 -1
- package/lib/components/DatePickerInput/DatePickerInput.js +16 -10
- package/lib/components/Dropdown/Dropdown.d.ts +5 -0
- package/lib/components/Dropdown/Dropdown.js +131 -91
- package/lib/components/FeatureFlags/index.js +1 -2
- package/lib/components/FluidNumberInput/FluidNumberInput.d.ts +4 -0
- package/lib/components/FluidSelect/FluidSelect.d.ts +4 -0
- package/lib/components/FluidSelect/FluidSelect.js +5 -1
- package/lib/components/FluidTextArea/FluidTextArea.d.ts +4 -0
- package/lib/components/FluidTextArea/FluidTextArea.js +5 -1
- package/lib/components/FluidTextInput/FluidPasswordInput.d.ts +4 -0
- package/lib/components/FluidTextInput/FluidPasswordInput.js +5 -1
- package/lib/components/FluidTextInput/FluidTextInput.d.ts +4 -0
- package/lib/components/FluidTextInput/FluidTextInput.js +5 -1
- package/lib/components/FluidTimePicker/FluidTimePicker.d.ts +4 -0
- package/lib/components/FluidTimePicker/FluidTimePicker.js +23 -7
- package/lib/components/IconButton/index.d.ts +4 -1
- package/lib/components/IconButton/index.js +40 -1
- package/lib/components/InlineCheckbox/InlineCheckbox.d.ts +50 -0
- package/lib/components/InlineCheckbox/InlineCheckbox.js +3 -6
- package/lib/components/InlineCheckbox/index.d.ts +9 -0
- package/lib/components/LayoutDirection/LayoutDirection.d.ts +44 -0
- package/lib/components/LayoutDirection/LayoutDirectionContext.d.ts +10 -0
- package/lib/components/LayoutDirection/useLayoutDirection.d.ts +12 -0
- package/lib/components/Menu/MenuItem.js +0 -3
- package/lib/components/Modal/Modal.d.ts +5 -0
- package/lib/components/Modal/Modal.js +16 -10
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +1 -1
- package/lib/components/MultiSelect/FilterableMultiSelect.js +1 -2
- package/lib/components/MultiSelect/MultiSelect.js +1 -1
- package/lib/components/Notification/Notification.d.ts +9 -2
- package/lib/components/Notification/Notification.js +16 -2
- package/lib/components/NumberInput/NumberInput.d.ts +5 -0
- package/lib/components/NumberInput/NumberInput.js +17 -9
- package/lib/components/OverflowMenu/next/index.js +40 -1
- package/lib/components/Pagination/Pagination.js +1 -1
- package/lib/components/PaginationNav/PaginationNav.d.ts +1 -1
- package/lib/components/PaginationNav/PaginationNav.js +22 -5
- package/lib/components/RadioButton/RadioButton.d.ts +5 -0
- package/lib/components/RadioButton/RadioButton.js +16 -7
- package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +5 -0
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +16 -7
- package/lib/components/RadioTile/RadioTile.d.ts +5 -0
- package/lib/components/RadioTile/RadioTile.js +17 -8
- package/lib/components/Tabs/Tabs.js +46 -29
- package/lib/components/Tag/DismissibleTag.d.ts +11 -2
- package/lib/components/Tag/DismissibleTag.js +13 -5
- package/lib/components/Tag/Tag.d.ts +5 -0
- package/lib/components/Tag/Tag.js +14 -7
- package/lib/components/TextArea/TextArea.d.ts +5 -0
- package/lib/components/TextArea/TextArea.js +15 -7
- package/lib/components/TextInput/TextInput.d.ts +5 -0
- package/lib/components/TextInput/TextInput.js +15 -7
- package/lib/components/Tile/Tile.d.ts +21 -1
- package/lib/components/Tile/Tile.js +67 -47
- package/lib/components/UIShell/SideNavMenuItem.d.ts +5 -1
- package/lib/components/UIShell/SideNavMenuItem.js +7 -2
- package/package.json +5 -5
|
@@ -52,6 +52,10 @@ export interface FluidSelectProps {
|
|
|
52
52
|
* Provide the text that is displayed when the control is in warning state
|
|
53
53
|
*/
|
|
54
54
|
warnText?: React.ReactNode;
|
|
55
|
+
/**
|
|
56
|
+
* Whether or not the component is readonly
|
|
57
|
+
*/
|
|
58
|
+
readOnly?: boolean;
|
|
55
59
|
}
|
|
56
60
|
declare const FluidSelect: React.ForwardRefExoticComponent<FluidSelectProps & React.RefAttributes<HTMLSelectElement>>;
|
|
57
61
|
export default FluidSelect;
|
|
@@ -77,7 +77,11 @@ FluidSelect.propTypes = {
|
|
|
77
77
|
/**
|
|
78
78
|
* Provide the text that is displayed when the control is in warning state
|
|
79
79
|
*/
|
|
80
|
-
warnText: PropTypes.node
|
|
80
|
+
warnText: PropTypes.node,
|
|
81
|
+
/**
|
|
82
|
+
* Whether or not the component is readonly
|
|
83
|
+
*/
|
|
84
|
+
readOnly: PropTypes.bool
|
|
81
85
|
};
|
|
82
86
|
|
|
83
87
|
export { FluidSelect as default };
|
|
@@ -91,6 +91,10 @@ export interface FluidTextAreaProps {
|
|
|
91
91
|
* Provide the text that is displayed when the control is in warning state
|
|
92
92
|
*/
|
|
93
93
|
warnText?: React.ReactNode;
|
|
94
|
+
/**
|
|
95
|
+
* Whether or not the component is readonly
|
|
96
|
+
*/
|
|
97
|
+
readOnly?: boolean;
|
|
94
98
|
}
|
|
95
99
|
declare const FluidTextArea: React.FC<FluidTextAreaProps>;
|
|
96
100
|
export default FluidTextArea;
|
|
@@ -115,7 +115,11 @@ FluidTextArea.propTypes = {
|
|
|
115
115
|
/**
|
|
116
116
|
* Provide the text that is displayed when the control is in warning state
|
|
117
117
|
*/
|
|
118
|
-
warnText: PropTypes.node
|
|
118
|
+
warnText: PropTypes.node,
|
|
119
|
+
/**
|
|
120
|
+
* Whether or not the component is readonly
|
|
121
|
+
*/
|
|
122
|
+
readOnly: PropTypes.bool
|
|
119
123
|
};
|
|
120
124
|
|
|
121
125
|
export { FluidTextArea as default };
|
|
@@ -78,6 +78,10 @@ export interface FluidPasswordInputProps {
|
|
|
78
78
|
* Provide the text that is displayed when the control is in warning state
|
|
79
79
|
*/
|
|
80
80
|
warnText?: React.ReactNode;
|
|
81
|
+
/**
|
|
82
|
+
* Whether or not the component is readonly
|
|
83
|
+
*/
|
|
84
|
+
readOnly?: boolean;
|
|
81
85
|
}
|
|
82
86
|
declare const FluidPasswordInput: React.FC<FluidPasswordInputProps>;
|
|
83
87
|
export default FluidPasswordInput;
|
|
@@ -83,5 +83,9 @@ import '../TextInput/PasswordInput.js';
|
|
|
83
83
|
/**
|
|
84
84
|
* Provide the text that is displayed when the control is in warning state
|
|
85
85
|
*/
|
|
86
|
-
warnText: PropTypes.node
|
|
86
|
+
warnText: PropTypes.node,
|
|
87
|
+
/**
|
|
88
|
+
* Whether or not the component is readonly
|
|
89
|
+
*/
|
|
90
|
+
readOnly: PropTypes.bool
|
|
87
91
|
});
|
|
@@ -65,6 +65,10 @@ export interface FluidTextInputProps {
|
|
|
65
65
|
* Provide the text that is displayed when the control is in warning state
|
|
66
66
|
*/
|
|
67
67
|
warnText?: React.ReactNode;
|
|
68
|
+
/**
|
|
69
|
+
* Whether or not the component is readonly
|
|
70
|
+
*/
|
|
71
|
+
readOnly?: boolean;
|
|
68
72
|
}
|
|
69
73
|
declare const FluidTextInput: React.ForwardRefExoticComponent<FluidTextInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
70
74
|
export default FluidTextInput;
|
|
@@ -97,7 +97,11 @@ FluidTextInput.propTypes = {
|
|
|
97
97
|
/**
|
|
98
98
|
* Provide the text that is displayed when the control is in warning state
|
|
99
99
|
*/
|
|
100
|
-
warnText: PropTypes.node
|
|
100
|
+
warnText: PropTypes.node,
|
|
101
|
+
/**
|
|
102
|
+
* Whether or not the component is readonly
|
|
103
|
+
*/
|
|
104
|
+
readOnly: PropTypes.bool
|
|
101
105
|
};
|
|
102
106
|
|
|
103
107
|
export { FluidTextInput as default };
|
|
@@ -40,6 +40,10 @@ export interface FluidTimePickerProps extends FluidTextInputProps {
|
|
|
40
40
|
* Provide the text that is displayed when the control is in warning state
|
|
41
41
|
*/
|
|
42
42
|
warnText?: React.ReactNode;
|
|
43
|
+
/**
|
|
44
|
+
* Specify if the component is readonly
|
|
45
|
+
*/
|
|
46
|
+
readOnly?: boolean;
|
|
43
47
|
}
|
|
44
48
|
declare const FluidTimePicker: React.ForwardRefExoticComponent<FluidTimePickerProps & React.RefAttributes<HTMLInputElement>>;
|
|
45
49
|
export default FluidTimePicker;
|
|
@@ -24,6 +24,7 @@ const FluidTimePicker = /*#__PURE__*/React__default.forwardRef(function FluidTim
|
|
|
24
24
|
invalidText,
|
|
25
25
|
warn,
|
|
26
26
|
warnText,
|
|
27
|
+
readOnly,
|
|
27
28
|
...other
|
|
28
29
|
} = _ref;
|
|
29
30
|
const prefix = usePrefix();
|
|
@@ -43,6 +44,19 @@ const FluidTimePicker = /*#__PURE__*/React__default.forwardRef(function FluidTim
|
|
|
43
44
|
}
|
|
44
45
|
};
|
|
45
46
|
const error = invalid || warn;
|
|
47
|
+
const childrenWithProps = () => {
|
|
48
|
+
if (disabled) {
|
|
49
|
+
return React__default.Children.toArray(children).map(child => /*#__PURE__*/React__default.cloneElement(child, {
|
|
50
|
+
disabled: true
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
if (readOnly) {
|
|
54
|
+
return React__default.Children.toArray(children).map(child => /*#__PURE__*/React__default.cloneElement(child, {
|
|
55
|
+
readOnly: true
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
return children;
|
|
59
|
+
};
|
|
46
60
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
47
61
|
className: classNames
|
|
48
62
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -50,12 +64,10 @@ const FluidTimePicker = /*#__PURE__*/React__default.forwardRef(function FluidTim
|
|
|
50
64
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
51
65
|
className: `${prefix}--time-picker__input`
|
|
52
66
|
}, /*#__PURE__*/React__default.createElement(FluidTextInput, _extends({
|
|
53
|
-
ref: ref
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
});
|
|
58
|
-
}) : children), error && /*#__PURE__*/React__default.createElement("hr", {
|
|
67
|
+
ref: ref,
|
|
68
|
+
readOnly: readOnly,
|
|
69
|
+
disabled: disabled
|
|
70
|
+
}, other))), childrenWithProps()), error && /*#__PURE__*/React__default.createElement("hr", {
|
|
59
71
|
className: `${prefix}--time-picker__divider`
|
|
60
72
|
}), error && /*#__PURE__*/React__default.createElement("div", {
|
|
61
73
|
className: `${prefix}--form-requirement`
|
|
@@ -98,7 +110,11 @@ FluidTimePicker.propTypes = {
|
|
|
98
110
|
/**
|
|
99
111
|
* Provide the text that is displayed when the control is in warning state
|
|
100
112
|
*/
|
|
101
|
-
warnText: PropTypes.node
|
|
113
|
+
warnText: PropTypes.node,
|
|
114
|
+
/**
|
|
115
|
+
* Whether or not the component is readonly
|
|
116
|
+
*/
|
|
117
|
+
readOnly: PropTypes.bool
|
|
102
118
|
};
|
|
103
119
|
|
|
104
120
|
export { FluidTimePicker as default };
|
|
@@ -8,11 +8,14 @@ import React, { ReactNode } from 'react';
|
|
|
8
8
|
import { ButtonSize } from '../Button';
|
|
9
9
|
export declare const IconButtonKinds: readonly ["primary", "secondary", "ghost", "tertiary"];
|
|
10
10
|
export type IconButtonKind = (typeof IconButtonKinds)[number];
|
|
11
|
+
export type DeprecatedIconButtonAlignment = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'left-bottom' | 'left-top' | 'right-bottom' | 'right-top';
|
|
12
|
+
export type NewIconButtonAlignment = 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-end' | 'left-start' | 'right-end' | 'right-start';
|
|
13
|
+
export type IconButtonAlignment = DeprecatedIconButtonAlignment | NewIconButtonAlignment;
|
|
11
14
|
interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
12
15
|
/**
|
|
13
16
|
* Specify how the trigger should align with the tooltip
|
|
14
17
|
*/
|
|
15
|
-
align?:
|
|
18
|
+
align?: IconButtonAlignment;
|
|
16
19
|
/**
|
|
17
20
|
* **Experimental**: Will attempt to automatically align the tooltip
|
|
18
21
|
*/
|
|
@@ -13,8 +13,22 @@ import '../Tooltip/DefinitionTooltip.js';
|
|
|
13
13
|
import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
14
14
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
15
15
|
import ButtonBase from '../Button/ButtonBase.js';
|
|
16
|
+
import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
16
17
|
|
|
17
18
|
const IconButtonKinds = ['primary', 'secondary', 'ghost', 'tertiary'];
|
|
19
|
+
const propMappingFunction = deprecatedValue => {
|
|
20
|
+
const mapping = {
|
|
21
|
+
'top-left': 'top-start',
|
|
22
|
+
'top-right': 'top-end',
|
|
23
|
+
'bottom-left': 'bottom-start',
|
|
24
|
+
'bottom-right': 'bottom-end',
|
|
25
|
+
'left-bottom': 'left-end',
|
|
26
|
+
'left-top': 'left-start',
|
|
27
|
+
'right-bottom': 'right-end',
|
|
28
|
+
'right-top': 'right-start'
|
|
29
|
+
};
|
|
30
|
+
return mapping[deprecatedValue];
|
|
31
|
+
};
|
|
18
32
|
const IconButton = /*#__PURE__*/React__default.forwardRef(function IconButton(_ref, ref) {
|
|
19
33
|
let {
|
|
20
34
|
align,
|
|
@@ -60,7 +74,32 @@ IconButton.propTypes = {
|
|
|
60
74
|
/**
|
|
61
75
|
* Specify how the trigger should align with the tooltip
|
|
62
76
|
*/
|
|
63
|
-
align: PropTypes.oneOf(['top', 'top-left',
|
|
77
|
+
align: deprecateValuesWithin(PropTypes.oneOf(['top', 'top-left',
|
|
78
|
+
// deprecated use top-start instead
|
|
79
|
+
'top-right',
|
|
80
|
+
// deprecated use top-end instead
|
|
81
|
+
|
|
82
|
+
'bottom', 'bottom-left',
|
|
83
|
+
// deprecated use bottom-start instead
|
|
84
|
+
'bottom-right',
|
|
85
|
+
// deprecated use bottom-end instead
|
|
86
|
+
|
|
87
|
+
'left', 'left-bottom',
|
|
88
|
+
// deprecated use left-end instead
|
|
89
|
+
'left-top',
|
|
90
|
+
// deprecated use left-start instead
|
|
91
|
+
|
|
92
|
+
'right', 'right-bottom',
|
|
93
|
+
// deprecated use right-end instead
|
|
94
|
+
'right-top',
|
|
95
|
+
// deprecated use right-start instead
|
|
96
|
+
|
|
97
|
+
// new values to match floating-ui
|
|
98
|
+
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
99
|
+
//allowed prop values
|
|
100
|
+
['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
|
|
101
|
+
//optional mapper function
|
|
102
|
+
propMappingFunction),
|
|
64
103
|
/**
|
|
65
104
|
* **Experimental**: Will attempt to automatically align the tooltip
|
|
66
105
|
*/
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface InlineCheckboxProps {
|
|
3
|
+
'aria-label': string;
|
|
4
|
+
/**
|
|
5
|
+
* Deprecated, please use `aria-label` instead.
|
|
6
|
+
* Specify the label for the control
|
|
7
|
+
*/
|
|
8
|
+
ariaLabel?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Specify whether the underlying control is checked,
|
|
11
|
+
* or not
|
|
12
|
+
* @default false
|
|
13
|
+
* */
|
|
14
|
+
checked?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Specify whether the underlying input control should be disabled
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Provide an `id` for the underlying input control
|
|
22
|
+
*/
|
|
23
|
+
id: string;
|
|
24
|
+
/**
|
|
25
|
+
* Specify whether the control is in an indeterminate state
|
|
26
|
+
*/
|
|
27
|
+
indeterminate?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Provide a `name` for the underlying input control
|
|
30
|
+
*/
|
|
31
|
+
name: string;
|
|
32
|
+
/**
|
|
33
|
+
* Provide an optional hook that is called each time the input is updated
|
|
34
|
+
*/
|
|
35
|
+
onChange?: (checked: boolean, id: string, event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Provide a handler that is invoked when a user clicks on the control
|
|
38
|
+
*/
|
|
39
|
+
onClick?: (event: React.MouseEvent<HTMLInputElement>) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Provide a handler that is invoked on the key down event for the control
|
|
42
|
+
*/
|
|
43
|
+
onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Provide an optional tooltip for the InlineCheckbox
|
|
46
|
+
*/
|
|
47
|
+
title?: string;
|
|
48
|
+
}
|
|
49
|
+
declare const InlineCheckbox: React.ForwardRefExoticComponent<InlineCheckboxProps & React.RefAttributes<HTMLInputElement>>;
|
|
50
|
+
export default InlineCheckbox;
|
|
@@ -11,7 +11,6 @@ import deprecate from '../../prop-types/deprecate.js';
|
|
|
11
11
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
12
12
|
import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
13
13
|
|
|
14
|
-
/** @type any */
|
|
15
14
|
const InlineCheckbox = /*#__PURE__*/React__default.forwardRef(function InlineCheckbox(props, forwardRef) {
|
|
16
15
|
const {
|
|
17
16
|
['aria-label']: ariaLabel,
|
|
@@ -48,15 +47,14 @@ const InlineCheckbox = /*#__PURE__*/React__default.forwardRef(function InlineChe
|
|
|
48
47
|
}
|
|
49
48
|
useEffect(() => {
|
|
50
49
|
if (inputRef?.current) {
|
|
51
|
-
inputRef.current.indeterminate = indeterminate;
|
|
50
|
+
inputRef.current.indeterminate = indeterminate || false;
|
|
52
51
|
}
|
|
53
52
|
}, [indeterminate]);
|
|
54
53
|
function onClickCheckBoxInput(evt) {
|
|
55
|
-
// If the previous "indeterminate" is true, change "checked" to false. If it is not undefined, we're working on `TableSelectAll`
|
|
56
54
|
if (indeterminate) {
|
|
57
55
|
evt.target.checked = false;
|
|
58
56
|
}
|
|
59
|
-
onClick(evt);
|
|
57
|
+
onClick?.(evt);
|
|
60
58
|
}
|
|
61
59
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
62
60
|
className: `${prefix}--checkbox--inline`
|
|
@@ -121,6 +119,5 @@ InlineCheckbox.propTypes = {
|
|
|
121
119
|
*/
|
|
122
120
|
title: PropTypes.string
|
|
123
121
|
};
|
|
124
|
-
var InlineCheckbox$1 = InlineCheckbox;
|
|
125
122
|
|
|
126
|
-
export { InlineCheckbox
|
|
123
|
+
export { InlineCheckbox as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
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 InlineCheckbox, { type InlineCheckboxProps } from './InlineCheckbox';
|
|
8
|
+
export default InlineCheckbox;
|
|
9
|
+
export { InlineCheckbox, type InlineCheckboxProps };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
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 PropTypes from 'prop-types';
|
|
8
|
+
import { ElementType, ReactNode } from 'react';
|
|
9
|
+
import { LayoutDirectionContext } from './LayoutDirectionContext';
|
|
10
|
+
type Direction = 'ltr' | 'rtl';
|
|
11
|
+
interface LayoutDirectionProps {
|
|
12
|
+
/**
|
|
13
|
+
* Customize the element type used to render the outermost node
|
|
14
|
+
*/
|
|
15
|
+
as?: ElementType;
|
|
16
|
+
/**
|
|
17
|
+
* Provide child elements or components to be rendered inside of this
|
|
18
|
+
* component
|
|
19
|
+
*/
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* Specify the layout direction of this part of the page
|
|
23
|
+
*/
|
|
24
|
+
dir: Direction;
|
|
25
|
+
}
|
|
26
|
+
declare function LayoutDirection({ as: BaseComponent, children, dir, ...rest }: LayoutDirectionProps): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
declare namespace LayoutDirection {
|
|
28
|
+
var propTypes: {
|
|
29
|
+
/**
|
|
30
|
+
* Customize the element type used to render the outermost node
|
|
31
|
+
*/
|
|
32
|
+
as: PropTypes.Requireable<NonNullable<((...args: any[]) => any) | PropTypes.ReactComponentLike | null | undefined>>;
|
|
33
|
+
/**
|
|
34
|
+
* Provide child elements or components to be rendered inside of this
|
|
35
|
+
* component
|
|
36
|
+
*/
|
|
37
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
38
|
+
/**
|
|
39
|
+
* Specify the layout direction of this part of the page
|
|
40
|
+
*/
|
|
41
|
+
dir: PropTypes.Validator<string>;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export { LayoutDirectionContext, LayoutDirection };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
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 from 'react';
|
|
8
|
+
export declare const LayoutDirectionContext: React.Context<{
|
|
9
|
+
direction: string;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Get access to the current layout direction in context
|
|
9
|
+
*/
|
|
10
|
+
export declare function useLayoutDirection(): {
|
|
11
|
+
direction: string;
|
|
12
|
+
};
|
|
@@ -243,9 +243,6 @@ const MenuItemSelectable = /*#__PURE__*/forwardRef(function MenuItemSelectable(_
|
|
|
243
243
|
});
|
|
244
244
|
function handleClick(e) {
|
|
245
245
|
setChecked(!checked);
|
|
246
|
-
if (onChange) {
|
|
247
|
-
onChange(e);
|
|
248
|
-
}
|
|
249
246
|
}
|
|
250
247
|
useEffect(() => {
|
|
251
248
|
if (!context.state.hasIcons) {
|
|
@@ -39,6 +39,10 @@ export interface ModalProps extends ReactAttr<HTMLDivElement> {
|
|
|
39
39
|
* Specify whether the Modal is for dangerous actions
|
|
40
40
|
*/
|
|
41
41
|
danger?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* **Experimental**: Provide a decorator component to be rendered inside the `Modal` component
|
|
44
|
+
*/
|
|
45
|
+
decorator?: ReactNode;
|
|
42
46
|
/**
|
|
43
47
|
* Specify whether the modal contains scrolling content
|
|
44
48
|
*/
|
|
@@ -151,6 +155,7 @@ export interface ModalProps extends ReactAttr<HTMLDivElement> {
|
|
|
151
155
|
*/
|
|
152
156
|
size?: ModalSize;
|
|
153
157
|
/**
|
|
158
|
+
* @deprecated please use decorator instead.
|
|
154
159
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `Modal` component
|
|
155
160
|
*/
|
|
156
161
|
slug?: ReactNode;
|
|
@@ -27,6 +27,7 @@ import { noopFn } from '../../internal/noopFn.js';
|
|
|
27
27
|
import '../Text/index.js';
|
|
28
28
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
29
29
|
import { composeEventHandlers } from '../../tools/events.js';
|
|
30
|
+
import deprecate from '../../prop-types/deprecate.js';
|
|
30
31
|
import { Text } from '../Text/Text.js';
|
|
31
32
|
import { match } from '../../internal/keyboard/match.js';
|
|
32
33
|
import { Escape, Enter, Tab } from '../../internal/keyboard/keys.js';
|
|
@@ -37,6 +38,7 @@ const Modal = /*#__PURE__*/React__default.forwardRef(function Modal(_ref, ref) {
|
|
|
37
38
|
'aria-label': ariaLabelProp,
|
|
38
39
|
children,
|
|
39
40
|
className,
|
|
41
|
+
decorator,
|
|
40
42
|
modalHeading = '',
|
|
41
43
|
modalLabel = '',
|
|
42
44
|
modalAriaLabel,
|
|
@@ -143,7 +145,8 @@ const Modal = /*#__PURE__*/React__default.forwardRef(function Modal(_ref, ref) {
|
|
|
143
145
|
[`${prefix}--modal-tall`]: !passiveModal,
|
|
144
146
|
'is-visible': open,
|
|
145
147
|
[`${prefix}--modal--danger`]: danger,
|
|
146
|
-
[`${prefix}--modal--slug`]: slug
|
|
148
|
+
[`${prefix}--modal--slug`]: slug,
|
|
149
|
+
[`${prefix}--modal--decorator`]: decorator
|
|
147
150
|
}, className);
|
|
148
151
|
const containerClasses = cx(`${prefix}--modal-container`, {
|
|
149
152
|
[`${prefix}--modal-container--${size}`]: size,
|
|
@@ -227,10 +230,10 @@ const Modal = /*#__PURE__*/React__default.forwardRef(function Modal(_ref, ref) {
|
|
|
227
230
|
};
|
|
228
231
|
}, []);
|
|
229
232
|
|
|
230
|
-
//
|
|
231
|
-
let
|
|
232
|
-
if (
|
|
233
|
-
|
|
233
|
+
// AILabel always size `sm`
|
|
234
|
+
let normalizedDecorator = /*#__PURE__*/React__default.isValidElement(slug ?? decorator) ? slug ?? decorator : null;
|
|
235
|
+
if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
|
|
236
|
+
normalizedDecorator = /*#__PURE__*/React__default.cloneElement(normalizedDecorator, {
|
|
234
237
|
size: 'sm'
|
|
235
238
|
});
|
|
236
239
|
}
|
|
@@ -267,7 +270,9 @@ const Modal = /*#__PURE__*/React__default.forwardRef(function Modal(_ref, ref) {
|
|
|
267
270
|
as: "h2",
|
|
268
271
|
id: modalHeadingId,
|
|
269
272
|
className: `${prefix}--modal-header__heading`
|
|
270
|
-
}, modalHeading),
|
|
273
|
+
}, modalHeading), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default.createElement("div", {
|
|
274
|
+
className: `${prefix}--modal--inner__decorator`
|
|
275
|
+
}, normalizedDecorator) : '', !passiveModal && modalButton), /*#__PURE__*/React__default.createElement(Layer, _extends({
|
|
271
276
|
ref: contentRef,
|
|
272
277
|
id: modalBodyId,
|
|
273
278
|
className: contentClasses
|
|
@@ -348,6 +353,10 @@ Modal.propTypes = {
|
|
|
348
353
|
* Specify whether the Modal is for dangerous actions
|
|
349
354
|
*/
|
|
350
355
|
danger: PropTypes.bool,
|
|
356
|
+
/**
|
|
357
|
+
* **Experimental**: Provide a decorator component to be rendered inside the `Modal` component
|
|
358
|
+
*/
|
|
359
|
+
decorator: PropTypes.node,
|
|
351
360
|
/**
|
|
352
361
|
* Specify whether the modal contains scrolling content
|
|
353
362
|
*/
|
|
@@ -478,10 +487,7 @@ Modal.propTypes = {
|
|
|
478
487
|
* Specify the size variant.
|
|
479
488
|
*/
|
|
480
489
|
size: PropTypes.oneOf(ModalSizes),
|
|
481
|
-
|
|
482
|
-
* **Experimental**: Provide a `Slug` component to be rendered inside the `Modal` component
|
|
483
|
-
*/
|
|
484
|
-
slug: PropTypes.node
|
|
490
|
+
slug: deprecate(PropTypes.node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.')
|
|
485
491
|
};
|
|
486
492
|
|
|
487
493
|
export { ModalSizes, Modal as default };
|
|
@@ -61,7 +61,7 @@ export interface FilterableMultiSelectProps<ItemType> extends MultiSelectSorting
|
|
|
61
61
|
*/
|
|
62
62
|
filterItems(items: readonly ItemType[], extra: {
|
|
63
63
|
inputValue: string | null;
|
|
64
|
-
itemToString: NonNullable<
|
|
64
|
+
itemToString: NonNullable<UseComboboxProps<ItemType>['itemToString']>;
|
|
65
65
|
}): ItemType[];
|
|
66
66
|
/**
|
|
67
67
|
* Specify whether the title text should be hidden or not
|
|
@@ -264,7 +264,7 @@ const FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function Fi
|
|
|
264
264
|
inputValue,
|
|
265
265
|
stateReducer,
|
|
266
266
|
isItemDisabled(item, _index) {
|
|
267
|
-
return item
|
|
267
|
+
return item?.disabled;
|
|
268
268
|
}
|
|
269
269
|
});
|
|
270
270
|
function stateReducer(state, actionAndChanges) {
|
|
@@ -381,7 +381,6 @@ const FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function Fi
|
|
|
381
381
|
activeIndex: highlightedIndex,
|
|
382
382
|
initialSelectedItems,
|
|
383
383
|
selectedItems: controlledSelectedItems,
|
|
384
|
-
itemToString,
|
|
385
384
|
onStateChange(changes) {
|
|
386
385
|
switch (changes.type) {
|
|
387
386
|
case SelectedItemKeyDownBackspace:
|
|
@@ -196,7 +196,7 @@ const MultiSelect = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
196
196
|
selectedItem: controlledSelectedItems,
|
|
197
197
|
items: filteredItems,
|
|
198
198
|
isItemDisabled(item, _index) {
|
|
199
|
-
return item
|
|
199
|
+
return item?.disabled;
|
|
200
200
|
},
|
|
201
201
|
...downshiftProps
|
|
202
202
|
};
|
|
@@ -516,6 +516,13 @@ export declare namespace ActionableNotification {
|
|
|
516
516
|
* Callout
|
|
517
517
|
* ==================
|
|
518
518
|
*/
|
|
519
|
+
/**
|
|
520
|
+
* Deprecated callout kind values.
|
|
521
|
+
* @deprecated Use NewKindProps instead.
|
|
522
|
+
*/
|
|
523
|
+
export type DeprecatedKindProps = 'error' | 'info' | 'info-square' | 'success' | 'warning' | 'warning-alt';
|
|
524
|
+
export type NewKindProps = 'warning' | 'info';
|
|
525
|
+
export type KindProps = DeprecatedKindProps | NewKindProps;
|
|
519
526
|
export interface CalloutProps extends HTMLAttributes<HTMLDivElement> {
|
|
520
527
|
/**
|
|
521
528
|
* Pass in the action button label that will be rendered within the ActionableNotification.
|
|
@@ -532,7 +539,7 @@ export interface CalloutProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
532
539
|
/**
|
|
533
540
|
* Specify what state the notification represents
|
|
534
541
|
*/
|
|
535
|
-
kind?:
|
|
542
|
+
kind?: KindProps;
|
|
536
543
|
/**
|
|
537
544
|
* Specify whether you are using the low contrast variant of the Callout.
|
|
538
545
|
*/
|
|
@@ -576,7 +583,7 @@ export declare namespace Callout {
|
|
|
576
583
|
/**
|
|
577
584
|
* Specify what state the notification represents
|
|
578
585
|
*/
|
|
579
|
-
kind:
|
|
586
|
+
kind: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
|
|
580
587
|
/**
|
|
581
588
|
* Specify whether you are using the low contrast variant of the Callout.
|
|
582
589
|
*/
|
|
@@ -22,6 +22,7 @@ import { noopFn } from '../../internal/noopFn.js';
|
|
|
22
22
|
import wrapFocus, { wrapFocusWithoutSentinels } from '../../internal/wrapFocus.js';
|
|
23
23
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
24
24
|
import { warning } from '../../internal/warning.js';
|
|
25
|
+
import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
25
26
|
import { Text } from '../Text/Text.js';
|
|
26
27
|
import { match, matches } from '../../internal/keyboard/match.js';
|
|
27
28
|
import { Tab, Escape } from '../../internal/keyboard/keys.js';
|
|
@@ -693,6 +694,19 @@ ActionableNotification.propTypes = {
|
|
|
693
694
|
* ==================
|
|
694
695
|
*/
|
|
695
696
|
|
|
697
|
+
/**
|
|
698
|
+
* Deprecated callout kind values.
|
|
699
|
+
* @deprecated Use NewKindProps instead.
|
|
700
|
+
*/
|
|
701
|
+
|
|
702
|
+
const propMappingFunction = deprecatedValue => {
|
|
703
|
+
const mapping = {
|
|
704
|
+
error: 'warning',
|
|
705
|
+
// only redirect error -> warning
|
|
706
|
+
success: 'info' // only redirect success -> info
|
|
707
|
+
};
|
|
708
|
+
return mapping[deprecatedValue];
|
|
709
|
+
};
|
|
696
710
|
function Callout(_ref8) {
|
|
697
711
|
let {
|
|
698
712
|
actionButtonLabel,
|
|
@@ -703,7 +717,7 @@ function Callout(_ref8) {
|
|
|
703
717
|
subtitle,
|
|
704
718
|
statusIconDescription,
|
|
705
719
|
className,
|
|
706
|
-
kind = '
|
|
720
|
+
kind = 'info',
|
|
707
721
|
lowContrast,
|
|
708
722
|
...rest
|
|
709
723
|
} = _ref8;
|
|
@@ -759,7 +773,7 @@ Callout.propTypes = {
|
|
|
759
773
|
/**
|
|
760
774
|
* Specify what state the notification represents
|
|
761
775
|
*/
|
|
762
|
-
kind: PropTypes.oneOf(['error', 'info', 'info-square', 'success', 'warning', 'warning-alt']),
|
|
776
|
+
kind: deprecateValuesWithin(PropTypes.oneOf(['error', 'info', 'info-square', 'success', 'warning', 'warning-alt']), ['warning', 'info'], propMappingFunction),
|
|
763
777
|
/**
|
|
764
778
|
* Specify whether you are using the low contrast variant of the Callout.
|
|
765
779
|
*/
|
|
@@ -24,6 +24,10 @@ export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
24
24
|
* Specify an optional className to be applied to the wrapper node
|
|
25
25
|
*/
|
|
26
26
|
className?: string;
|
|
27
|
+
/**
|
|
28
|
+
* **Experimental**: Provide a `decorator` component to be rendered inside the `TextInput` component
|
|
29
|
+
*/
|
|
30
|
+
decorator?: ReactNode;
|
|
27
31
|
/**
|
|
28
32
|
* Optional starting value for uncontrolled state
|
|
29
33
|
*/
|
|
@@ -113,6 +117,7 @@ export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
113
117
|
*/
|
|
114
118
|
size?: 'sm' | 'md' | 'lg';
|
|
115
119
|
/**
|
|
120
|
+
* @deprecated please use `decorator` instead.
|
|
116
121
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `TextInput` component
|
|
117
122
|
*/
|
|
118
123
|
slug?: ReactNode;
|