@carbon/react 1.71.0-rc.0 → 1.71.1

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 (70) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +770 -770
  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/es/internal/wrapFocus.js +1 -2
  36. package/lib/components/Checkbox/Checkbox.d.ts +5 -0
  37. package/lib/components/Checkbox/Checkbox.js +16 -7
  38. package/lib/components/CheckboxGroup/CheckboxGroup.d.ts +5 -0
  39. package/lib/components/CheckboxGroup/CheckboxGroup.js +16 -7
  40. package/lib/components/ComboBox/ComboBox.d.ts +1 -1
  41. package/lib/components/ComposedModal/ComposedModal.d.ts +5 -0
  42. package/lib/components/ComposedModal/ComposedModal.js +16 -10
  43. package/lib/components/FluidNumberInput/FluidNumberInput.d.ts +4 -0
  44. package/lib/components/FluidSelect/FluidSelect.d.ts +4 -0
  45. package/lib/components/FluidSelect/FluidSelect.js +5 -1
  46. package/lib/components/FluidTextArea/FluidTextArea.d.ts +4 -0
  47. package/lib/components/FluidTextArea/FluidTextArea.js +5 -1
  48. package/lib/components/FluidTextInput/FluidPasswordInput.d.ts +4 -0
  49. package/lib/components/FluidTextInput/FluidPasswordInput.js +5 -1
  50. package/lib/components/FluidTextInput/FluidTextInput.d.ts +4 -0
  51. package/lib/components/FluidTextInput/FluidTextInput.js +5 -1
  52. package/lib/components/FluidTimePicker/FluidTimePicker.d.ts +4 -0
  53. package/lib/components/FluidTimePicker/FluidTimePicker.js +23 -7
  54. package/lib/components/Modal/Modal.d.ts +5 -0
  55. package/lib/components/Modal/Modal.js +16 -10
  56. package/lib/components/PaginationNav/PaginationNav.js +15 -3
  57. package/lib/components/RadioButton/RadioButton.d.ts +5 -0
  58. package/lib/components/RadioButton/RadioButton.js +16 -7
  59. package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +5 -0
  60. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +16 -7
  61. package/lib/components/RadioTile/RadioTile.d.ts +5 -0
  62. package/lib/components/RadioTile/RadioTile.js +17 -8
  63. package/lib/components/Tag/DismissibleTag.d.ts +11 -2
  64. package/lib/components/Tag/DismissibleTag.js +13 -5
  65. package/lib/components/Tag/Tag.d.ts +5 -0
  66. package/lib/components/Tag/Tag.js +14 -7
  67. package/lib/components/Tile/Tile.d.ts +21 -1
  68. package/lib/components/Tile/Tile.js +67 -47
  69. package/lib/internal/wrapFocus.js +1 -6
  70. package/package.json +4 -5
@@ -9,7 +9,7 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
9
9
  import React__default, { useState, useRef, useEffect } from 'react';
10
10
  import PropTypes from 'prop-types';
11
11
  import cx from 'classnames';
12
- import { CheckboxCheckedFilled, Checkbox, ChevronDown, ArrowRight, Error } from '@carbon/icons-react';
12
+ import { AiLabel, CheckboxCheckedFilled, Checkbox, ChevronDown, ArrowRight, Error } from '@carbon/icons-react';
13
13
  import Link from '../Link/Link.js';
14
14
  import deprecate from '../../prop-types/deprecate.js';
15
15
  import { composeEventHandlers } from '../../tools/events.js';
@@ -24,11 +24,12 @@ import { Text } from '../Text/Text.js';
24
24
  import { matches } from '../../internal/keyboard/match.js';
25
25
  import { Enter, Space } from '../../internal/keyboard/keys.js';
26
26
 
27
- var _rect, _path, _CheckboxCheckedFille, _Checkbox, _ChevronDown, _ChevronDown2;
27
+ var _CheckboxCheckedFille, _Checkbox, _ChevronDown, _ChevronDown2;
28
28
  const Tile = /*#__PURE__*/React__default.forwardRef(function Tile(_ref, ref) {
29
29
  let {
30
30
  children,
31
31
  className,
32
+ decorator,
32
33
  light = false,
33
34
  slug,
34
35
  hasRoundedCorners = false,
@@ -38,12 +39,16 @@ const Tile = /*#__PURE__*/React__default.forwardRef(function Tile(_ref, ref) {
38
39
  const tileClasses = cx(`${prefix}--tile`, {
39
40
  [`${prefix}--tile--light`]: light,
40
41
  [`${prefix}--tile--slug`]: slug,
41
- [`${prefix}--tile--slug-rounded`]: slug && hasRoundedCorners
42
+ [`${prefix}--tile--slug-rounded`]: slug && hasRoundedCorners,
43
+ [`${prefix}--tile--decorator`]: decorator,
44
+ [`${prefix}--tile--decorator-rounded`]: decorator && hasRoundedCorners
42
45
  }, className);
43
46
  return /*#__PURE__*/React__default.createElement("div", _extends({
44
47
  className: tileClasses,
45
48
  ref: ref
46
- }, rest), children, slug);
49
+ }, rest), children, slug, decorator && /*#__PURE__*/React__default.createElement("div", {
50
+ className: `${prefix}--tile--inner-decorator`
51
+ }, decorator));
47
52
  });
