@carbon/react 1.57.0 → 1.58.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 +1106 -990
- package/es/components/Accordion/Accordion.d.ts +1 -1
- package/es/components/Accordion/index.d.ts +2 -2
- package/es/components/Button/Button.js +2 -2
- package/es/components/Button/index.d.ts +2 -1
- 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 +6 -7
- package/es/components/Dropdown/index.d.ts +2 -2
- package/es/components/FormLabel/index.d.ts +2 -2
- package/es/components/Grid/Column.d.ts +2 -2
- package/es/components/Grid/GridTypes.d.ts +1 -2
- package/es/components/Grid/index.d.ts +3 -1
- package/es/components/IconButton/index.d.ts +3 -4
- package/es/components/InlineLoading/index.d.ts +2 -2
- package/es/components/ListBox/next/ListBoxTrigger.js +1 -0
- package/es/components/Loading/index.d.ts +2 -2
- 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/Modal/index.d.ts +2 -2
- 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 +12 -2
- package/es/components/NumberInput/NumberInput.js +2 -2
- package/es/components/NumberInput/index.d.ts +1 -1
- package/es/components/OverflowMenu/OverflowMenu.d.ts +10 -6
- package/es/components/OverflowMenu/index.d.ts +13 -0
- 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/ProgressBar/ProgressBar.d.ts +1 -1
- package/es/components/ProgressBar/index.d.ts +2 -2
- package/es/components/ProgressIndicator/ProgressIndicator.d.ts +2 -2
- package/es/components/ProgressIndicator/index.d.ts +2 -0
- 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/StructuredList/index.d.ts +2 -0
- package/es/components/Switch/Switch.d.ts +1 -1
- package/es/components/Switch/index.d.ts +2 -2
- package/es/components/Tab/index.d.ts +2 -1
- package/es/components/Tag/DismissibleTag.d.ts +12 -12
- package/es/components/Tag/DismissibleTag.js +34 -9
- package/es/components/Tag/OperationalTag.d.ts +12 -12
- package/es/components/Tag/OperationalTag.js +45 -9
- package/es/components/Tag/SelectableTag.d.ts +12 -12
- package/es/components/Tag/SelectableTag.js +46 -10
- package/es/components/Tag/Tag.d.ts +3 -3
- package/es/components/Tag/Tag.js +31 -5
- package/es/components/TextArea/TextArea.d.ts +6 -7
- package/es/components/TextArea/index.d.ts +2 -2
- 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/TextInput/index.d.ts +4 -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/components/Tooltip/Tooltip.js +16 -5
- package/es/components/Tooltip/index.d.ts +2 -2
- package/es/components/UnorderedList/UnorderedList.d.ts +1 -1
- package/es/components/UnorderedList/index.d.ts +1 -0
- package/es/index.js +4 -4
- package/es/prop-types/deprecateValuesWithin.js +35 -0
- package/lib/components/Accordion/Accordion.d.ts +1 -1
- package/lib/components/Accordion/index.d.ts +2 -2
- package/lib/components/Button/Button.js +2 -2
- package/lib/components/Button/index.d.ts +2 -1
- 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 +6 -7
- package/lib/components/Dropdown/index.d.ts +2 -2
- package/lib/components/FormLabel/index.d.ts +2 -2
- package/lib/components/Grid/Column.d.ts +2 -2
- package/lib/components/Grid/GridTypes.d.ts +1 -2
- package/lib/components/Grid/index.d.ts +3 -1
- package/lib/components/IconButton/index.d.ts +3 -4
- package/lib/components/InlineLoading/index.d.ts +2 -2
- package/lib/components/ListBox/next/ListBoxTrigger.js +1 -0
- package/lib/components/Loading/index.d.ts +2 -2
- 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/Modal/index.d.ts +2 -2
- 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 +12 -2
- package/lib/components/NumberInput/NumberInput.js +2 -2
- package/lib/components/NumberInput/index.d.ts +1 -1
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +10 -6
- package/lib/components/OverflowMenu/index.d.ts +13 -0
- 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/ProgressBar/ProgressBar.d.ts +1 -1
- package/lib/components/ProgressBar/index.d.ts +2 -2
- package/lib/components/ProgressIndicator/ProgressIndicator.d.ts +2 -2
- package/lib/components/ProgressIndicator/index.d.ts +2 -0
- 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/StructuredList/index.d.ts +2 -0
- package/lib/components/Switch/Switch.d.ts +1 -1
- package/lib/components/Switch/index.d.ts +2 -2
- package/lib/components/Tab/index.d.ts +2 -1
- package/lib/components/Tag/DismissibleTag.d.ts +12 -12
- package/lib/components/Tag/DismissibleTag.js +33 -8
- package/lib/components/Tag/OperationalTag.d.ts +12 -12
- package/lib/components/Tag/OperationalTag.js +44 -8
- package/lib/components/Tag/SelectableTag.d.ts +12 -12
- package/lib/components/Tag/SelectableTag.js +45 -9
- package/lib/components/Tag/Tag.d.ts +3 -3
- package/lib/components/Tag/Tag.js +30 -4
- package/lib/components/TextArea/TextArea.d.ts +6 -7
- package/lib/components/TextArea/index.d.ts +2 -2
- 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/TextInput/index.d.ts +4 -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/components/Tooltip/Tooltip.js +16 -5
- package/lib/components/Tooltip/index.d.ts +2 -2
- package/lib/components/UnorderedList/UnorderedList.d.ts +1 -1
- package/lib/components/UnorderedList/index.d.ts +1 -0
- package/lib/index.js +30 -29
- package/lib/prop-types/deprecateValuesWithin.js +39 -0
- package/package.json +6 -6
- 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,11 +134,11 @@ 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>>;
|
|
142
|
-
interface DropdownComponent {
|
|
141
|
+
export interface DropdownComponent {
|
|
143
142
|
<ItemType>(props: DropdownComponentProps<ItemType>): React.ReactElement | null;
|
|
144
143
|
}
|
|
145
144
|
declare const _default: DropdownComponent;
|
|
@@ -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 Dropdown, { type DropdownTranslationKey, type OnChangeData } from './Dropdown';
|
|
7
|
+
import Dropdown, { type DropdownTranslationKey, type OnChangeData, type DropdownProps } from './Dropdown';
|
|
8
8
|
export type { DropdownTranslationKey, OnChangeData };
|
|
9
|
-
export { Dropdown };
|
|
9
|
+
export { Dropdown, type DropdownProps };
|
|
10
10
|
export { default as DropdownSkeleton } from './Dropdown.Skeleton';
|
|
11
11
|
export default Dropdown;
|
|
@@ -4,6 +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 FormLabel from './FormLabel';
|
|
7
|
+
import FormLabel, { type FormLabelProps } from './FormLabel';
|
|
8
8
|
export default FormLabel;
|
|
9
|
-
export { FormLabel };
|
|
9
|
+
export { FormLabel, type FormLabelProps };
|
|
@@ -8,14 +8,14 @@ import React from 'react';
|
|
|
8
8
|
import { PolymorphicProps } from '../../types/common';
|
|
9
9
|
type ColumnSpanPercent = '25%' | '50%' | '75%' | '100%';
|
|
10
10
|
type ColumnSpanSimple = boolean | number | ColumnSpanPercent;
|
|
11
|
-
interface ColumnSpanObject {
|
|
11
|
+
export interface ColumnSpanObject {
|
|
12
12
|
span?: ColumnSpanSimple;
|
|
13
13
|
offset?: number;
|
|
14
14
|
start?: number;
|
|
15
15
|
end?: number;
|
|
16
16
|
}
|
|
17
17
|
export type ColumnSpan = ColumnSpanSimple | ColumnSpanObject;
|
|
18
|
-
interface ColumnBaseProps {
|
|
18
|
+
export interface ColumnBaseProps {
|
|
19
19
|
/**
|
|
20
20
|
* Pass in content that will be rendered within the `Column`
|
|
21
21
|
*/
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
/// <reference types="react" />
|
|
8
8
|
import { PolymorphicProps } from '../../types/common';
|
|
9
|
-
interface GridBaseProps {
|
|
9
|
+
export interface GridBaseProps {
|
|
10
10
|
/**
|
|
11
11
|
* Pass in content that will be rendered within the `Grid`
|
|
12
12
|
*/
|
|
@@ -34,4 +34,3 @@ export type GridProps<T extends React.ElementType> = PolymorphicProps<T, GridBas
|
|
|
34
34
|
export interface GridComponent {
|
|
35
35
|
<T extends React.ElementType>(props: GridProps<T>, context?: any): React.ReactElement<any, any> | null;
|
|
36
36
|
}
|
|
37
|
-
export {};
|
|
@@ -4,9 +4,11 @@
|
|
|
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 { type GridProps } from './GridTypes';
|
|
8
|
+
export { type GridProps };
|
|
7
9
|
export { FlexGrid } from './FlexGrid';
|
|
8
10
|
export { Grid } from './Grid';
|
|
9
11
|
export { default as Row } from './Row';
|
|
10
|
-
export { default as Column } from './Column';
|
|
12
|
+
export { default as Column, type ColumnProps } from './Column';
|
|
11
13
|
export { ColumnHang } from './ColumnHang';
|
|
12
14
|
export { GridSettings } from './GridContext';
|
|
@@ -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
|
*/
|
|
@@ -4,6 +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 InlineLoading from './InlineLoading';
|
|
7
|
+
import InlineLoading, { type InlineLoadingProps } from './InlineLoading';
|
|
8
8
|
export default InlineLoading;
|
|
9
|
-
export { InlineLoading };
|
|
9
|
+
export { InlineLoading, type InlineLoadingProps };
|
|
@@ -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,
|
|
@@ -4,6 +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 Loading from './Loading';
|
|
7
|
+
import Loading, { type LoadingProps } from './Loading';
|
|
8
8
|
export default Loading;
|
|
9
|
-
export { Loading };
|
|
9
|
+
export { Loading, type LoadingProps };
|
|
@@ -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;
|
|
@@ -4,6 +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 Modal from './Modal';
|
|
7
|
+
import Modal, { type ModalProps } from './Modal';
|
|
8
8
|
export default Modal;
|
|
9
|
-
export { Modal };
|
|
9
|
+
export { Modal, type ModalProps };
|
|
@@ -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
|
*/
|
|
@@ -134,4 +133,15 @@ export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
134
133
|
warnText?: ReactNode;
|
|
135
134
|
}
|
|
136
135
|
declare const NumberInput: React.ForwardRefExoticComponent<NumberInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
136
|
+
export interface Label {
|
|
137
|
+
disabled?: boolean;
|
|
138
|
+
hideLabel?: boolean;
|
|
139
|
+
id?: string;
|
|
140
|
+
label?: ReactNode;
|
|
141
|
+
}
|
|
142
|
+
export interface HelperTextProps {
|
|
143
|
+
id?: string;
|
|
144
|
+
description?: ReactNode;
|
|
145
|
+
disabled?: boolean;
|
|
146
|
+
}
|
|
137
147
|
export { NumberInput };
|
|
@@ -387,7 +387,7 @@ NumberInput.propTypes = {
|
|
|
387
387
|
*/
|
|
388
388
|
warnText: PropTypes.node
|
|
389
389
|
};
|
|
390
|
-
|
|
390
|
+
const Label = _ref => {
|
|
391
391
|
let {
|
|
392
392
|
disabled,
|
|
393
393
|
id,
|
|
@@ -408,7 +408,7 @@ function Label(_ref) {
|
|
|
408
408
|
}, label);
|
|
409
409
|
}
|
|
410
410
|
return null;
|
|
411
|
-
}
|
|
411
|
+
};
|
|
412
412
|
Label.propTypes = {
|
|
413
413
|
disabled: PropTypes.bool,
|
|
414
414
|
hideLabel: PropTypes.bool,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import React from 'react';
|
|
8
|
+
import React, { ComponentType } from 'react';
|
|
9
9
|
/**
|
|
10
10
|
* @param {Element} menuBody The menu body with the menu arrow.
|
|
11
11
|
* @param {string} direction The floating menu direction.
|
|
@@ -17,14 +17,18 @@ export declare const getMenuOffset: (menuBody: any, direction: any, trigger: any
|
|
|
17
17
|
top: number;
|
|
18
18
|
} | undefined;
|
|
19
19
|
interface Offset {
|
|
20
|
-
top
|
|
21
|
-
left
|
|
20
|
+
top?: number | null | undefined;
|
|
21
|
+
left?: number | null | undefined;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
type IconProps = {
|
|
24
|
+
className?: string;
|
|
25
|
+
'aria-label'?: string;
|
|
26
|
+
};
|
|
27
|
+
export interface OverflowMenuProps {
|
|
24
28
|
/**
|
|
25
29
|
* Specify a label to be read by screen readers on the container node
|
|
26
30
|
*/
|
|
27
|
-
['aria-label']
|
|
31
|
+
['aria-label']?: string;
|
|
28
32
|
/**
|
|
29
33
|
* Deprecated, please use `aria-label` instead.
|
|
30
34
|
* Specify a label to be read by screen readers on the container note.
|
|
@@ -99,7 +103,7 @@ interface OverflowMenuProps {
|
|
|
99
103
|
/**
|
|
100
104
|
* Function called to override icon rendering.
|
|
101
105
|
*/
|
|
102
|
-
renderIcon?:
|
|
106
|
+
renderIcon?: ComponentType<IconProps>;
|
|
103
107
|
/**
|
|
104
108
|
* Specify a CSS selector that matches the DOM element that should
|
|
105
109
|
* be focused when the OverflowMenu opens
|
|
@@ -0,0 +1,13 @@
|
|
|
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 { type OverflowMenuProps } from './OverflowMenu';
|
|
8
|
+
declare function OverflowMenu(props: any): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare namespace OverflowMenu {
|
|
10
|
+
var displayName: string;
|
|
11
|
+
}
|
|
12
|
+
export default OverflowMenu;
|
|
13
|
+
export { OverflowMenu, type OverflowMenuProps };
|
|
@@ -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
|
/**
|