@carbon/react 1.65.0 → 1.66.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 (110) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +927 -927
  2. package/es/components/AILabel/index.d.ts +37 -0
  3. package/es/components/AILabel/index.js +38 -14
  4. package/es/components/Accordion/Accordion.d.ts +5 -1
  5. package/es/components/Breadcrumb/BreadcrumbItem.js +1 -1
  6. package/es/components/Button/Button.d.ts +2 -1
  7. package/es/components/Button/Button.js +14 -3
  8. package/es/components/ChatButton/ChatButton.Skeleton.d.ts +31 -0
  9. package/es/components/ChatButton/ChatButton.Skeleton.js +1 -2
  10. package/es/components/ChatButton/ChatButton.d.ts +46 -0
  11. package/es/components/ChatButton/ChatButton.js +3 -3
  12. package/es/components/ChatButton/index.d.ts +12 -0
  13. package/es/components/Checkbox/index.js +10 -0
  14. package/es/components/CodeSnippet/CodeSnippet.d.ts +9 -1
  15. package/es/components/CodeSnippet/CodeSnippet.js +7 -0
  16. package/es/components/ComboBox/ComboBox.js +38 -19
  17. package/es/components/ComboButton/index.js +8 -3
  18. package/es/components/ComposedModal/index.d.ts +2 -0
  19. package/es/components/Copy/Copy.d.ts +9 -1
  20. package/es/components/Copy/Copy.js +6 -0
  21. package/es/components/CopyButton/CopyButton.d.ts +9 -1
  22. package/es/components/CopyButton/CopyButton.js +6 -0
  23. package/es/components/DataTable/TableSlugRow.d.ts +1 -0
  24. package/es/components/DataTable/TableSlugRow.js +1 -0
  25. package/es/components/Dropdown/Dropdown.js +1 -1
  26. package/es/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +20 -0
  27. package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +3 -20
  28. package/es/components/FluidTextArea/FluidTextArea.d.ts +96 -0
  29. package/es/components/FluidTextArea/FluidTextArea.js +2 -2
  30. package/es/components/FluidTextArea/index.d.ts +12 -0
  31. package/es/components/Grid/Column.js +3 -3
  32. package/es/components/IconButton/index.d.ts +4 -0
  33. package/es/components/IconButton/index.js +6 -0
  34. package/es/components/ListBox/ListBoxMenuItem.d.ts +10 -1
  35. package/es/components/ListBox/next/ListBoxSelection.d.ts +106 -0
  36. package/es/components/ListBox/next/ListBoxSelection.js +12 -16
  37. package/es/components/ListBox/next/ListBoxTrigger.d.ts +31 -0
  38. package/es/components/ListBox/next/ListBoxTrigger.js +2 -4
  39. package/es/components/ListBox/next/index.d.ts +8 -0
  40. package/es/components/Menu/Menu.js +2 -1
  41. package/es/components/MultiSelect/FilterableMultiSelect.js +14 -15
  42. package/es/components/MultiSelect/MultiSelect.js +65 -49
  43. package/es/components/MultiSelect/tools/sorting.js +5 -8
  44. package/es/components/OverflowMenu/OverflowMenu.js +1 -1
  45. package/es/components/OverflowMenu/next/index.js +3 -1
  46. package/es/components/Popover/index.js +22 -5
  47. package/es/components/Tag/DismissibleTag.d.ts +9 -1
  48. package/es/components/Tag/DismissibleTag.js +7 -3
  49. package/es/components/Tag/Tag.js +2 -2
  50. package/es/components/Toggletip/index.js +2 -1
  51. package/es/components/TreeView/TreeNode.js +41 -33
  52. package/es/components/TreeView/TreeView.d.ts +5 -3
  53. package/es/index.js +4 -4
  54. package/es/internal/Selection.js +30 -18
  55. package/es/internal/useMergedRefs.d.ts +1 -1
  56. package/lib/components/AILabel/index.d.ts +37 -0
  57. package/lib/components/AILabel/index.js +38 -14
  58. package/lib/components/Accordion/Accordion.d.ts +5 -1
  59. package/lib/components/Breadcrumb/BreadcrumbItem.js +1 -1
  60. package/lib/components/Button/Button.d.ts +2 -1
  61. package/lib/components/Button/Button.js +13 -2
  62. package/lib/components/ChatButton/ChatButton.Skeleton.d.ts +31 -0
  63. package/lib/components/ChatButton/ChatButton.Skeleton.js +1 -2
  64. package/lib/components/ChatButton/ChatButton.d.ts +46 -0
  65. package/lib/components/ChatButton/ChatButton.js +4 -4
  66. package/lib/components/ChatButton/index.d.ts +12 -0
  67. package/lib/components/Checkbox/index.js +19 -0
  68. package/lib/components/CodeSnippet/CodeSnippet.d.ts +9 -1
  69. package/lib/components/CodeSnippet/CodeSnippet.js +7 -0
  70. package/lib/components/ComboBox/ComboBox.js +38 -19
  71. package/lib/components/ComboButton/index.js +8 -3
  72. package/lib/components/ComposedModal/index.d.ts +2 -0
  73. package/lib/components/Copy/Copy.d.ts +9 -1
  74. package/lib/components/Copy/Copy.js +6 -0
  75. package/lib/components/CopyButton/CopyButton.d.ts +9 -1
  76. package/lib/components/CopyButton/CopyButton.js +6 -0
  77. package/lib/components/DataTable/TableSlugRow.d.ts +1 -0
  78. package/lib/components/DataTable/TableSlugRow.js +1 -0
  79. package/lib/components/Dropdown/Dropdown.js +1 -1
  80. package/lib/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +20 -0
  81. package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +3 -22
  82. package/lib/components/FluidTextArea/FluidTextArea.d.ts +96 -0
  83. package/lib/components/FluidTextArea/FluidTextArea.js +2 -2
  84. package/lib/components/FluidTextArea/index.d.ts +12 -0
  85. package/lib/components/Grid/Column.js +3 -3
  86. package/lib/components/IconButton/index.d.ts +4 -0
  87. package/lib/components/IconButton/index.js +6 -0
  88. package/lib/components/ListBox/ListBoxMenuItem.d.ts +10 -1
  89. package/lib/components/ListBox/next/ListBoxSelection.d.ts +106 -0
  90. package/lib/components/ListBox/next/ListBoxSelection.js +11 -16
  91. package/lib/components/ListBox/next/ListBoxTrigger.d.ts +31 -0
  92. package/lib/components/ListBox/next/ListBoxTrigger.js +2 -4
  93. package/lib/components/ListBox/next/index.d.ts +8 -0
  94. package/lib/components/Menu/Menu.js +2 -1
  95. package/lib/components/MultiSelect/FilterableMultiSelect.js +14 -15
  96. package/lib/components/MultiSelect/MultiSelect.js +64 -48
  97. package/lib/components/MultiSelect/tools/sorting.js +5 -8
  98. package/lib/components/OverflowMenu/OverflowMenu.js +1 -1
  99. package/lib/components/OverflowMenu/next/index.js +3 -1
  100. package/lib/components/Popover/index.js +22 -5
  101. package/lib/components/Tag/DismissibleTag.d.ts +9 -1
  102. package/lib/components/Tag/DismissibleTag.js +7 -3
  103. package/lib/components/Tag/Tag.js +2 -2
  104. package/lib/components/Toggletip/index.js +2 -1
  105. package/lib/components/TreeView/TreeNode.js +41 -33
  106. package/lib/components/TreeView/TreeView.d.ts +5 -3
  107. package/lib/index.js +8 -8
  108. package/lib/internal/Selection.js +30 -18
  109. package/lib/internal/useMergedRefs.d.ts +1 -1
  110. package/package.json +25 -22