48
53
  Tile.displayName = 'Tile';
49
54
  Tile.propTypes = {
@@ -55,6 +60,10 @@ Tile.propTypes = {
55
60
  * The CSS class names.
56
61
  */
57
62
  className: PropTypes.string,
63
+ /**
64
+ * **Experimental**: Provide a `decorator` component to be rendered inside the `Tile` component
65
+ */
66
+ decorator: PropTypes.node,
58
67
  /**
59
68
  * **Experimental**: Specify if the `Tile` component should be rendered with rounded corners. Only valid
60
69
  * when `slug` prop is present
@@ -70,13 +79,14 @@ Tile.propTypes = {
70
79
  /**
71
80
  * **Experimental**: Provide a `Slug` component to be rendered inside the `Tile` component
72
81
  */
73
- slug: PropTypes.node
82
+ slug: deprecate(PropTypes.node, 'The `slug` prop for `Tile` has ' + 'been deprecated in favor of the new `decorator` prop. It will be removed in the next major release.')
74
83
  };
75
84
  const ClickableTile = /*#__PURE__*/React__default.forwardRef(function ClickableTile(_ref2, ref) {
76
85
  let {
77
86
  children,
78
87
  className,
79
88
  clicked = false,
89
+ decorator,
80
90
  disabled,
81
91
  href,
82
92
  light,
@@ -92,7 +102,9 @@ const ClickableTile = /*#__PURE__*/React__default.forwardRef(function ClickableT
92
102
  [`${prefix}--tile--is-clicked`]: clicked,
93
103
  [`${prefix}--tile--light`]: light,
94
104
  [`${prefix}--tile--slug`]: slug,
95
- [`${prefix}--tile--slug-rounded`]: slug && hasRoundedCorners
105
+ [`${prefix}--tile--slug-rounded`]: slug && hasRoundedCorners,
106
+ [`${prefix}--tile--decorator`]: decorator,
107
+ [`${prefix}--tile--decorator-rounded`]: decorator && hasRoundedCorners
96
108
  }, className);
97
109
  const [isSelected, setIsSelected] = useState(clicked);
98
110
  function handleOnClick(evt) {
@@ -107,25 +119,6 @@ const ClickableTile = /*#__PURE__*/React__default.forwardRef(function ClickableT
107
119
  }
108
120
  onKeyDown(evt);
109
121
  }
110
-
111
- // To Do: Replace with an an icon from `@carbon/react`
112
- // since the hollow slug in `ClickableTile` is not interactive
113
- const hollowSlugIcon = /*#__PURE__*/React__default.createElement("svg", {
114
- className: `${prefix}--tile--slug-icon`,
115
- width: "24",
116
- height: "24",
117
- viewBox: "0 0 24 24",
118
- fill: "none",
119
- xmlns: "http://www.w3.org/2000/svg"
120
- }, _rect || (_rect = /*#__PURE__*/React__default.createElement("rect", {
121
- x: "0.5",
122
- y: "0.5",
123
- width: "23",
124
- height: "23"
125
- })), _path || (_path = /*#__PURE__*/React__default.createElement("path", {
126
- d: "M13.2436 16H11.5996L10.9276 13.864H7.95164L7.29164 16H5.68364L8.49164 7.624H10.4596L13.2436 16ZM10.5436 12.508L9.46364 9.064H9.40364L8.33564 12.508H10.5436ZM17.9341 16H14.1301V14.728H15.2341V8.896H14.1301V7.624H17.9341V8.896H16.8181V14.728H17.9341V16Z",
127
- fill: "#161616"
128
- })));
129
122
  const v12DefaultIcons = useFeatureFlag('enable-v12-tile-default-icons');
130
123
  if (v12DefaultIcons) {
131
124
  if (!Icon) {
@@ -147,9 +140,14 @@ const ClickableTile = /*#__PURE__*/React__default.forwardRef(function ClickableT
147
140
  onKeyDown: handleOnKeyDown,
148
141
  ref: ref,
149
142
  disabled: disabled
150
- }, rest), slug ? /*#__PURE__*/React__default.createElement("div", {
143
+ }, rest), slug || decorator ? /*#__PURE__*/React__default.createElement("div", {
151
144
  className: `${prefix}--tile-content`
152
- }, children) : children, slug && hollowSlugIcon, Icon && /*#__PURE__*/React__default.createElement(Icon, {
145
+ }, children) : children, (slug === true || decorator === true) && /*#__PURE__*/React__default.createElement(AiLabel, {
146
+ size: "24",
147
+ className: `${prefix}--tile--ai-label-icon`
148
+ }), /*#__PURE__*/React__default.isValidElement(decorator) && /*#__PURE__*/React__default.createElement("div", {
149
+ className: `${prefix}--tile--inner-decorator`
150
+ }, decorator), Icon && /*#__PURE__*/React__default.createElement(Icon, {
153
151
  className: iconClasses,
154
152
  "aria-hidden": "true"
155
153
  }));
@@ -168,6 +166,10 @@ ClickableTile.propTypes = {
168
166
  * Boolean for whether a tile has been clicked.
169
167
  */
170
168
  clicked: PropTypes.bool,
169
+ /**
170
+ * **Experimental**: Provide a `decorator` component or set the boolean to True for an AILabel icon to be rendered inside the `ClickableTile` component
171
+ */
172
+ decorator: PropTypes.oneOfType([PropTypes.bool, PropTypes.node]),
171
173
  /**
172
174
  * Specify whether the ClickableTile should be disabled
173
175
  */
@@ -209,6 +211,7 @@ const SelectableTile = /*#__PURE__*/React__default.forwardRef(function Selectabl
209
211
  let {
210
212
  children,
211
213
  className,
214
+ decorator,
212
215
  disabled,
213
216
  id,
214
217
  light,
@@ -232,14 +235,16 @@ const SelectableTile = /*#__PURE__*/React__default.forwardRef(function Selectabl
232
235
  [`${prefix}--tile--light`]: light,
233
236
  [`${prefix}--tile--disabled`]: disabled,
234
237
  [`${prefix}--tile--slug`]: slug,
235
- [`${prefix}--tile--slug-rounded`]: slug && hasRoundedCorners
238
+ [`${prefix}--tile--slug-rounded`]: slug && hasRoundedCorners,
239
+ [`${prefix}--tile--decorator`]: decorator,
240
+ [`${prefix}--tile--decorator-rounded`]: decorator && hasRoundedCorners
236
241
  }, className);
237
242
 
238
243
  // TODO: rename to handleClick when handleClick prop is deprecated
239
244
  function handleOnClick(evt) {
240
245
  evt.preventDefault();
241
246
  evt?.persist?.();
242
- if (slug && slugRef.current && slugRef.current.contains(evt.target)) {
247
+ if (normalizedDecorator && decoratorRef.current && decoratorRef.current.contains(evt.target)) {
243
248
  return;
244
249
  }
245
250
  setIsSelected(!isSelected);
@@ -266,13 +271,13 @@ const SelectableTile = /*#__PURE__*/React__default.forwardRef(function Selectabl
266
271
  setPrevSelected(selected);
267
272
  }
268
273
 
269
- // Slug is always size `xs`
270
- const slugRef = useRef(null);
271
- let normalizedSlug;
272
- if (slug && slug['type']?.displayName === 'AILabel') {
273
- normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
274
+ // AILabel is always size `xs`
275
+ const decoratorRef = useRef(null);
276
+ let normalizedDecorator = /*#__PURE__*/React__default.isValidElement(slug ?? decorator) ? slug ?? decorator : null;
277
+ if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
278
+ normalizedDecorator = /*#__PURE__*/React__default.cloneElement(normalizedDecorator, {
274
279
  size: 'xs',
275
- ref: slugRef
280
+ ref: decoratorRef
276
281
  });
277
282
  }
278
283
  return (
@@ -297,12 +302,18 @@ const SelectableTile = /*#__PURE__*/React__default.forwardRef(function Selectabl
297
302
  as: "label",
298
303
  htmlFor: id,
299
304
  className: `${prefix}--tile-content`
300
- }, children), normalizedSlug)
305
+ }, children), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default.createElement("div", {
306
+ className: `${prefix}--tile--inner-decorator`
307
+ }, normalizedDecorator) : '')
301
308
  );
302
309
  });
