@carbon/react 1.71.0-rc.0 → 1.71.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +910 -885
  2. package/es/components/Checkbox/Checkbox.d.ts +5 -0
  3. package/es/components/Checkbox/Checkbox.js +16 -7
  4. package/es/components/CheckboxGroup/CheckboxGroup.d.ts +5 -0
  5. package/es/components/CheckboxGroup/CheckboxGroup.js +16 -7
  6. package/es/components/ComboBox/ComboBox.d.ts +1 -1
  7. package/es/components/ComposedModal/ComposedModal.d.ts +5 -0
  8. package/es/components/ComposedModal/ComposedModal.js +16 -10
  9. package/es/components/FluidNumberInput/FluidNumberInput.d.ts +4 -0
  10. package/es/components/FluidSelect/FluidSelect.d.ts +4 -0
  11. package/es/components/FluidSelect/FluidSelect.js +5 -1
  12. package/es/components/FluidTextArea/FluidTextArea.d.ts +4 -0
  13. package/es/components/FluidTextArea/FluidTextArea.js +5 -1
  14. package/es/components/FluidTextInput/FluidPasswordInput.d.ts +4 -0
  15. package/es/components/FluidTextInput/FluidPasswordInput.js +5 -1
  16. package/es/components/FluidTextInput/FluidTextInput.d.ts +4 -0
  17. package/es/components/FluidTextInput/FluidTextInput.js +5 -1
  18. package/es/components/FluidTimePicker/FluidTimePicker.d.ts +4 -0
  19. package/es/components/FluidTimePicker/FluidTimePicker.js +23 -7
  20. package/es/components/Modal/Modal.d.ts +5 -0
  21. package/es/components/Modal/Modal.js +16 -10
  22. package/es/components/PaginationNav/PaginationNav.js +15 -3
  23. package/es/components/RadioButton/RadioButton.d.ts +5 -0
  24. package/es/components/RadioButton/RadioButton.js +16 -7
  25. package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +5 -0
  26. package/es/components/RadioButtonGroup/RadioButtonGroup.js +16 -7
  27. package/es/components/RadioTile/RadioTile.d.ts +5 -0
  28. package/es/components/RadioTile/RadioTile.js +17 -8
  29. package/es/components/Tag/DismissibleTag.d.ts +11 -2
  30. package/es/components/Tag/DismissibleTag.js +13 -5
  31. package/es/components/Tag/Tag.d.ts +5 -0
  32. package/es/components/Tag/Tag.js +14 -7
  33. package/es/components/Tile/Tile.d.ts +21 -1
  34. package/es/components/Tile/Tile.js +68 -48
  35. package/lib/components/Checkbox/Checkbox.d.ts +5 -0
  36. package/lib/components/Checkbox/Checkbox.js +16 -7
  37. package/lib/components/CheckboxGroup/CheckboxGroup.d.ts +5 -0
  38. package/lib/components/CheckboxGroup/CheckboxGroup.js +16 -7
  39. package/lib/components/ComboBox/ComboBox.d.ts +1 -1
  40. package/lib/components/ComposedModal/ComposedModal.d.ts +5 -0
  41. package/lib/components/ComposedModal/ComposedModal.js +16 -10
  42. package/lib/components/FluidNumberInput/FluidNumberInput.d.ts +4 -0
  43. package/lib/components/FluidSelect/FluidSelect.d.ts +4 -0
  44. package/lib/components/FluidSelect/FluidSelect.js +5 -1
  45. package/lib/components/FluidTextArea/FluidTextArea.d.ts +4 -0
  46. package/lib/components/FluidTextArea/FluidTextArea.js +5 -1
  47. package/lib/components/FluidTextInput/FluidPasswordInput.d.ts +4 -0
  48. package/lib/components/FluidTextInput/FluidPasswordInput.js +5 -1
  49. package/lib/components/FluidTextInput/FluidTextInput.d.ts +4 -0
  50. package/lib/components/FluidTextInput/FluidTextInput.js +5 -1
  51. package/lib/components/FluidTimePicker/FluidTimePicker.d.ts +4 -0
  52. package/lib/components/FluidTimePicker/FluidTimePicker.js +23 -7
  53. package/lib/components/Modal/Modal.d.ts +5 -0
  54. package/lib/components/Modal/Modal.js +16 -10
  55. package/lib/components/PaginationNav/PaginationNav.js +15 -3
  56. package/lib/components/RadioButton/RadioButton.d.ts +5 -0
  57. package/lib/components/RadioButton/RadioButton.js +16 -7
  58. package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +5 -0
  59. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +16 -7
  60. package/lib/components/RadioTile/RadioTile.d.ts +5 -0
  61. package/lib/components/RadioTile/RadioTile.js +17 -8
  62. package/lib/components/Tag/DismissibleTag.d.ts +11 -2
  63. package/lib/components/Tag/DismissibleTag.js +13 -5
  64. package/lib/components/Tag/Tag.d.ts +5 -0
  65. package/lib/components/Tag/Tag.js +14 -7
  66. package/lib/components/Tile/Tile.d.ts +21 -1
  67. package/lib/components/Tile/Tile.js +67 -47
  68. package/package.json +4 -4
