@carbon/react 1.43.0-rc.0 → 1.44.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 (82) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1024 -905
  2. package/es/components/Accordion/AccordionItem.d.ts +1 -1
  3. package/es/components/Accordion/AccordionItem.js +19 -15
  4. package/es/components/Checkbox/Checkbox.d.ts +4 -0
  5. package/es/components/Checkbox/Checkbox.js +15 -2
  6. package/es/components/CheckboxGroup/CheckboxGroup.js +17 -2
  7. package/es/components/ComboBox/ComboBox.js +12 -0
  8. package/es/components/ComboButton/index.js +2 -1
  9. package/es/components/ComposedModal/ComposedModal.d.ts +3 -3
  10. package/es/components/ComposedModal/ComposedModal.js +3 -3
  11. package/es/components/ContextMenu/useContextMenu.js +2 -1
  12. package/es/components/DataTable/tools/sorting.js +1 -1
  13. package/es/components/DataTableSkeleton/DataTableSkeleton.js +1 -1
  14. package/es/components/Dropdown/Dropdown.js +4 -1
  15. package/es/components/FileUploader/FileUploader.js +5 -3
  16. package/es/components/Grid/Column.js +11 -1
  17. package/es/components/Link/Link.d.ts +5 -0
  18. package/es/components/Link/Link.js +9 -2
  19. package/es/components/Menu/Menu.js +14 -0
  20. package/es/components/Menu/MenuContext.js +1 -0
  21. package/es/components/Menu/MenuItem.js +19 -4
  22. package/es/components/MenuButton/index.js +10 -2
  23. package/es/components/RadioButton/RadioButton.d.ts +4 -0
  24. package/es/components/RadioButton/RadioButton.js +15 -2
  25. package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +4 -0
  26. package/es/components/RadioButtonGroup/RadioButtonGroup.js +17 -2
  27. package/es/components/Select/Select.d.ts +1 -1
  28. package/es/components/Slug/index.js +2 -2
  29. package/es/components/Tile/Tile.d.ts +37 -0
  30. package/es/components/Tile/Tile.js +110 -13
  31. package/es/components/UIShell/Content.d.ts +296 -0
  32. package/es/components/UIShell/Content.js +1 -2
  33. package/es/components/UIShell/SideNav.d.ts +1 -1
  34. package/es/components/UIShell/SideNav.js +1 -1
  35. package/es/components/UIShell/Switcher.d.ts +38 -0
  36. package/es/components/UIShell/Switcher.js +14 -13
  37. package/es/components/UIShell/SwitcherDivider.d.ts +9 -0
  38. package/es/components/UIShell/SwitcherDivider.js +4 -5
  39. package/es/components/UIShell/SwitcherItem.d.ts +49 -0
  40. package/es/components/UIShell/SwitcherItem.js +13 -17
  41. package/es/prop-types/tools/getDisplayName.js +34 -0
  42. package/lib/components/Accordion/AccordionItem.d.ts +1 -1
  43. package/lib/components/Accordion/AccordionItem.js +18 -14
  44. package/lib/components/Checkbox/Checkbox.d.ts +4 -0
  45. package/lib/components/Checkbox/Checkbox.js +15 -2
  46. package/lib/components/CheckboxGroup/CheckboxGroup.js +17 -2
  47. package/lib/components/ComboBox/ComboBox.js +12 -0
  48. package/lib/components/ComboButton/index.js +2 -1
  49. package/lib/components/ComposedModal/ComposedModal.d.ts +3 -3
  50. package/lib/components/ComposedModal/ComposedModal.js +3 -3
  51. package/lib/components/ContextMenu/useContextMenu.js +2 -1
  52. package/lib/components/DataTable/tools/sorting.js +1 -1
  53. package/lib/components/DataTableSkeleton/DataTableSkeleton.js +1 -1
  54. package/lib/components/Dropdown/Dropdown.js +4 -1
  55. package/lib/components/FileUploader/FileUploader.js +5 -3
  56. package/lib/components/Grid/Column.js +11 -1
  57. package/lib/components/Link/Link.d.ts +5 -0
  58. package/lib/components/Link/Link.js +9 -2
  59. package/lib/components/Menu/Menu.js +14 -0
  60. package/lib/components/Menu/MenuContext.js +1 -0
  61. package/lib/components/Menu/MenuItem.js +19 -4
  62. package/lib/components/MenuButton/index.js +10 -2
  63. package/lib/components/RadioButton/RadioButton.d.ts +4 -0
  64. package/lib/components/RadioButton/RadioButton.js +15 -2
  65. package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +4 -0
  66. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +17 -2
  67. package/lib/components/Select/Select.d.ts +1 -1
  68. package/lib/components/Slug/index.js +2 -2
  69. package/lib/components/Tile/Tile.d.ts +37 -0
  70. package/lib/components/Tile/Tile.js +110 -13
  71. package/lib/components/UIShell/Content.d.ts +296 -0
  72. package/lib/components/UIShell/Content.js +1 -2
  73. package/lib/components/UIShell/SideNav.d.ts +1 -1
  74. package/lib/components/UIShell/SideNav.js +1 -1
  75. package/lib/components/UIShell/Switcher.d.ts +38 -0
  76. package/lib/components/UIShell/Switcher.js +13 -12
  77. package/lib/components/UIShell/SwitcherDivider.d.ts +9 -0
  78. package/lib/components/UIShell/SwitcherDivider.js +4 -5
  79. package/lib/components/UIShell/SwitcherItem.d.ts +49 -0
  80. package/lib/components/UIShell/SwitcherItem.js +12 -16
  81. package/lib/prop-types/tools/getDisplayName.js +38 -0
  82. package/package.json +5 -5