@@ -17,6 +17,8 @@ var React = require('react');
17
17
  require('../Text/index.js');
18
18
  var iconsReact = require('@carbon/icons-react');
19
19
  var index = require('../ListBox/index.js');
20
+ var ListBoxSelection = require('../ListBox/next/ListBoxSelection.js');
21
+ var ListBoxTrigger = require('../ListBox/next/ListBoxTrigger.js');
20
22
  var useId = require('../../internal/useId.js');
21
23
  var mergeRefs = require('../../tools/mergeRefs.js');
22
24
  var deprecate = require('../../prop-types/deprecate.js');
@@ -24,10 +26,9 @@ var usePrefix = require('../../internal/usePrefix.js');
24
26
  require('../FluidForm/FluidForm.js');
25
27
  var FormContext = require('../FluidForm/FormContext.js');
26
28
  var react = require('@floating-ui/react');
29
+ var floatingUi_core = require('../../node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js');
27
30
  var Text = require('../Text/Text.js');
28
31
  var match = require('../../internal/keyboard/match.js');
29
- var ListBoxSelection = require('../ListBox/next/ListBoxSelection.js');
30
- var ListBoxTrigger = require('../ListBox/next/ListBoxTrigger.js');
31
32
  var ListBoxPropTypes = require('../ListBox/ListBoxPropTypes.js');
