@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
|
@@ -17,6 +17,7 @@ require('../Tooltip/DefinitionTooltip.js');
|
|
|
17
17
|
var Tooltip = require('../Tooltip/Tooltip.js');
|
|
18
18
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
19
19
|
var ButtonBase = require('../Button/ButtonBase.js');
|
|
20
|
+
var deprecateValuesWithin = require('../../prop-types/deprecateValuesWithin.js');
|
|
20
21
|
|
|
21
22
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
22
23
|
|
|
@@ -25,6 +26,19 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
25
26
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
26
27
|
|
|
27
28
|
const IconButtonKinds = ['primary', 'secondary', 'ghost', 'tertiary'];
|
|
29
|
+
const propMappingFunction = deprecatedValue => {
|
|
30
|
+
const mapping = {
|
|
31
|
+
'top-left': 'top-start',
|
|
32
|
+
'top-right': 'top-end',
|
|
33
|
+
'bottom-left': 'bottom-start',
|
|
34
|
+
'bottom-right': 'bottom-end',
|
|
35
|
+
'left-bottom': 'left-end',
|
|
36
|
+
'left-top': 'left-start',
|
|
37
|
+
'right-bottom': 'right-end',
|
|
38
|
+
'right-top': 'right-start'
|
|
39
|
+
};
|
|
40
|
+
return mapping[deprecatedValue];
|
|
41
|
+
};
|
|
28
42
|
const IconButton = /*#__PURE__*/React__default["default"].forwardRef(function IconButton(_ref, ref) {
|
|
29
43
|
let {
|
|
30
44
|
align,
|
|
@@ -70,7 +84,32 @@ IconButton.propTypes = {
|
|
|
70
84
|
/**
|
|
71
85
|
* Specify how the trigger should align with the tooltip
|
|
72
86
|
*/
|
|
73
|
-
align: PropTypes__default["default"].oneOf(['top', 'top-left',
|
|
87
|
+
align: deprecateValuesWithin["default"](PropTypes__default["default"].oneOf(['top', 'top-left',
|
|
88
|
+
// deprecated use top-start instead
|
|
89
|
+
'top-right',
|
|
90
|
+
// deprecated use top-end instead
|
|
91
|
+
|
|
92
|
+
'bottom', 'bottom-left',
|
|
93
|
+
// deprecated use bottom-start instead
|
|
94
|
+
'bottom-right',
|
|
95
|
+
// deprecated use bottom-end instead
|
|
96
|
+
|
|
97
|
+
'left', 'left-bottom',
|
|
98
|
+
// deprecated use left-end instead
|
|
99
|
+
'left-top',
|
|
100
|
+
// deprecated use left-start instead
|
|
101
|
+
|
|
102
|
+
'right', 'right-bottom',
|
|
103
|
+
// deprecated use right-end instead
|
|
104
|
+
'right-top',
|
|
105
|
+
// deprecated use right-start instead
|
|
106
|
+
|
|
107
|
+
// new values to match floating-ui
|
|
108
|
+
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
109
|
+
//allowed prop values
|
|
110
|
+
['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
|
|
111
|
+
//optional mapper function
|
|
112
|
+
propMappingFunction),
|
|
74
113
|
/**
|
|
75
114
|
* **Experimental**: Will attempt to automatically align the tooltip
|
|
76
115
|
*/
|
|
@@ -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;
|
|
@@ -20,7 +20,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
20
20
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
21
21
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
22
22
|
|
|
23
|
-
/** @type any */
|
|
24
23
|
const InlineCheckbox = /*#__PURE__*/React__default["default"].forwardRef(function InlineCheckbox(props, forwardRef) {
|
|
25
24
|
const {
|
|
26
25
|
['aria-label']: ariaLabel,
|
|
@@ -57,15 +56,14 @@ const InlineCheckbox = /*#__PURE__*/React__default["default"].forwardRef(functio
|
|
|
57
56
|
}
|
|
58
57
|
React.useEffect(() => {
|
|
59
58
|
if (inputRef?.current) {
|
|
60
|
-
inputRef.current.indeterminate = indeterminate;
|
|
59
|
+
inputRef.current.indeterminate = indeterminate || false;
|
|
61
60
|
}
|
|
62
61
|
}, [indeterminate]);
|
|
63
62
|
function onClickCheckBoxInput(evt) {
|
|
64
|
-
// If the previous "indeterminate" is true, change "checked" to false. If it is not undefined, we're working on `TableSelectAll`
|
|
65
63
|
if (indeterminate) {
|
|
66
64
|
evt.target.checked = false;
|
|
67
65
|
}
|
|
68
|
-
onClick(evt);
|
|
66
|
+
onClick?.(evt);
|
|
69
67
|
}
|
|
70
68
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
71
69
|
className: `${prefix}--checkbox--inline`
|
|
@@ -130,6 +128,5 @@ InlineCheckbox.propTypes = {
|
|
|
130
128
|
*/
|
|
131
129
|
title: PropTypes__default["default"].string
|
|
132
130
|
};
|
|
133
|
-
var InlineCheckbox$1 = InlineCheckbox;
|
|
134
131
|
|
|
135
|
-
exports["default"] = InlineCheckbox
|
|
132
|
+
exports["default"] = InlineCheckbox;
|
|
@@ -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
|
+
};
|
|
@@ -253,9 +253,6 @@ const MenuItemSelectable = /*#__PURE__*/React.forwardRef(function MenuItemSelect
|
|
|
253
253
|
});
|
|
254
254
|
function handleClick(e) {
|
|
255
255
|
setChecked(!checked);
|
|
256
|
-
if (onChange) {
|
|
257
|
-
onChange(e);
|
|
258
|
-
}
|
|
259
256
|
}
|
|
260
257
|
React.useEffect(() => {
|
|
261
258
|
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;
|
|
@@ -31,6 +31,7 @@ var noopFn = require('../../internal/noopFn.js');
|
|
|
31
31
|
require('../Text/index.js');
|
|
32
32
|
var index = require('../FeatureFlags/index.js');
|
|
33
33
|
var events = require('../../tools/events.js');
|
|
34
|
+
var deprecate = require('../../prop-types/deprecate.js');
|
|
34
35
|
var Text = require('../Text/Text.js');
|
|
35
36
|
var match = require('../../internal/keyboard/match.js');
|
|
36
37
|
var keys = require('../../internal/keyboard/keys.js');
|
|
@@ -48,6 +49,7 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
|
|
|
48
49
|
'aria-label': ariaLabelProp,
|
|
49
50
|
children,
|
|
50
51
|
className,
|
|
52
|
+
decorator,
|
|
51
53
|
modalHeading = '',
|
|
52
54
|
modalLabel = '',
|
|
53
55
|
modalAriaLabel,
|
|
@@ -154,7 +156,8 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
|
|
|
154
156
|
[`${prefix}--modal-tall`]: !passiveModal,
|
|
155
157
|
'is-visible': open,
|
|
156
158
|
[`${prefix}--modal--danger`]: danger,
|
|
157
|
-
[`${prefix}--modal--slug`]: slug
|
|
159
|
+
[`${prefix}--modal--slug`]: slug,
|
|
160
|
+
[`${prefix}--modal--decorator`]: decorator
|
|
158
161
|
}, className);
|
|
159
162
|
const containerClasses = cx__default["default"](`${prefix}--modal-container`, {
|
|
160
163
|
[`${prefix}--modal-container--${size}`]: size,
|
|
@@ -238,10 +241,10 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
|
|
|
238
241
|
};
|
|
239
242
|
}, []);
|
|
240
243
|
|
|
241
|
-
//
|
|
242
|
-
let
|
|
243
|
-
if (
|
|
244
|
-
|
|
244
|
+
// AILabel always size `sm`
|
|
245
|
+
let normalizedDecorator = /*#__PURE__*/React__default["default"].isValidElement(slug ?? decorator) ? slug ?? decorator : null;
|
|
246
|
+
if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
|
|
247
|
+
normalizedDecorator = /*#__PURE__*/React__default["default"].cloneElement(normalizedDecorator, {
|
|
245
248
|
size: 'sm'
|
|
246
249
|
});
|
|
247
250
|
}
|
|
@@ -278,7 +281,9 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
|
|
|
278
281
|
as: "h2",
|
|
279
282
|
id: modalHeadingId,
|
|
280
283
|
className: `${prefix}--modal-header__heading`
|
|
281
|
-
}, modalHeading),
|
|
284
|
+
}, modalHeading), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
285
|
+
className: `${prefix}--modal--inner__decorator`
|
|
286
|
+
}, normalizedDecorator) : '', !passiveModal && modalButton), /*#__PURE__*/React__default["default"].createElement(index$1.Layer, _rollupPluginBabelHelpers["extends"]({
|
|
282
287
|
ref: contentRef,
|
|
283
288
|
id: modalBodyId,
|
|
284
289
|
className: contentClasses
|
|
@@ -359,6 +364,10 @@ Modal.propTypes = {
|
|
|
359
364
|
* Specify whether the Modal is for dangerous actions
|
|
360
365
|
*/
|
|
361
366
|
danger: PropTypes__default["default"].bool,
|
|
367
|
+
/**
|
|
368
|
+
* **Experimental**: Provide a decorator component to be rendered inside the `Modal` component
|
|
369
|
+
*/
|
|
370
|
+
decorator: PropTypes__default["default"].node,
|
|
362
371
|
/**
|
|
363
372
|
* Specify whether the modal contains scrolling content
|
|
364
373
|
*/
|
|
@@ -489,10 +498,7 @@ Modal.propTypes = {
|
|
|
489
498
|
* Specify the size variant.
|
|
490
499
|
*/
|
|
491
500
|
size: PropTypes__default["default"].oneOf(ModalSizes),
|
|
492
|
-
|
|
493
|
-
* **Experimental**: Provide a `Slug` component to be rendered inside the `Modal` component
|
|
494
|
-
*/
|
|
495
|
-
slug: PropTypes__default["default"].node
|
|
501
|
+
slug: deprecate["default"](PropTypes__default["default"].node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.')
|
|
496
502
|
};
|
|
497
503
|
|
|
498
504
|
exports.ModalSizes = ModalSizes;
|
|
@@ -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
|
|
@@ -276,7 +276,7 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
|
|
|
276
276
|
inputValue,
|
|
277
277
|
stateReducer,
|
|
278
278
|
isItemDisabled(item, _index) {
|
|
279
|
-
return item
|
|
279
|
+
return item?.disabled;
|
|
280
280
|
}
|
|
281
281
|
});
|
|
282
282
|
function stateReducer(state, actionAndChanges) {
|
|
@@ -393,7 +393,6 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
|
|
|
393
393
|
activeIndex: highlightedIndex,
|
|
394
394
|
initialSelectedItems,
|
|
395
395
|
selectedItems: controlledSelectedItems,
|
|
396
|
-
itemToString: itemToString$1,
|
|
397
396
|
onStateChange(changes) {
|
|
398
397
|
switch (changes.type) {
|
|
399
398
|
case SelectedItemKeyDownBackspace:
|
|
@@ -207,7 +207,7 @@ const MultiSelect = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref
|
|
|
207
207
|
selectedItem: controlledSelectedItems,
|
|
208
208
|
items: filteredItems,
|
|
209
209
|
isItemDisabled(item, _index) {
|
|
210
|
-
return item
|
|
210
|
+
return item?.disabled;
|
|
211
211
|
},
|
|
212
212
|
...downshiftProps
|
|
213
213
|
};
|
|
@@ -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
|
*/
|
|
@@ -26,6 +26,7 @@ var noopFn = require('../../internal/noopFn.js');
|
|
|
26
26
|
var wrapFocus = require('../../internal/wrapFocus.js');
|
|
27
27
|
var index = require('../FeatureFlags/index.js');
|
|
28
28
|
var warning = require('../../internal/warning.js');
|
|
29
|
+
var deprecateValuesWithin = require('../../prop-types/deprecateValuesWithin.js');
|
|
29
30
|
var Text = require('../Text/Text.js');
|
|
30
31
|
var match = require('../../internal/keyboard/match.js');
|
|
31
32
|
var keys = require('../../internal/keyboard/keys.js');
|
|
@@ -703,6 +704,19 @@ ActionableNotification.propTypes = {
|
|
|
703
704
|
* ==================
|
|
704
705
|
*/
|
|
705
706
|
|
|
707
|
+
/**
|
|
708
|
+
* Deprecated callout kind values.
|
|
709
|
+
* @deprecated Use NewKindProps instead.
|
|
710
|
+
*/
|
|
711
|
+
|
|
712
|
+
const propMappingFunction = deprecatedValue => {
|
|
713
|
+
const mapping = {
|
|
714
|
+
error: 'warning',
|
|
715
|
+
// only redirect error -> warning
|
|
716
|
+
success: 'info' // only redirect success -> info
|
|
717
|
+
};
|
|
718
|
+
return mapping[deprecatedValue];
|
|
719
|
+
};
|
|
706
720
|
function Callout(_ref8) {
|
|
707
721
|
let {
|
|
708
722
|
actionButtonLabel,
|
|
@@ -713,7 +727,7 @@ function Callout(_ref8) {
|
|
|
713
727
|
subtitle,
|
|
714
728
|
statusIconDescription,
|
|
715
729
|
className,
|
|
716
|
-
kind = '
|
|
730
|
+
kind = 'info',
|
|
717
731
|
lowContrast,
|
|
718
732
|
...rest
|
|
719
733
|
} = _ref8;
|
|
@@ -769,7 +783,7 @@ Callout.propTypes = {
|
|
|
769
783
|
/**
|
|
770
784
|
* Specify what state the notification represents
|
|
771
785
|
*/
|
|
772
|
-
kind: PropTypes__default["default"].oneOf(['error', 'info', 'info-square', 'success', 'warning', 'warning-alt']),
|
|
786
|
+
kind: deprecateValuesWithin["default"](PropTypes__default["default"].oneOf(['error', 'info', 'info-square', 'success', 'warning', 'warning-alt']), ['warning', 'info'], propMappingFunction),
|
|
773
787
|
/**
|
|
774
788
|
* Specify whether you are using the low contrast variant of the Callout.
|
|
775
789
|
*/
|
|
@@ -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;
|
|
@@ -47,6 +47,7 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
|
|
|
47
47
|
const {
|
|
48
48
|
allowEmpty = false,
|
|
49
49
|
className: customClassName,
|
|
50
|
+
decorator,
|
|
50
51
|
disabled = false,
|
|
51
52
|
disableWheel: disableWheelProp = false,
|
|
52
53
|
defaultValue = 0,
|
|
@@ -122,7 +123,8 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
|
|
|
122
123
|
const [incrementNumLabel, decrementNumLabel] = [t('increment.number'), t('decrement.number')];
|
|
123
124
|
const wrapperClasses = cx__default["default"](`${prefix}--number__input-wrapper`, {
|
|
124
125
|
[`${prefix}--number__input-wrapper--warning`]: normalizedProps.warn,
|
|
125
|
-
[`${prefix}--number__input-wrapper--slug`]: slug
|
|
126
|
+
[`${prefix}--number__input-wrapper--slug`]: slug,
|
|
127
|
+
[`${prefix}--number__input-wrapper--decorator`]: decorator
|
|
126
128
|
});
|
|
127
129
|
const iconClasses = cx__default["default"]({
|
|
128
130
|
[`${prefix}--number__invalid`]: normalizedProps.invalid || normalizedProps.warn,
|
|
@@ -196,18 +198,18 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
|
|
|
196
198
|
}
|
|
197
199
|
}
|
|
198
200
|
|
|
199
|
-
//
|
|
200
|
-
let
|
|
201
|
-
if (
|
|
202
|
-
|
|
201
|
+
// AILabel always size `mini`
|
|
202
|
+
let normalizedDecorator = /*#__PURE__*/React__default["default"].isValidElement(slug ?? decorator) ? slug ?? decorator : null;
|
|
203
|
+
if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
|
|
204
|
+
normalizedDecorator = /*#__PURE__*/React__default["default"].cloneElement(normalizedDecorator, {
|
|
203
205
|
size: 'mini'
|
|
204
206
|
});
|
|
205
207
|
}
|
|
206
208
|
|
|
207
209
|
// Need to update the internal value when the revert button is clicked
|
|
208
210
|
let isRevertActive;
|
|
209
|
-
if (
|
|
210
|
-
isRevertActive =
|
|
211
|
+
if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
|
|
212
|
+
isRevertActive = normalizedDecorator.props.revertActive;
|
|
211
213
|
}
|
|
212
214
|
React.useEffect(() => {
|
|
213
215
|
if (!isRevertActive && slug && defaultValue) {
|
|
@@ -262,7 +264,9 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
|
|
|
262
264
|
step: step,
|
|
263
265
|
type: "number",
|
|
264
266
|
value: value
|
|
265
|
-
})),
|
|
267
|
+
})), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
268
|
+
className: `${prefix}--number__input-inner-wrapper--decorator`
|
|
269
|
+
}, normalizedDecorator) : '', Icon ? /*#__PURE__*/React__default["default"].createElement(Icon, {
|
|
266
270
|
className: iconClasses
|
|
267
271
|
}) : null, !hideSteppers && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
268
272
|
className: `${prefix}--number__controls`
|
|
@@ -307,6 +311,10 @@ NumberInput.propTypes = {
|
|
|
307
311
|
* Specify an optional className to be applied to the wrapper node
|
|
308
312
|
*/
|
|
309
313
|
className: PropTypes__default["default"].string,
|
|
314
|
+
/**
|
|
315
|
+
* **Experimental**: Provide a `decorator` component to be rendered inside the `NumberInput` component
|
|
316
|
+
*/
|
|
317
|
+
decorator: PropTypes__default["default"].node,
|
|
310
318
|
/**
|
|
311
319
|
* Optional starting value for uncontrolled state
|
|
312
320
|
*/
|
|
@@ -389,7 +397,7 @@ NumberInput.propTypes = {
|
|
|
389
397
|
/**
|
|
390
398
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `NumberInput` component
|
|
391
399
|
*/
|
|
392
|
-
slug: PropTypes__default["default"].node,
|
|
400
|
+
slug: deprecate["default"](PropTypes__default["default"].node, 'The `slug` prop for `NumberInput` is no longer needed and has ' + 'been deprecated in v11 in favor of the new `decorator` prop. It will be moved in the next major release.'),
|
|
393
401
|
/**
|
|
394
402
|
* Specify how much the values should increase/decrease upon clicking on up/down button
|
|
395
403
|
*/
|
|
@@ -23,6 +23,7 @@ var mergeRefs = require('../../../tools/mergeRefs.js');
|
|
|
23
23
|
var useId = require('../../../internal/useId.js');
|
|
24
24
|
var usePrefix = require('../../../internal/usePrefix.js');
|
|
25
25
|
var useAttachedMenu = require('../../../internal/useAttachedMenu.js');
|
|
26
|
+
var deprecateValuesWithin = require('../../../prop-types/deprecateValuesWithin.js');
|
|
26
27
|
|
|
27
28
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
28
29
|
|
|
@@ -31,6 +32,19 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
31
32
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
32
33
|
|
|
33
34
|
const defaultSize = 'md';
|
|
35
|
+
const propMappingFunction = deprecatedValue => {
|
|
36
|
+
const mapping = {
|
|
37
|
+
'top-left': 'top-start',
|
|
38
|
+
'top-right': 'top-end',
|
|
39
|
+
'bottom-left': 'bottom-start',
|
|
40
|
+
'bottom-right': 'bottom-end',
|
|
41
|
+
'left-bottom': 'left-end',
|
|
42
|
+
'left-top': 'left-start',
|
|
43
|
+
'right-bottom': 'right-end',
|
|
44
|
+
'right-top': 'right-start'
|
|
45
|
+
};
|
|
46
|
+
return mapping[deprecatedValue];
|
|
47
|
+
};
|
|
34
48
|
const OverflowMenu = /*#__PURE__*/React__default["default"].forwardRef(function OverflowMenu(_ref, forwardRef) {
|
|
35
49
|
let {
|
|
36
50
|
autoAlign = false,
|
|
@@ -172,7 +186,32 @@ OverflowMenu.propTypes = {
|
|
|
172
186
|
/**
|
|
173
187
|
* Specify how the trigger tooltip should be aligned.
|
|
174
188
|
*/
|
|
175
|
-
tooltipAlignment: PropTypes__default["default"].oneOf(['top', 'top-left',
|
|
189
|
+
tooltipAlignment: deprecateValuesWithin["default"](PropTypes__default["default"].oneOf(['top', 'top-left',
|
|
190
|
+
// deprecated use top-start instead
|
|
191
|
+
'top-right',
|
|
192
|
+
// deprecated use top-end instead
|
|
193
|
+
|
|
194
|
+
'bottom', 'bottom-left',
|
|
195
|
+
// deprecated use bottom-start instead
|
|
196
|
+
'bottom-right',
|
|
197
|
+
// deprecated use bottom-end instead
|
|
198
|
+
|
|
199
|
+
'left', 'left-bottom',
|
|
200
|
+
// deprecated use left-end instead
|
|
201
|
+
'left-top',
|
|
202
|
+
// deprecated use left-start instead
|
|
203
|
+
|
|
204
|
+
'right', 'right-bottom',
|
|
205
|
+
// deprecated use right-end instead
|
|
206
|
+
'right-top',
|
|
207
|
+
// deprecated use right-start instead
|
|
208
|
+
|
|
209
|
+
// new values to match floating-ui
|
|
210
|
+
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
211
|
+
//allowed prop values
|
|
212
|
+
['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
|
|
213
|
+
//optional mapper function
|
|
214
|
+
propMappingFunction),
|
|
176
215
|
/**
|
|
177
216
|
* Specify a DOM node where the Menu should be rendered in. Defaults to document.body.
|
|
178
217
|
*/
|
|
@@ -255,7 +255,7 @@ const Pagination = /*#__PURE__*/React__default["default"].forwardRef(function Pa
|
|
|
255
255
|
onClick: decrementPage,
|
|
256
256
|
ref: backBtnRef
|
|
257
257
|
}, _CaretLeft || (_CaretLeft = /*#__PURE__*/React__default["default"].createElement(iconsReact.CaretLeft, null))), /*#__PURE__*/React__default["default"].createElement(index.IconButton, {
|
|
258
|
-
align: "top-
|
|
258
|
+
align: "top-end",
|
|
259
259
|
disabled: forwardButtonDisabled || isLastPage,
|
|
260
260
|
kind: "ghost",
|
|
261
261
|
className: forwardButtonClasses,
|
|
@@ -28,7 +28,7 @@ interface PaginationNavProps extends Omit<React.HTMLAttributes<HTMLElement>, 'on
|
|
|
28
28
|
*/
|
|
29
29
|
disableOverflow?: boolean;
|
|
30
30
|
/**
|
|
31
|
-
* The number of items to be shown.
|
|
31
|
+
* The number of items to be shown (minimum of 4 unless props.items < 4).
|
|
32
32
|
*/
|
|
33
33
|
itemsShown?: number;
|
|
34
34
|
/**
|