@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,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 PropTypes
|
|
8
|
-
import React from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import React, { ReactNode } from 'react';
|
|
9
9
|
import { PolymorphicProps } from '../../types/common';
|
|
10
10
|
import { SIZES, TYPES } from './Tag';
|
|
11
11
|
export interface DismissibleTagBaseProps {
|
|
@@ -42,7 +42,7 @@ export interface DismissibleTagBaseProps {
|
|
|
42
42
|
/**
|
|
43
43
|
* **Experimental:** Provide a `Slug` component to be rendered inside the `DismissibleTag` component
|
|
44
44
|
*/
|
|
45
|
-
slug?:
|
|
45
|
+
slug?: ReactNode;
|
|
46
46
|
/**
|
|
47
47
|
* Text to show on clear filters
|
|
48
48
|
*/
|
|
@@ -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 PropTypes
|
|
8
|
-
import React, { MouseEventHandler } from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import React, { MouseEventHandler, ReactNode } from 'react';
|
|
9
9
|
import { PolymorphicProps } from '../../types/common';
|
|
10
10
|
import { SIZES } from './Tag';
|
|
11
11
|
declare const TYPES: {
|
|
@@ -51,7 +51,7 @@ export interface OperationalTagBaseProps {
|
|
|
51
51
|
/**
|
|
52
52
|
* **Experimental:** Provide a `Slug` component to be rendered inside the `OperationalTag` component
|
|
53
53
|
*/
|
|
54
|
-
slug?:
|
|
54
|
+
slug?: ReactNode;
|
|
55
55
|
/**
|
|
56
56
|
* Specify the type of the `Tag`
|
|
57
57
|
*/
|
|
@@ -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 PropTypes
|
|
8
|
-
import React from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import React, { ReactNode } from 'react';
|
|
9
9
|
import { PolymorphicProps } from '../../types/common';
|
|
10
10
|
import { SIZES } from './Tag';
|
|
11
11
|
export interface SelectableTagBaseProps {
|
|
@@ -42,7 +42,7 @@ export interface SelectableTagBaseProps {
|
|
|
42
42
|
/**
|
|
43
43
|
* **Experimental:** Provide a `Slug` component to be rendered inside the `SelectableTag` component
|
|
44
44
|
*/
|
|
45
|
-
slug?:
|
|
45
|
+
slug?: ReactNode;
|
|
46
46
|
}
|
|
47
47
|
export type SelectableTagProps<T extends React.ElementType> = PolymorphicProps<T, SelectableTagBaseProps>;
|
|
48
48
|
declare const SelectableTag: {
|
|
@@ -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 PropTypes
|
|
8
|
-
import React from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import React, { ReactNode } from 'react';
|
|
9
9
|
import { PolymorphicProps } from '../../types/common';
|
|
10
10
|
export declare const TYPES: {
|
|
11
11
|
red: string;
|
|
@@ -64,7 +64,7 @@ export interface TagBaseProps {
|
|
|
64
64
|
/**
|
|
65
65
|
* **Experimental:** Provide a `Slug` component to be rendered inside the `Tag` component
|
|
66
66
|
*/
|
|
67
|
-
slug?:
|
|
67
|
+
slug?: ReactNode;
|
|
68
68
|
/**
|
|
69
69
|
* @deprecated This property is deprecated and will be removed in the next major version. Use DismissibleTag instead.
|
|
70
70
|
*/
|
|
@@ -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
|
export interface TextAreaProps extends React.InputHTMLAttributes<HTMLTextAreaElement> {
|
|
10
9
|
/**
|
|
11
10
|
* Provide a custom className that is applied directly to the underlying
|
|
@@ -31,7 +30,7 @@ export interface TextAreaProps extends React.InputHTMLAttributes<HTMLTextAreaEle
|
|
|
31
30
|
/**
|
|
32
31
|
* Provide text that is used alongside the control label for additional help
|
|
33
32
|
*/
|
|
34
|
-
helperText?:
|
|
33
|
+
helperText?: ReactNode;
|
|
35
34
|
/**
|
|
36
35
|
* Specify whether you want the underlying label to be visually hidden
|
|
37
36
|
*/
|
|
@@ -47,12 +46,12 @@ export interface TextAreaProps extends React.InputHTMLAttributes<HTMLTextAreaEle
|
|
|
47
46
|
/**
|
|
48
47
|
* Provide the text that is displayed when the control is in an invalid state
|
|
49
48
|
*/
|
|
50
|
-
invalidText?:
|
|
49
|
+
invalidText?: ReactNode;
|
|
51
50
|
/**
|
|
52
51
|
* Provide the text that will be read by a screen reader when visiting this
|
|
53
52
|
* control
|
|
54
53
|
*/
|
|
55
|
-
labelText:
|
|
54
|
+
labelText: ReactNode;
|
|
56
55
|
/**
|
|
57
56
|
* @deprecated
|
|
58
57
|
* `true` to use the light version. For use on $ui-01 backgrounds only.
|
|
@@ -93,7 +92,7 @@ export interface TextAreaProps extends React.InputHTMLAttributes<HTMLTextAreaEle
|
|
|
93
92
|
/**
|
|
94
93
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `TextArea` component
|
|
95
94
|
*/
|
|
96
|
-
slug?:
|
|
95
|
+
slug?: ReactNode;
|
|
97
96
|
/**
|
|
98
97
|
* Provide the current value of the `<textarea>`
|
|
99
98
|
*/
|
|
@@ -105,7 +104,7 @@ export interface TextAreaProps extends React.InputHTMLAttributes<HTMLTextAreaEle
|
|
|
105
104
|
/**
|
|
106
105
|
* Provide the text that is displayed when the control is in warning state
|
|
107
106
|
*/
|
|
108
|
-
warnText?:
|
|
107
|
+
warnText?: ReactNode;
|
|
109
108
|
/**
|
|
110
109
|
* Specify the method used for calculating the counter number
|
|
111
110
|
*/
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import React, { InputHTMLAttributes } from 'react';
|
|
2
|
-
import { ReactNodeLike } from 'prop-types';
|
|
1
|
+
import React, { InputHTMLAttributes, ReactNode } from 'react';
|
|
3
2
|
type ExcludedAttributes = 'size';
|
|
4
3
|
export interface PasswordInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes> {
|
|
5
4
|
/**
|
|
@@ -21,7 +20,7 @@ export interface PasswordInputProps extends Omit<InputHTMLAttributes<HTMLInputEl
|
|
|
21
20
|
/**
|
|
22
21
|
* Provide text that is used alongside the control label for additional help
|
|
23
22
|
*/
|
|
24
|
-
helperText?:
|
|
23
|
+
helperText?: ReactNode;
|
|
25
24
|
/**
|
|
26
25
|
* Specify whether or not the underlying label is visually hidden
|
|
27
26
|
*/
|
|
@@ -45,11 +44,11 @@ export interface PasswordInputProps extends Omit<InputHTMLAttributes<HTMLInputEl
|
|
|
45
44
|
/**
|
|
46
45
|
* Provide the text that is displayed when the control is in an invalid state
|
|
47
46
|
*/
|
|
48
|
-
invalidText?:
|
|
47
|
+
invalidText?: ReactNode;
|
|
49
48
|
/**
|
|
50
49
|
* Provide the text that will be read by a screen reader when visiting this control
|
|
51
50
|
*/
|
|
52
|
-
labelText:
|
|
51
|
+
labelText: ReactNode;
|
|
53
52
|
/**
|
|
54
53
|
* @deprecated The `light` prop for `PasswordInput` has been deprecated in favor of the new `Layer` component. It will be removed in the next major release.
|
|
55
54
|
* `true` to use the light version. For use on $ui-01 backgrounds only.
|
|
@@ -119,7 +118,7 @@ export interface PasswordInputProps extends Omit<InputHTMLAttributes<HTMLInputEl
|
|
|
119
118
|
/**
|
|
120
119
|
* Provide the text that is displayed when the control is in warning state
|
|
121
120
|
*/
|
|
122
|
-
warnText?:
|
|
121
|
+
warnText?: ReactNode;
|
|
123
122
|
}
|
|
124
123
|
declare const PasswordInput: React.ForwardRefExoticComponent<PasswordInputProps & React.RefAttributes<unknown>>;
|
|
125
124
|
export default PasswordInput;
|
|
@@ -139,10 +139,10 @@ const PasswordInput = /*#__PURE__*/React__default.forwardRef(function PasswordIn
|
|
|
139
139
|
align = tooltipPosition;
|
|
140
140
|
}
|
|
141
141
|
if (tooltipAlignment === 'end') {
|
|
142
|
-
align = `${tooltipPosition}-
|
|
142
|
+
align = `${tooltipPosition}-end`;
|
|
143
143
|
}
|
|
144
144
|
if (tooltipAlignment === 'start') {
|
|
145
|
-
align = `${tooltipPosition}-
|
|
145
|
+
align = `${tooltipPosition}-start`;
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
if (tooltipPosition === 'right' || tooltipPosition === 'left') {
|
|
@@ -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
|
type ExcludedAttributes = 'defaultValue' | 'id' | 'size' | 'value';
|
|
10
9
|
export interface TextInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes> {
|
|
@@ -89,7 +88,7 @@ export interface TextInputProps extends Omit<React.InputHTMLAttributes<HTMLInput
|
|
|
89
88
|
/**
|
|
90
89
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `TextInput` component
|
|
91
90
|
*/
|
|
92
|
-
slug?:
|
|
91
|
+
slug?: ReactNode;
|
|
93
92
|
/**
|
|
94
93
|
* Specify the type of the `<input>`
|
|
95
94
|
*/
|
|
@@ -11,6 +11,7 @@ import PropTypes from 'prop-types';
|
|
|
11
11
|
import React__default, { useMemo } from 'react';
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
import { LayerContext } from '../Layer/LayerContext.js';
|
|
14
|
+
import { useMatchMedia } from '../../internal/useMatchMedia.js';
|
|
14
15
|
|
|
15
16
|
const ThemeContext = /*#__PURE__*/React__default.createContext({
|
|
16
17
|
theme: 'white'
|
|
@@ -62,8 +63,10 @@ function Theme(_ref2) {
|
|
|
62
63
|
[`${prefix}--layer-one`]: true
|
|
63
64
|
});
|
|
64
65
|
const value = React__default.useMemo(() => {
|
|
66
|
+
const isDark = theme && ['g90', 'g100'].includes(theme);
|
|
65
67
|
return {
|
|
66
|
-
theme
|
|
68
|
+
theme,
|
|
69
|
+
isDark
|
|
67
70
|
};
|
|
68
71
|
}, [theme]);
|
|
69
72
|
const BaseComponentAsAny = BaseComponent;
|
|
@@ -102,5 +105,8 @@ Theme.propTypes = {
|
|
|
102
105
|
function useTheme() {
|
|
103
106
|
return React__default.useContext(ThemeContext);
|
|
104
107
|
}
|
|
108
|
+
function usePrefersDarkScheme() {
|
|
109
|
+
return useMatchMedia('(prefers-color-scheme: dark)');
|
|
110
|
+
}
|
|
105
111
|
|
|
106
|
-
export { GlobalTheme, Theme, ThemeContext, useTheme };
|
|
112
|
+
export { GlobalTheme, Theme, ThemeContext, usePrefersDarkScheme, useTheme };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { type ReactNode, type MouseEvent, type KeyboardEvent, type HTMLAttributes, type ChangeEvent, type ComponentType } from 'react';
|
|
2
|
-
import { ReactNodeLike } from 'prop-types';
|
|
3
2
|
export interface TileProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
3
|
children?: ReactNode;
|
|
5
4
|
className?: string;
|
|
@@ -13,7 +12,7 @@ export interface TileProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
13
12
|
/**
|
|
14
13
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `SelectableTile` component
|
|
15
14
|
*/
|
|
16
|
-
slug?:
|
|
15
|
+
slug?: ReactNode;
|
|
17
16
|
}
|
|
18
17
|
export declare const Tile: React.ForwardRefExoticComponent<TileProps & React.RefAttributes<HTMLDivElement>>;
|
|
19
18
|
export interface ClickableTileProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
@@ -104,7 +103,7 @@ export interface SelectableTileProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
104
103
|
/**
|
|
105
104
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `SelectableTile` component
|
|
106
105
|
*/
|
|
107
|
-
slug?:
|
|
106
|
+
slug?: ReactNode;
|
|
108
107
|
/**
|
|
109
108
|
* Specify the tab index of the wrapper element
|
|
110
109
|
*/
|
|
@@ -149,7 +148,7 @@ export interface ExpandableTileProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
149
148
|
/**
|
|
150
149
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `ExpandableTile` component
|
|
151
150
|
*/
|
|
152
|
-
slug?:
|
|
151
|
+
slug?: ReactNode;
|
|
153
152
|
/**
|
|
154
153
|
* The `tabindex` attribute.
|
|
155
154
|
*/
|
|
@@ -4,14 +4,15 @@
|
|
|
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
|
import { ReactAttr } from '../../types/common';
|
|
9
10
|
type ExcludedAttributes = 'onChange';
|
|
10
11
|
export interface TileGroupProps extends Omit<ReactAttr<HTMLFieldSetElement>, ExcludedAttributes> {
|
|
11
12
|
/**
|
|
12
13
|
* Provide a collection of <RadioTile> components to render in the group
|
|
13
14
|
*/
|
|
14
|
-
children?:
|
|
15
|
+
children?: ReactNode;
|
|
15
16
|
/**
|
|
16
17
|
* Provide an optional className to be applied to the container node
|
|
17
18
|
*/
|
|
@@ -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 TileGroup from './TileGroup';
|
|
8
|
+
export default TileGroup;
|
|
9
|
+
export { TileGroup };
|
|
@@ -89,7 +89,7 @@ function Toggle(_ref) {
|
|
|
89
89
|
role: "switch",
|
|
90
90
|
type: "button",
|
|
91
91
|
"aria-checked": checked,
|
|
92
|
-
"aria-labelledby": ariaLabelledby ?? labelId,
|
|
92
|
+
"aria-labelledby": ariaLabelledby ?? (labelText ? labelId : undefined),
|
|
93
93
|
disabled: disabled,
|
|
94
94
|
onClick: handleClick
|
|
95
95
|
})), /*#__PURE__*/React__default.createElement(LabelComponent, {
|
package/es/index.js
CHANGED
|
@@ -80,6 +80,8 @@ export { default as OverflowMenuItem } from './components/OverflowMenuItem/Overf
|
|
|
80
80
|
export { default as Pagination } from './components/Pagination/Pagination.js';
|
|
81
81
|
export { default as PaginationSkeleton } from './components/Pagination/Pagination.Skeleton.js';
|
|
82
82
|
export { default as PaginationNav } from './components/PaginationNav/PaginationNav.js';
|
|
83
|
+
export { default as ControlledPasswordInput } from './components/TextInput/ControlledPasswordInput.js';
|
|
84
|
+
export { default as PasswordInput } from './components/TextInput/PasswordInput.js';
|
|
83
85
|
export { default as PrimaryButton } from './components/PrimaryButton/PrimaryButton.js';
|
|
84
86
|
export { default as ProgressIndicatorSkeleton } from './components/ProgressIndicator/ProgressIndicator.Skeleton.js';
|
|
85
87
|
export { ProgressIndicator, ProgressStep } from './components/ProgressIndicator/ProgressIndicator.js';
|
|
@@ -117,7 +119,7 @@ export { default as TextArea } from './components/TextArea/TextArea.js';
|
|
|
117
119
|
export { default as TextAreaSkeleton } from './components/TextArea/TextArea.Skeleton.js';
|
|
118
120
|
import './components/TextInput/index.js';
|
|
119
121
|
export { ClickableTile, ExpandableTile, SelectableTile, Tile, TileAboveTheFoldContent, TileBelowTheFoldContent } from './components/Tile/Tile.js';
|
|
120
|
-
export { default as TileGroup } from './components/TileGroup/
|
|
122
|
+
export { default as TileGroup } from './components/TileGroup/TileGroup.js';
|
|
121
123
|
export { default as TimePicker } from './components/TimePicker/TimePicker.js';
|
|
122
124
|
export { default as TimePickerSelect } from './components/TimePickerSelect/TimePickerSelect.js';
|
|
123
125
|
export { Toggle } from './components/Toggle/Toggle.js';
|
|
@@ -169,7 +171,7 @@ export { default as unstable__AiSkeletonText } from './components/AiSkeleton/AiS
|
|
|
169
171
|
export { DefinitionTooltip } from './components/Tooltip/DefinitionTooltip.js';
|
|
170
172
|
export { Tooltip } from './components/Tooltip/Tooltip.js';
|
|
171
173
|
import './components/Text/index.js';
|
|
172
|
-
export { GlobalTheme, Theme, ThemeContext, useTheme } from './components/Theme/index.js';
|
|
174
|
+
export { GlobalTheme, Theme, ThemeContext, usePrefersDarkScheme, useTheme } from './components/Theme/index.js';
|
|
173
175
|
export { PrefixContext, usePrefix } from './internal/usePrefix.js';
|
|
174
176
|
export { useIdPrefix } from './internal/useIdPrefix.js';
|
|
175
177
|
export { default as unstable__FluidDatePickerSkeleton } from './components/FluidDatePicker/FluidDatePicker.Skeleton.js';
|
|
@@ -230,6 +232,4 @@ export { default as TableToolbarSearch } from './components/DataTable/TableToolb
|
|
|
230
232
|
export { default as TableToolbarMenu } from './components/DataTable/TableToolbarMenu.js';
|
|
231
233
|
export { default as FilterableMultiSelect } from './components/MultiSelect/FilterableMultiSelect.js';
|
|
232
234
|
export { default as MultiSelect } from './components/MultiSelect/MultiSelect.js';
|
|
233
|
-
export { default as ControlledPasswordInput } from './components/TextInput/ControlledPasswordInput.js';
|
|
234
|
-
export { default as PasswordInput } from './components/TextInput/PasswordInput.js';
|
|
235
235
|
export { default as TreeNode } from './components/TreeView/TreeNode.js';
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
import { warning } from '../internal/warning.js';
|
|
9
|
+
|
|
10
|
+
const didWarnAboutDeprecation = {};
|
|
11
|
+
function deprecateValuesWithin(propType, allowedValues, propMappingFunction) {
|
|
12
|
+
return function checker(props, propName, componentName) {
|
|
13
|
+
if (props[propName] === undefined) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (!didWarnAboutDeprecation[componentName] || !didWarnAboutDeprecation[componentName][propName]) {
|
|
17
|
+
didWarnAboutDeprecation[componentName] = {
|
|
18
|
+
...didWarnAboutDeprecation[componentName],
|
|
19
|
+
[propName]: true
|
|
20
|
+
};
|
|
21
|
+
const deprecatedValue = props[propName];
|
|
22
|
+
const newValue = propMappingFunction ? propMappingFunction(deprecatedValue) : null;
|
|
23
|
+
if (allowedValues && !allowedValues.includes(deprecatedValue)) {
|
|
24
|
+
const message = propMappingFunction ? `"${deprecatedValue}" is a deprecated value for the "${propName}" prop on the "${componentName}" component. Use "${newValue}" instead. "${deprecatedValue}" will be removed in the next major release.` : `"${deprecatedValue}" is a deprecated value for the "${propName}" prop on the "${componentName}" component. Allowed values is/are: ${allowedValues.join(', ')}. "${deprecatedValue}" will be removed in the next major release. `;
|
|
25
|
+
process.env.NODE_ENV !== "production" ? warning(false, message) : void 0;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
29
|
+
rest[_key - 3] = arguments[_key];
|
|
30
|
+
}
|
|
31
|
+
return propType(props, propName, componentName, ...rest);
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { deprecateValuesWithin as default };
|
|
@@ -73,10 +73,10 @@ const Button = /*#__PURE__*/React__default["default"].forwardRef(function Button
|
|
|
73
73
|
align = tooltipPosition;
|
|
74
74
|
}
|
|
75
75
|
if (tooltipAlignment === 'end') {
|
|
76
|
-
align = `${tooltipPosition}-
|
|
76
|
+
align = `${tooltipPosition}-end`;
|
|
77
77
|
}
|
|
78
78
|
if (tooltipAlignment === 'start') {
|
|
79
|
-
align = `${tooltipPosition}-
|
|
79
|
+
align = `${tooltipPosition}-start`;
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
if (tooltipPosition === 'right' || tooltipPosition === 'left') {
|
|
@@ -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 = 'id' | 'onChange' | 'onClick' | 'type';
|
|
10
9
|
export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes> {
|
|
11
10
|
/**
|
|
@@ -16,7 +15,7 @@ export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
|
|
|
16
15
|
* Provide a label to provide a description of the Checkbox input that you are
|
|
17
16
|
* exposing to the user
|
|
18
17
|
*/
|
|
19
|
-
labelText: NonNullable<
|
|
18
|
+
labelText: NonNullable<ReactNode>;
|
|
20
19
|
/**
|
|
21
20
|
* Specify whether the underlying input should be checked by default
|
|
22
21
|
*/
|
|
@@ -28,7 +27,7 @@ export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
|
|
|
28
27
|
/**
|
|
29
28
|
* Provide text for the form group for additional help
|
|
30
29
|
*/
|
|
31
|
-
helperText?:
|
|
30
|
+
helperText?: ReactNode;
|
|
32
31
|
/**
|
|
33
32
|
* Specify whether the label should be hidden, or not
|
|
34
33
|
*/
|
|
@@ -44,11 +43,11 @@ export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
|
|
|
44
43
|
/**
|
|
45
44
|
* Provide the text that is displayed when the Checkbox is in an invalid state
|
|
46
45
|
*/
|
|
47
|
-
invalidText?:
|
|
46
|
+
invalidText?: ReactNode;
|
|
48
47
|
/**
|
|
49
48
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `Checkbox` component
|
|
50
49
|
*/
|
|
51
|
-
slug?:
|
|
50
|
+
slug?: ReactNode;
|
|
52
51
|
/**
|
|
53
52
|
* Specify whether the Checkbox is currently invalid
|
|
54
53
|
*/
|
|
@@ -56,7 +55,7 @@ export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
|
|
|
56
55
|
/**
|
|
57
56
|
* Provide the text that is displayed when the Checkbox is in an invalid state
|
|
58
57
|
*/
|
|
59
|
-
warnText?:
|
|
58
|
+
warnText?: ReactNode;
|
|
60
59
|
/**
|
|
61
60
|
* Provide an optional handler that is called when the internal state of
|
|
62
61
|
* Checkbox changes. This handler is called with event and state info.
|
|
@@ -4,9 +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
|
|
8
|
-
import {
|
|
9
|
-
import { type ComponentProps, type ReactNode, type ComponentType, type ReactElement, type RefAttributes, type PropsWithChildren, type PropsWithRef, type InputHTMLAttributes, type MouseEvent } from 'react';
|
|
7
|
+
import { UseComboboxProps } from 'downshift';
|
|
8
|
+
import { type ReactNode, type ComponentType, type ReactElement, type RefAttributes, type PropsWithChildren, type PropsWithRef, type InputHTMLAttributes, type MouseEvent } from 'react';
|
|
10
9
|
import { ListBoxSize } from '../ListBox';
|
|
11
10
|
type ExcludedAttributes = 'id' | 'onChange' | 'onClick' | 'type' | 'size';
|
|
12
11
|
interface OnChangeData<ItemType> {
|
|
@@ -45,7 +44,7 @@ export interface ComboBoxProps<ItemType> extends Omit<InputHTMLAttributes<HTMLIn
|
|
|
45
44
|
/**
|
|
46
45
|
* Additional props passed to Downshift
|
|
47
46
|
*/
|
|
48
|
-
downshiftProps?:
|
|
47
|
+
downshiftProps?: Partial<UseComboboxProps<ItemType>>;
|
|
49
48
|
/**
|
|
50
49
|
* Provide helper text that is used alongside the control label for
|
|
51
50
|
* additional help
|
|
@@ -139,7 +138,7 @@ export interface ComboBoxProps<ItemType> extends Omit<InputHTMLAttributes<HTMLIn
|
|
|
139
138
|
/**
|
|
140
139
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `ComboBox` component
|
|
141
140
|
*/
|
|
142
|
-
slug?:
|
|
141
|
+
slug?: ReactNode;
|
|
143
142
|
/**
|
|
144
143
|
* Provide text to be used in a `<label>` element that is tied to the
|
|
145
144
|
* combobox via ARIA attributes.
|