32
33
  var keys = require('../../internal/keyboard/keys.js');
33
34
 
@@ -138,19 +139,24 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
138
139
  } = props;
139
140
  const {
140
141
  refs,
141
- floatingStyles
142
+ floatingStyles,
143
+ middlewareData
142
144
  } = react.useFloating(autoAlign ? {
143
145
  placement: direction,
144
146
  strategy: 'fixed',
145
- middleware: [react.flip()],
147
+ middleware: [react.flip(), floatingUi_core.hide()],
146
148
  whileElementsMounted: react.autoUpdate
147
149
  } : {});
148
150
  const parentWidth = refs?.reference?.current?.clientWidth;
149
151
  React.useEffect(() => {
150
152
  if (autoAlign) {
151
- Object.keys(floatingStyles).forEach(style => {
153
+ const updatedFloatingStyles = {
154
+ ...floatingStyles,
155
+ visibility: middlewareData.hide?.referenceHidden ? 'hidden' : 'visible'
156
+ };
157
+ Object.keys(updatedFloatingStyles).forEach(style => {
152
158
  if (refs.floating.current) {
153
- refs.floating.current.style[style] = floatingStyles[style];
159
+ refs.floating.current.style[style] = updatedFloatingStyles[style];
154
160
  }
155
161
  });
156
162
  if (parentWidth && refs.floating.current) {
@@ -217,17 +223,30 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
217
223
  } = changes;
218
224
  switch (type) {
219
225
  case InputBlur:
220
- if (state.inputValue && highlightedIndex == '-1' && changes.selectedItem) {
221
- return {
222
- ...changes,
223
- inputValue: itemToString(changes.selectedItem)
224
- };
225
- } else if (state.inputValue && highlightedIndex == '-1' && !allowCustomValue && !changes.selectedItem) {
226
- return {
227
- ...changes,
228
- inputValue: ''
229
- };
230
- } else {
226
+ {
227
+ if (allowCustomValue && highlightedIndex == '-1') {
228
+ const customValue = inputValue;
229
+ changes.selectedItem = customValue;
230
+ if (onChange) {
231
+ onChange({
232
+ selectedItem: inputValue,
233
+ inputValue
234
+ });
235
+ }
236
+ return changes;
237
+ }
238
+ if (state.inputValue && highlightedIndex == '-1' && changes.selectedItem) {
239
+ return {
240
+ ...changes,
241
+ inputValue: itemToString(changes.selectedItem)
242
+ };
243
+ }
244
+ if (state.inputValue && highlightedIndex == '-1' && !allowCustomValue && !changes.selectedItem) {
245
+ return {
246
+ ...changes,
247
+ inputValue: ''
248
+ };
249
+ }
231
250
  return changes;
232
251
  }
233
252
  case InputKeyDownEnter:
@@ -296,7 +315,8 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
296
315
  [`${prefix}--combo-box--invalid--focused`]: invalid && isFocused,
297
316
  [`${prefix}--list-box--up`]: direction === 'top',
298
317
  [`${prefix}--combo-box--warning`]: showWarning,
299
- [`${prefix}--combo-box--readonly`]: readOnly
318
+ [`${prefix}--combo-box--readonly`]: readOnly,
319
+ [`${prefix}--autoalign`]: autoAlign
300
320
  });
301
321
  const titleClasses = cx__default["default"](`${prefix}--label`, {
302
322
  [`${prefix}--label--disabled`]: disabled
@@ -543,7 +563,6 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
543
563
  onClearSelection: handleSelectionClear,
544
564
  selectionCount: 0
545
565
  }), /*#__PURE__*/React__default["default"].createElement(ListBoxTrigger["default"], _rollupPluginBabelHelpers["extends"]({}, buttonProps, {
546
- // @ts-expect-error
547
566
  isOpen: isOpen,
548
567
  translateWithId: translateWithId
549
568
  }))), normalizedSlug, /*#__PURE__*/React__default["default"].createElement(index["default"].Menu, menuProps, isOpen ? filterItems(items, itemToString, inputValue).map((item, index$1) => {
@@ -24,6 +24,7 @@ var useId = require('../../internal/useId.js');
24
24
  var usePrefix = require('../../internal/usePrefix.js');
25
25
  var react = require('@floating-ui/react');
26
26
  var mergeRefs = require('../../tools/mergeRefs.js');
27
+ var floatingUi_core = require('../../node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js');
27
28
 
28
29
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
29
30
 
@@ -61,7 +62,7 @@ const ComboButton = /*#__PURE__*/React__default["default"].forwardRef(function C
61
62
  const containerRef = React.useRef(null);
62
63
  const middlewares = [react.flip({
63
64
  crossAxis: false
64
- })];
65
+ }), floatingUi_core.hide()];
65
66
  if (menuAlignment === 'bottom' || menuAlignment === 'top') {
66
67
  middlewares.push(react.size({
67
68
  apply(_ref2) {
@@ -99,9 +100,13 @@ const ComboButton = /*#__PURE__*/React__default["default"].forwardRef(function C
99
100
  handleClose
100
101
  } = useAttachedMenu.useAttachedMenu(containerRef);
101
102
  React.useLayoutEffect(() => {
102
- Object.keys(floatingStyles).forEach(style => {
103
+ const updatedFloatingStyles = {
104
+ ...floatingStyles,
105
+ visibility: middlewareData.hide?.referenceHidden ? 'hidden' : 'visible'
106
+ };
107
+ Object.keys(updatedFloatingStyles).forEach(style => {
103
108
  if (refs.floating.current) {
104
- refs.floating.current.style[style] = floatingStyles[style];
109
+ refs.floating.current.style[style] = updatedFloatingStyles[style];
105
110
  }
106
111
  });
107
112
  }, [floatingStyles, refs.floating, middlewareData, placement, open]);
@@ -4,6 +4,8 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
+ import ComposedModal from './ComposedModal';
7
8
  export { default as ComposedModal, type ComposedModalProps, ModalBody, type ModalBodyProps, } from './ComposedModal';
8
9
  export { ModalHeader, type ModalHeaderProps } from './ModalHeader';
9
10
  export { ModalFooter, type ModalFooterProps } from './ModalFooter';
11
+ export default ComposedModal;
@@ -11,6 +11,10 @@ interface CopyProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
11
11
  * Specify how the trigger should align with the tooltip
12
12
  */
13
13
  align?: 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'right';
14
+ /**
15
+ * **Experimental**: Will attempt to automatically align the tooltip
16
+ */
17
+ autoAlign?: boolean;
14
18
  /**
15
19
  * Specify an optional className to be applied to the underlying `<button>`
16
20
  */
@@ -35,13 +39,17 @@ interface CopyProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
35
39
  */
36
40
  onClick?: MouseEventHandler<HTMLButtonElement>;
37
41
  }
38
- declare function Copy({ align, children, className, feedback, feedbackTimeout, onAnimationEnd, onClick, ...other }: PropsWithChildren<CopyProps>): import("react/jsx-runtime").JSX.Element;
42
+ declare function Copy({ align, autoAlign, children, className, feedback, feedbackTimeout, onAnimationEnd, onClick, ...other }: PropsWithChildren<CopyProps>): import("react/jsx-runtime").JSX.Element;
39
43
  declare namespace Copy {
40
44
  var propTypes: {
41
45
  /**
42
46
  * Specify how the trigger should align with the tooltip
43
47
  */
44
48
  align: PropTypes.Requireable<string>;
49
+ /**
50
+ * **Experimental**: Will attempt to automatically align the tooltip
51
+ */
52
+ autoAlign: PropTypes.Requireable<boolean>;
45
53
  /**
46
54
  * Pass in content to be rendered in the underlying `<button>`
47
55
  */
@@ -29,6 +29,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
29
29
  function Copy(_ref) {
30
30
  let {
31
31
  align = 'bottom',
32
+ autoAlign = false,
32
33
  children,
33
34
  className,
34
35
  feedback = 'Copied!',
@@ -63,6 +64,7 @@ function Copy(_ref) {
63
64
  return /*#__PURE__*/React__default["default"].createElement(index.IconButton, _rollupPluginBabelHelpers["extends"]({
64
65
  closeOnActivation: false,
65
66
  align: align,
67
+ autoAlign: autoAlign,
66
68
  className: classNames,
67
69
  label: animation ? feedback : initialLabel,
68
70
  onClick: events.composeEventHandlers([onClick, handleClick]),
@@ -76,6 +78,10 @@ Copy.propTypes = {
76
78
  * Specify how the trigger should align with the tooltip
77
79
  */
78
80
  align: PropTypes__default["default"].oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right']),
81
+ /**
82
+ * **Experimental**: Will attempt to automatically align the tooltip
83
+ */
84
+ autoAlign: PropTypes__default["default"].bool,
79
85
  /**
80
86
  * Pass in content to be rendered in the underlying `<button>`
81
87
  */
@@ -12,6 +12,10 @@ export interface CopyButtonProps extends ButtonProps<'button'> {
12
12
  * Specify how the trigger should align with the tooltip
13
13
  */
14
14
  align?: 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'right';
15
+ /**
16
+ * **Experimental**: Will attempt to automatically align the tooltip
17
+ */
18
+ autoAlign?: boolean;
15
19
  /**
16
20
  * Specify an optional className to be applied to the underlying `<button>`
17
21
  */
@@ -36,13 +40,17 @@ export interface CopyButtonProps extends ButtonProps<'button'> {
36
40
  */
37
41
  onClick?: MouseEventHandler<HTMLButtonElement>;
38
42
  }
39
- declare function CopyButton({ align, feedback, feedbackTimeout, iconDescription, className, onClick, ...other }: CopyButtonProps): import("react/jsx-runtime").JSX.Element;
43
+ declare function CopyButton({ align, autoAlign, feedback, feedbackTimeout, iconDescription, className, onClick, ...other }: CopyButtonProps): import("react/jsx-runtime").JSX.Element;
40
44
  declare namespace CopyButton {
41
45
  var propTypes: {
42
46
  /**
43
47
  * Specify how the trigger should align with the tooltip
44
48
  */
45
49
  align: PropTypes.Requireable<string>;
50
+ /**
51
+ * **Experimental**: Will attempt to automatically align the tooltip
52
+ */
53
+ autoAlign: PropTypes.Requireable<boolean>;
46
54
  /**
47
55
  * Specify an optional className to be applied to the underlying `<button>`
48
56
  */
@@ -28,6 +28,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
28
28
  function CopyButton(_ref) {
29
29
  let {
30
30
  align = 'bottom',
31
+ autoAlign = false,
31
32
  feedback = 'Copied!',
32
33
  feedbackTimeout = 2000,
33
34
  iconDescription = 'Copy to clipboard',
@@ -46,6 +47,7 @@ function CopyButton(_ref) {
46
47
  feedbackTimeout: feedbackTimeout,
47
48
  onClick: onClick,
48
49
  align: align,
50
+ autoAlign: autoAlign,
49
51
  className: cx__default["default"](className, `${prefix}--copy-btn`),
50
52
  "aria-label": iconDescription
51
53
  }, other), /*#__PURE__*/React__default["default"].createElement(iconsReact.Copy, {
@@ -57,6 +59,10 @@ CopyButton.propTypes = {
57
59
  * Specify how the trigger should align with the tooltip
58
60
  */
59
61
  align: PropTypes__default["default"].oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right']),
62
+ /**
63
+ * **Experimental**: Will attempt to automatically align the tooltip
64
+ */
65
+ autoAlign: PropTypes__default["default"].bool,
60
66
  /**
61
67
  * Specify an optional className to be applied to the underlying `<button>`
62
68
  */
@@ -18,6 +18,7 @@ export interface TableSlugRowProps {
18
18
  }
19
19
  declare const TableSlugRow: {
20
20
  ({ className, slug }: TableSlugRowProps): import("react/jsx-runtime").JSX.Element;
21
+ displayName: string;
21
22
  propTypes: {
22
23
  /**
23
24
  * The CSS class names of the cell that wraps the underlying input control
@@ -45,6 +45,7 @@ const TableSlugRow = _ref => {
45
45
  className: TableSlugRowClasses
46
46
  }, normalizedSlug);
47
47
  };
48
+ TableSlugRow.displayName = 'TableSlugRow';
48
49
  TableSlugRow.propTypes = {
49
50
  /**
50
51
  * The CSS class names of the cell that wraps the underlying input control
@@ -195,7 +195,7 @@ const Dropdown = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
195
195
  [`${prefix}--dropdown--readonly`]: readOnly,
196
196
  [`${prefix}--dropdown--${size}`]: size,
197
197
  [`${prefix}--list-box--up`]: direction === 'top',
198
- [`${prefix}--dropdown--autoalign`]: autoAlign
198
+ [`${prefix}--autoalign`]: autoAlign
199
199
  });
200
200
  const titleClasses = cx__default["default"](`${prefix}--label`, {
201
201
  [`${prefix}--label--disabled`]: disabled,
@@ -0,0 +1,20 @@
1
+ import PropTypes from 'prop-types';
2
+ export interface FluidTextAreaSkeletonProps {
3
+ /**
4
+ * Specify an optional className to be applied to the outer FluidForm wrapper
5
+ */
6
+ className?: string;
7
+ }
8
+ declare function FluidTextAreaSkeleton({ className, ...other }: {
9
+ [x: string]: any;
10
+ className: any;
11
+ }): void;
12
+ declare namespace FluidTextAreaSkeleton {
13
+ var propTypes: {
14
+ /**
15
+ * Specify an optional className to be applied to the outer FluidForm wrapper
16
+ */
17
+ className: PropTypes.Requireable<string>;
18
+ };
19
+ }
20
+ export default FluidTextAreaSkeleton;
@@ -9,36 +9,17 @@
9
9
 
10
10
  Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
- var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
13
12
  var PropTypes = require('prop-types');
14
- var React = require('react');
15
- var cx = require('classnames');
13
+ require('react');
14
+ require('classnames');
16
15
  var usePrefix = require('../../internal/usePrefix.js');
17
- var FormContext = require('../FluidForm/FormContext.js');
18
16
 
19
17
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
20
18
 
21
19
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
22
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
23
- var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
24
20
 
25
21
  function FluidTextAreaSkeleton(_ref) {
26
- let {
27
- className,
28
- ...other
29
- } = _ref;
30
- const prefix = usePrefix.usePrefix();
31
- return /*#__PURE__*/React__default["default"].createElement(FormContext.FormContext.Provider, {
32
- value: {
33
- isFluid: true
34
- }
35
- }, /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
36
- className: cx__default["default"](`${prefix}--form-item ${prefix}--text-area--fluid__skeleton`, className)
37
- }, other), /*#__PURE__*/React__default["default"].createElement("span", {
38
- className: `${prefix}--label ${prefix}--skeleton`
39
- }), /*#__PURE__*/React__default["default"].createElement("div", {
40
- className: `${prefix}--skeleton ${prefix}--text-area`
41
- })));
22
+ usePrefix.usePrefix();
42
23
  }
43
24
  FluidTextAreaSkeleton.propTypes = {
44
25
  /**
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import React from 'react';
8
+ export interface FluidTextAreaProps {
9
+ /**
10
+ * Provide a custom className that is applied directly to the underlying
11
+ * `<textarea>` node
12
+ */
13
+ className?: string;
14
+ /**
15
+ * Specify the `cols` attribute for the underlying `<textarea>` node
16
+ */
17
+ cols?: number;
18
+ /**
19
+ * Optionally provide the default value of the `<textarea>`
20
+ */
21
+ defaultValue?: string | number;
22
+ /**
23
+ * Specify whether the control is disabled
24
+ */
25
+ disabled?: boolean;
26
+ /**
27
+ * Specify whether to display the character counter
28
+ */
29
+ enableCounter?: boolean;
30
+ /**
31
+ * Provide text that is used alongside the control label for additional help
32
+ */
33
+ helperText?: React.ReactNode;
34
+ /**
35
+ * Specify whether you want the underlying label to be visually hidden
36
+ */
37
+ hideLabel?: boolean;
38
+ /**
39
+ * Provide a unique identifier for the control
40
+ */
41
+ id?: string;
42
+ /**
43
+ * Specify whether the control is currently invalid
44
+ */
45
+ invalid?: boolean;
46
+ /**
47
+ * Provide the text that is displayed when the control is in an invalid state
48
+ */
49
+ invalidText?: React.ReactNode;
50
+ /**
51
+ * Provide the text that will be read by a screen reader when visiting this
52
+ * control
53
+ */
54
+ labelText: React.ReactNode;
55
+ /**
56
+ * `true` to use the light version. For use on $ui-01 backgrounds only.
57
+ * Don't use this to make tile background color same as container background color.
58
+ */
59
+ light?: boolean;
60
+ /**
61
+ * Max character count allowed for the textarea. This is needed in order for enableCounter to display
62
+ */
63
+ maxCount?: number;
64
+ /**
65
+ * Optionally provide an `onChange` handler that is called whenever `<textarea>`
66
+ * is updated
67
+ */
68
+ onChange?: React.ChangeEventHandler<HTMLTextAreaElement>;
69
+ /**
70
+ * Optionally provide an `onClick` handler that is called whenever the
71
+ * `<textarea>` is clicked
72
+ */
73
+ onClick?: React.MouseEventHandler<HTMLTextAreaElement>;
74
+ /**
75
+ * Specify the placeholder attribute for the `<textarea>`
76
+ */
77
+ placeholder?: string;
78
+ /**
79
+ * Specify the rows attribute for the `<textarea>`
80
+ */
81
+ rows?: number;
82
+ /**
83
+ * Provide the current value of the `<textarea>`
84
+ */
85
+ value?: string | number;
86
+ /**
87
+ * Specify whether the control is currently in warning state
88
+ */
89
+ warn?: boolean;
90
+ /**
91
+ * Provide the text that is displayed when the control is in warning state
92
+ */
93
+ warnText?: React.ReactNode;
94
+ }
95
+ declare const FluidTextArea: React.FC<FluidTextAreaProps>;
96
+ export default FluidTextArea;
@@ -25,7 +25,7 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
25
25
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
26
26
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
27
27
 
28
- function FluidTextArea(_ref) {
28
+ const FluidTextArea = _ref => {
29
29
  let {
30
30
  className,
31
31
  ...other
@@ -39,7 +39,7 @@ function FluidTextArea(_ref) {
39
39
  }, /*#__PURE__*/React__default["default"].createElement(TextArea["default"], _rollupPluginBabelHelpers["extends"]({
40
40
  className: classNames
41
41
  }, other)));
42
- }
42
+ };
43
43
  FluidTextArea.propTypes = {
44
44
  /**
45
45
  * Provide a custom className that is applied directly to the underlying
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import FluidTextArea from './FluidTextArea';
8
+ import { type FluidTextAreaProps } from './FluidTextArea';
9
+ import { type FluidTextAreaSkeletonProps } from './FluidTextArea.Skeleton';
10
+ export default FluidTextArea;
11
+ export { FluidTextArea, type FluidTextAreaProps, type FluidTextAreaSkeletonProps, };
12
+ export { default as FluidTextAreaSkeleton } from './FluidTextArea.Skeleton';
@@ -274,11 +274,11 @@ function getClassNameForBreakpoints(breakpoints, prefix) {
274
274
  start,
275
275
  end
276
276
  } = breakpoint;
277
- if (typeof offset === 'number' && offset > 0) {
278
- classNames.push(`${prefix}--${name}:col-start-${offset + 1}`);
277
+ if (typeof offset === 'number') {
278
+ classNames.push(`${prefix}--${name}:col-start-${offset > 0 ? offset + 1 : 'auto'}`);
279
279
  }
280
280
  if (typeof start === 'number') {
281
- classNames.push(`${prefix}--${name}:col-start-${start}`);
281
+ classNames.push(`${prefix}--${name}:col-start-${start ? start : 'auto'}`);
282
282
  }
283
283
  if (typeof end === 'number') {
284
284
  classNames.push(`${prefix}--${name}:col-end-${end}`);
@@ -13,6 +13,10 @@ interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>
13
13
  * Specify how the trigger should align with the tooltip
14
14
  */
15
15
  align?: 'top' | 'top-left' | 'top-start' | 'top-right' | 'top-end' | 'bottom' | 'bottom-left' | 'bottom-start' | 'bottom-right' | 'bottom-end' | 'left' | 'right';
16
+ /**
17
+ * **Experimental**: Will attempt to automatically align the tooltip
18
+ */
19
+ autoAlign?: boolean;
16
20
  /**
17
21
  * Provide an icon or asset to be rendered inside of the IconButton
18
22
  */
@@ -28,6 +28,7 @@ const IconButtonKinds = ['primary', 'secondary', 'ghost', 'tertiary'];
28
28
  const IconButton = /*#__PURE__*/React__default["default"].forwardRef(function IconButton(_ref, ref) {
29
29
  let {
30
30
  align,
31
+ autoAlign = false,
31
32
  children,
32
33
  className,
33
34
  closeOnActivation = true,
@@ -48,6 +49,7 @@ const IconButton = /*#__PURE__*/React__default["default"].forwardRef(function Ic
48
49
  });
49
50
  return /*#__PURE__*/React__default["default"].createElement(Tooltip.Tooltip, {
50
51
  align: align,
52
+ autoAlign: autoAlign,
51
53
  closeOnActivation: closeOnActivation,
52
54
  className: tooltipClasses,
53
55
  defaultOpen: defaultOpen,
@@ -69,6 +71,10 @@ IconButton.propTypes = {
69
71
  * Specify how the trigger should align with the tooltip
70
72
  */
71
73
  align: PropTypes__default["default"].oneOf(['top', 'top-left', 'top-start', 'top-right', 'top-end', 'bottom', 'bottom-left', 'bottom-start', 'bottom-right', 'bottom-end', 'left', 'right']),
74
+ /**
75
+ * **Experimental**: Will attempt to automatically align the tooltip
76
+ */
77
+ autoAlign: PropTypes__default["default"].bool,
72
78
  /**
73
79
  * Provide an icon or asset to be rendered inside of the IconButton
74
80
  */
@@ -4,9 +4,14 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import React, { ForwardedRef } from 'react';
7
+ import React, { ForwardedRef, ReactNode } from 'react';
8
8
  import { ForwardRefReturn, ReactAttr } from '../../types/common';
9
9
  export interface ListBoxMenuItemProps extends ReactAttr<HTMLLIElement> {
10
+ /**
11
+ * Specify any children nodes that should be rendered inside of the ListBox
12
+ * Menu Item
13
+ */
14
+ children?: ReactNode;
10
15
  /**
11
16
  * Specify whether the current menu item is "active".
12
17
  */
@@ -19,6 +24,10 @@ export interface ListBoxMenuItemProps extends ReactAttr<HTMLLIElement> {
19
24
  * Specify whether the item should be disabled
20
25
  */
21
26
  disabled?: boolean;
27
+ /**
28
+ * Provide an optional tooltip for the ListBoxMenuItem
29
+ */
30
+ title?: string;
22
31
  }
23
32
  export type ListBoxMenuItemForwardedRef = (ForwardedRef<HTMLLIElement> & {
24
33
  menuItemOptionRef?: React.Ref<HTMLDivElement>;