@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
|
@@ -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,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 ProgressBar from './ProgressBar';
|
|
7
|
+
import ProgressBar, { type ProgressBarProps } from './ProgressBar';
|
|
8
8
|
export default ProgressBar;
|
|
9
|
-
export { ProgressBar };
|
|
9
|
+
export { ProgressBar, type ProgressBarProps };
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import React from 'react';
|
|
9
|
-
interface ProgressIndicatorProps extends Omit<React.HTMLAttributes<HTMLUListElement>, 'onChange'> {
|
|
9
|
+
export interface ProgressIndicatorProps extends Omit<React.HTMLAttributes<HTMLUListElement>, 'onChange'> {
|
|
10
10
|
/**
|
|
11
11
|
* Provide `<ProgressStep>` components to be rendered in the
|
|
12
12
|
* `<ProgressIndicator>`
|
|
@@ -63,7 +63,7 @@ declare namespace ProgressIndicator {
|
|
|
63
63
|
vertical: PropTypes.Requireable<boolean>;
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
-
interface ProgressStepProps {
|
|
66
|
+
export interface ProgressStepProps {
|
|
67
67
|
/**
|
|
68
68
|
* Provide an optional className to be applied to the containing `<li>` node
|
|
69
69
|
*/
|
|
@@ -4,5 +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 { type ProgressIndicatorProps, type ProgressStepProps } from './ProgressIndicator';
|
|
7
8
|
export { default as ProgressIndicatorSkeleton } from './ProgressIndicator.Skeleton';
|
|
8
9
|
export * from './ProgressIndicator';
|
|
10
|
+
export { type ProgressIndicatorProps, type ProgressStepProps };
|
|
@@ -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.
|
|
@@ -4,5 +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 { type StructuredListWrapperProps } from './StructuredList';
|
|
7
8
|
export * from './StructuredList';
|
|
8
9
|
export { default as StructuredListSkeleton, type StructuredListSkeletonProps, } from './StructuredList.Skeleton';
|
|
10
|
+
export { type StructuredListWrapperProps };
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React, { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
8
|
-
interface SwitchEventHandlersParams {
|
|
8
|
+
export interface SwitchEventHandlersParams {
|
|
9
9
|
index?: number;
|
|
10
10
|
name?: string | number;
|
|
11
11
|
text?: string;
|
|
@@ -4,7 +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 Switch from './Switch';
|
|
7
|
+
import Switch, { type SwitchProps } from './Switch';
|
|
8
8
|
import IconSwitch from './IconSwitch';
|
|
9
9
|
export default Switch;
|
|
10
|
-
export { Switch, IconSwitch };
|
|
10
|
+
export { Switch, IconSwitch, type SwitchProps };
|
|
@@ -4,15 +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 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 {
|
|
12
|
-
/**
|
|
13
|
-
* Provide content to be rendered inside of a `DismissibleTag`
|
|
14
|
-
*/
|
|
15
|
-
children?: React.ReactNode;
|
|
16
12
|
/**
|
|
17
13
|
* Provide a custom className that is applied to the containing <span>
|
|
18
14
|
*/
|
|
@@ -42,7 +38,11 @@ export interface DismissibleTagBaseProps {
|
|
|
42
38
|
/**
|
|
43
39
|
* **Experimental:** Provide a `Slug` component to be rendered inside the `DismissibleTag` component
|
|
44
40
|
*/
|
|
45
|
-
slug?:
|
|
41
|
+
slug?: ReactNode;
|
|
42
|
+
/**
|
|
43
|
+
* Provide text to be rendered inside of a the tag.
|
|
44
|
+
*/
|
|
45
|
+
text?: string;
|
|
46
46
|
/**
|
|
47
47
|
* Text to show on clear filters
|
|
48
48
|
*/
|
|
@@ -54,12 +54,8 @@ export interface DismissibleTagBaseProps {
|
|
|
54
54
|
}
|
|
55
55
|
export type DismissibleTagProps<T extends React.ElementType> = PolymorphicProps<T, DismissibleTagBaseProps>;
|
|
56
56
|
declare const DismissibleTag: {
|
|
57
|
-
<T extends React.ElementType<any>>({
|
|
57
|
+
<T extends React.ElementType<any>>({ className, disabled, id, renderIcon, title, onClose, slug, size, text, type, ...other }: DismissibleTagProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
58
58
|
propTypes: {
|
|
59
|
-
/**
|
|
60
|
-
* Provide content to be rendered inside of a `DismissibleTag`
|
|
61
|
-
*/
|
|
62
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
63
59
|
/**
|
|
64
60
|
* Provide a custom className that is applied to the containing <span>
|
|
65
61
|
*/
|
|
@@ -90,6 +86,10 @@ declare const DismissibleTag: {
|
|
|
90
86
|
* **Experimental:** Provide a `Slug` component to be rendered inside the `DismissibleTag` component
|
|
91
87
|
*/
|
|
92
88
|
slug: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
89
|
+
/**
|
|
90
|
+
* Provide text to be rendered inside of a the tag.
|
|
91
|
+
*/
|
|
92
|
+
text: PropTypes.Requireable<string>;
|
|
93
93
|
/**
|
|
94
94
|
* Text to show on clear filters
|
|
95
95
|
*/
|
|
@@ -7,32 +7,46 @@
|
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
|
-
import React__default from 'react';
|
|
10
|
+
import React__default, { useState, useLayoutEffect } from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import setupGetInstanceId from '../../tools/setupGetInstanceId.js';
|
|
13
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
14
|
import Tag, { SIZES, TYPES } from './Tag.js';
|
|
15
15
|
import { Close } from '@carbon/icons-react';
|
|
16
|
+
import '../Tooltip/DefinitionTooltip.js';
|
|
17
|
+
import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
18
|
+
import '../Text/index.js';
|
|
19
|
+
import { Text } from '../Text/Text.js';
|
|
16
20
|
|
|
17
21
|
var _Close;
|
|
18
22
|
const getInstanceId = setupGetInstanceId();
|
|
19
23
|
const DismissibleTag = _ref => {
|
|
20
24
|
let {
|
|
21
|
-
children,
|
|
22
25
|
className,
|
|
23
26
|
disabled,
|
|
24
27
|
id,
|
|
25
28
|
renderIcon,
|
|
26
|
-
title = '
|
|
29
|
+
title = 'Dismiss',
|
|
27
30
|
onClose,
|
|
28
31
|
slug,
|
|
29
32
|
size,
|
|
33
|
+
text,
|
|
30
34
|
type,
|
|
31
35
|
...other
|
|
32
36
|
} = _ref;
|
|
33
37
|
const prefix = usePrefix();
|
|
34
38
|
const tagId = id || `tag-${getInstanceId()}`;
|
|
35
39
|
const tagClasses = cx(`${prefix}--tag--filter`, className);
|
|
40
|
+
const [isEllipsisApplied, setIsEllipsisApplied] = useState(false);
|
|
41
|
+
const isEllipsisActive = element => {
|
|
42
|
+
setIsEllipsisApplied(element.offsetWidth < element.scrollWidth);
|
|
43
|
+
return element.offsetWidth < element.scrollWidth;
|
|
44
|
+
};
|
|
45
|
+
useLayoutEffect(() => {
|
|
46
|
+
const elementTagId = document.querySelector(`#${tagId}`);
|
|
47
|
+
const newElement = elementTagId?.getElementsByClassName(`${prefix}--tag__label`)[0];
|
|
48
|
+
isEllipsisActive(newElement);
|
|
49
|
+
}, [prefix, tagId]);
|
|
36
50
|
const handleClose = event => {
|
|
37
51
|
if (onClose) {
|
|
38
52
|
event.stopPropagation();
|
|
@@ -46,6 +60,7 @@ const DismissibleTag = _ref => {
|
|
|
46
60
|
kind: 'inline'
|
|
47
61
|
});
|
|
48
62
|
}
|
|
63
|
+
const tooltipClasses = cx(`${prefix}--icon-tooltip`, `${prefix}--tag-label-tooltip`);
|
|
49
64
|
|
|
50
65
|
// Removing onClick from the spread operator
|
|
51
66
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -53,6 +68,7 @@ const DismissibleTag = _ref => {
|
|
|
53
68
|
onClick,
|
|
54
69
|
...otherProps
|
|
55
70
|
} = other;
|
|
71
|
+
const dismissLabel = `Dismiss "${text}"`;
|
|
56
72
|
return /*#__PURE__*/React__default.createElement(Tag, _extends({
|
|
57
73
|
type: type,
|
|
58
74
|
size: size,
|
|
@@ -62,20 +78,25 @@ const DismissibleTag = _ref => {
|
|
|
62
78
|
id: tagId
|
|
63
79
|
}, otherProps), /*#__PURE__*/React__default.createElement("div", {
|
|
64
80
|
className: `${prefix}--interactive--tag-children`
|
|
65
|
-
},
|
|
81
|
+
}, /*#__PURE__*/React__default.createElement(Text, {
|
|
82
|
+
title: text,
|
|
83
|
+
className: `${prefix}--tag__label`
|
|
84
|
+
}, text), /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
85
|
+
label: isEllipsisApplied ? dismissLabel : title,
|
|
86
|
+
align: "bottom",
|
|
87
|
+
className: tooltipClasses,
|
|
88
|
+
leaveDelayMs: 0,
|
|
89
|
+
closeOnActivation: true
|
|
90
|
+
}, /*#__PURE__*/React__default.createElement("button", {
|
|
66
91
|
type: "button",
|
|
67
92
|
className: `${prefix}--tag__close-icon`,
|
|
68
93
|
onClick: handleClose,
|
|
69
94
|
disabled: disabled,
|
|
70
95
|
"aria-label": title,
|
|
71
96
|
title: title
|
|
72
|
-
}, _Close || (_Close = /*#__PURE__*/React__default.createElement(Close, null)))));
|
|
97
|
+
}, _Close || (_Close = /*#__PURE__*/React__default.createElement(Close, null)))), normalizedSlug));
|
|
73
98
|
};
|
|
74
99
|
DismissibleTag.propTypes = {
|
|
75
|
-
/**
|
|
76
|
-
* Provide content to be rendered inside of a `DismissibleTag`
|
|
77
|
-
*/
|
|
78
|
-
children: PropTypes.node,
|
|
79
100
|
/**
|
|
80
101
|
* Provide a custom className that is applied to the containing <span>
|
|
81
102
|
*/
|
|
@@ -106,6 +127,10 @@ DismissibleTag.propTypes = {
|
|
|
106
127
|
* **Experimental:** Provide a `Slug` component to be rendered inside the `DismissibleTag` component
|
|
107
128
|
*/
|
|
108
129
|
slug: PropTypes.node,
|
|
130
|
+
/**
|
|
131
|
+
* Provide text to be rendered inside of a the tag.
|
|
132
|
+
*/
|
|
133
|
+
text: PropTypes.string,
|
|
109
134
|
/**
|
|
110
135
|
* Text to show on clear filters
|
|
111
136
|
*/
|
|
@@ -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: {
|
|
@@ -21,10 +21,6 @@ declare const TYPES: {
|
|
|
21
21
|
'warm-gray': string;
|
|
22
22
|
};
|
|
23
23
|
export interface OperationalTagBaseProps {
|
|
24
|
-
/**
|
|
25
|
-
* Provide content to be rendered inside of a `OperationalTag`
|
|
26
|
-
*/
|
|
27
|
-
children?: React.ReactNode;
|
|
28
24
|
/**
|
|
29
25
|
* Provide a custom className that is applied to the containing <span>
|
|
30
26
|
*/
|
|
@@ -51,7 +47,11 @@ export interface OperationalTagBaseProps {
|
|
|
51
47
|
/**
|
|
52
48
|
* **Experimental:** Provide a `Slug` component to be rendered inside the `OperationalTag` component
|
|
53
49
|
*/
|
|
54
|
-
slug?:
|
|
50
|
+
slug?: ReactNode;
|
|
51
|
+
/**
|
|
52
|
+
* Provide text to be rendered inside of a the tag.
|
|
53
|
+
*/
|
|
54
|
+
text?: string;
|
|
55
55
|
/**
|
|
56
56
|
* Specify the type of the `Tag`
|
|
57
57
|
*/
|
|
@@ -59,12 +59,8 @@ export interface OperationalTagBaseProps {
|
|
|
59
59
|
}
|
|
60
60
|
export type OperationalTagProps<T extends React.ElementType> = PolymorphicProps<T, OperationalTagBaseProps>;
|
|
61
61
|
declare const OperationalTag: {
|
|
62
|
-
<T extends React.ElementType<any>>({
|
|
62
|
+
<T extends React.ElementType<any>>({ className, disabled, id, renderIcon, slug, size, text, type, ...other }: OperationalTagProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
63
63
|
propTypes: {
|
|
64
|
-
/**
|
|
65
|
-
* Provide content to be rendered inside of a `OperationalTag`
|
|
66
|
-
*/
|
|
67
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
68
64
|
/**
|
|
69
65
|
* Provide a custom className that is applied to the containing <span>
|
|
70
66
|
*/
|
|
@@ -91,6 +87,10 @@ declare const OperationalTag: {
|
|
|
91
87
|
* **Experimental:** Provide a `Slug` component to be rendered inside the `OperationalTag` component
|
|
92
88
|
*/
|
|
93
89
|
slug: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
90
|
+
/**
|
|
91
|
+
* Provide text to be rendered inside of a the tag.
|
|
92
|
+
*/
|
|
93
|
+
text: PropTypes.Requireable<string>;
|
|
94
94
|
/**
|
|
95
95
|
* Specify the type of the `Tag`
|
|
96
96
|
*/
|
|
@@ -7,11 +7,15 @@
|
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
|
-
import React__default from 'react';
|
|
10
|
+
import React__default, { useState, useLayoutEffect } from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import setupGetInstanceId from '../../tools/setupGetInstanceId.js';
|
|
13
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
14
|
import Tag, { SIZES } from './Tag.js';
|
|
15
|
+
import '../Tooltip/DefinitionTooltip.js';
|
|
16
|
+
import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
17
|
+
import '../Text/index.js';
|
|
18
|
+
import { Text } from '../Text/Text.js';
|
|
15
19
|
|
|
16
20
|
const getInstanceId = setupGetInstanceId();
|
|
17
21
|
const TYPES = {
|
|
@@ -28,19 +32,29 @@ const TYPES = {
|
|
|
28
32
|
};
|
|
29
33
|
const OperationalTag = _ref => {
|
|
30
34
|
let {
|
|
31
|
-
children,
|
|
32
35
|
className,
|
|
33
36
|
disabled,
|
|
34
37
|
id,
|
|
35
38
|
renderIcon,
|
|
36
39
|
slug,
|
|
37
40
|
size,
|
|
41
|
+
text,
|
|
38
42
|
type = 'gray',
|
|
39
43
|
...other
|
|
40
44
|
} = _ref;
|
|
41
45
|
const prefix = usePrefix();
|
|
42
46
|
const tagId = id || `tag-${getInstanceId()}`;
|
|
43
47
|
const tagClasses = cx(`${prefix}--tag--operational`, className);
|
|
48
|
+
const [isEllipsisApplied, setIsEllipsisApplied] = useState(false);
|
|
49
|
+
const isEllipsisActive = element => {
|
|
50
|
+
setIsEllipsisApplied(element.offsetWidth < element.scrollWidth);
|
|
51
|
+
return element.offsetWidth < element.scrollWidth;
|
|
52
|
+
};
|
|
53
|
+
useLayoutEffect(() => {
|
|
54
|
+
const elementTagId = document.querySelector(`#${tagId}`);
|
|
55
|
+
const newElement = elementTagId?.getElementsByClassName(`${prefix}--tag__label`)[0];
|
|
56
|
+
isEllipsisActive(newElement);
|
|
57
|
+
}, [prefix, tagId]);
|
|
44
58
|
let normalizedSlug;
|
|
45
59
|
if (slug && slug['type']?.displayName === 'Slug') {
|
|
46
60
|
normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
|
|
@@ -48,6 +62,27 @@ const OperationalTag = _ref => {
|
|
|
48
62
|
kind: 'inline'
|
|
49
63
|
});
|
|
50
64
|
}
|
|
65
|
+
const tooltipClasses = cx(`${prefix}--icon-tooltip`, `${prefix}--tag-label-tooltip`);
|
|
66
|
+
if (isEllipsisApplied) {
|
|
67
|
+
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
68
|
+
label: text,
|
|
69
|
+
align: "bottom",
|
|
70
|
+
className: tooltipClasses,
|
|
71
|
+
leaveDelayMs: 0,
|
|
72
|
+
onMouseEnter: false,
|
|
73
|
+
closeOnActivation: true
|
|
74
|
+
}, /*#__PURE__*/React__default.createElement(Tag, _extends({
|
|
75
|
+
type: type,
|
|
76
|
+
size: size,
|
|
77
|
+
renderIcon: renderIcon,
|
|
78
|
+
disabled: disabled,
|
|
79
|
+
className: tagClasses,
|
|
80
|
+
id: tagId
|
|
81
|
+
}, other), /*#__PURE__*/React__default.createElement(Text, {
|
|
82
|
+
title: text,
|
|
83
|
+
className: `${prefix}--tag__label`
|
|
84
|
+
}, text), normalizedSlug));
|
|
85
|
+
}
|
|
51
86
|
return /*#__PURE__*/React__default.createElement(Tag, _extends({
|
|
52
87
|
type: type,
|
|
53
88
|
size: size,
|
|
@@ -55,15 +90,12 @@ const OperationalTag = _ref => {
|
|
|
55
90
|
disabled: disabled,
|
|
56
91
|
className: tagClasses,
|
|
57
92
|
id: tagId
|
|
58
|
-
}, other), /*#__PURE__*/React__default.createElement(
|
|
59
|
-
|
|
60
|
-
|
|
93
|
+
}, other), normalizedSlug, /*#__PURE__*/React__default.createElement(Text, {
|
|
94
|
+
title: text,
|
|
95
|
+
className: `${prefix}--tag__label`
|
|
96
|
+
}, text));
|
|
61
97
|
};
|
|
62
98
|
OperationalTag.propTypes = {
|
|
63
|
-
/**
|
|
64
|
-
* Provide content to be rendered inside of a `OperationalTag`
|
|
65
|
-
*/
|
|
66
|
-
children: PropTypes.node,
|
|
67
99
|
/**
|
|
68
100
|
* Provide a custom className that is applied to the containing <span>
|
|
69
101
|
*/
|
|
@@ -90,6 +122,10 @@ OperationalTag.propTypes = {
|
|
|
90
122
|
* **Experimental:** Provide a `Slug` component to be rendered inside the `OperationalTag` component
|
|
91
123
|
*/
|
|
92
124
|
slug: PropTypes.node,
|
|
125
|
+
/**
|
|
126
|
+
* Provide text to be rendered inside of a the tag.
|
|
127
|
+
*/
|
|
128
|
+
text: PropTypes.string,
|
|
93
129
|
/**
|
|
94
130
|
* Specify the type of the `Tag`
|
|
95
131
|
*/
|