@carbon/react 1.49.0 → 1.50.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 (56) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1074 -996
  2. package/es/components/Accordion/AccordionItem.js +10 -15
  3. package/es/components/Button/Button.js +3 -2
  4. package/es/components/ChatButton/ChatButton.Skeleton.js +40 -0
  5. package/es/components/ChatButton/ChatButton.js +81 -0
  6. package/es/components/ComboButton/index.js +14 -0
  7. package/es/components/ContainedList/ContainedList.js +5 -3
  8. package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +5 -3
  9. package/es/components/DataTable/DataTable.d.ts +21 -0
  10. package/es/components/DataTable/DataTable.js +19 -0
  11. package/es/components/DataTable/TableCell.d.ts +28 -3
  12. package/es/components/DataTable/TableCell.js +22 -5
  13. package/es/components/DataTable/TableExpandRow.js +1 -1
  14. package/es/components/DataTable/TableHeader.js +2 -2
  15. package/es/components/DataTable/TableRow.js +12 -1
  16. package/es/components/DataTable/tools/normalize.js +3 -1
  17. package/es/components/Menu/Menu.d.ts +9 -1
  18. package/es/components/Menu/Menu.js +34 -0
  19. package/es/components/MenuButton/index.js +13 -0
  20. package/es/components/MultiSelect/MultiSelect.js +2 -1
  21. package/es/components/Notification/Notification.d.ts +75 -0
  22. package/es/components/Notification/Notification.js +84 -2
  23. package/es/components/Notification/index.d.ts +1 -1
  24. package/es/components/OverflowMenu/next/index.js +16 -2
  25. package/es/index.d.ts +1 -0
  26. package/es/index.js +3 -1
  27. package/es/internal/useNoInteractiveChildren.js +13 -1
  28. package/lib/components/Accordion/AccordionItem.js +9 -14
  29. package/lib/components/Button/Button.js +3 -2
  30. package/lib/components/ChatButton/ChatButton.Skeleton.js +50 -0
  31. package/lib/components/ChatButton/ChatButton.js +91 -0
  32. package/lib/components/ComboButton/index.js +14 -0
  33. package/lib/components/ContainedList/ContainedList.js +5 -3
  34. package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +5 -3
  35. package/lib/components/DataTable/DataTable.d.ts +21 -0
  36. package/lib/components/DataTable/DataTable.js +19 -0
  37. package/lib/components/DataTable/TableCell.d.ts +28 -3
  38. package/lib/components/DataTable/TableCell.js +27 -5
  39. package/lib/components/DataTable/TableExpandRow.js +1 -1
  40. package/lib/components/DataTable/TableHeader.js +2 -2
  41. package/lib/components/DataTable/TableRow.js +12 -1
  42. package/lib/components/DataTable/tools/normalize.js +3 -1
  43. package/lib/components/Menu/Menu.d.ts +9 -1
  44. package/lib/components/Menu/Menu.js +34 -0
  45. package/lib/components/MenuButton/index.js +13 -0
  46. package/lib/components/MultiSelect/MultiSelect.js +2 -1
  47. package/lib/components/Notification/Notification.d.ts +75 -0
  48. package/lib/components/Notification/Notification.js +83 -0
  49. package/lib/components/Notification/index.d.ts +1 -1
  50. package/lib/components/OverflowMenu/next/index.js +16 -2
  51. package/lib/index.d.ts +1 -0
  52. package/lib/index.js +5 -0
  53. package/lib/internal/useNoInteractiveChildren.js +13 -0
  54. package/package.json +5 -5
  55. package/scss/components/chat-button/_chat-button.scss +9 -0
  56. package/scss/components/chat-button/_index.scss +9 -0
@@ -306,13 +306,14 @@ const MultiSelect = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
306
306
  size: 'mini'
307
307
  });
308
308
  }