@@ -10,6 +10,7 @@ import PropTypes from 'prop-types';
10
10
  import React__default, { useRef } from 'react';
11
11
  import cx from 'classnames';
12
12
  import '../Text/index.js';
13
+ import deprecate from '../../prop-types/deprecate.js';
13
14
  import { usePrefix } from '../../internal/usePrefix.js';
14
15
  import { useId } from '../../internal/useId.js';
15
16
  import mergeRefs from '../../tools/mergeRefs.js';
@@ -18,6 +19,7 @@ import { Text } from '../Text/Text.js';
18
19
  const RadioButton = /*#__PURE__*/React__default.forwardRef((props, ref) => {
19
20
  const {
20
21
  className,
22
+ decorator,
21
23
  disabled,
22
24
  hideLabel,
23
25
  id,
@@ -41,13 +43,14 @@ const RadioButton = /*#__PURE__*/React__default.forwardRef((props, ref) => {
41
43
  });
42
44
  const wrapperClasses = cx(className, `${prefix}--radio-button-wrapper`, {
43
45
  [`${prefix}--radio-button-wrapper--label-${labelPosition}`]: labelPosition !== 'right',
44
- [`${prefix}--radio-button-wrapper--slug`]: slug
46
+ [`${prefix}--radio-button-wrapper--slug`]: slug,
47
+ [`${prefix}--radio-button-wrapper--decorator`]: decorator
45
48
  });
46
49
  const inputRef = useRef(null);
47
- let normalizedSlug;
48
- if (slug && /*#__PURE__*/React__default.isValidElement(slug)) {
49
- const size = slug.props?.['kind'] === 'inline' ? 'md' : 'mini';
50
- normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
50
+ let normalizedDecorator = /*#__PURE__*/React__default.isValidElement(slug ?? decorator) ? slug ?? decorator : null;
51
+ if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
52
+ const size = normalizedDecorator.props?.['kind'] === 'inline' ? 'md' : 'mini';
53
+ normalizedDecorator = /*#__PURE__*/React__default.cloneElement(normalizedDecorator, {
51
54
  size
52
55
  });
53
56
  }
@@ -70,7 +73,9 @@ const RadioButton = /*#__PURE__*/React__default.forwardRef((props, ref) => {
70
73
  className: `${prefix}--radio-button__appearance`
71
74
  }), labelText && /*#__PURE__*/React__default.createElement(Text, {
72
75
  className: innerLabelClasses
73
- }, labelText, normalizedSlug)));
76
+ }, labelText, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default.createElement("div", {
77
+ className: `${prefix}--radio-button-wrapper-inner--decorator`
78
+ }, normalizedDecorator) : '')));
74
79
  });
75
80
  RadioButton.displayName = 'RadioButton';