@@ -36,6 +36,7 @@ const RadioButton = /*#__PURE__*/React__default["default"].forwardRef((props, re
36
36
  name,
37
37
  onChange = () => {},
38
38
  value = '',
39
+ slug,
39
40
  ...rest
40
41
  } = props;
41
42
  const prefix = usePrefix.usePrefix();
@@ -48,9 +49,17 @@ const RadioButton = /*#__PURE__*/React__default["default"].forwardRef((props, re
48
49
  [`${prefix}--visually-hidden`]: hideLabel
49
50
  });
50
51
  const wrapperClasses = cx__default["default"](className, `${prefix}--radio-button-wrapper`, {
51
- [`${prefix}--radio-button-wrapper--label-${labelPosition}`]: labelPosition !== 'right'
52
+ [`${prefix}--radio-button-wrapper--label-${labelPosition}`]: labelPosition !== 'right',
53
+ [`${prefix}--radio-button-wrapper--slug`]: slug
52
54
  });
53
55
  const inputRef = React.useRef(null);
56
+ let normalizedSlug;
57
+ if (slug && /*#__PURE__*/React__default["default"].isValidElement(slug)) {
58
+ const size = slug.props?.['kind'] === 'inline' ? 'md' : 'mini';
59
+ normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
60
+ size
61
+ });
62
+ }
54
63
  return /*#__PURE__*/React__default["default"].createElement("div", {
55
64
  className: wrapperClasses
56
65
  }, /*#__PURE__*/React__default["default"].createElement("input", _rollupPluginBabelHelpers["extends"]({}, rest, {
@@ -69,7 +78,7 @@ const RadioButton = /*#__PURE__*/React__default["default"].forwardRef((props, re
69
78
  className: `${prefix}--radio-button__appearance`
70
79
  }), labelText && /*#__PURE__*/React__default["default"].createElement(Text.Text, {
71
80
  className: innerLabelClasses
72
- }, labelText)));
81
+ }, labelText, normalizedSlug)));
73
82
  });
74
83
  RadioButton.displayName = 'RadioButton';