309
+ const itemsSelectedText = selectedItems.length > 0 && selectedItems.map(item => item.text);
309
310
  return /*#__PURE__*/React__default.createElement("div", {
310
311
  className: wrapperClasses
311
312
  }, /*#__PURE__*/React__default.createElement("label", _extends({
312
313
  className: titleClasses
313
314
  }, getLabelProps()), titleText && titleText, selectedItems.length > 0 && /*#__PURE__*/React__default.createElement("span", {
314
315
  className: `${prefix}--visually-hidden`
315
- }, clearSelectionDescription, " ", selectedItems.length, ",", clearSelectionText)), /*#__PURE__*/React__default.createElement(ListBox, {
316
+ }, clearSelectionDescription, " ", selectedItems.length, ' ', itemsSelectedText, ",", clearSelectionText)), /*#__PURE__*/React__default.createElement(ListBox, {
316
317
  onFocus: isFluid ? handleFocus : undefined,
317
318
  onBlur: isFluid ? handleFocus : undefined,
318
319
  type: type,
@@ -513,3 +513,78 @@ export declare namespace ActionableNotification {
513
513
  title: PropTypes.Requireable<string>;
514
514
  };
515
515
  }
516
+ /**
517
+ * StaticNotification
518
+ * ==================
519
+ */
520
+ export interface StaticNotificationProps extends HTMLAttributes<HTMLDivElement> {
521
+ /**
522
+ * Specify the content
523
+ */
524
+ children?: ReactNode;
525
+ /**
526
+ * Specify an optional className to be applied to the notification box
527
+ */
528
+ className?: string;
529
+ /**
530
+ * Specify what state the notification represents
531
+ */
532
+ kind?: 'error' | 'info' | 'info-square' | 'success' | 'warning' | 'warning-alt';
533
+ /**
534
+ * Specify whether you are using the low contrast variant of the StaticNotification.
535
+ */
536
+ lowContrast?: boolean;
537
+ /**
538
+ * Provide a description for "status" icon that can be read by screen readers
539
+ */
540
+ statusIconDescription?: string;
541
+ /**
542
+ * Specify the subtitle
543
+ */
544
+ subtitle?: string;
545
+ /**
546
+ * Specify the title
547
+ */
548
+ title?: string;
549
+ /**
550
+ * Specify the id for the element containing the title
551
+ */
552
+ titleId?: string;
553
+ }
554
+ export declare function StaticNotification({ children, title, titleId, subtitle, statusIconDescription, className, kind, lowContrast, ...rest }: StaticNotificationProps): import("react/jsx-runtime").JSX.Element;
555
+ export declare namespace StaticNotification {
556
+ var propTypes: {
557
+ /**
558
+ * Specify the content
559
+ */
560
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
561
+ /**
562
+ * Specify an optional className to be applied to the notification box
563
+ */
564
+ className: PropTypes.Requireable<string>;
565
+ /**
566
+ * Specify what state the notification represents
567
+ */
568
+ kind: PropTypes.Requireable<string>;
569
+ /**
570
+ * Specify whether you are using the low contrast variant of the StaticNotification.
571
+ */
572
+ lowContrast: PropTypes.Requireable<boolean>;
573
+ /**
574
+ * Provide a description for "status" icon that can be read by screen readers
575
+ */
576
+ statusIconDescription: PropTypes.Requireable<string>;
577
+ /**
578
+ * Specify the subtitle
579
+ */
580
+ subtitle: PropTypes.Requireable<string>;
581
+ /**
582
+ * Specify the title
583
+ */
584
+ title: PropTypes.Requireable<string>;
585
+ /**
586
+ * Specify the id for the element containing the title
587
+ */
588
+ titleId: PropTypes.Requireable<string>;
589
+ };
590
+ }
@@ -15,7 +15,7 @@ import '../Text/index.js';
15
15
  import Button from '../Button/Button.js';
16
16
  import '../Button/Button.Skeleton.js';
17
17
  import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
18
- import { useNoInteractiveChildren } from '../../internal/useNoInteractiveChildren.js';
18
+ import { useNoInteractiveChildren, useInteractiveChildrenNeedDescription } from '../../internal/useNoInteractiveChildren.js';
19
19
  import { usePrefix } from '../../internal/usePrefix.js';
20
20
  import { useId } from '../../internal/useId.js';
21
21
  import { noopFn } from '../../internal/noopFn.js';
@@ -678,4 +678,86 @@ ActionableNotification.propTypes = {
678
678
  title: PropTypes.string
679
679
  };
680
680
 
681
- export { ActionableNotification, InlineNotification, NotificationActionButton, NotificationButton, ToastNotification };
681
+ /**
682
+ * StaticNotification
683
+ * ==================
684
+ */
685
+
686
+ function StaticNotification(_ref8) {
687
+ let {
688
+ children,
689
+ title,
690
+ titleId,
691
+ subtitle,
692
+ statusIconDescription,
693
+ className,
694
+ kind = 'error',
695
+ lowContrast,
696
+ ...rest
697
+ } = _ref8;
698
+ const prefix = usePrefix();
699
+ const containerClassName = cx(className, {
700
+ [`${prefix}--inline-notification`]: true,
701
+ [`${prefix}--inline-notification--low-contrast`]: lowContrast,
702
+ [`${prefix}--inline-notification--${kind}`]: kind,
703
+ [`${prefix}--inline-notification--hide-close-button`]: true
704
+ });
705
+ const ref = useRef(null);
706
+ useInteractiveChildrenNeedDescription(ref, `interactive child node(s) should have an \`aria-describedby\` property with a value matching the value of \`titleId\``);
707
+ return /*#__PURE__*/React__default.createElement("div", _extends({
708
+ ref: ref
709
+ }, rest, {
710
+ className: containerClassName
711
+ }), /*#__PURE__*/React__default.createElement("div", {
712
+ className: `${prefix}--inline-notification__details`
713
+ }, /*#__PURE__*/React__default.createElement(NotificationIcon, {
714
+ notificationType: "inline",
715
+ kind: kind,
716
+ iconDescription: statusIconDescription || `${kind} icon`
717
+ }), /*#__PURE__*/React__default.createElement("div", {
718
+ className: `${prefix}--inline-notification__text-wrapper`
719
+ }, title && /*#__PURE__*/React__default.createElement(Text, {
720
+ as: "div",
721
+ id: titleId,
722
+ className: `${prefix}--inline-notification__title`
723
+ }, title), subtitle && /*#__PURE__*/React__default.createElement(Text, {
724
+ as: "div",
725
+ className: `${prefix}--inline-notification__subtitle`
726
+ }, subtitle), children)));
727
+ }
728
+ StaticNotification.propTypes = {
729
+ /**
730
+ * Specify the content
731
+ */
732
+ children: PropTypes.node,
733
+ /**
734
+ * Specify an optional className to be applied to the notification box
735
+ */
736
+ className: PropTypes.string,
737
+ /**
738
+ * Specify what state the notification represents
739
+ */
740
+ kind: PropTypes.oneOf(['error', 'info', 'info-square', 'success', 'warning', 'warning-alt']),
741
+ /**
742
+ * Specify whether you are using the low contrast variant of the StaticNotification.
743
+ */
744
+ lowContrast: PropTypes.bool,
745
+ /**
746
+ * Provide a description for "status" icon that can be read by screen readers
747
+ */
748
+ statusIconDescription: PropTypes.string,
749
+ /**
750
+ * Specify the subtitle
751
+ */
752
+ subtitle: PropTypes.string,
753
+ /**
754
+ * Specify the title
755
+ */
756
+ title: PropTypes.string,
757
+ /**
758
+ * Specify the id for the element containing the title
759
+ */
760
+ titleId: PropTypes.string
761
+ };
762
+
763
+ export { ActionableNotification, InlineNotification, NotificationActionButton, NotificationButton, StaticNotification, ToastNotification };
@@ -4,4 +4,4 @@
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
- export { NotificationActionButton, type NotificationActionButtonProps, NotificationButton, type NotificationButtonProps, ToastNotification, type ToastNotificationProps, InlineNotification, type InlineNotificationProps, ActionableNotification, type ActionableNotificationProps, } from './Notification';
7
+ export { NotificationActionButton, type NotificationActionButtonProps, NotificationButton, type NotificationButtonProps, ToastNotification, type ToastNotificationProps, InlineNotification, type InlineNotificationProps, ActionableNotification, type ActionableNotificationProps, StaticNotification, type StaticNotificationProps, } from './Notification';
@@ -25,6 +25,7 @@ const OverflowMenu = /*#__PURE__*/React__default.forwardRef(function OverflowMen
25
25
  label = 'Options',
26
26
  renderIcon: IconElement = OverflowMenuVertical,
27
27
  size = defaultSize,
28
+ menuAlignment = 'bottom-start',
28
29
  tooltipAlignment,
29
30
  ...rest
30
31
  } = _ref;
@@ -35,11 +36,17 @@ const OverflowMenu = /*#__PURE__*/React__default.forwardRef(function OverflowMen
35
36
  open,
36
37
  x,
37
38
  y,
38
- handleClick,
39
+ handleClick: hookOnClick,
39
40
  handleMousedown,
40
41
  handleClose
41
42
  } = useAttachedMenu(triggerRef);
43
+ function handleTriggerClick() {
44
+ if (triggerRef.current) {
45
+ hookOnClick();
46
+ }
47
+ }
42
48
  const containerClasses = cx(className, `${prefix}--overflow-menu__container`);
49
+ const menuClasses = cx(`${prefix}--overflow-menu__${menuAlignment}`);
43
50
  const triggerClasses = cx(`${prefix}--overflow-menu`, {
44
51
  [`${prefix}--overflow-menu--open`]: open
45
52
  }, size !== defaultSize && `${prefix}--overflow-menu--${size}`);
@@ -52,7 +59,7 @@ const OverflowMenu = /*#__PURE__*/React__default.forwardRef(function OverflowMen
52
59
  "aria-haspopup": true,
53
60
  "aria-expanded": open,
54
61
  className: triggerClasses,
55
- onClick: handleClick,
62
+ onClick: handleTriggerClick,
56
63
  onMouseDown: handleMousedown,
57
64
  ref: triggerRef,
58
65
  label: label,
@@ -60,6 +67,9 @@ const OverflowMenu = /*#__PURE__*/React__default.forwardRef(function OverflowMen
60
67
  }, /*#__PURE__*/React__default.createElement(IconElement, {
61
68
  className: `${prefix}--overflow-menu__icon`
62
69
  })), /*#__PURE__*/React__default.createElement(Menu, {
70
+ containerRef: triggerRef,
71
+ menuAlignment: menuAlignment,
72
+ className: menuClasses,
63
73
  id: id,
64
74
  size: size,
65
75
  open: open,
@@ -82,6 +92,10 @@ OverflowMenu.propTypes = {
82
92
  * A label describing the options available. Is used in the trigger tooltip and as the menu's accessible label.
83
93
  */
84
94
  label: PropTypes.string,
95
+ /**
96
+ * Experimental property. Specify how the menu should align with the button element
97
+ */
98
+ menuAlignment: PropTypes.oneOf(['top-start', 'top-end', 'bottom-start', 'bottom-end']),
85
99
  /**
86
100
  * Otionally provide a custom icon to be rendered on the trigger button.
87
101
  */
package/es/index.d.ts CHANGED
@@ -115,6 +115,7 @@ export { PageSelector as unstable_PageSelector, Pagination as unstable_Paginatio
115
115
  export * from './components/Popover';
116
116
  export * from './components/ProgressBar';
117
117
  export { Slug as unstable__Slug, SlugContent as unstable__SlugContent, SlugActions as unstable__SlugActions, } from './components/Slug';
118
+ export { ChatButton as unstable__ChatButton, ChatButtonSkeleton as unstable__ChatButtonSkeleton, } from './components/ChatButton';
118
119
  export * from './components/Stack';
119
120
  export * from './components/Tooltip';
120
121
  export { Text as unstable_Text, TextDirection as unstable_TextDirection, } from './components/Text';
package/es/index.js CHANGED
@@ -65,7 +65,7 @@ export { MenuItem, MenuItemDivider, MenuItemGroup, MenuItemRadioGroup, MenuItemS
65
65
  export { MenuButton } from './components/MenuButton/index.js';
66
66
  export { default as Modal } from './components/Modal/Modal.js';
67
67
  export { default as ModalWrapper } from './components/ModalWrapper/ModalWrapper.js';
68
- export { ActionableNotification, InlineNotification, NotificationActionButton, NotificationButton, ToastNotification } from './components/Notification/Notification.js';
68
+ export { ActionableNotification, InlineNotification, NotificationActionButton, NotificationButton, StaticNotification, ToastNotification } from './components/Notification/Notification.js';
69
69
  export { default as NumberInputSkeleton } from './components/NumberInput/NumberInput.Skeleton.js';
70
70
  export { NumberInput } from './components/NumberInput/NumberInput.js';
71
71
  export { default as OrderedList } from './components/OrderedList/OrderedList.js';
@@ -189,6 +189,8 @@ export { default as unstable__FluidTimePickerSkeleton } from './components/Fluid
189
189
  export { default as unstable__FluidTimePickerSelect } from './components/FluidTimePickerSelect/FluidTimePickerSelect.js';
190
190
  export { LayoutDirection as unstable_LayoutDirection } from './components/LayoutDirection/LayoutDirection.js';
191
191
  export { useLayoutDirection as unstable_useLayoutDirection } from './components/LayoutDirection/useLayoutDirection.js';
192
+ export { default as unstable__ChatButton } from './components/ChatButton/ChatButton.js';
193
+ export { default as unstable__ChatButtonSkeleton } from './components/ChatButton/ChatButton.Skeleton.js';
192
194
  export { Text as unstable_Text } from './components/Text/Text.js';
193
195
  export { TextDirection as unstable_TextDirection } from './components/Text/TextDirection.js';
194
196
  export { default as DataTable } from './components/DataTable/DataTable.js';
@@ -19,6 +19,18 @@ function useNoInteractiveChildren(ref) {
19
19
  });
20
20
  }
21
21
  }
22
+ function useInteractiveChildrenNeedDescription(ref) {
23
+ let message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : `interactive child node(s) should have an \`aria-describedby\` property`;
24
+ if (process.env.NODE_ENV !== "production") {
25
+ // eslint-disable-next-line react-hooks/rules-of-hooks
26
+ useEffect(() => {
27
+ const node = ref.current ? getInteractiveContent(ref.current) : false;
28
+ if (node && !node.hasAttribute('aria-describedby')) {
29
+ throw new Error(`Error: ${message}.\n\nInstead found: ${node.outerHTML}`);
30
+ }
31
+ });
32
+ }
33
+ }
22
34
 
23
35
  /**
24
36
  * Determines if a given DOM node has interactive content, or is itself
@@ -90,4 +102,4 @@ function isFocusable(element) {
90
102
  }
91
103
  }
92
104
 
93
- export { getInteractiveContent, getRoleContent, useNoInteractiveChildren };
105
+ export { getInteractiveContent, getRoleContent, useInteractiveChildrenNeedDescription, useNoInteractiveChildren };
@@ -61,7 +61,15 @@ function AccordionItem(_ref) {
61
61
  });
62
62
  const Toggle = renderToggle || renderExpando; // remove renderExpando in next major release
63
63
 
64
- const content = React.useRef(null);
64
+ const content = React__default["default"].useCallback(node => {
65
+ if (!node) {
66
+ return;
67
+ }
68
+ if (isOpen) {
69
+ // accordion closes
70
+ node.style.maxBlockSize = '';
71
+ }
72
+ }, [isOpen]);
65
73
  if (open !== prevIsOpen) {
66
74
  setIsOpen(open);
67
75
  setPrevIsOpen(open);
@@ -70,19 +78,6 @@ function AccordionItem(_ref) {
70
78
  // When the AccordionItem heading is clicked, toggle the open state of the
71
79
  // panel
72
80
  function onClick(event) {
73
- // type guard for ref
74
- if (!content.current) {
75
- return;
76
- }
77
- if (isOpen) {
78
- // accordion closes
79
- content.current.style.maxBlockSize = '';
80
- } else {
81
- // accordion opens
82
- content.current.style.maxBlockSize =
83
- // Scroll height plus top/bottom padding
84
- content.current.scrollHeight + 32 + 'px';
85
- }
86
81
  const nextValue = !isOpen;
87
82
  setIsOpen(nextValue);
88
83
  if (onHeadingClick) {
@@ -100,12 +100,13 @@ const Button = /*#__PURE__*/React__default["default"].forwardRef(function Button
100
100
  let component = 'button';
101
101
  const assistiveId = useId.useId('danger-description');
102
102
  const {
103
- 'aria-pressed': ariaPressed
103
+ 'aria-pressed': ariaPressed,
104
+ 'aria-describedby': ariaDescribedBy
104
105
  } = rest;
105
106
  let otherProps = {
106
107
  disabled,
107
108
  type,
108
- 'aria-describedby': dangerButtonVariants.includes(kind) ? assistiveId : undefined,
109
+ 'aria-describedby': dangerButtonVariants.includes(kind) ? assistiveId : ariaDescribedBy || undefined,
109
110
  'aria-pressed': ariaPressed ?? (hasIconOnly && kind === 'ghost' ? isSelected : undefined)
110
111
  };
111
112
  const anchorProps = {
@@ -0,0 +1,50 @@
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
+
8
+ 'use strict';
9
+
10
+ Object.defineProperty(exports, '__esModule', { value: true });
11
+
12
+ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
13
+ var PropTypes = require('prop-types');
14
+ var React = require('react');
15
+ var cx = require('classnames');
16
+ var usePrefix = require('../../internal/usePrefix.js');
17
+
18
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
19
+
20
+ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
21
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
22
+ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
23
+
24
+ const ChatButtonSkeleton = _ref => {
25
+ let {
26
+ className,
27
+ size,
28
+ ...rest
29
+ } = _ref;
30
+ const prefix = usePrefix.usePrefix();
31
+ const skeletonClasses = cx__default["default"](className, `${prefix}--skeleton`, `${prefix}--btn`, `${prefix}--chat-btn`, {
32
+ [`${prefix}--layout--size-${size}`]: size
33
+ });
34
+ return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
35
+ className: skeletonClasses
36
+ }, rest));
37
+ };
38
+ ChatButtonSkeleton.propTypes = {
39
+ /**
40
+ * Specify an optional className to add.
41
+ */
42
+ className: PropTypes__default["default"].string,
43
+ /**
44
+ * Specify the size of the `ChatButtonSkeleton`, from the following list of sizes:
45
+ */
46
+ size: PropTypes__default["default"].oneOf(['sm', 'md', 'lg'])
47
+ };
48
+ var ChatButtonSkeleton$1 = ChatButtonSkeleton;
49
+
50
+ exports["default"] = ChatButtonSkeleton$1;
@@ -0,0 +1,91 @@
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
+
8
+ 'use strict';
9
+
10
+ Object.defineProperty(exports, '__esModule', { value: true });
11
+
12
+ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
13
+ var PropTypes = require('prop-types');
14
+ var React = require('react');
15
+ var cx = require('classnames');
16
+ var Button = require('../Button/Button.js');
17
+ require('../Button/Button.Skeleton.js');
18
+ var usePrefix = require('../../internal/usePrefix.js');
19
+
20
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
+
22
+ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
23
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
24
+ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
25
+
26
+ const ChatButton = /*#__PURE__*/React__default["default"].forwardRef(function ChatButton(_ref, ref) {
27
+ let {
28
+ className,
29
+ children,
30
+ disabled,
31
+ isQuickAction,
32
+ isSelected,
33
+ kind,
34
+ size,
35
+ ...other
36
+ } = _ref;
37
+ const prefix = usePrefix.usePrefix();
38
+ const classNames = cx__default["default"](className, {
39
+ [`${prefix}--chat-btn`]: true,
40
+ [`${prefix}--chat-btn--quick-action`]: isQuickAction,
41
+ [`${prefix}--chat-btn--quick-action--selected`]: isSelected
42
+ });
43
+ const allowedSizes = ['sm', 'md', 'lg'];
44
+ if (isQuickAction) {
45
+ kind = 'ghost';
46
+ size = 'sm';
47
+ } else {
48
+ // Do not allow size larger than `lg`
49
+ size = allowedSizes.includes(size) ? size : 'lg';
50
+ }
51
+ return /*#__PURE__*/React__default["default"].createElement(Button["default"], _rollupPluginBabelHelpers["extends"]({
52
+ disabled: disabled,
53
+ className: classNames,
54
+ kind: kind,
55
+ ref: ref,
56
+ size: size
57
+ }, other), children);
58
+ });
59
+ ChatButton.propTypes = {
60
+ /**
61
+ * Provide the contents of your Select
62
+ */
63
+ children: PropTypes__default["default"].node,
64
+ /**
65
+ * Specify an optional className to be applied to the node containing the label and the select box
66
+ */
67
+ className: PropTypes__default["default"].string,
68
+ /**
69
+ * Specify whether the `ChatButton` should be disabled
70
+ */
71
+ disabled: PropTypes__default["default"].bool,
72
+ /**
73
+ * Specify whether the `ChatButton` should be rendered as a quick action button
74
+ */
75
+ isQuickAction: PropTypes__default["default"].bool,
76
+ /**
77
+ * Specify whether the quick action `ChatButton` should be rendered as selected. This disables the input
78
+ */
79
+ isSelected: PropTypes__default["default"].bool,
80
+ /**
81
+ * Specify the kind of `ChatButton` you want to create
82
+ */
83
+ kind: PropTypes__default["default"].oneOf(['primary', 'secondary', 'danger', 'ghost', 'tertiary']),
84
+ /**
85
+ * Specify the size of the `ChatButton`, from the following list of sizes:
86
+ */
87
+ size: PropTypes__default["default"].oneOf(['sm', 'md', 'lg'])
88
+ };
89
+ var ChatButton$1 = ChatButton;
90
+
91
+ exports["default"] = ChatButton$1;
@@ -46,6 +46,7 @@ const ComboButton = /*#__PURE__*/React__default["default"].forwardRef(function C
46
46
  label,
47
47
  onClick,
48
48
  size = 'lg',
49
+ menuAlignment = 'bottom',
49
50
  tooltipAlignment,
50
51
  translateWithId: t = defaultTranslateWithId,
51
52
  ...rest
@@ -80,10 +81,15 @@ const ComboButton = /*#__PURE__*/React__default["default"].forwardRef(function C
80
81
  }
81
82
  function handleOpen() {
82
83
  menuRef.current.style.inlineSize = `${width}px`;
84
+ menuRef.current.style.minInlineSize = `${width}px`;
85
+ if (menuAlignment !== 'bottom' && menuAlignment !== 'top') {
86
+ menuRef.current.style.inlineSize = `fit-content`;
87
+ }
83
88
  }
84
89
  const containerClasses = cx__default["default"](`${prefix}--combo-button__container`, `${prefix}--combo-button__container--${size}`, {
85
90
  [`${prefix}--combo-button__container--open`]: open
86
91
  }, className);
92
+ const menuClasses = cx__default["default"](`${prefix}--combo-button__${menuAlignment}`);
87
93
  const primaryActionClasses = cx__default["default"](`${prefix}--combo-button__primary-action`);
88
94
  const triggerClasses = cx__default["default"](`${prefix}--combo-button__trigger`);
89
95
  return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
@@ -93,6 +99,7 @@ const ComboButton = /*#__PURE__*/React__default["default"].forwardRef(function C
93
99
  }), /*#__PURE__*/React__default["default"].createElement("div", {
94
100
  className: primaryActionClasses
95
101
  }, /*#__PURE__*/React__default["default"].createElement(Button["default"], {
102
+ title: label,
96
103
  size: size,
97
104
  disabled: disabled,
98
105
  onClick: handlePrimaryActionClick
@@ -108,6 +115,9 @@ const ComboButton = /*#__PURE__*/React__default["default"].forwardRef(function C
108
115
  onMouseDown: handleTriggerMousedown,
109
116
  "aria-controls": open ? id : null
110
117
  }, _ChevronDown || (_ChevronDown = /*#__PURE__*/React__default["default"].createElement(iconsReact.ChevronDown, null))), /*#__PURE__*/React__default["default"].createElement(Menu.Menu, {
118
+ containerRef: containerRef,
119
+ menuAlignment: menuAlignment,
120
+ className: menuClasses,
111
121
  ref: menuRef,
112
122
  id: id,
113
123
  label: t('carbon.combo-button.additional-actions'),
@@ -137,6 +147,10 @@ ComboButton.propTypes = {
137
147
  * Provide the label to be renderd on the primary action button.
138
148
  */
139
149
  label: PropTypes__default["default"].string.isRequired,
150
+ /**
151
+ * Experimental property. Specify how the menu should align with the button element
152
+ */
153
+ menuAlignment: PropTypes__default["default"].oneOf(['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end']),
140
154
  /**
141
155
  * Provide an optional function to be called when the primary action element is clicked.
142
156
  */
@@ -9,6 +9,7 @@
9
9
 
10
10
  Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
+ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
12
13
  var React = require('react');
13
14
  var PropTypes = require('prop-types');
14
15
  var cx = require('classnames');
@@ -54,7 +55,8 @@ function ContainedList(_ref) {
54
55
  isInset,
55
56
  kind = variants[0],
56
57
  label,
57
- size
58
+ size,
59
+ ...rest
58
60
  } = _ref;
59
61
  const labelId = `${useId.useId('contained-list')}-header`;
60
62
  const prefix = usePrefix.usePrefix();
@@ -67,9 +69,9 @@ function ContainedList(_ref) {
67
69
  const filteredChildren = filterChildren(children);
68
70
  const isActionSearch = ['Search', 'ExpandableSearch'].includes(action?.type?.displayName);
69
71
  const renderedChildren = renderChildren(children);
70
- return /*#__PURE__*/React__default["default"].createElement("div", {
72
+ return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
71
73
  className: classes
72
- }, /*#__PURE__*/React__default["default"].createElement("div", {
74
+ }, rest), /*#__PURE__*/React__default["default"].createElement("div", {
73
75
  className: `${prefix}--contained-list__header`
74
76
  }, /*#__PURE__*/React__default["default"].createElement("div", {
75
77
  id: labelId,
@@ -9,6 +9,7 @@
9
9
 
10
10
  Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
+ var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
12
13
  var React = require('react');
13
14
  var PropTypes = require('prop-types');
14
15
  var cx = require('classnames');
@@ -28,7 +29,8 @@ function ContainedListItem(_ref) {
28
29
  className,
29
30
  disabled = false,
30
31
  onClick,
31
- renderIcon: IconElement
32
+ renderIcon: IconElement,
33
+ ...rest
32
34
  } = _ref;
33
35
  const prefix = usePrefix.usePrefix();
34
36
  const isClickable = onClick !== undefined;
@@ -40,9 +42,9 @@ function ContainedListItem(_ref) {
40
42
  const content = /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, IconElement && /*#__PURE__*/React__default["default"].createElement("div", {
41
43
  className: `${prefix}--contained-list-item__icon`
42
44
  }, /*#__PURE__*/React__default["default"].createElement(IconElement, null)), /*#__PURE__*/React__default["default"].createElement("div", null, children));
43
- return /*#__PURE__*/React__default["default"].createElement("li", {
45
+ return /*#__PURE__*/React__default["default"].createElement("li", _rollupPluginBabelHelpers["extends"]({
44
46
  className: classes
45
- }, isClickable ? /*#__PURE__*/React__default["default"].createElement("button", {
47
+ }, rest), isClickable ? /*#__PURE__*/React__default["default"].createElement("button", {
46
48
  className: `${prefix}--contained-list-item__content`,
47
49
  type: "button",
48
50
  disabled: disabled,
@@ -53,6 +53,7 @@ export interface DataTableRow<ColTypes extends any[]> {
53
53
  export interface DataTableHeader {
54
54
  key: string;
55
55
  header: React.ReactNode;
56
+ slug: React.ReactElement;
56
57
  }
57
58
  export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
58
59
  headers: Array<DataTableHeader>;
@@ -152,6 +153,12 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
152
153
  stickyHeader?: boolean;
153
154
  useStaticWidth?: boolean;
154
155
  };
156
+ getCellProps: (getCellPropsArgs: {
157
+ cell: DataTableCell<ColTypes>;
158
+ }) => {
159
+ [key: string]: unknown;
160
+ hasSlugHeader?: boolean;
161
+ };
155
162
  onInputChange: (e: React.ChangeEvent<HTMLInputElement>, defaultValue?: string) => void;
156
163
  sortBy: (headerKey: string) => void;
157
164
  selectAll: () => void;
@@ -334,6 +341,7 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
334
341
  sortDirection: DataTableSortState;
335
342
  isSortable: boolean | undefined;
336
343
  isSortHeader: boolean;
344
+ slug: React.ReactElement<any, string | React.JSXElementConstructor<any>>;
337
345
  onClick: (event: any) => void;
338
346
  };
339
347
  /**
@@ -468,6 +476,19 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
468
476
  stickyHeader: boolean | undefined;
469
477
  useStaticWidth: boolean | undefined;
470
478
  };
479
+ /**
480
+ * Get the props associated with the given table cell.
481
+ *
482
+ * @param {object} config
483
+ * @param {object} config.cell the cell we want the props for
484
+ * @returns {object}
485
+ */
486
+ getCellProps: ({ cell, ...rest }: {
487
+ [x: string]: any;
488
+ cell: any;
489
+ }) => {
490
+ hasSlugHeader: any;
491
+ };
471
492
  /**
472
493
  * Helper utility to get all the currently selected rows
473
494
  * @returns {Array<string>} the array of rowIds that are currently selected