303
310
  SelectableTile.propTypes = {
304
311
  children: PropTypes.node,
305
312
  className: PropTypes.string,
313
+ /**
314
+ * **Experimental**: Provide a `decorator` component to be rendered inside the `SelectableTile` component
315
+ */
316
+ decorator: PropTypes.node,
306
317
  /**
307
318
  * Specify whether the SelectableTile should be disabled
308
319
  */
@@ -325,7 +336,7 @@ SelectableTile.propTypes = {
325
336
  * The `name` of the `<input>`.
326
337
  * @deprecated
327
338
  */
328
- name: PropTypes.string,
339
+ name: deprecate(PropTypes.string, 'The `name` property is no longer used. It will be removed in the next major release.'),
329
340
  /**
330
341
  * The empty handler of the `<input>`.
331
342
  */
@@ -345,7 +356,7 @@ SelectableTile.propTypes = {
345
356
  /**
346
357
  * **Experimental**: Provide a `Slug` component to be rendered inside the `SelectableTile` component
347
358
  */
348
- slug: PropTypes.node,
359
+ slug: deprecate(PropTypes.node, 'The `slug` prop for `SelectableTile` has ' + 'been deprecated in favor of the new `decorator` prop. It will be removed in the next major release.'),
349
360
  /**
350
361
  * Specify the tab index of the wrapper element
351
362
  */
@@ -358,13 +369,14 @@ SelectableTile.propTypes = {
358
369
  * The value of the `<input>`.
359
370
  * @deprecated
360
371
  */
361
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired
372
+ value: deprecate(PropTypes.oneOfType([PropTypes.string, PropTypes.number]), 'The `value` property is no longer used. It will be removed in the next major release.`')
362
373
  };
363
374
  const ExpandableTile = /*#__PURE__*/React__default.forwardRef(function ExpandableTile(_ref4, forwardRef) {
364
375
  let {
365
376
  tabIndex = 0,
366
377
  className,
367
378
  children,
379
+ decorator,
368
380
  expanded = false,
369
381
  tileMaxHeight = 0,
370
382
  // eslint-disable-line
@@ -439,7 +451,9 @@ const ExpandableTile = /*#__PURE__*/React__default.forwardRef(function Expandabl
439
451
  [`${prefix}--tile--is-expanded`]: isExpanded,
440
452
  [`${prefix}--tile--light`]: light,
441
453
  [`${prefix}--tile--slug`]: slug,
442
- [`${prefix}--tile--slug-rounded`]: slug && hasRoundedCorners
454
+ [`${prefix}--tile--slug-rounded`]: slug && hasRoundedCorners,
455
+ [`${prefix}--tile--decorator`]: decorator,
456
+ [`${prefix}--tile--decorator-rounded`]: decorator && hasRoundedCorners
443
457
  }, className);
444
458
  const chevronInteractiveClassNames = cx(`${prefix}--tile__chevron`, `${prefix}--tile__chevron--interactive`);
445
459
  const childrenAsArray = getChildren();
@@ -466,10 +480,10 @@ const ExpandableTile = /*#__PURE__*/React__default.forwardRef(function Expandabl
466
480
 
467
481
  // Interactive elements or elements that are given a role should be treated
468
482
  // the same because elements with a role can not be rendered inside a `button`
469
- if (!getInteractiveContent(belowTheFold.current) && !getRoleContent(belowTheFold.current) && !getInteractiveContent(aboveTheFold.current) && !getRoleContent(aboveTheFold.current) && !slug) {
483
+ if (!getInteractiveContent(belowTheFold.current) && !getRoleContent(belowTheFold.current) && !getInteractiveContent(aboveTheFold.current) && !getRoleContent(aboveTheFold.current) && !(slug || decorator)) {
470
484
  setInteractive(false);
471
485
  }
472
- }, [slug]);
486
+ }, [slug, decorator]);
473
487
  useIsomorphicEffect(() => {
474
488
  if (!tile.current) {
475
489
  return;
@@ -493,10 +507,10 @@ const ExpandableTile = /*#__PURE__*/React__default.forwardRef(function Expandabl
493
507
  }, []);
494
508
  const belowTheFoldId = useId('expandable-tile-interactive');
495
509
 
496
- // Slug is always size `xs`
497
- let normalizedSlug;
498
- if (slug && slug['type']?.displayName === 'AILabel') {
499
- normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
510
+ // AILabel is always size `xs`
511
+ let normalizedDecorator = /*#__PURE__*/React__default.isValidElement(slug ?? decorator) ? slug ?? decorator : null;
512
+ if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
513
+ normalizedDecorator = /*#__PURE__*/React__default.cloneElement(normalizedDecorator, {
500
514
  size: 'xs'
501
515
  });
502
516
  }
@@ -506,7 +520,9 @@ const ExpandableTile = /*#__PURE__*/React__default.forwardRef(function Expandabl
506
520
  className: interactiveClassNames
507
521
  }, rest), /*#__PURE__*/React__default.createElement("div", {
508
522
  ref: tileContent
509
- }, normalizedSlug, /*#__PURE__*/React__default.createElement("div", {
523
+ }, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default.createElement("div", {
524
+ className: `${prefix}--tile--inner-decorator`
525
+ }, normalizedDecorator) : '', /*#__PURE__*/React__default.createElement("div", {
510
526
  ref: aboveTheFold,
511
527
  className: `${prefix}--tile-content`
512
528
  }, childrenAsArray[0]), /*#__PURE__*/React__default.createElement("button", {
@@ -549,6 +565,10 @@ const ExpandableTile = /*#__PURE__*/React__default.forwardRef(function Expandabl
549
565
  ExpandableTile.propTypes = {
550
566
  children: PropTypes.node,
551
567
  className: PropTypes.string,
568
+ /**
569
+ * **Experimental**: Provide a `decorator` component to be rendered inside the `ExpandableTile` component
570
+ */
571
+ decorator: PropTypes.node,
552
572
  /**
553
573
  * `true` if the tile is expanded.
554
574
  */
@@ -578,7 +598,7 @@ ExpandableTile.propTypes = {
578
598
  /**
579
599
  * **Experimental**: Provide a `Slug` component to be rendered inside the `ExpandableTile` component
580
600
  */
581
- slug: PropTypes.node,
601
+ slug: deprecate(PropTypes.node, 'The `slug` prop for `ExpandableTile` has ' + 'been deprecated in favor of the new `decorator` prop. It will be removed in the next major release.'),
582
602
  /**
583
603
  * The `tabindex` attribute.
584
604
  */
@@ -5,7 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import findLast from 'lodash.findlast';
9
8
  import { useEffect } from 'react';
10
9
  import { DOCUMENT_POSITION_BROAD_PRECEDING, selectorTabbable, DOCUMENT_POSITION_BROAD_FOLLOWING } from './keyboard/navigation.js';
11
10
  import { tabbable } from 'tabbable';
@@ -45,7 +44,7 @@ function wrapFocus(_ref) {
45
44
  if (bodyNode && currentActiveNode && oldActiveNode && !bodyNode.contains(currentActiveNode) && !elementOrParentIsFloatingMenu(currentActiveNode, selectorsFloatingMenus)) {
46
45
  const comparisonResult = oldActiveNode.compareDocumentPosition(currentActiveNode);
47
46
  if (currentActiveNode === startTrapNode || comparisonResult & DOCUMENT_POSITION_BROAD_PRECEDING) {
48
- const tabbable = findLast(bodyNode.querySelectorAll(selectorTabbable), elem => Boolean(elem.offsetParent));
47
+ const tabbable = [...bodyNode.querySelectorAll(selectorTabbable)].reverse().find(elem => Boolean(elem.offsetParent));
49
48
  if (tabbable) {
50
49
  tabbable.focus();
51
50
  } else if (bodyNode !== oldActiveNode) {
@@ -16,6 +16,10 @@ export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
16
16
  * exposing to the user
17
17
  */
18
18
  labelText: NonNullable<ReactNode>;
19
+ /**
20
+ * **Experimental**: Provide a `decorator` component to be rendered inside the `Checkbox` component
21
+ */
22
+ decorator?: ReactNode;
19
23
  /**
20
24
  * Specify whether the underlying input should be checked by default
21
25
  */
@@ -45,6 +49,7 @@ export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
45
49
  */
46
50
  invalidText?: ReactNode;
47
51
  /**
52
+ * @deprecated please use decorator instead.
48
53
  * **Experimental**: Provide a `Slug` component to be rendered inside the `Checkbox` component
49
54
  */
50
55
  slug?: ReactNode;
@@ -14,6 +14,7 @@ var PropTypes = require('prop-types');
14
14
  var React = require('react');
15
15
  var cx = require('classnames');
16
16
  require('../Text/index.js');
17
+ var deprecate = require('../../prop-types/deprecate.js');
17
18
  var usePrefix = require('../../internal/usePrefix.js');
18
19
  var iconsReact = require('@carbon/icons-react');
19
20
  var useId = require('../../internal/useId.js');
@@ -29,6 +30,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
29
30
  const Checkbox = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
30
31
  let {
31
32
  className,
33
+ decorator,
32
34
  helperText,
33
35
  id,
34
36
  labelText,
@@ -58,15 +60,16 @@ const Checkbox = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
58
60
  [`${prefix}--checkbox-wrapper--readonly`]: readOnly,
59
61
  [`${prefix}--checkbox-wrapper--invalid`]: !readOnly && invalid,
60
62
  [`${prefix}--checkbox-wrapper--warning`]: showWarning,
61
- [`${prefix}--checkbox-wrapper--slug`]: slug
63
+ [`${prefix}--checkbox-wrapper--slug`]: slug,
64
+ [`${prefix}--checkbox-wrapper--decorator`]: decorator
62
65
  });
63
66
  const innerLabelClasses = cx__default["default"](`${prefix}--checkbox-label-text`, {
64
67
  [`${prefix}--visually-hidden`]: hideLabel
65
68
  });
66
- let normalizedSlug;
67
- if (slug && /*#__PURE__*/React__default["default"].isValidElement(slug)) {
68
- const size = slug.props?.['kind'] === 'inline' ? 'md' : 'mini';
69
- normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
69
+ let normalizedDecorator = /*#__PURE__*/React__default["default"].isValidElement(slug ?? decorator) ? slug ?? decorator : null;
70
+ if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
71
+ const size = normalizedDecorator.props?.['kind'] === 'inline' ? 'md' : 'mini';
72
+ normalizedDecorator = /*#__PURE__*/React__default["default"].cloneElement(normalizedDecorator, {
70
73
  size
71
74
  });
72
75
  }
@@ -115,7 +118,9 @@ const Checkbox = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
115
118
  title: title
116
119
  }, /*#__PURE__*/React__default["default"].createElement(Text.Text, {
117
120
  className: innerLabelClasses
118
- }, labelText, normalizedSlug)), /*#__PURE__*/React__default["default"].createElement("div", {
121
+ }, labelText, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default["default"].createElement("div", {
122
+ className: `${prefix}--checkbox-wrapper-inner--decorator`
123
+ }, normalizedDecorator) : '')), /*#__PURE__*/React__default["default"].createElement("div", {
119
124
  className: `${prefix}--checkbox__validation-msg`
120
125
  }, !readOnly && invalid && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(iconsReact.WarningFilled, {
121
126
  className: `${prefix}--checkbox__invalid-icon`
@@ -136,6 +141,10 @@ Checkbox.propTypes = {
136
141
  * Specify an optional className to be applied to the <label> node
137
142
  */
138
143
  className: PropTypes__default["default"].string,
144
+ /**
145
+ * **Experimental**: Provide a decorator component to be rendered inside the `Checkbox` component
146
+ */
147
+ decorator: PropTypes__default["default"].node,
139
148
  /**
140
149
  * Specify whether the underlying input should be checked by default
141
150
  */
@@ -186,7 +195,7 @@ Checkbox.propTypes = {
186
195
  /**
187
196
  * **Experimental**: Provide a `Slug` component to be rendered inside the `Checkbox` component
188
197
  */
189
- slug: PropTypes__default["default"].node,
198
+ slug: deprecate["default"](PropTypes__default["default"].node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
190
199
  /**
191
200
  * Specify a title for the <label> node for the Checkbox
192
201
  */
@@ -8,6 +8,7 @@ import React, { ReactNode } from 'react';
8
8
  export interface CheckboxGroupProps {
9
9
  children?: ReactNode;
10
10
  className?: string;
11
+ decorator?: ReactNode;
11
12
  helperText?: ReactNode;
12
13
  invalid?: boolean;
13
14
  invalidText?: ReactNode;
@@ -15,6 +16,10 @@ export interface CheckboxGroupProps {
15
16
  orientation?: 'horizontal' | 'vertical';
16
17
  legendText: ReactNode;
17
18
  readOnly?: boolean;
19
+ /**
20
+ * * @deprecated please use decorator instead.
21
+ * **Experimental**: Provide a `Slug` component to be rendered inside the `Checkbox` component
22
+ */
18
23
  slug?: ReactNode;
19
24
  warn?: boolean;
20
25
  warnText?: ReactNode;
@@ -13,6 +13,7 @@ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelper
13
13
  var PropTypes = require('prop-types');
14
14
  var React = require('react');
15
15
  var cx = require('classnames');
16
+ var deprecate = require('../../prop-types/deprecate.js');
16
17
  var usePrefix = require('../../internal/usePrefix.js');
17
18
  var iconsReact = require('@carbon/icons-react');
18
19
  var useId = require('../../internal/useId.js');
@@ -27,6 +28,7 @@ const CheckboxGroup = _ref => {
27
28
  let {
28
29
  children,
29
30
  className,
31
+ decorator,
30
32
  helperText,
31
33
  invalid,
32
34
  invalidText,
@@ -53,13 +55,14 @@ const CheckboxGroup = _ref => {
53
55
  [`${prefix}--checkbox-group--readonly`]: readOnly,
54
56
  [`${prefix}--checkbox-group--invalid`]: !readOnly && invalid,
55
57
  [`${prefix}--checkbox-group--warning`]: showWarning,
56
- [`${prefix}--checkbox-group--slug`]: slug
58
+ [`${prefix}--checkbox-group--slug`]: slug,
59
+ [`${prefix}--checkbox-group--decorator`]: decorator
57
60
  });
58
61
 
59
- // Slug is always size `mini`
60
- let normalizedSlug;
61
- if (/*#__PURE__*/React__default["default"].isValidElement(slug) && slug['type']?.displayName === 'AILabel') {
62
- normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
62
+ // AILabel always size `mini`
63
+ let normalizedDecorator = /*#__PURE__*/React__default["default"].isValidElement(slug ?? decorator) ? slug ?? decorator : null;
64
+ if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
65
+ normalizedDecorator = /*#__PURE__*/React__default["default"].cloneElement(normalizedDecorator, {
63
66
  size: 'mini',
64
67
  kind: 'default'
65
68
  });
@@ -73,7 +76,9 @@ const CheckboxGroup = _ref => {
73
76
  }, rest), /*#__PURE__*/React__default["default"].createElement("legend", {
74
77
  className: `${prefix}--label`,
75
78
  id: legendId || rest['aria-labelledby']
76
- }, legendText, normalizedSlug), children, /*#__PURE__*/React__default["default"].createElement("div", {
79
+ }, legendText, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default["default"].createElement("div", {
80
+ className: `${prefix}--checkbox-group-inner--decorator`
81
+ }, normalizedDecorator) : ''), children, /*#__PURE__*/React__default["default"].createElement("div", {
77
82
  className: `${prefix}--checkbox-group__validation-msg`
78
83
  }, !readOnly && invalid && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(iconsReact.WarningFilled, {
79
84
  className: `${prefix}--checkbox__invalid-icon`
@@ -94,6 +99,10 @@ CheckboxGroup.propTypes = {
94
99
  * Provide a custom className to be applied to the containing <fieldset> node
95
100
  */
96
101
  className: PropTypes__default["default"].string,
102
+ /**
103
+ * **Experimental**: Provide a decorator component to be rendered inside the `CheckboxGroup` component
104
+ */
105
+ decorator: PropTypes__default["default"].node,
97
106
  /**
98
107
  * Provide text for the form group for additional help
99
108
  */
@@ -126,7 +135,7 @@ CheckboxGroup.propTypes = {
126
135
  /**
127
136
  * **Experimental**: Provide a `Slug` component to be rendered inside the `CheckboxGroup` component
128
137
  */
129
- slug: PropTypes__default["default"].node,
138
+ slug: deprecate["default"](PropTypes__default["default"].node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
130
139
  /**
131
140
  * Specify whether the form group is currently in warning state
132
141
  */
@@ -147,7 +147,7 @@ export interface ComboBoxProps<ItemType> extends Omit<InputHTMLAttributes<HTMLIn
147
147
  */
148
148
  placeholder?: string;
149
149
  /**
150
- * Is the ComboBox readonly?
150
+ * Whether or not the component is read-only
151
151
  */
152
152
  readOnly?: boolean;
153
153
  /**
@@ -39,6 +39,10 @@ export interface ComposedModalProps extends HTMLAttributes<HTMLDivElement> {
39
39
  * Note that this prop is not applied if you render primary/danger button by yourself
40
40
  */
41
41
  danger?: boolean;
42
+ /**
43
+ * **Experimental**: Provide a `decorator` component to be rendered inside the `ComposedModal` component
44
+ */
45
+ decorator?: ReactNode;
42
46
  /**
43
47
  * Specify whether the Modal content should have any inner padding.
44
48
  */
@@ -70,6 +74,7 @@ export interface ComposedModalProps extends HTMLAttributes<HTMLDivElement> {
70
74
  selectorsFloatingMenus?: string[];
71
75
  size?: 'xs' | 'sm' | 'md' | 'lg';
72
76
  /**
77
+ * @deprecated please use `decorator` instead.
73
78
  * **Experimental**: Provide a `Slug` component to be rendered inside the `ComposedModal` component
74
79
  */
75
80
  slug?: ReactNode;
@@ -26,6 +26,7 @@ var wrapFocus = require('../../internal/wrapFocus.js');
26
26
  var usePrefix = require('../../internal/usePrefix.js');
27
27
  var index$1 = require('../FeatureFlags/index.js');
28
28
  var events = require('../../tools/events.js');
29
+ var deprecate = require('../../prop-types/deprecate.js');
29
30
  var match = require('../../internal/keyboard/match.js');
30
31
  var keys = require('../../internal/keyboard/keys.js');
31
32
 
@@ -109,6 +110,7 @@ const ComposedModal = /*#__PURE__*/React__default["default"].forwardRef(function
109
110
  className: customClassName,
110
111
  containerClassName,
111
112
  danger,
113
+ decorator,
112
114
  isFullWidth,
113
115
  onClose,
114
116
  onKeyDown,
@@ -200,7 +202,8 @@ const ComposedModal = /*#__PURE__*/React__default["default"].forwardRef(function
200
202
  const modalClass = cx__default["default"](`${prefix}--modal`, {
201
203
  'is-visible': isOpen,
202
204
  [`${prefix}--modal--danger`]: danger,
203
- [`${prefix}--modal--slug`]: slug
205
+ [`${prefix}--modal--slug`]: slug,
206
+ [`${prefix}--modal--decorator`]: decorator
204
207
  }, customClassName);
205
208
  const containerClass = cx__default["default"](`${prefix}--modal-container`, size && `${prefix}--modal-container--${size}`, isFullWidth && `${prefix}--modal-container--full-width`, containerClassName);
206
209
 
@@ -259,10 +262,10 @@ const ComposedModal = /*#__PURE__*/React__default["default"].forwardRef(function
259
262
  }
260
263
  }, [open, selectorPrimaryFocus, isOpen]);
261
264
 
262
- // Slug is always size `sm`
263
- let normalizedSlug;
264
- if (slug && slug['type']?.displayName === 'AILabel') {
265
- normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
265
+ // AILabel is always size `sm`
266
+ let normalizedDecorator = /*#__PURE__*/React__default["default"].isValidElement(slug ?? decorator) ? slug ?? decorator : null;
267
+ if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
268
+ normalizedDecorator = /*#__PURE__*/React__default["default"].cloneElement(normalizedDecorator, {
266
269
  size: 'sm'
267
270
  });
268
271
  }
@@ -288,7 +291,9 @@ const ComposedModal = /*#__PURE__*/React__default["default"].forwardRef(function
288
291
  }, "Focus sentinel"), /*#__PURE__*/React__default["default"].createElement("div", {
289
292
  ref: innerModal,
290
293
  className: `${prefix}--modal-container-body`
291
- }, normalizedSlug, childrenWithProps), !focusTrapWithoutSentinels && /*#__PURE__*/React__default["default"].createElement("button", {
294
+ }, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default["default"].createElement("div", {
295
+ className: `${prefix}--modal--inner__decorator`
296
+ }, normalizedDecorator) : '', childrenWithProps), !focusTrapWithoutSentinels && /*#__PURE__*/React__default["default"].createElement("button", {
292
297
  type: "button",
293
298
  ref: endSentinel,
294
299
  className: `${prefix}--visually-hidden`
@@ -320,6 +325,10 @@ ComposedModal.propTypes = {
320
325
  * Note that this prop is not applied if you render primary/danger button by yourself
321
326
  */
322
327
  danger: PropTypes__default["default"].bool,
328
+ /**
329
+ * **Experimental**: Provide a `decorator` component to be rendered inside the `ComposedModal` component
330
+ */
331
+ decorator: PropTypes__default["default"].node,
323
332
  /**
324
333
  * Specify whether the Modal content should have any inner padding.
325
334
  */
@@ -359,10 +368,7 @@ ComposedModal.propTypes = {
359
368
  * Specify the size variant.
360
369
  */
361
370
  size: PropTypes__default["default"].oneOf(['xs', 'sm', 'md', 'lg']),
362
- /**
363
- * **Experimental**: Provide a `Slug` component to be rendered inside the `ComposedModal` component
364
- */
365
- slug: PropTypes__default["default"].node
371
+ slug: deprecate["default"](PropTypes__default["default"].node, 'The `slug` prop for `ComposedModal` has ' + 'been deprecated in favor of the new `decorator` prop. It will be removed in the next major release.')
366
372
  };
367
373
 
368
374
  exports.ModalBody = ModalBody;
@@ -90,6 +90,10 @@ export interface FluidNumberInputProps {
90
90
  * Provide the text that is displayed when the control is in warning state
91
91
  */
92
92
  warnText?: React.ReactNode;
93
+ /**
94
+ * Whether or not the component is readonly
95
+ */
96
+ readOnly?: boolean;
93
97
  }
94
98
  declare const FluidNumberInput: React.FC<FluidNumberInputProps>;
95
99
  export default FluidNumberInput;
@@ -52,6 +52,10 @@ export interface FluidSelectProps {
52
52
  * Provide the text that is displayed when the control is in warning state
53
53
  */
54
54
  warnText?: React.ReactNode;
55
+ /**
56
+ * Whether or not the component is readonly
57
+ */
58
+ readOnly?: boolean;
55
59
  }
56
60
  declare const FluidSelect: React.ForwardRefExoticComponent<FluidSelectProps & React.RefAttributes<HTMLSelectElement>>;
57
61
  export default FluidSelect;
@@ -87,7 +87,11 @@ FluidSelect.propTypes = {
87
87
  /**
88
88
  * Provide the text that is displayed when the control is in warning state
89
89
  */
90
- warnText: PropTypes__default["default"].node
90
+ warnText: PropTypes__default["default"].node,
91
+ /**
92
+ * Whether or not the component is readonly
93
+ */
94
+ readOnly: PropTypes__default["default"].bool
91
95
  };
92
96
 
93
97
  exports["default"] = FluidSelect;
@@ -91,6 +91,10 @@ export interface FluidTextAreaProps {
91
91
  * Provide the text that is displayed when the control is in warning state
92
92
  */
93
93
  warnText?: React.ReactNode;
94
+ /**
95
+ * Whether or not the component is readonly
96
+ */
97
+ readOnly?: boolean;
94
98
  }
95
99
  declare const FluidTextArea: React.FC<FluidTextAreaProps>;
96
100
  export default FluidTextArea;
@@ -125,7 +125,11 @@ FluidTextArea.propTypes = {
125
125
  /**
126
126
  * Provide the text that is displayed when the control is in warning state
127
127
  */
128
- warnText: PropTypes__default["default"].node
128
+ warnText: PropTypes__default["default"].node,
129
+ /**
130
+ * Whether or not the component is readonly
131
+ */
132
+ readOnly: PropTypes__default["default"].bool
129
133
  };
130
134
 
131
135
  exports["default"] = FluidTextArea;