75
84
  RadioButton.propTypes = {
@@ -120,6 +129,10 @@ RadioButton.propTypes = {
120
129
  * Provide a handler that is invoked when a user clicks on the control
121
130
  */
122
131
  onClick: PropTypes__default["default"].func,
132
+ /**
133
+ * Provide a `Slug` component to be rendered inside the `RadioButton` component
134
+ */
135
+ slug: PropTypes__default["default"].node,
123
136
  /**
124
137
  * Specify the value of the `<RadioButton>`
125
138
  */
@@ -63,6 +63,10 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
63
63
  * Whether the RadioButtonGroup should be read-only
64
64
  */
65
65
  readOnly?: boolean;
66
+ /**
67
+ * Provide a `Slug` component to be rendered inside the `RadioButtonGroup` component
68
+ */
69
+ slug?: ReactNodeLike;
66
70
  /**
67
71
  * Specify whether the control is currently in warning state
68
72
  */
@@ -44,6 +44,7 @@ const RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef((prop
44
44
  valueSelected,
45
45
  warn = false,
46
46
  warnText,
47
+ slug,
47
48
  ...rest
48
49
  } = props;
49
50
  const prefix = usePrefix.usePrefix();
@@ -98,7 +99,8 @@ const RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef((prop
98
99
  [`${prefix}--radio-button-group--label-${labelPosition}`]: labelPosition,
99
100
  [`${prefix}--radio-button-group--readonly`]: readOnly,
100
101
  [`${prefix}--radio-button-group--invalid`]: !readOnly && invalid,
101
- [`${prefix}--radio-button-group--warning`]: showWarning
102
+ [`${prefix}--radio-button-group--warning`]: showWarning,
103
+ [`${prefix}--radio-button-group--slug`]: slug
102
104
  });
103
105
  const helperClasses = cx__default["default"](`${prefix}--form__helper-text`, {
104
106
  [`${prefix}--form__helper-text--disabled`]: disabled
@@ -109,6 +111,15 @@ const RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef((prop
109
111
  className: helperClasses
110
112
  }, helperText) : null;
111
113
  const divRef = React.useRef(null);
114
+
115
+ // Slug is always size `mini`
116
+ let normalizedSlug;
117
+ if (slug) {
118
+ normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
119
+ size: 'mini',
120
+ kind: 'default'
121
+ });
122
+ }
112
123
  return /*#__PURE__*/React__default["default"].createElement("div", {
113
124
  className: wrapperClasses,
114
125
  ref: mergeRefs["default"](divRef, ref)
@@ -119,7 +130,7 @@ const RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef((prop
119
130
  "aria-describedby": showHelper && helperText ? helperId : undefined
120
131
  }, rest), legendText && /*#__PURE__*/React__default["default"].createElement(index.Legend, {
121
132
  className: `${prefix}--label`
122
- }, legendText), getRadioButtons()), /*#__PURE__*/React__default["default"].createElement("div", {
133
+ }, legendText, normalizedSlug), getRadioButtons()), /*#__PURE__*/React__default["default"].createElement("div", {
123
134
  className: `${prefix}--radio-button__validation-msg`
124
135
  }, !readOnly && invalid && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(iconsReact.WarningFilled, {
125
136
  className: `${prefix}--radio-button__invalid-icon`
@@ -186,6 +197,10 @@ RadioButtonGroup.propTypes = {
186
197
  * Whether the RadioButtonGroup should be read-only
187
198
  */
188
199
  readOnly: PropTypes__default["default"].bool,
200
+ /**
201
+ * Provide a `Slug` component to be rendered inside the `RadioButtonGroup` component
202
+ */
203
+ slug: PropTypes__default["default"].node,
189
204
  /**
190
205
  * Specify the value that is currently selected in the group
191
206
  */
@@ -90,5 +90,5 @@ interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, ExcludedAttr
90
90
  */
91
91
  warnText?: ReactNode;
92
92
  }
93
- declare const Select: React.ForwardRefExoticComponent<Pick<SelectProps, "value" | "children" | "disabled" | "form" | "slot" | "style" | "title" | "className" | "size" | "dir" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "autoComplete" | "multiple" | "key" | "id" | "aria-controls" | "aria-expanded" | "onClick" | "onAnimationEnd" | "onKeyDown" | "tabIndex" | "color" | "lang" | "name" | "role" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "inline" | "readOnly" | "required" | "light" | "invalid" | "labelText" | "helperText" | "invalidText" | "hideLabel" | "warn" | "warnText" | "slug" | "noLabel"> & React.RefAttributes<HTMLSelectElement>>;
93
+ declare const Select: React.ForwardRefExoticComponent<Pick<SelectProps, "value" | "children" | "disabled" | "form" | "slot" | "style" | "title" | "className" | "size" | "dir" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "autoComplete" | "multiple" | "key" | "id" | "aria-controls" | "aria-expanded" | "onClick" | "onKeyDown" | "onTransitionEnd" | "tabIndex" | "color" | "lang" | "name" | "role" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEndCapture" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "inline" | "readOnly" | "required" | "light" | "invalid" | "labelText" | "helperText" | "invalidText" | "hideLabel" | "warn" | "warnText" | "slug" | "noLabel"> & React.RefAttributes<HTMLSelectElement>>;
94
94
  export default Select;
@@ -83,7 +83,7 @@ const Slug = /*#__PURE__*/React__default["default"].forwardRef(function Slug(_re
83
83
  children,
84
84
  className,
85
85
  dotType,
86
- kind,
86
+ kind = 'default',
87
87
  onRevertClick,
88
88
  revertActive,
89
89
  revertLabel = 'Revert to AI input',
@@ -113,7 +113,7 @@ const Slug = /*#__PURE__*/React__default["default"].forwardRef(function Slug(_re
113
113
  onRevertClick(evt);
114
114
  }
115
115
  };
116
- const ariaLabel = `${aiText} - ${slugLabel}`;
116
+ const ariaLabel = !aiTextLabel ? `${aiText} - ${slugLabel}` : `${aiText} - ${aiTextLabel}`;
117
117
  return /*#__PURE__*/React__default["default"].createElement("div", {
118
118
  className: slugClasses,
119
119
  ref: ref,
@@ -1,9 +1,19 @@
1
1
  import React, { type ReactNode, type MouseEvent, type KeyboardEvent, type HTMLAttributes, type ChangeEvent, type ComponentType } from 'react';
2
+ import { ReactNodeLike } from 'prop-types';
2
3
  export interface TileProps extends HTMLAttributes<HTMLDivElement> {
3
4
  children?: ReactNode;
4
5
  className?: string;
5
6
  /** @deprecated */
6
7
  light?: boolean;
8
+ /**
9
+ * Specify if the `Tile` component should be rendered with rounded corners. Only valid
10
+ * when `slug` prop is present
11
+ */
12
+ hasRoundedCorners?: boolean;
13
+ /**
14
+ * Provide a `Slug` component to be rendered inside the `SelectableTile` component
15
+ */
16
+ slug?: ReactNodeLike;
7
17
  }
8
18
  export declare const Tile: React.ForwardRefExoticComponent<TileProps & React.RefAttributes<HTMLDivElement>>;
9
19
  export interface ClickableTileProps extends HTMLAttributes<HTMLAnchorElement> {
@@ -19,6 +29,11 @@ export interface ClickableTileProps extends HTMLAttributes<HTMLAnchorElement> {
19
29
  * Specify whether the ClickableTile should be disabled
20
30
  */
21
31
  disabled?: boolean;
32
+ /**
33
+ * Specify if the `ClickableTile` component should be rendered with rounded corners.
34
+ * Only valid when `slug` prop is present
35
+ */
36
+ hasRoundedCorners?: boolean;
22
37
  /**
23
38
  * The href for the link.
24
39
  */
@@ -41,6 +56,10 @@ export interface ClickableTileProps extends HTMLAttributes<HTMLAnchorElement> {
41
56
  * The rel property for the link.
42
57
  */
43
58
  rel?: string;
59
+ /**
60
+ * Specify if a `Slug` icon should be rendered inside the `ClickableTile`
61
+ */
62
+ slug?: boolean;
44
63
  }
45
64
  export declare const ClickableTile: React.ForwardRefExoticComponent<ClickableTileProps & React.RefAttributes<HTMLAnchorElement>>;
46
65
  export interface SelectableTileProps extends HTMLAttributes<HTMLDivElement> {
@@ -52,6 +71,11 @@ export interface SelectableTileProps extends HTMLAttributes<HTMLDivElement> {
52
71
  * Specify whether the SelectableTile should be disabled
53
72
  */
54
73
  disabled?: boolean;
74
+ /**
75
+ * Specify if the `SelectableTile` component should be rendered with rounded corners.
76
+ * Only valid when `slug` prop is present
77
+ */
78
+ hasRoundedCorners?: boolean;
55
79
  /**
56
80
  * The ID of the `<input>`.
57
81
  */
@@ -77,6 +101,10 @@ export interface SelectableTileProps extends HTMLAttributes<HTMLDivElement> {
77
101
  * `true` to select this tile.
78
102
  */
79
103
  selected?: boolean;
104
+ /**
105
+ * Provide a `Slug` component to be rendered inside the `SelectableTile` component
106
+ */
107
+ slug?: ReactNodeLike;
80
108
  /**
81
109
  * Specify the tab index of the wrapper element
82
110
  */
@@ -101,6 +129,11 @@ export interface ExpandableTileProps extends HTMLAttributes<HTMLDivElement> {
101
129
  * `true` if the tile is expanded.
102
130
  */
103
131
  expanded?: boolean;
132
+ /**
133
+ * Specify if the `ExpandableTile` component should be rendered with rounded corners.
134
+ * Only valid when `slug` prop is present
135
+ */
136
+ hasRoundedCorners?: boolean;
104
137
  /**
105
138
  * An ID that can be provided to aria-labelledby
106
139
  */
@@ -113,6 +146,10 @@ export interface ExpandableTileProps extends HTMLAttributes<HTMLDivElement> {
113
146
  * optional handler to trigger a function when a key is pressed
114
147
  */
115
148
  onKeyUp?(event: KeyboardEvent): void;
149
+ /**
150
+ * Provide a `Slug` component to be rendered inside the `ExpandableTile` component
151
+ */
152
+ slug?: ReactNodeLike;
116
153
  /**
117
154
  * The `tabindex` attribute.
118
155
  */
@@ -34,20 +34,26 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
34
34
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
35
35
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
36
36
 
37
- var _CheckboxCheckedFille, _Checkbox, _ChevronDown, _ChevronDown2;
37
+ var _rect, _path, _CheckboxCheckedFille, _Checkbox, _ChevronDown, _ChevronDown2;
38
38
  const Tile = /*#__PURE__*/React__default["default"].forwardRef(function Tile(_ref, ref) {
39
39
  let {
40
40
  children,
41
41
  className,
42
42
  light = false,
43
+ slug,
44
+ hasRoundedCorners = false,
43
45
  ...rest
44
46
  } = _ref;
45
47
  const prefix = usePrefix.usePrefix();
46
- const tileClasses = cx__default["default"](`${prefix}--tile`, light && `${prefix}--tile--light`, className);
48
+ const tileClasses = cx__default["default"](`${prefix}--tile`, {
49
+ [`${prefix}--tile--light`]: light,
50
+ [`${prefix}--tile--slug`]: slug,
51
+ [`${prefix}--tile--slug-rounded`]: slug && hasRoundedCorners
52
+ }, className);
47
53
  return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
48
54
  className: tileClasses,
49
55
  ref: ref
50
- }, rest), children);
56
+ }, rest), children, slug);
51
57
  });
52
58
  Tile.displayName = 'Tile';
53
59
  Tile.propTypes = {
@@ -59,13 +65,22 @@ Tile.propTypes = {
59
65
  * The CSS class names.
60
66
  */
61
67
  className: PropTypes__default["default"].string,
68
+ /**
69
+ * Specify if the `Tile` component should be rendered with rounded corners. Only valid
70
+ * when `slug` prop is present
71
+ */
72
+ hasRoundedCorners: PropTypes__default["default"].bool,
62
73
  /**
63
74
  * `true` to use the light version. For use on $ui-01 backgrounds only.
64
75
  * Don't use this to make tile background color same as container background color.
65
76
  *
66
77
  * @deprecated
67
78
  */
68
- light: deprecate["default"](PropTypes__default["default"].bool, 'The `light` prop for `Tile` is no longer needed and has been deprecated. It will be removed in the next major release. Use the Layer component instead.')
79
+ light: deprecate["default"](PropTypes__default["default"].bool, 'The `light` prop for `Tile` is no longer needed and has been deprecated. It will be removed in the next major release. Use the Layer component instead.'),
80
+ /**
81
+ * Provide a `Slug` component to be rendered inside the `Tile` component
82
+ */
83
+ slug: PropTypes__default["default"].node
69
84
  };
70
85
  const ClickableTile = /*#__PURE__*/React__default["default"].forwardRef(function ClickableTile(_ref2, ref) {
71
86
  let {
@@ -78,10 +93,17 @@ const ClickableTile = /*#__PURE__*/React__default["default"].forwardRef(function
78
93
  onClick = () => {},
79
94
  onKeyDown = () => {},
80
95
  renderIcon: Icon,
96
+ hasRoundedCorners,
97
+ slug,
81
98
  ...rest
82
99
  } = _ref2;
83
100
  const prefix = usePrefix.usePrefix();
84
- const classes = cx__default["default"](`${prefix}--tile`, `${prefix}--tile--clickable`, clicked && `${prefix}--tile--is-clicked`, light && `${prefix}--tile--light`, className);
101
+ const classes = cx__default["default"](`${prefix}--tile`, `${prefix}--tile--clickable`, {
102
+ [`${prefix}--tile--is-clicked`]: clicked,
103
+ [`${prefix}--tile--light`]: light,
104
+ [`${prefix}--tile--slug`]: slug,
105
+ [`${prefix}--tile--slug-rounded`]: slug && hasRoundedCorners
106
+ }, className);
85
107
  const [isSelected, setIsSelected] = React.useState(clicked);
86
108
  function handleOnClick(evt) {
87
109
  evt?.persist?.();
@@ -95,6 +117,25 @@ const ClickableTile = /*#__PURE__*/React__default["default"].forwardRef(function
95
117
  }
96
118
  onKeyDown(evt);
97
119
  }
120
+
121
+ // To Do: Replace with an an icon from `@carbon/react`
122
+ // since the hollow slug in `ClickableTile` is not interactive
123
+ const hollowSlugIcon = /*#__PURE__*/React__default["default"].createElement("svg", {
124
+ className: `${prefix}--tile--slug-icon`,
125
+ width: "24",
126
+ height: "24",
127
+ viewBox: "0 0 24 24",
128
+ fill: "none",
129
+ xmlns: "http://www.w3.org/2000/svg"
130
+ }, _rect || (_rect = /*#__PURE__*/React__default["default"].createElement("rect", {
131
+ x: "0.5",
132
+ y: "0.5",
133
+ width: "23",
134
+ height: "23"
135
+ })), _path || (_path = /*#__PURE__*/React__default["default"].createElement("path", {
136
+ 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",
137
+ fill: "#161616"
138
+ })));
98
139
  const v12DefaultIcons = index.useFeatureFlag('enable-v12-tile-default-icons');
99
140
  if (v12DefaultIcons) {
100
141
  if (!Icon) {
@@ -116,7 +157,9 @@ const ClickableTile = /*#__PURE__*/React__default["default"].forwardRef(function
116
157
  onKeyDown: handleOnKeyDown,
117
158
  ref: ref,
118
159
  disabled: disabled
119
- }, rest), children, Icon && /*#__PURE__*/React__default["default"].createElement(Icon, {
160
+ }, rest), slug ? /*#__PURE__*/React__default["default"].createElement("div", {
161
+ className: `${prefix}--tile-content`
162
+ }, children) : children, slug && hollowSlugIcon, Icon && /*#__PURE__*/React__default["default"].createElement(Icon, {
120
163
  className: iconClasses,
121
164
  "aria-hidden": "true"
122
165
  }));
@@ -139,6 +182,11 @@ ClickableTile.propTypes = {
139
182
  * Specify whether the ClickableTile should be disabled
140
183
  */
141
184
  disabled: PropTypes__default["default"].bool,
185
+ /**
186
+ * Specify if the `ClickableTile` component should be rendered with rounded corners.
187
+ * Only valid when `slug` prop is present
188
+ */
189
+ hasRoundedCorners: PropTypes__default["default"].bool,
142
190
  /**
143
191
  * The href for the link.
144
192
  */
@@ -180,6 +228,8 @@ const SelectableTile = /*#__PURE__*/React__default["default"].forwardRef(functio
180
228
  selected = false,
181
229
  tabIndex = 0,
182
230
  title = 'title',
231
+ slug,
232
+ hasRoundedCorners,
183
233
  ...rest
184
234
  } = _ref3;
185
235
  const prefix = usePrefix.usePrefix();
@@ -187,12 +237,21 @@ const SelectableTile = /*#__PURE__*/React__default["default"].forwardRef(functio
187
237
  const keyDownHandler = onKeyDown;
188
238
  const [isSelected, setIsSelected] = React.useState(selected);
189
239
  const [prevSelected, setPrevSelected] = React.useState(selected);
190
- const classes = cx__default["default"](`${prefix}--tile`, `${prefix}--tile--selectable`, isSelected && `${prefix}--tile--is-selected`, light && `${prefix}--tile--light`, disabled && `${prefix}--tile--disabled`, className);
240
+ const classes = cx__default["default"](`${prefix}--tile`, `${prefix}--tile--selectable`, {
241
+ [`${prefix}--tile--is-selected`]: isSelected,
242
+ [`${prefix}--tile--light`]: light,
243
+ [`${prefix}--tile--disabled`]: disabled,
244
+ [`${prefix}--tile--slug`]: slug,
245
+ [`${prefix}--tile--slug-rounded`]: slug && hasRoundedCorners
246
+ }, className);
191
247
 
192
248
  // TODO: rename to handleClick when handleClick prop is deprecated
193
249
  function handleOnClick(evt) {
194
250
  evt.preventDefault();
195
251
  evt?.persist?.();
252
+ if (slug && slugRef.current && slugRef.current.contains(evt.target)) {
253
+ return;
254
+ }
196
255
  setIsSelected(!isSelected);
197
256
  clickHandler(evt);
198
257
  onChange(evt);
@@ -216,6 +275,16 @@ const SelectableTile = /*#__PURE__*/React__default["default"].forwardRef(functio
216
275
  setIsSelected(selected);
217
276
  setPrevSelected(selected);
218
277
  }
278
+
279
+ // Slug is always size `xs`
280
+ const slugRef = React.useRef(null);
281
+ let normalizedSlug;
282
+ if (slug) {
283
+ normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
284
+ size: 'xs',
285
+ ref: slugRef
286
+ });
287
+ }
219
288
  return (
220
289
  /*#__PURE__*/
221
290
  // eslint-disable-next-line jsx-a11y/interactive-supports-focus
@@ -238,10 +307,9 @@ const SelectableTile = /*#__PURE__*/React__default["default"].forwardRef(functio
238
307
  as: "label",
239
308
  htmlFor: id,
240
309
  className: `${prefix}--tile-content`
241
- }, children))
310
+ }, children), normalizedSlug)
242
311
  );
243
312
  });
244
- SelectableTile.displayName = 'SelectableTile';
245
313
  SelectableTile.propTypes = {
246
314
  children: PropTypes__default["default"].node,
247
315
  className: PropTypes__default["default"].string,
@@ -249,6 +317,11 @@ SelectableTile.propTypes = {
249
317
  * Specify whether the SelectableTile should be disabled
250
318
  */
251
319
  disabled: PropTypes__default["default"].bool,
320
+ /**
321
+ * Specify if the `SelectableTile` component should be rendered with rounded corners.
322
+ * Only valid when `slug` prop is present
323
+ */
324
+ hasRoundedCorners: PropTypes__default["default"].bool,
252
325
  /**
253
326
  * The ID of the `<input>`.
254
327
  */
@@ -279,6 +352,10 @@ SelectableTile.propTypes = {
279
352
  * `true` to select this tile.
280
353
  */
281
354
  selected: PropTypes__default["default"].bool,
355
+ /**
356
+ * Provide a `Slug` component to be rendered inside the `SelectableTile` component
357
+ */
358
+ slug: PropTypes__default["default"].node,
282
359
  /**
283
360
  * Specify the tab index of the wrapper element
284
361
  */
@@ -310,6 +387,8 @@ const ExpandableTile = /*#__PURE__*/React__default["default"].forwardRef(functio
310
387
  tileCollapsedLabel,
311
388
  tileExpandedLabel,
312
389
  light,
390
+ slug,
391
+ hasRoundedCorners,
313
392
  ...rest
314
393
  } = _ref4;
315
394
  const [isTileMaxHeight, setIsTileMaxHeight] = React.useState(tileMaxHeight);
@@ -365,7 +444,12 @@ const ExpandableTile = /*#__PURE__*/React__default["default"].forwardRef(functio
365
444
  [`${prefix}--tile--is-expanded`]: isExpanded,
366
445
  [`${prefix}--tile--light`]: light
367
446
  }, className);
368
- const interactiveClassNames = cx__default["default"](`${prefix}--tile`, `${prefix}--tile--expandable`, `${prefix}--tile--expandable--interactive`, isExpanded && `${prefix}--tile--is-expanded`, light && `${prefix}--tile--light`, className);
447
+ const interactiveClassNames = cx__default["default"](`${prefix}--tile`, `${prefix}--tile--expandable`, `${prefix}--tile--expandable--interactive`, {
448
+ [`${prefix}--tile--is-expanded`]: isExpanded,
449
+ [`${prefix}--tile--light`]: light,
450
+ [`${prefix}--tile--slug`]: slug,
451
+ [`${prefix}--tile--slug-rounded`]: slug && hasRoundedCorners
452
+ }, className);
369
453
  const chevronInteractiveClassNames = cx__default["default"](`${prefix}--tile__chevron`, `${prefix}--tile__chevron--interactive`);
370
454
  const childrenAsArray = getChildren();
371
455
  useIsomorphicEffect["default"](() => {
@@ -391,10 +475,10 @@ const ExpandableTile = /*#__PURE__*/React__default["default"].forwardRef(functio
391
475
 
392
476
  // Interactive elements or elements that are given a role should be treated
393
477
  // the same because elements with a role can not be rendered inside a `button`
394
- if (!useNoInteractiveChildren.getInteractiveContent(belowTheFold.current) && !useNoInteractiveChildren.getRoleContent(belowTheFold.current) && !useNoInteractiveChildren.getInteractiveContent(aboveTheFold.current) && !useNoInteractiveChildren.getRoleContent(aboveTheFold.current)) {
478
+ if (!useNoInteractiveChildren.getInteractiveContent(belowTheFold.current) && !useNoInteractiveChildren.getRoleContent(belowTheFold.current) && !useNoInteractiveChildren.getInteractiveContent(aboveTheFold.current) && !useNoInteractiveChildren.getRoleContent(aboveTheFold.current) && !slug) {
395
479
  setInteractive(false);
396
480
  }
397
- }, []);
481
+ }, [slug]);
398
482
  useIsomorphicEffect["default"](() => {
399
483
  if (!tile.current) {
400
484
  return;
@@ -417,13 +501,21 @@ const ExpandableTile = /*#__PURE__*/React__default["default"].forwardRef(functio
417
501
  return () => resizeObserver.disconnect();
418
502
  }, []);
419
503
  const belowTheFoldId = useId.useId('expandable-tile-interactive');
504
+
505
+ // Slug is always size `xs`
506
+ let normalizedSlug;
507
+ if (slug) {
508
+ normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
509
+ size: 'xs'
510
+ });
511
+ }
420
512
  return interactive ? /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
421
513
  // @ts-expect-error: Needlesly strict & deep typing for the element type
422
514
  ref: ref,
423
515
  className: interactiveClassNames
424
516
  }, rest), /*#__PURE__*/React__default["default"].createElement("div", {
425
517
  ref: tileContent
426
- }, /*#__PURE__*/React__default["default"].createElement("div", {
518
+ }, normalizedSlug, /*#__PURE__*/React__default["default"].createElement("div", {
427
519
  ref: aboveTheFold,
428
520
  className: `${prefix}--tile-content`
429
521
  }, childrenAsArray[0]), /*#__PURE__*/React__default["default"].createElement("button", {
@@ -469,6 +561,11 @@ ExpandableTile.propTypes = {
469
561
  * `true` if the tile is expanded.
470
562
  */
471
563
  expanded: PropTypes__default["default"].bool,
564
+ /**
565
+ * Specify if the `ExpandableTile` component should be rendered with rounded corners.
566
+ * Only valid when `slug` prop is present
567
+ */
568
+ hasRoundedCorners: PropTypes__default["default"].bool,
472
569
  /**
473
570
  * An ID that can be provided to aria-labelledby
474
571
  */