@carbon/react 1.57.0 → 1.58.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 +870 -911
- package/es/components/Button/Button.js +2 -2
- package/es/components/Checkbox/Checkbox.d.ts +6 -7
- package/es/components/ComboBox/ComboBox.d.ts +4 -5
- package/es/components/ComboBox/ComboBox.js +268 -261
- package/es/components/ComposedModal/ComposedModal.d.ts +1 -2
- package/es/components/DataTable/TableHeader.d.ts +4 -5
- package/es/components/DataTable/TableSlugRow.d.ts +3 -2
- package/es/components/DatePicker/DatePicker.d.ts +4 -5
- package/es/components/Dropdown/Dropdown.d.ts +5 -6
- package/es/components/IconButton/index.d.ts +3 -4
- package/es/components/ListBox/next/ListBoxTrigger.js +1 -0
- package/es/components/Menu/Menu.js +1 -1
- package/es/components/Menu/MenuItem.js +13 -2
- package/es/components/Modal/Modal.d.ts +8 -9
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +1 -2
- package/es/components/MultiSelect/MultiSelect.d.ts +10 -9
- package/es/components/Notification/Notification.d.ts +2 -2
- package/es/components/NumberInput/NumberInput.d.ts +1 -2
- package/es/components/PasswordInput/index.d.ts +3 -0
- package/es/components/Popover/index.d.ts +8 -2
- package/es/components/Popover/index.js +26 -1
- package/es/components/RadioButton/RadioButton.d.ts +3 -4
- package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +7 -8
- package/es/components/Select/Select.d.ts +1 -2
- package/es/components/Slider/Slider.d.ts +5 -5
- package/es/components/Slider/Slider.js +1 -1
- package/es/components/Tag/DismissibleTag.d.ts +3 -3
- package/es/components/Tag/OperationalTag.d.ts +3 -3
- package/es/components/Tag/SelectableTag.d.ts +3 -3
- package/es/components/Tag/Tag.d.ts +3 -3
- package/es/components/TextArea/TextArea.d.ts +6 -7
- package/es/components/TextInput/PasswordInput.d.ts +5 -6
- package/es/components/TextInput/PasswordInput.js +2 -2
- package/es/components/TextInput/TextInput.d.ts +1 -2
- package/es/components/Theme/index.d.ts +1 -0
- package/es/components/Theme/index.js +8 -2
- package/es/components/Tile/Tile.d.ts +3 -4
- package/es/components/TileGroup/TileGroup.d.ts +3 -2
- package/es/components/TileGroup/index.d.ts +9 -0
- package/es/components/Toggle/Toggle.js +1 -1
- package/es/components/Tooltip/DefinitionTooltip.js +1 -1
- package/es/index.js +4 -4
- package/es/prop-types/deprecateValuesWithin.js +35 -0
- package/lib/components/Button/Button.js +2 -2
- package/lib/components/Checkbox/Checkbox.d.ts +6 -7
- package/lib/components/ComboBox/ComboBox.d.ts +4 -5
- package/lib/components/ComboBox/ComboBox.js +267 -261
- package/lib/components/ComposedModal/ComposedModal.d.ts +1 -2
- package/lib/components/DataTable/TableHeader.d.ts +4 -5
- package/lib/components/DataTable/TableSlugRow.d.ts +3 -2
- package/lib/components/DatePicker/DatePicker.d.ts +4 -5
- package/lib/components/Dropdown/Dropdown.d.ts +5 -6
- package/lib/components/IconButton/index.d.ts +3 -4
- package/lib/components/ListBox/next/ListBoxTrigger.js +1 -0
- package/lib/components/Menu/Menu.js +1 -1
- package/lib/components/Menu/MenuItem.js +13 -2
- package/lib/components/Modal/Modal.d.ts +8 -9
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +1 -2
- package/lib/components/MultiSelect/MultiSelect.d.ts +10 -9
- package/lib/components/Notification/Notification.d.ts +2 -2
- package/lib/components/NumberInput/NumberInput.d.ts +1 -2
- package/lib/components/PasswordInput/index.d.ts +3 -0
- package/lib/components/Popover/index.d.ts +8 -2
- package/lib/components/Popover/index.js +26 -1
- package/lib/components/RadioButton/RadioButton.d.ts +3 -4
- package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +7 -8
- package/lib/components/Select/Select.d.ts +1 -2
- package/lib/components/Slider/Slider.d.ts +5 -5
- package/lib/components/Slider/Slider.js +1 -1
- package/lib/components/Tag/DismissibleTag.d.ts +3 -3
- package/lib/components/Tag/OperationalTag.d.ts +3 -3
- package/lib/components/Tag/SelectableTag.d.ts +3 -3
- package/lib/components/Tag/Tag.d.ts +3 -3
- package/lib/components/TextArea/TextArea.d.ts +6 -7
- package/lib/components/TextInput/PasswordInput.d.ts +5 -6
- package/lib/components/TextInput/PasswordInput.js +2 -2
- package/lib/components/TextInput/TextInput.d.ts +1 -2
- package/lib/components/Theme/index.d.ts +1 -0
- package/lib/components/Theme/index.js +8 -1
- package/lib/components/Tile/Tile.d.ts +3 -4
- package/lib/components/TileGroup/TileGroup.d.ts +3 -2
- package/lib/components/TileGroup/index.d.ts +9 -0
- package/lib/components/Toggle/Toggle.js +1 -1
- package/lib/components/Tooltip/DefinitionTooltip.js +1 -1
- package/lib/index.js +30 -29
- package/lib/prop-types/deprecateValuesWithin.js +39 -0
- package/package.json +5 -5
- package/es/components/TileGroup/index.js +0 -13
- package/lib/components/TileGroup/index.js +0 -18
|
@@ -4,14 +4,13 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import React, { type MouseEventHandler } from 'react';
|
|
7
|
+
import React, { type MouseEventHandler, ReactNode } from 'react';
|
|
9
8
|
import { sortStates } from './state/sorting';
|
|
10
9
|
import { ReactAttr } from '../../types/common';
|
|
11
10
|
import { DataTableSortState } from './state/sortStates';
|
|
12
11
|
export type TableHeaderTranslationKey = 'carbon.table.header.icon.description';
|
|
13
12
|
export interface TableHeaderTranslationArgs {
|
|
14
|
-
header:
|
|
13
|
+
header: ReactNode;
|
|
15
14
|
isSortHeader?: boolean;
|
|
16
15
|
sortDirection?: DataTableSortState;
|
|
17
16
|
sortStates: typeof sortStates;
|
|
@@ -20,7 +19,7 @@ interface TableHeaderProps extends ReactAttr<HTMLTableCellElement & HTMLButtonEl
|
|
|
20
19
|
/**
|
|
21
20
|
* Pass in children that will be embedded in the table header label
|
|
22
21
|
*/
|
|
23
|
-
children?:
|
|
22
|
+
children?: ReactNode;
|
|
24
23
|
/**
|
|
25
24
|
* Specify an optional className to be applied to the container node
|
|
26
25
|
*/
|
|
@@ -56,7 +55,7 @@ interface TableHeaderProps extends ReactAttr<HTMLTableCellElement & HTMLButtonEl
|
|
|
56
55
|
/**
|
|
57
56
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `TableSlugRow` component
|
|
58
57
|
*/
|
|
59
|
-
slug?:
|
|
58
|
+
slug?: ReactNode;
|
|
60
59
|
/**
|
|
61
60
|
* Specify which direction we are currently sorting by, should be one of DESC,
|
|
62
61
|
* NONE, or ASC.
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import PropTypes
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { ReactNode } from 'react';
|
|
8
9
|
export interface TableSlugRowProps {
|
|
9
10
|
/**
|
|
10
11
|
* The CSS class names of the cell that wraps the underlying input control
|
|
@@ -13,7 +14,7 @@ export interface TableSlugRowProps {
|
|
|
13
14
|
/**
|
|
14
15
|
* Provide a `Slug` component to be rendered inside the `TableSlugRow` component
|
|
15
16
|
*/
|
|
16
|
-
slug?:
|
|
17
|
+
slug?: ReactNode;
|
|
17
18
|
}
|
|
18
19
|
declare const TableSlugRow: {
|
|
19
20
|
({ className, slug }: TableSlugRowProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import React from 'react';
|
|
7
|
+
import React, { ReactNode } from 'react';
|
|
9
8
|
import flatpickr from 'flatpickr';
|
|
10
9
|
import { DateLimit, DateOption } from 'flatpickr/dist/types/options';
|
|
11
10
|
export type DatePickerTypes = 'simple' | 'single' | 'range';
|
|
@@ -34,7 +33,7 @@ interface DatePickerProps {
|
|
|
34
33
|
/**
|
|
35
34
|
* The child nodes.
|
|
36
35
|
*/
|
|
37
|
-
children:
|
|
36
|
+
children: ReactNode | object;
|
|
38
37
|
/**
|
|
39
38
|
* The CSS class names.
|
|
40
39
|
*/
|
|
@@ -74,7 +73,7 @@ interface DatePickerProps {
|
|
|
74
73
|
/**
|
|
75
74
|
* Provide the text that is displayed when the control is in error state (Fluid Only)
|
|
76
75
|
*/
|
|
77
|
-
invalidText?:
|
|
76
|
+
invalidText?: ReactNode;
|
|
78
77
|
/**
|
|
79
78
|
* `true` to use the light version.
|
|
80
79
|
*/
|
|
@@ -129,7 +128,7 @@ interface DatePickerProps {
|
|
|
129
128
|
/**
|
|
130
129
|
* Provide the text that is displayed when the control is in warning state (Fluid only)
|
|
131
130
|
*/
|
|
132
|
-
warnText?:
|
|
131
|
+
warnText?: ReactNode;
|
|
133
132
|
}
|
|
134
133
|
declare const DatePicker: React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<HTMLDivElement>>;
|
|
135
134
|
export default DatePicker;
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React, { ReactNode } from 'react';
|
|
8
8
|
import { UseSelectProps } from 'downshift';
|
|
9
|
-
import { ReactNodeLike } from 'prop-types';
|
|
10
9
|
import { type ListBoxMenuIconTranslationKey, ListBoxSize, ListBoxType } from '../ListBox';
|
|
11
10
|
import { ReactAttr } from '../../types/common';
|
|
12
11
|
type ExcludedAttributes = 'id' | 'onChange';
|
|
@@ -40,7 +39,7 @@ export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>,
|
|
|
40
39
|
* Provide helper text that is used alongside the control label for
|
|
41
40
|
* additional help
|
|
42
41
|
*/
|
|
43
|
-
helperText?:
|
|
42
|
+
helperText?: ReactNode;
|
|
44
43
|
/**
|
|
45
44
|
* Specify whether the title text should be hidden or not
|
|
46
45
|
*/
|
|
@@ -61,7 +60,7 @@ export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>,
|
|
|
61
60
|
/**
|
|
62
61
|
* Message which is displayed if the value is invalid.
|
|
63
62
|
*/
|
|
64
|
-
invalidText?:
|
|
63
|
+
invalidText?: ReactNode;
|
|
65
64
|
/**
|
|
66
65
|
* Function to render items as custom components instead of strings.
|
|
67
66
|
* Defaults to null and is overridden by a getter
|
|
@@ -114,12 +113,12 @@ export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>,
|
|
|
114
113
|
/**
|
|
115
114
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `Dropdown` component
|
|
116
115
|
*/
|
|
117
|
-
slug?:
|
|
116
|
+
slug?: ReactNode;
|
|
118
117
|
/**
|
|
119
118
|
* Provide the title text that will be read by a screen reader when
|
|
120
119
|
* visiting this control
|
|
121
120
|
*/
|
|
122
|
-
titleText?:
|
|
121
|
+
titleText?: ReactNode;
|
|
123
122
|
/**
|
|
124
123
|
* Callback function for translating ListBoxMenuIcon SVG title
|
|
125
124
|
*/
|
|
@@ -135,7 +134,7 @@ export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>,
|
|
|
135
134
|
/**
|
|
136
135
|
* Provide the text that is displayed when the control is in warning state
|
|
137
136
|
*/
|
|
138
|
-
warnText?:
|
|
137
|
+
warnText?: ReactNode;
|
|
139
138
|
}
|
|
140
139
|
export type DropdownTranslationKey = ListBoxMenuIconTranslationKey;
|
|
141
140
|
type DropdownComponentProps<ItemType> = React.PropsWithoutRef<React.PropsWithChildren<DropdownProps<ItemType>> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import React from 'react';
|
|
7
|
+
import React, { ReactNode } from 'react';
|
|
9
8
|
import { ButtonSize } from '../Button';
|
|
10
9
|
export declare const IconButtonKinds: readonly ["primary", "secondary", "ghost", "tertiary"];
|
|
11
10
|
export type IconButtonKind = (typeof IconButtonKinds)[number];
|
|
@@ -17,7 +16,7 @@ interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>
|
|
|
17
16
|
/**
|
|
18
17
|
* Provide an icon or asset to be rendered inside of the IconButton
|
|
19
18
|
*/
|
|
20
|
-
children?:
|
|
19
|
+
children?: ReactNode;
|
|
21
20
|
/**
|
|
22
21
|
* Specify an optional className to be added to your Button
|
|
23
22
|
*/
|
|
@@ -52,7 +51,7 @@ interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>
|
|
|
52
51
|
* This means that if you have text in the child node it will not be
|
|
53
52
|
* announced to the screen reader.
|
|
54
53
|
*/
|
|
55
|
-
label:
|
|
54
|
+
label: ReactNode;
|
|
56
55
|
/**
|
|
57
56
|
* Specify the duration in milliseconds to delay before hiding the tooltip
|
|
58
57
|
*/
|
|
@@ -27,6 +27,7 @@ const defaultTranslateWithId = id => defaultTranslations[id];
|
|
|
27
27
|
* `ListBoxTrigger` is used to orient the icon up or down depending on the
|
|
28
28
|
* state of the menu for a given `ListBox`
|
|
29
29
|
*/
|
|
30
|
+
|
|
30
31
|
const ListBoxTrigger = /*#__PURE__*/React__default.forwardRef(function ListBoxTrigger(_ref, ref) {
|
|
31
32
|
let {
|
|
32
33
|
isOpen,
|
|
@@ -130,7 +130,7 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(_ref, forwardRef) {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
function focusItem(e) {
|
|
133
|
-
const currentItem = focusableItems.findIndex(item => item.ref
|
|
133
|
+
const currentItem = focusableItems.findIndex(item => item.ref?.current?.contains(document.activeElement));
|
|
134
134
|
let indexToFocus = currentItem;
|
|
135
135
|
|
|
136
136
|
// if currentItem is -1, no menu item is focused yet.
|
|
@@ -24,6 +24,7 @@ import { ArrowRight, Enter, Space } from '../../internal/keyboard/keys.js';
|
|
|
24
24
|
|
|
25
25
|
var _CaretLeft, _CaretRight;
|
|
26
26
|
const hoverIntentDelay = 150; // in ms
|
|
27
|
+
const leaveIntentDelay = 300; // in ms
|
|
27
28
|
|
|
28
29
|
const MenuItem = /*#__PURE__*/forwardRef(function MenuItem(_ref, forwardRef) {
|
|
29
30
|
let {
|
|
@@ -49,6 +50,7 @@ const MenuItem = /*#__PURE__*/forwardRef(function MenuItem(_ref, forwardRef) {
|
|
|
49
50
|
const hasChildren = Boolean(children);
|
|
50
51
|
const [submenuOpen, setSubmenuOpen] = useState(false);
|
|
51
52
|
const hoverIntentTimeout = useRef(null);
|
|
53
|
+
const leaveIntentTimeout = useRef(null);
|
|
52
54
|
const isDisabled = disabled && !hasChildren;
|
|
53
55
|
const isDanger = kind === 'danger' && !hasChildren;
|
|
54
56
|
function registerItem() {
|
|
@@ -103,6 +105,11 @@ const MenuItem = /*#__PURE__*/forwardRef(function MenuItem(_ref, forwardRef) {
|
|
|
103
105
|
}
|
|
104
106
|
}
|
|
105
107
|
function handleMouseEnter() {
|
|
108
|
+
if (leaveIntentTimeout.current) {
|
|
109
|
+
// When mouse reenters before closing keep sub menu open
|
|
110
|
+
clearTimeout(leaveIntentTimeout.current);
|
|
111
|
+
leaveIntentTimeout.current = null;
|
|
112
|
+
}
|
|
106
113
|
hoverIntentTimeout.current = setTimeout(() => {
|
|
107
114
|
openSubmenu();
|
|
108
115
|
}, hoverIntentDelay);
|
|
@@ -110,8 +117,12 @@ const MenuItem = /*#__PURE__*/forwardRef(function MenuItem(_ref, forwardRef) {
|
|
|
110
117
|
function handleMouseLeave() {
|
|
111
118
|
if (hoverIntentTimeout.current) {
|
|
112
119
|
clearTimeout(hoverIntentTimeout.current);
|
|
113
|
-
|
|
114
|
-
|
|
120
|
+
// Avoid closing the sub menu as soon as mouse leaves
|
|
121
|
+
// prevents accidental closure due to scroll bar
|
|
122
|
+
leaveIntentTimeout.current = setTimeout(() => {
|
|
123
|
+
closeSubmenu();
|
|
124
|
+
menuItem.current?.focus();
|
|
125
|
+
}, leaveIntentDelay);
|
|
115
126
|
}
|
|
116
127
|
}
|
|
117
128
|
function handleKeyDown(e) {
|
|
@@ -4,14 +4,13 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import React from 'react';
|
|
7
|
+
import React, { ReactNode } from 'react';
|
|
9
8
|
import { ReactAttr } from '../../types/common';
|
|
10
9
|
import { InlineLoadingStatus } from '../InlineLoading/InlineLoading';
|
|
11
10
|
export declare const ModalSizes: readonly ["xs", "sm", "md", "lg"];
|
|
12
11
|
export type ModalSize = (typeof ModalSizes)[number];
|
|
13
12
|
export interface ModalSecondaryButton {
|
|
14
|
-
buttonText?: string |
|
|
13
|
+
buttonText?: string | ReactNode;
|
|
15
14
|
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
16
15
|
}
|
|
17
16
|
export interface ModalProps extends ReactAttr<HTMLDivElement> {
|
|
@@ -27,7 +26,7 @@ export interface ModalProps extends ReactAttr<HTMLDivElement> {
|
|
|
27
26
|
/**
|
|
28
27
|
* Provide the contents of your Modal
|
|
29
28
|
*/
|
|
30
|
-
children?:
|
|
29
|
+
children?: ReactNode;
|
|
31
30
|
/**
|
|
32
31
|
* Specify an optional className to be applied to the modal root node
|
|
33
32
|
*/
|
|
@@ -75,11 +74,11 @@ export interface ModalProps extends ReactAttr<HTMLDivElement> {
|
|
|
75
74
|
/**
|
|
76
75
|
* Specify the content of the modal header title.
|
|
77
76
|
*/
|
|
78
|
-
modalHeading?:
|
|
77
|
+
modalHeading?: ReactNode;
|
|
79
78
|
/**
|
|
80
79
|
* Specify the content of the modal header label.
|
|
81
80
|
*/
|
|
82
|
-
modalLabel?:
|
|
81
|
+
modalLabel?: ReactNode;
|
|
83
82
|
/**
|
|
84
83
|
* Specify a handler for keypresses.
|
|
85
84
|
* @deprecated this property is unused
|
|
@@ -124,11 +123,11 @@ export interface ModalProps extends ReactAttr<HTMLDivElement> {
|
|
|
124
123
|
/**
|
|
125
124
|
* Specify the text for the primary button
|
|
126
125
|
*/
|
|
127
|
-
primaryButtonText?:
|
|
126
|
+
primaryButtonText?: ReactNode;
|
|
128
127
|
/**
|
|
129
128
|
* Specify the text for the secondary button
|
|
130
129
|
*/
|
|
131
|
-
secondaryButtonText?:
|
|
130
|
+
secondaryButtonText?: ReactNode;
|
|
132
131
|
/**
|
|
133
132
|
* Specify an array of config objects for secondary buttons
|
|
134
133
|
*/
|
|
@@ -154,7 +153,7 @@ export interface ModalProps extends ReactAttr<HTMLDivElement> {
|
|
|
154
153
|
/**
|
|
155
154
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `Modal` component
|
|
156
155
|
*/
|
|
157
|
-
slug?:
|
|
156
|
+
slug?: ReactNode;
|
|
158
157
|
}
|
|
159
158
|
declare const Modal: React.ForwardRefExoticComponent<ModalProps & React.RefAttributes<HTMLDivElement>>;
|
|
160
159
|
export default Modal;
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { type UseComboboxProps, type UseMultipleSelectionProps } from 'downshift';
|
|
8
|
-
import { ReactNodeLike } from 'prop-types';
|
|
9
8
|
import { ReactNode, FunctionComponent, ReactElement } from 'react';
|
|
10
9
|
import { type ItemBase, type SortingPropTypes } from './MultiSelectPropTypes';
|
|
11
10
|
export interface FilterableMultiSelectProps<Item extends ItemBase> extends SortingPropTypes<Item> {
|
|
@@ -143,7 +142,7 @@ export interface FilterableMultiSelectProps<Item extends ItemBase> extends Sorti
|
|
|
143
142
|
/**
|
|
144
143
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `Checkbox` component
|
|
145
144
|
*/
|
|
146
|
-
slug?:
|
|
145
|
+
slug?: ReactNode;
|
|
147
146
|
/**
|
|
148
147
|
* Provide text to be used in a `<label>` element that is tied to the
|
|
149
148
|
* combobox via ARIA attributes.
|
|
@@ -5,11 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { UseSelectProps } from 'downshift';
|
|
8
|
-
import {
|
|
9
|
-
import React from 'react';
|
|
8
|
+
import React, { ReactNode } from 'react';
|
|
10
9
|
import { ListBoxSize, ListBoxType } from '../ListBox';
|
|
11
10
|
import { ListBoxProps } from '../ListBox/ListBox';
|
|
12
|
-
import { OnChangeData } from '../Dropdown';
|
|
13
11
|
import type { InternationalProps } from '../../types/common';
|
|
14
12
|
interface SharedOptions {
|
|
15
13
|
locale: string;
|
|
@@ -49,6 +47,9 @@ interface MultiSelectSortingProps<ItemType> {
|
|
|
49
47
|
*/
|
|
50
48
|
sortItems?(items: ReadonlyArray<ItemType>, options: SortItemsOptions<ItemType>): ItemType[];
|
|
51
49
|
}
|
|
50
|
+
interface OnChangeData<ItemType> {
|
|
51
|
+
selectedItems: ItemType[] | null;
|
|
52
|
+
}
|
|
52
53
|
export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<ItemType>, InternationalProps<'close.menu' | 'open.menu' | 'clear.all' | 'clear.selection'> {
|
|
53
54
|
className?: string;
|
|
54
55
|
/**
|
|
@@ -79,7 +80,7 @@ export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<Item
|
|
|
79
80
|
* Provide helper text that is used alongside the control label for
|
|
80
81
|
* additional help
|
|
81
82
|
*/
|
|
82
|
-
helperText?:
|
|
83
|
+
helperText?: ReactNode;
|
|
83
84
|
/**
|
|
84
85
|
* Specify whether the title text should be hidden or not
|
|
85
86
|
*/
|
|
@@ -100,7 +101,7 @@ export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<Item
|
|
|
100
101
|
/**
|
|
101
102
|
* If invalid, what is the error?
|
|
102
103
|
*/
|
|
103
|
-
invalidText?:
|
|
104
|
+
invalidText?: ReactNode;
|
|
104
105
|
/**
|
|
105
106
|
* Function to render items as custom components instead of strings.
|
|
106
107
|
* Defaults to null and is overridden by a getter
|
|
@@ -121,7 +122,7 @@ export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<Item
|
|
|
121
122
|
* Generic `label` that will be used as the textual representation of what
|
|
122
123
|
* this field is for
|
|
123
124
|
*/
|
|
124
|
-
label: NonNullable<
|
|
125
|
+
label: NonNullable<ReactNode>;
|
|
125
126
|
/**
|
|
126
127
|
* `true` to use the light version.
|
|
127
128
|
*
|
|
@@ -170,12 +171,12 @@ export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<Item
|
|
|
170
171
|
/**
|
|
171
172
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `MultiSelect` component
|
|
172
173
|
*/
|
|
173
|
-
slug?:
|
|
174
|
+
slug?: ReactNode;
|
|
174
175
|
/**
|
|
175
176
|
* Provide text to be used in a `<label>` element that is tied to the
|
|
176
177
|
* multiselect via ARIA attributes.
|
|
177
178
|
*/
|
|
178
|
-
titleText?:
|
|
179
|
+
titleText?: ReactNode;
|
|
179
180
|
/**
|
|
180
181
|
* Specify 'inline' to create an inline multi-select.
|
|
181
182
|
*/
|
|
@@ -191,7 +192,7 @@ export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<Item
|
|
|
191
192
|
/**
|
|
192
193
|
* Provide the text that is displayed when the control is in warning state
|
|
193
194
|
*/
|
|
194
|
-
warnText?:
|
|
195
|
+
warnText?: ReactNode;
|
|
195
196
|
}
|
|
196
197
|
type MultiSelectComponentProps<ItemType> = React.PropsWithChildren<MultiSelectProps<ItemType>> & React.RefAttributes<HTMLButtonElement>;
|
|
197
198
|
interface MultiSelectComponent {
|
|
@@ -388,8 +388,8 @@ export interface ActionableNotificationProps extends HTMLAttributes<HTMLDivEleme
|
|
|
388
388
|
*/
|
|
389
389
|
closeOnEscape?: boolean;
|
|
390
390
|
/**
|
|
391
|
-
* @deprecated
|
|
392
|
-
* Specify if focus should be moved to the component
|
|
391
|
+
* @deprecated This prop will be removed in the next major version, v12.
|
|
392
|
+
* Specify if focus should be moved to the component on render. To meet the spec for alertdialog, this must always be true. If you're setting this to false, explore using StaticNotification instead. https://github.com/carbon-design-system/carbon/pull/15532
|
|
393
393
|
*/
|
|
394
394
|
hasFocus?: boolean;
|
|
395
395
|
/**
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import { ReactNodeLike } from 'prop-types';
|
|
8
7
|
import React, { ReactNode } from 'react';
|
|
9
8
|
export declare const translationIds: {
|
|
10
9
|
'increment.number': string;
|
|
@@ -111,7 +110,7 @@ export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
111
110
|
/**
|
|
112
111
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `TextInput` component
|
|
113
112
|
*/
|
|
114
|
-
slug?:
|
|
113
|
+
slug?: ReactNode;
|
|
115
114
|
/**
|
|
116
115
|
* Specify how much the values should increase/decrease upon clicking on up/down button
|
|
117
116
|
*/
|
|
@@ -6,10 +6,16 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React, { type ForwardedRef, type WeakValidationMap, type ElementType } from 'react';
|
|
8
8
|
import { type PolymorphicProps } from '../../types/common';
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Deprecated popover alignment values.
|
|
11
|
+
* @deprecated Use NewPopoverAlignment instead.
|
|
12
|
+
*/
|
|
13
|
+
export type DeprecatedPopoverAlignment = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'left-bottom' | 'left-top' | 'right-bottom' | 'right-top';
|
|
14
|
+
export type NewPopoverAlignment = 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-end' | 'left-start' | 'right-end' | 'right-start';
|
|
15
|
+
export type PopoverAlignment = DeprecatedPopoverAlignment | NewPopoverAlignment;
|
|
10
16
|
interface PopoverBaseProps {
|
|
11
17
|
/**
|
|
12
|
-
* Specify how the popover should align with the trigger element
|
|
18
|
+
* Specify how the popover should align with the trigger element.
|
|
13
19
|
*/
|
|
14
20
|
align?: PopoverAlignment;
|
|
15
21
|
/**
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
|
+
import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
11
12
|
import React__default, { useRef, useMemo, useEffect } from 'react';
|
|
12
13
|
import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
|
|
13
14
|
import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
@@ -25,6 +26,25 @@ const PopoverContext = /*#__PURE__*/React__default.createContext({
|
|
|
25
26
|
},
|
|
26
27
|
autoAlign: null
|
|
27
28
|
});
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Deprecated popover alignment values.
|
|
32
|
+
* @deprecated Use NewPopoverAlignment instead.
|
|
33
|
+
*/
|
|
34
|
+
|
|
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
|
+
};
|
|
28
48
|
const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFunction(_ref, forwardRef) {
|
|
29
49
|
let {
|
|
30
50
|
isTabTip,
|
|
@@ -223,8 +243,9 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
223
243
|
Popover.propTypes = {
|
|
224
244
|
/**
|
|
225
245
|
* Specify how the popover should align with the trigger element
|
|
246
|
+
|
|
226
247
|
*/
|
|
227
|
-
align: PropTypes.oneOf(['top', 'top-left',
|
|
248
|
+
align: deprecateValuesWithin(PropTypes.oneOf(['top', 'top-left',
|
|
228
249
|
// deprecated use top-start instead
|
|
229
250
|
'top-right',
|
|
230
251
|
// deprecated use top-end instead
|
|
@@ -246,6 +267,10 @@ Popover.propTypes = {
|
|
|
246
267
|
|
|
247
268
|
// new values to match floating-ui
|
|
248
269
|
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
270
|
+
//allowed prop values
|
|
271
|
+
['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
|
|
272
|
+
//optional mapper function
|
|
273
|
+
propMappingFunction),
|
|
249
274
|
/**
|
|
250
275
|
* Provide a custom element or component to render the top-level node for the
|
|
251
276
|
* component.
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import React from 'react';
|
|
7
|
+
import React, { ReactNode } from 'react';
|
|
9
8
|
type ExcludedAttributes = 'onChange';
|
|
10
9
|
export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes> {
|
|
11
10
|
/**
|
|
@@ -41,7 +40,7 @@ export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
41
40
|
* Provide label text to be read by screen readers when interacting with the
|
|
42
41
|
* control
|
|
43
42
|
*/
|
|
44
|
-
labelText:
|
|
43
|
+
labelText: ReactNode;
|
|
45
44
|
/**
|
|
46
45
|
* Provide a name for the underlying `<input>` node
|
|
47
46
|
*/
|
|
@@ -58,7 +57,7 @@ export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
58
57
|
/**
|
|
59
58
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `RadioButton` component
|
|
60
59
|
*/
|
|
61
|
-
slug?:
|
|
60
|
+
slug?: ReactNode;
|
|
62
61
|
/**
|
|
63
62
|
* Specify the value of the `<RadioButton>`
|
|
64
63
|
*/
|
|
@@ -4,15 +4,14 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import React from 'react';
|
|
7
|
+
import React, { ReactNode } from 'react';
|
|
9
8
|
export declare const RadioButtonGroupContext: React.Context<null>;
|
|
10
9
|
type ExcludedAttributes = 'onChange';
|
|
11
10
|
export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HTMLFieldSetElement>, ExcludedAttributes> {
|
|
12
11
|
/**
|
|
13
12
|
* Provide a collection of `<RadioButton>` components to render in the group
|
|
14
13
|
*/
|
|
15
|
-
children?:
|
|
14
|
+
children?: ReactNode;
|
|
16
15
|
/**
|
|
17
16
|
* Provide an optional className to be applied to the container node
|
|
18
17
|
*/
|
|
@@ -28,7 +27,7 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
|
|
|
28
27
|
/**
|
|
29
28
|
* Provide text that is used alongside the control label for additional help
|
|
30
29
|
*/
|
|
31
|
-
helperText?:
|
|
30
|
+
helperText?: ReactNode;
|
|
32
31
|
/**
|
|
33
32
|
* Specify whether the control is currently invalid
|
|
34
33
|
*/
|
|
@@ -36,7 +35,7 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
|
|
|
36
35
|
/**
|
|
37
36
|
* Provide the text that is displayed when the control is in an invalid state
|
|
38
37
|
*/
|
|
39
|
-
invalidText?:
|
|
38
|
+
invalidText?: ReactNode;
|
|
40
39
|
/**
|
|
41
40
|
* Provide where label text should be placed
|
|
42
41
|
*/
|
|
@@ -45,7 +44,7 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
|
|
|
45
44
|
* Provide a legend to the RadioButtonGroup input that you are
|
|
46
45
|
* exposing to the user
|
|
47
46
|
*/
|
|
48
|
-
legendText?:
|
|
47
|
+
legendText?: ReactNode;
|
|
49
48
|
/**
|
|
50
49
|
* Specify the name of the underlying `<input>` nodes
|
|
51
50
|
*/
|
|
@@ -66,7 +65,7 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
|
|
|
66
65
|
/**
|
|
67
66
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `RadioButtonGroup` component
|
|
68
67
|
*/
|
|
69
|
-
slug?:
|
|
68
|
+
slug?: ReactNode;
|
|
70
69
|
/**
|
|
71
70
|
* Specify whether the control is currently in warning state
|
|
72
71
|
*/
|
|
@@ -74,7 +73,7 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
|
|
|
74
73
|
/**
|
|
75
74
|
* Provide the text that is displayed when the control is in warning state
|
|
76
75
|
*/
|
|
77
|
-
warnText?:
|
|
76
|
+
warnText?: ReactNode;
|
|
78
77
|
/**
|
|
79
78
|
* Specify the value that is currently selected in the group
|
|
80
79
|
*/
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import { ReactNodeLike } from 'prop-types';
|
|
8
7
|
import React, { ChangeEventHandler, ComponentPropsWithRef, ReactNode } from 'react';
|
|
9
8
|
type ExcludedAttributes = 'size';
|
|
10
9
|
interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, ExcludedAttributes> {
|
|
@@ -80,7 +79,7 @@ interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, ExcludedAttr
|
|
|
80
79
|
/**
|
|
81
80
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `Dropdown` component
|
|
82
81
|
*/
|
|
83
|
-
slug?:
|
|
82
|
+
slug?: ReactNode;
|
|
84
83
|
/**
|
|
85
84
|
* Specify whether the control is currently in warning state
|
|
86
85
|
*/
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import React, { type KeyboardEventHandler, PureComponent } from 'react';
|
|
8
|
-
import PropTypes
|
|
7
|
+
import React, { type KeyboardEventHandler, PureComponent, ReactNode } from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
9
|
/**
|
|
10
10
|
* Distinguish two handles by lower and upper positions.
|
|
11
11
|
*/
|
|
@@ -26,7 +26,7 @@ export interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputEle
|
|
|
26
26
|
/**
|
|
27
27
|
* The child nodes.
|
|
28
28
|
*/
|
|
29
|
-
children?:
|
|
29
|
+
children?: ReactNode;
|
|
30
30
|
/**
|
|
31
31
|
* The CSS class name for the slider, set on the wrapping div.
|
|
32
32
|
*/
|
|
@@ -58,11 +58,11 @@ export interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputEle
|
|
|
58
58
|
/**
|
|
59
59
|
* Provide the text that is displayed when the Slider is in an invalid state
|
|
60
60
|
*/
|
|
61
|
-
invalidText?:
|
|
61
|
+
invalidText?: ReactNode;
|
|
62
62
|
/**
|
|
63
63
|
* The label for the slider.
|
|
64
64
|
*/
|
|
65
|
-
labelText?:
|
|
65
|
+
labelText?: ReactNode;
|
|
66
66
|
/**
|
|
67
67
|
* @deprecated
|
|
68
68
|
* `true` to use the light version.
|