76
81
  RadioButton.propTypes = {
@@ -82,6 +87,10 @@ RadioButton.propTypes = {
82
87
  * Provide an optional className to be applied to the containing node
83
88
  */
84
89
  className: PropTypes.string,
90
+ /**
91
+ * **Experimental**: Provide a decorator component to be rendered inside the `RadioButton` component
92
+ */
93
+ decorator: PropTypes.node,
85
94
  /**
86
95
  * Specify whether the `<RadioButton>` should be checked by default
87
96
  */
@@ -128,7 +137,7 @@ RadioButton.propTypes = {
128
137
  /**
129
138
  * **Experimental**: Provide a `Slug` component to be rendered inside the `RadioButton` component
130
139
  */
131
- slug: PropTypes.node,
140
+ slug: deprecate(PropTypes.node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
132
141
  /**
133
142
  * Specify the value of the `<RadioButton>`
134
143
  */
@@ -17,6 +17,10 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
17
17
  * Provide an optional className to be applied to the container node
18
18
  */
19
19
  className?: string;
20
+ /**
21
+ * **Experimental**: Provide a decorator component to be rendered inside the `RadioButtonGroup` component
22
+ */
23
+ decorator?: ReactNode;
20
24
  /**
21
25
  * Specify the `<RadioButton>` to be selected by default
22
26
  */
@@ -64,6 +68,7 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
64
68
  */
65
69
  readOnly?: boolean;
66
70
  /**
71
+ * @deprecated please use decorator instead.
67
72
  * **Experimental**: Provide a `Slug` component to be rendered inside the `RadioButtonGroup` component
68
73
  */
69
74
  slug?: ReactNode;
@@ -12,6 +12,7 @@ import cx from 'classnames';
12
12
  import { Legend } from '../Text/index.js';
13
13
  import { usePrefix } from '../../internal/usePrefix.js';
14
14
  import { WarningFilled, WarningAltFilled } from '@carbon/icons-react';
15
+ import deprecate from '../../prop-types/deprecate.js';
15
16
  import mergeRefs from '../../tools/mergeRefs.js';
16
17
  import { useId } from '../../internal/useId.js';
17
18
 
@@ -19,6 +20,7 @@ const RadioButtonGroup = /*#__PURE__*/React__default.forwardRef((props, ref) =>
19
20
  const {
20
21
  children,
21
22
  className,
23
+ decorator,
22
24
  defaultSelected,
23
25
  disabled,
24
26
  helperText,
@@ -87,7 +89,8 @@ const RadioButtonGroup = /*#__PURE__*/React__default.forwardRef((props, ref) =>
87
89
  [`${prefix}--radio-button-group--readonly`]: readOnly,
88
90
  [`${prefix}--radio-button-group--invalid`]: !readOnly && invalid,
89
91
  [`${prefix}--radio-button-group--warning`]: showWarning,
90
- [`${prefix}--radio-button-group--slug`]: slug
92
+ [`${prefix}--radio-button-group--slug`]: slug,
93
+ [`${prefix}--radio-button-group--decorator`]: decorator
91
94
  });
92
95
  const helperClasses = cx(`${prefix}--form__helper-text`, {
93
96
  [`${prefix}--form__helper-text--disabled`]: disabled
@@ -99,10 +102,10 @@ const RadioButtonGroup = /*#__PURE__*/React__default.forwardRef((props, ref) =>
99
102
  }, helperText) : null;
100
103
  const divRef = useRef(null);
101
104
 
102
- // Slug is always size `mini`
103
- let normalizedSlug;
104
- if (slug && slug['type']?.displayName === 'AILabel') {
105
- normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
105
+ // AILabel is always size `mini`
106
+ let normalizedDecorator = /*#__PURE__*/React__default.isValidElement(slug ?? decorator) ? slug ?? decorator : null;
107
+ if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
108
+ normalizedDecorator = /*#__PURE__*/React__default.cloneElement(normalizedDecorator, {
106
109
  size: 'mini',
107
110
  kind: 'default'
108
111
  });
@@ -117,7 +120,9 @@ const RadioButtonGroup = /*#__PURE__*/React__default.forwardRef((props, ref) =>
117
120
  "aria-describedby": showHelper && helperText ? helperId : undefined
118
121
  }, rest), legendText && /*#__PURE__*/React__default.createElement(Legend, {
119
122
  className: `${prefix}--label`
120
- }, legendText, normalizedSlug), getRadioButtons()), /*#__PURE__*/React__default.createElement("div", {
123
+ }, legendText, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default.createElement("div", {
124
+ className: `${prefix}--radio-button-group-inner--decorator`
125
+ }, normalizedDecorator) : ''), getRadioButtons()), /*#__PURE__*/React__default.createElement("div", {
121
126
  className: `${prefix}--radio-button__validation-msg`
122
127
  }, !readOnly && invalid && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(WarningFilled, {
123
128
  className: `${prefix}--radio-button__invalid-icon`
@@ -138,6 +143,10 @@ RadioButtonGroup.propTypes = {
138
143
  * Provide an optional className to be applied to the container node
139
144
  */
140
145
  className: PropTypes.string,
146
+ /**
147
+ * **Experimental**: Provide a decorator component to be rendered inside the `RadioButtonGroup` component
148
+ */
149
+ decorator: PropTypes.node,
141
150
  /**
142
151
  * Specify the `<RadioButton>` to be selected by default
143
152
  */
@@ -191,7 +200,7 @@ RadioButtonGroup.propTypes = {
191
200
  /**
192
201
  * **Experimental**: Provide a `Slug` component to be rendered inside the `RadioButtonGroup` component
193
202
  */
194
- slug: PropTypes.node,
203
+ slug: deprecate(PropTypes.node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
195
204
  /**
196
205
  * Specify the value that is currently selected in the group
197
206
  */
@@ -18,6 +18,10 @@ export interface RadioTileProps {
18
18
  * Provide an optional `className` to be applied to the underlying `<label>`.
19
19
  */
20
20
  className?: string;
21
+ /**
22
+ * **Experimental**: Provide a `decorator` component to be rendered inside the `RadioTile` component
23
+ */
24
+ decorator?: React.ReactNode;
21
25
  /**
22
26
  * Specify whether the `RadioTile` should be disabled.
23
27
  */
@@ -48,6 +52,7 @@ export interface RadioTileProps {
48
52
  */
49
53
  onChange?: (value: string | number, name: string | undefined, event: React.ChangeEvent<HTMLInputElement> | React.KeyboardEvent<HTMLInputElement>) => void;
50
54
  /**
55
+ * @deprecated please use `decorator` instead.
51
56
  * **Experimental**: Provide a `Slug` component to be rendered inside the `SelectableTile` component
52
57
  */
53
58
  slug?: React.ReactNode;
@@ -25,6 +25,7 @@ const RadioTile = /*#__PURE__*/React__default.forwardRef(function RadioTile(_ref
25
25
  let {
26
26
  children,
27
27
  className: customClassName,
28
+ decorator,
28
29
  disabled,
29
30
  light,
30
31
  checked,
@@ -45,7 +46,9 @@ const RadioTile = /*#__PURE__*/React__default.forwardRef(function RadioTile(_ref
45
46
  [`${prefix}--tile--light`]: light,
46
47
  [`${prefix}--tile--disabled`]: disabled,
47
48
  [`${prefix}--tile--slug`]: slug,
48
- [`${prefix}--tile--slug-rounded`]: slug && hasRoundedCorners
49
+ [`${prefix}--tile--slug-rounded`]: slug && hasRoundedCorners,
50
+ [`${prefix}--tile--decorator`]: decorator,
51
+ [`${prefix}--tile--decorator-rounded`]: decorator && hasRoundedCorners
49
52
  });
50
53
  const v12TileRadioIcons = useFeatureFlag('enable-v12-tile-radio-icons');
51
54
  function icon() {
@@ -69,10 +72,10 @@ const RadioTile = /*#__PURE__*/React__default.forwardRef(function RadioTile(_ref
69
72
  }
70
73
  }
71
74
 
72
- // Slug is always size `xs`
73
- let normalizedSlug;
74
- if (slug && slug['type']?.displayName === 'AILabel') {
75
- normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
75
+ // AILabel is always size `xs`
76
+ let normalizedDecorator = /*#__PURE__*/React__default.isValidElement(slug ?? decorator) ? slug ?? decorator : null;
77
+ if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
78
+ normalizedDecorator = /*#__PURE__*/React__default.cloneElement(normalizedDecorator, {
76
79
  size: 'xs'
77
80
  });
78
81
  }
@@ -96,7 +99,9 @@ const RadioTile = /*#__PURE__*/React__default.forwardRef(function RadioTile(_ref
96
99
  className: `${prefix}--tile__checkmark`
97
100
  }, icon()), /*#__PURE__*/React__default.createElement(Text, {
98
101
  className: `${prefix}--tile-content`
99
- }, children), normalizedSlug));
102
+ }, children), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default.createElement("div", {
103
+ className: `${prefix}--tile--inner-decorator`
104
+ }, normalizedDecorator) : ''));
100
105
  });
101
106
  RadioTile.displayName = 'RadioTile';
102
107
  RadioTile.propTypes = {
@@ -112,6 +117,10 @@ RadioTile.propTypes = {
112
117
  * Provide an optional `className` to be applied to the underlying `<label>`.
113
118
  */
114
119
  className: PropTypes.string,
120
+ /**
121
+ * **Experimental**: Provide a `decorator` component to be rendered inside the `RadioTile` component
122
+ */
123
+ decorator: PropTypes.node,
115
124
  /**
116
125
  * Specify whether the `RadioTile` should be disabled.
117
126
  */
@@ -144,9 +153,9 @@ RadioTile.propTypes = {
144
153
  */
145
154
  required: PropTypes.bool,
146
155
  /**
147
- * **Experimental**: Provide a `Slug` component to be rendered inside the `SelectableTile` component
156
+ * **Experimental**: Provide a `Slug` component to be rendered inside the `RadioTile` component
148
157
  */
149
- slug: PropTypes.node,
158
+ slug: deprecate(PropTypes.node, 'The `slug` prop for `RadioTile` has ' + 'been deprecated in favor of the new `decorator` prop. It will be removed in the next major release.'),
150
159
  /**
151
160
  * Specify the tab index of the underlying `<input>`.
152
161
  */
@@ -13,6 +13,10 @@ export interface DismissibleTagBaseProps {
13
13
  * Provide a custom className that is applied to the containing <span>
14
14
  */
15
15
  className?: string;
16
+ /**
17
+ * **Experimental:** Provide a `decorator` component to be rendered inside the `DismissibleTag` component
18
+ */
19
+ decorator?: ReactNode;
16
20
  /**
17
21
  * Specify if the `DismissibleTag` is disabled
18
22
  */
@@ -36,6 +40,7 @@ export interface DismissibleTagBaseProps {
36
40
  */
37
41
  size?: keyof typeof SIZES;
38
42
  /**
43
+ * @deprecated please use `decorator` instead.
39
44
  * **Experimental:** Provide a `Slug` component to be rendered inside the `DismissibleTag` component
40
45
  */
41
46
  slug?: ReactNode;
@@ -58,12 +63,16 @@ export interface DismissibleTagBaseProps {
58
63
  }
59
64
  export type DismissibleTagProps<T extends React.ElementType> = PolymorphicProps<T, DismissibleTagBaseProps>;
60
65
  declare const DismissibleTag: {
61
- <T extends React.ElementType<any, keyof React.JSX.IntrinsicElements>>({ className, disabled, id, renderIcon, title, onClose, slug, size, text, tagTitle, type, ...other }: DismissibleTagProps<T>): import("react/jsx-runtime").JSX.Element;
66
+ <T extends React.ElementType<any, keyof React.JSX.IntrinsicElements>>({ className, decorator, disabled, id, renderIcon, title, onClose, slug, size, text, tagTitle, type, ...other }: DismissibleTagProps<T>): import("react/jsx-runtime").JSX.Element;
62
67
  propTypes: {
63
68
  /**
64
69
  * Provide a custom className that is applied to the containing <span>
65
70
  */
66
71
  className: PropTypes.Requireable<string>;
72
+ /**
73
+ * **Experimental:** Provide a `decorator` component to be rendered inside the `DismissibleTag` component
74
+ */
75
+ decorator: PropTypes.Requireable<PropTypes.ReactNodeLike>;
67
76
  /**
68
77
  * Specify if the `DismissibleTag` is disabled
69
78
  */
@@ -89,7 +98,7 @@ declare const DismissibleTag: {
89
98
  /**
90
99
  * **Experimental:** Provide a `Slug` component to be rendered inside the `DismissibleTag` component
91
100
  */
92
- slug: PropTypes.Requireable<PropTypes.ReactNodeLike>;
101
+ slug: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
93
102
  /**
94
103
  * Provide text to be rendered inside of a the tag.
95
104
  */
@@ -11,6 +11,7 @@ import React__default, { useRef, useState, useLayoutEffect } from 'react';
11
11
  import cx from 'classnames';
12
12
  import { useId } from '../../internal/useId.js';
13
13
  import { usePrefix } from '../../internal/usePrefix.js';
14
+ import deprecate from '../../prop-types/deprecate.js';
14
15
  import Tag, { SIZES, TYPES } from './Tag.js';
15
16
  import { Close } from '@carbon/icons-react';
16
17
  import '../Tooltip/DefinitionTooltip.js';
@@ -23,6 +24,7 @@ var _Close;
23
24
  const DismissibleTag = _ref => {
24
25
  let {
25
26
  className,
27
+ decorator,
26
28
  disabled,
27
29
  id,
28
30
  renderIcon,
@@ -50,9 +52,9 @@ const DismissibleTag = _ref => {
50
52
  onClose(event);
51
53
  }
52
54
  };
53
- let normalizedSlug;
54
- if (slug && slug['type']?.displayName === 'AILabel') {
55
- normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
55
+ let normalizedDecorator = /*#__PURE__*/React__default.isValidElement(slug ?? decorator) ? slug ?? decorator : null;
56
+ if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
57
+ normalizedDecorator = /*#__PURE__*/React__default.cloneElement(normalizedDecorator, {
56
58
  size: 'sm',
57
59
  kind: 'inline'
58
60
  });
@@ -79,7 +81,9 @@ const DismissibleTag = _ref => {
79
81
  }, /*#__PURE__*/React__default.createElement(Text, {
80
82
  title: tagTitle ? tagTitle : text,
81
83
  className: `${prefix}--tag__label`
82
- }, text), normalizedSlug, /*#__PURE__*/React__default.createElement(Tooltip, {
84
+ }, text), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default.createElement("div", {
85
+ className: `${prefix}--tag__decorator`
86
+ }, normalizedDecorator) : '', /*#__PURE__*/React__default.createElement(Tooltip, {
83
87
  label: isEllipsisApplied ? dismissLabel : title,
84
88
  align: "bottom",
85
89
  className: tooltipClasses,
@@ -98,6 +102,10 @@ DismissibleTag.propTypes = {
98
102
  * Provide a custom className that is applied to the containing <span>
99
103
  */
100
104
  className: PropTypes.string,
105
+ /**
106
+ * **Experimental:** Provide a `decorator` component to be rendered inside the `DismissibleTag` component
107
+ */
108
+ decorator: PropTypes.node,
101
109
  /**
102
110
  * Specify if the `DismissibleTag` is disabled
103
111
  */
@@ -123,7 +131,7 @@ DismissibleTag.propTypes = {
123
131
  /**
124
132
  * **Experimental:** Provide a `Slug` component to be rendered inside the `DismissibleTag` component
125
133
  */
126
- slug: PropTypes.node,
134
+ slug: deprecate(PropTypes.node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
127
135
  /**
128
136
  * Provide text to be rendered inside of a the tag.
129
137
  */
@@ -34,6 +34,10 @@ export interface TagBaseProps {
34
34
  * Provide a custom className that is applied to the containing <span>
35
35
  */
36
36
  className?: string;
37
+ /**
38
+ * **Experimental:** Provide a `decorator` component to be rendered inside the `Tag` component
39
+ */
40
+ decorator?: ReactNode;
37
41
  /**
38
42
  * Specify if the `Tag` is disabled
39
43
  */
@@ -61,6 +65,7 @@ export interface TagBaseProps {
61
65
  */
62
66
  size?: keyof typeof SIZES;
63
67
  /**
68
+ * @deprecated please use `decorator` instead.
64
69
  * **Experimental:** Provide a `Slug` component to be rendered inside the `Tag` component
65
70
  */
66
71
  slug?: ReactNode;
@@ -44,6 +44,7 @@ const Tag = /*#__PURE__*/React__default.forwardRef(function Tag(_ref, forwardRef
44
44
  let {
45
45
  children,
46
46
  className,
47
+ decorator,
47
48
  id,
48
49
  type,
49
50
  filter,
@@ -87,10 +88,10 @@ const Tag = /*#__PURE__*/React__default.forwardRef(function Tag(_ref, forwardRef
87
88
  }
88
89
  };
89
90
 
90
- // Slug is always size `md` and `inline`
91
- let normalizedSlug;
92
- if (slug && slug['type']?.displayName === 'AILabel' && !isInteractiveTag) {
93
- normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
91
+ // AILabel is always size `sm` and `inline`
92
+ let normalizedDecorator = /*#__PURE__*/React__default.isValidElement(slug ?? decorator) ? slug ?? decorator : null;
93
+ if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel' && !isInteractiveTag) {
94
+ normalizedDecorator = /*#__PURE__*/React__default.cloneElement(normalizedDecorator, {
94
95
  size: 'sm',
95
96
  kind: 'inline'
96
97
  });
@@ -105,7 +106,7 @@ const Tag = /*#__PURE__*/React__default.forwardRef(function Tag(_ref, forwardRef
105
106
  }, /*#__PURE__*/React__default.createElement(CustomIconElement, null)) : '', /*#__PURE__*/React__default.createElement(Text, {
106
107
  title: typeof children === 'string' ? children : undefined,
107
108
  className: `${prefix}--tag__label`
108
- }, children !== null && children !== undefined ? children : typeText), normalizedSlug, /*#__PURE__*/React__default.createElement("button", {
109
+ }, children !== null && children !== undefined ? children : typeText), normalizedDecorator, /*#__PURE__*/React__default.createElement("button", {
109
110
  type: "button",
110
111
  className: `${prefix}--tag__close-icon`,
111
112
  onClick: handleClose,
@@ -136,7 +137,9 @@ const Tag = /*#__PURE__*/React__default.forwardRef(function Tag(_ref, forwardRef
136
137
  }, children !== null && children !== undefined ? children : typeText)) : /*#__PURE__*/React__default.createElement(Text, {
137
138
  title: children !== null && children !== undefined && typeof children === 'string' ? children : typeText,
138
139
  className: labelClasses
139
- }, children !== null && children !== undefined ? children : typeText), normalizedSlug);
140
+ }, children !== null && children !== undefined ? children : typeText), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default.createElement("div", {
141
+ className: `${prefix}--tag__decorator`
142
+ }, normalizedDecorator) : '');
140
143
  });
141
144
  Tag.propTypes = {
142
145
  /**
@@ -152,6 +155,10 @@ Tag.propTypes = {
152
155
  * Provide a custom className that is applied to the containing <span>
153
156
  */
154
157
  className: PropTypes.string,
158
+ /**
159
+ * **Experimental:** Provide a `decorator` component to be rendered inside the `Tag` component
160
+ */
161
+ decorator: PropTypes.node,
155
162
  /**
156
163
  * Specify if the `Tag` is disabled
157
164
  */
@@ -181,7 +188,7 @@ Tag.propTypes = {
181
188
  /**
182
189
  * **Experimental:** Provide a `Slug` component to be rendered inside the `Tag` component
183
190
  */
184
- slug: PropTypes.node,
191
+ slug: deprecate(PropTypes.node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
185
192
  /**
186
193
  * Text to show on clear filters
187
194
  */
@@ -2,6 +2,10 @@ import React, { type ReactNode, type MouseEvent, type KeyboardEvent, type HTMLAt
2
2
  export interface TileProps extends HTMLAttributes<HTMLDivElement> {
3
3
  children?: ReactNode;
4
4
  className?: string;
5
+ /**
6
+ * **Experimental**: Provide a `decorator` component to be rendered inside the `Tile` component
7
+ */
8
+ decorator?: ReactNode;
5
9
  /** @deprecated */
6
10
  light?: boolean;
7
11
  /**
@@ -10,7 +14,8 @@ export interface TileProps extends HTMLAttributes<HTMLDivElement> {
10
14
  */
11
15
  hasRoundedCorners?: boolean;
12
16
  /**
13
- * **Experimental**: Provide a `Slug` component to be rendered inside the `SelectableTile` component
17
+ * @deprecated please use `decorator` instead.
18
+ * **Experimental**: Provide a `Slug` component to be rendered inside the `Tile` component
14
19
  */
15
20
  slug?: ReactNode;
16
21
  }
@@ -18,6 +23,10 @@ export declare const Tile: React.ForwardRefExoticComponent<TileProps & React.Ref
18
23
  export interface ClickableTileProps extends HTMLAttributes<HTMLAnchorElement> {
19
24
  children?: ReactNode;
20
25
  className?: string;
26
+ /**
27
+ * **Experimental**: Provide a `decorator` component or set the boolean to True for an AILabel icon to be rendered inside the `ClickableTile` component
28
+ */
29
+ decorator?: boolean | ReactNode;
21
30
  /** @deprecated */
22
31
  light?: boolean;
23
32
  /**
@@ -56,6 +65,7 @@ export interface ClickableTileProps extends HTMLAttributes<HTMLAnchorElement> {
56
65
  */
57
66
  rel?: string;
58
67
  /**
68
+ * @deprecated please use `decorator` instead.
59
69
  * **Experimental**: Specify if a `Slug` icon should be rendered inside the `ClickableTile`
60
70
  */
61
71
  slug?: boolean;
@@ -64,6 +74,10 @@ export declare const ClickableTile: React.ForwardRefExoticComponent<ClickableTil
64
74
  export interface SelectableTileProps extends HTMLAttributes<HTMLDivElement> {
65
75
  children?: ReactNode;
66
76
  className?: string;
77
+ /**
78
+ * **Experimental**: Provide a `decorator` component to be rendered inside the `SelectableTile` component
79
+ */
80
+ decorator?: ReactNode;
67
81
  /** @deprecated */
68
82
  light?: boolean;
69
83
  /**
@@ -101,6 +115,7 @@ export interface SelectableTileProps extends HTMLAttributes<HTMLDivElement> {
101
115
  */
102
116
  selected?: boolean;
103
117
  /**
118
+ * @deprecated please use `decorator` instead.
104
119
  * **Experimental**: Provide a `Slug` component to be rendered inside the `SelectableTile` component
105
120
  */
106
121
  slug?: ReactNode;
@@ -122,6 +137,10 @@ export declare const SelectableTile: React.ForwardRefExoticComponent<SelectableT
122
137
  export interface ExpandableTileProps extends HTMLAttributes<HTMLDivElement> {
123
138
  children?: ReactNode;
124
139
  className?: string;
140
+ /**
141
+ * **Experimental**: Provide a `decorator` component to be rendered inside the `ExpandableTile` component
142
+ */
143
+ decorator?: ReactNode;
125
144
  /** @deprecated */
126
145
  light?: boolean;
127
146
  /**
@@ -146,6 +165,7 @@ export interface ExpandableTileProps extends HTMLAttributes<HTMLDivElement> {
146
165
  */
147
166
  onKeyUp?(event: KeyboardEvent): void;
148
167
  /**
168
+ * @deprecated please use `decorator` instead.
149
169
  * **Experimental**: Provide a `Slug` component to be rendered inside the `ExpandableTile` component
150
170
  */
151
171
  slug?: ReactNode;