@carbon/react 1.30.0 → 1.31.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 (121) hide show
  1. package/es/components/Accordion/Accordion.js +3 -1
  2. package/es/components/AspectRatio/AspectRatio.d.ts +67 -0
  3. package/es/components/AspectRatio/AspectRatio.js +2 -2
  4. package/es/components/AspectRatio/index.d.ts +7 -0
  5. package/es/components/Button/Button.js +6 -1
  6. package/es/components/Checkbox/Checkbox.js +2 -2
  7. package/es/components/CodeSnippet/CodeSnippet.js +1 -0
  8. package/es/components/ComboButton/index.js +6 -5
  9. package/es/components/ContainedList/ContainedList.js +12 -4
  10. package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +6 -1
  11. package/es/components/ContentSwitcher/ContentSwitcher.js +10 -1
  12. package/es/components/CopyButton/CopyButton.js +8 -2
  13. package/es/components/DataTable/DataTable.js +8 -2
  14. package/es/components/DataTable/Table.d.ts +6 -1
  15. package/es/components/DataTable/Table.js +78 -3
  16. package/es/components/DataTable/TableHeader.js +2 -1
  17. package/es/components/DataTableSkeleton/DataTableSkeleton.js +1 -2
  18. package/es/components/DataTableSkeleton/index.d.ts +9 -0
  19. package/es/components/ExpandableSearch/ExpandableSearch.d.ts +1 -1
  20. package/es/components/ExpandableSearch/ExpandableSearch.js +6 -2
  21. package/es/components/FileUploader/FileUploaderButton.js +2 -1
  22. package/es/components/IconButton/index.js +10 -2
  23. package/es/components/Layout/index.js +118 -0
  24. package/es/components/Link/Link.d.ts +53 -0
  25. package/es/components/Link/Link.js +4 -3
  26. package/es/components/Link/index.d.ts +9 -0
  27. package/es/components/ListBox/ListBoxPropTypes.d.ts +1 -1
  28. package/es/components/Menu/MenuItem.js +2 -1
  29. package/es/components/MenuButton/index.js +7 -4
  30. package/es/components/OverflowMenu/index.js +9 -1
  31. package/es/components/OverflowMenu/next/index.js +98 -0
  32. package/es/components/OverflowMenuV2/index.js +15 -73
  33. package/es/components/RadioButtonGroup/RadioButtonGroup.js +0 -1
  34. package/es/components/Search/Search.d.ts +4 -0
  35. package/es/components/Search/Search.js +8 -2
  36. package/es/components/Select/Select.d.ts +1 -1
  37. package/es/components/Tabs/Tabs.js +5 -1
  38. package/es/components/Tag/Tag.js +2 -0
  39. package/es/components/TextArea/TextArea.Skeleton.js +1 -2
  40. package/es/components/TextArea/TextArea.js +1 -2
  41. package/es/components/TextArea/index.d.ts +10 -0
  42. package/es/components/TextInput/PasswordInput.js +1 -2
  43. package/es/components/TextInput/TextInput.Skeleton.js +1 -2
  44. package/es/components/TextInput/TextInput.js +5 -4
  45. package/es/components/TextInput/index.d.ts +4 -0
  46. package/es/components/TimePicker/TimePicker.d.ts +8 -0
  47. package/es/components/TimePicker/TimePicker.js +26 -6
  48. package/es/components/Tooltip/Tooltip.js +4 -2
  49. package/es/components/UIShell/HeaderMenuItem.d.ts +22 -0
  50. package/es/components/UIShell/HeaderMenuItem.js +4 -3
  51. package/es/components/UIShell/HeaderPanel.js +3 -11
  52. package/es/components/UIShell/Link.d.ts +48 -0
  53. package/es/components/UIShell/Link.js +30 -19
  54. package/es/components/UIShell/SideNav.d.ts +2 -1
  55. package/es/components/UIShell/SideNav.js +25 -7
  56. package/es/index.d.ts +21 -20
  57. package/es/index.js +30 -28
  58. package/lib/components/Accordion/Accordion.js +3 -1
  59. package/lib/components/AspectRatio/AspectRatio.d.ts +67 -0
  60. package/lib/components/AspectRatio/AspectRatio.js +2 -2
  61. package/lib/components/AspectRatio/index.d.ts +7 -0
  62. package/lib/components/Button/Button.js +6 -1
  63. package/lib/components/Checkbox/Checkbox.js +2 -2
  64. package/lib/components/CodeSnippet/CodeSnippet.js +1 -0
  65. package/lib/components/ComboButton/index.js +6 -5
  66. package/lib/components/ContainedList/ContainedList.js +12 -4
  67. package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +6 -1
  68. package/lib/components/ContentSwitcher/ContentSwitcher.js +10 -1
  69. package/lib/components/CopyButton/CopyButton.js +8 -2
  70. package/lib/components/DataTable/DataTable.js +8 -2
  71. package/lib/components/DataTable/Table.d.ts +6 -1
  72. package/lib/components/DataTable/Table.js +78 -2
  73. package/lib/components/DataTable/TableHeader.js +2 -1
  74. package/lib/components/DataTableSkeleton/DataTableSkeleton.js +1 -2
  75. package/lib/components/DataTableSkeleton/index.d.ts +9 -0
  76. package/lib/components/ExpandableSearch/ExpandableSearch.d.ts +1 -1
  77. package/lib/components/ExpandableSearch/ExpandableSearch.js +6 -2
  78. package/lib/components/FileUploader/FileUploaderButton.js +2 -1
  79. package/lib/components/IconButton/index.js +10 -2
  80. package/lib/components/Layout/index.js +129 -0
  81. package/lib/components/Link/Link.d.ts +53 -0
  82. package/lib/components/Link/Link.js +4 -3
  83. package/lib/components/Link/index.d.ts +9 -0
  84. package/lib/components/ListBox/ListBoxPropTypes.d.ts +1 -1
  85. package/lib/components/Menu/MenuItem.js +2 -1
  86. package/lib/components/MenuButton/index.js +7 -4
  87. package/lib/components/OverflowMenu/index.js +13 -1
  88. package/lib/components/OverflowMenu/next/index.js +108 -0
  89. package/lib/components/OverflowMenuV2/index.js +14 -74
  90. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +0 -1
  91. package/lib/components/Search/Search.d.ts +4 -0
  92. package/lib/components/Search/Search.js +8 -2
  93. package/lib/components/Select/Select.d.ts +1 -1
  94. package/lib/components/Tabs/Tabs.js +5 -1
  95. package/lib/components/Tag/Tag.js +2 -0
  96. package/lib/components/TextArea/TextArea.Skeleton.js +1 -2
  97. package/lib/components/TextArea/TextArea.js +1 -2
  98. package/lib/components/TextArea/index.d.ts +10 -0
  99. package/lib/components/TextInput/PasswordInput.js +1 -2
  100. package/lib/components/TextInput/TextInput.Skeleton.js +1 -2
  101. package/lib/components/TextInput/TextInput.js +5 -4
  102. package/lib/components/TextInput/index.d.ts +4 -0
  103. package/lib/components/TimePicker/TimePicker.d.ts +8 -0
  104. package/lib/components/TimePicker/TimePicker.js +26 -6
  105. package/lib/components/Tooltip/Tooltip.js +4 -2
  106. package/lib/components/UIShell/HeaderMenuItem.d.ts +22 -0
  107. package/lib/components/UIShell/HeaderMenuItem.js +3 -2
  108. package/lib/components/UIShell/HeaderPanel.js +3 -11
  109. package/lib/components/UIShell/Link.d.ts +48 -0
  110. package/lib/components/UIShell/Link.js +29 -18
  111. package/lib/components/UIShell/SideNav.d.ts +2 -1
  112. package/lib/components/UIShell/SideNav.js +24 -6
  113. package/lib/index.d.ts +21 -20
  114. package/lib/index.js +92 -89
  115. package/package.json +10 -9
  116. /package/es/components/{Layout → LayoutDirection}/LayoutDirection.js +0 -0
  117. /package/es/components/{Layout → LayoutDirection}/LayoutDirectionContext.js +0 -0
  118. /package/es/components/{Layout → LayoutDirection}/useLayoutDirection.js +0 -0
  119. /package/lib/components/{Layout → LayoutDirection}/LayoutDirection.js +0 -0
  120. /package/lib/components/{Layout → LayoutDirection}/LayoutDirectionContext.js +0 -0
  121. /package/lib/components/{Layout → LayoutDirection}/useLayoutDirection.js +0 -0
@@ -0,0 +1,118 @@
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
+ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import cx from 'classnames';
10
+ import PropTypes from 'prop-types';
11
+ import React__default from 'react';
12
+ import { usePrefix } from '../../internal/usePrefix.js';
13
+
14
+ const sizes = ['xs', 'sm', 'md', 'lg', 'xl', '2xl'];
15
+ const densities = ['condensed', 'normal'];
16
+ const Layout = /*#__PURE__*/React__default.forwardRef(function Layout(_ref, forwardRef) {
17
+ let {
18
+ as: BaseComponent = 'div',
19
+ children,
20
+ className,
21
+ density,
22
+ size,
23
+ ...rest
24
+ } = _ref;
25
+ const prefix = usePrefix();
26
+ const classes = cx(className, `${prefix}--layout`, {
27
+ [`${prefix}--layout--size-${size}`]: sizes.includes(size),
28
+ [`${prefix}--layout--density-${density}`]: densities.includes(density)
29
+ });
30
+ return /*#__PURE__*/React__default.createElement(BaseComponent, _extends({}, rest, {
31
+ ref: forwardRef,
32
+ className: classes
33
+ }), children);
34
+ });
35
+ Layout.propTypes = {
36
+ /**
37
+ * Specify a custom component or element to be rendered as the top-level
38
+ * element in the component
39
+ */
40
+ as: PropTypes.oneOfType([PropTypes.func, PropTypes.string, PropTypes.elementType]),
41
+ /**
42
+ * Provide child elements to be rendered inside of `Layout`
43
+ */
44
+ children: PropTypes.node,
45
+ /**
46
+ * Provide a custom class name to be used on the outermost element rendered by
47
+ * the component
48
+ */
49
+ className: PropTypes.string,
50
+ /**
51
+ * Specify the desired density of components within this layout
52
+ */
53
+ density: PropTypes.oneOf(densities),
54
+ /**
55
+ * Specify the desired size of components within this layout
56
+ */
57
+ size: PropTypes.oneOf(sizes)
58
+ };
59
+ const LayoutConstraint = /*#__PURE__*/React__default.forwardRef(function Layout(_ref2, forwardRef) {
60
+ let {
61
+ as: BaseComponent = 'div',
62
+ children,
63
+ className,
64
+ density,
65
+ size,
66
+ ...rest
67
+ } = _ref2;
68
+ const prefix = usePrefix();
69
+ const classes = cx(className, Object.entries({
70
+ size,
71
+ density
72
+ }).map(_ref3 => {
73
+ let [group, constraints] = _ref3;
74
+ return {
75
+ [`${prefix}--layout-constraint--${group}:default-${constraints?.default}`]: constraints?.default,
76
+ [`${prefix}--layout-constraint--${group}:min-${constraints?.min}`]: constraints?.min,
77
+ [`${prefix}--layout-constraint--${group}:max-${constraints?.max}`]: constraints?.max
78
+ };
79
+ }));
80
+ return /*#__PURE__*/React__default.createElement(BaseComponent, _extends({}, rest, {
81
+ ref: forwardRef,
82
+ className: classes
83
+ }), children);
84
+ });
85
+ LayoutConstraint.propTypes = {
86
+ /**
87
+ * Specify a custom component or element to be rendered as the top-level
88
+ * element in the component
89
+ */
90
+ as: PropTypes.oneOfType([PropTypes.func, PropTypes.string, PropTypes.elementType]),
91
+ /**
92
+ * Provide child elements to be rendered inside of `LayoutConstraint`
93
+ */
94
+ children: PropTypes.node,
95
+ /**
96
+ * Provide a custom class name to be used on the outermost element rendered by
97
+ * the component
98
+ */
99
+ className: PropTypes.string,
100
+ /**
101
+ * Specify the desired layout density constraints of this element's children
102
+ */
103
+ density: PropTypes.shape({
104
+ min: PropTypes.oneOf(densities),
105
+ default: PropTypes.oneOf(densities),
106
+ max: PropTypes.oneOf(densities)
107
+ }),
108
+ /**
109
+ * Specify the desired layout size constraints of this element's children
110
+ */
111
+ size: PropTypes.shape({
112
+ min: PropTypes.oneOf(sizes),
113
+ default: PropTypes.oneOf(sizes),
114
+ max: PropTypes.oneOf(sizes)
115
+ })
116
+ };
117
+
118
+ export { Layout, LayoutConstraint };
@@ -0,0 +1,53 @@
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, { AriaAttributes, ComponentType, HTMLAttributeAnchorTarget } from 'react';
8
+ interface LinkProps {
9
+ /**
10
+ * @description Indicates the element that represents the
11
+ * current item within a container or set of related
12
+ * elements.
13
+ */
14
+ 'aria-current'?: AriaAttributes['aria-current'];
15
+ /**
16
+ * @description Provide a custom className to be applied to
17
+ * the containing `<a>` node.
18
+ */
19
+ className?: string;
20
+ /**
21
+ * @description Specify if the control should be disabled, or not.
22
+ */
23
+ disabled?: boolean;
24
+ /**
25
+ * @description Provide the `href` attribute for the `<a>` node.
26
+ */
27
+ href?: string;
28
+ /**
29
+ * @description Specify whether you want the inline version of this control.
30
+ */
31
+ inline?: boolean;
32
+ /**
33
+ * @description Optional prop to render an icon next to the link.
34
+ * Can be a React component class
35
+ */
36
+ renderIcon?: ComponentType;
37
+ /**
38
+ * Specify the size of the Link. Currently supports either `sm`, 'md' (default) or 'lg` as an option.
39
+ */
40
+ size?: 'sm' | 'md' | 'lg';
41
+ /**
42
+ * @description Specify the target attribute for the `<a>` node.
43
+ */
44
+ target?: HTMLAttributeAnchorTarget;
45
+ /**
46
+ * Specify whether you want the link to receive visited styles after the link has been clicked
47
+ */
48
+ visited?: boolean;
49
+ }
50
+ declare const Link: React.ForwardRefExoticComponent<LinkProps & {
51
+ children?: React.ReactNode;
52
+ } & React.RefAttributes<HTMLAnchorElement>>;
53
+ export default Link;
@@ -21,6 +21,7 @@ const Link = /*#__PURE__*/React__default.forwardRef(function Link(_ref, ref) {
21
21
  visited = false,
22
22
  renderIcon: Icon,
23
23
  size,
24
+ target,
24
25
  ...rest
25
26
  } = _ref;
26
27
  const prefix = usePrefix();
@@ -30,7 +31,7 @@ const Link = /*#__PURE__*/React__default.forwardRef(function Link(_ref, ref) {
30
31
  [`${prefix}--link--visited`]: visited,
31
32
  [`${prefix}--link--${size}`]: size
32
33
  });
33
- const rel = rest.target === '_blank' ? 'noopener' : null;
34
+ const rel = target === '_blank' ? 'noopener' : undefined;
34
35
  const linkProps = {
35
36
  className,
36
37
  rel
@@ -76,6 +77,7 @@ Link.propTypes = {
76
77
  * Optional prop to render an icon next to the link.
77
78
  * Can be a React component class
78
79
  */
80
+ // @ts-expect-error - PropTypes are unable to cover this case.
79
81
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
80
82
  /**
81
83
  * Specify the size of the Link. Currently supports either `sm`, 'md' (default) or 'lg` as an option.
@@ -86,6 +88,5 @@ Link.propTypes = {
86
88
  */
87
89
  visited: PropTypes.bool
88
90
  };
89
- var Link$1 = Link;
90
91
 
91
- export { Link$1 as default };
92
+ export { Link as default };
@@ -0,0 +1,9 @@
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 Link from './Link';
8
+ export default Link;
9
+ export { Link };
@@ -10,5 +10,5 @@ declare const listBoxSizes: readonly ["sm", "md", "lg"];
10
10
  export type ListBoxType = (typeof listBoxTypes)[number];
11
11
  export type ListBoxSize = (typeof listBoxSizes)[number];
12
12
  export declare const ListBoxType: PropTypes.Requireable<"default" | "inline">;
13
- export declare const ListBoxSize: PropTypes.Requireable<"md" | "sm" | "lg">;
13
+ export declare const ListBoxSize: PropTypes.Requireable<"sm" | "md" | "lg">;
14
14
  export {};
@@ -280,12 +280,13 @@ MenuItemGroup.propTypes = {
280
280
  */
281
281
  label: PropTypes.string.isRequired
282
282
  };
283
+ const defaultItemToString = item => item.toString();
283
284
  const MenuItemRadioGroup = /*#__PURE__*/React__default.forwardRef(function MenuItemRadioGroup(_ref4, forwardRef) {
284
285
  let {
285
286
  className,
286
287
  defaultSelectedItem,
287
288
  items,
288
- itemToString = item => item.toString(),
289
+ itemToString = defaultItemToString,
289
290
  label,
290
291
  onChange,
291
292
  selectedItem,
@@ -58,10 +58,13 @@ const MenuButton = /*#__PURE__*/React__default.forwardRef(function MenuButton(_r
58
58
  }
59
59
  const triggerClasses = cx(`${prefix}--menu-button__trigger`, {
60
60
  [`${prefix}--menu-button__trigger--open`]: open
61
- }, className);
61
+ });
62
62
  const buttonKind = validButtonKinds.includes(kind) ? kind : defaultButtonKind;
63
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Button, _extends({}, rest, {
63
+ return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
64
64
  ref: ref,
65
+ "aria-owns": open ? id : null,
66
+ className: className
67
+ }), /*#__PURE__*/React__default.createElement(Button, {
65
68
  className: triggerClasses,
66
69
  size: size,
67
70
  kind: buttonKind,
@@ -71,8 +74,8 @@ const MenuButton = /*#__PURE__*/React__default.forwardRef(function MenuButton(_r
71
74
  "aria-expanded": open,
72
75
  onClick: handleClick,
73
76
  onMouseDown: handleMousedown,
74
- "aria-owns": open ? id : null
75
- }), label), /*#__PURE__*/React__default.createElement(Menu, {
77
+ "aria-controls": open ? id : null
78
+ }, label), /*#__PURE__*/React__default.createElement(Menu, {
76
79
  ref: menuRef,
77
80
  id: id,
78
81
  label: label,
@@ -5,9 +5,17 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
+ import React__default from 'react';
9
+ import { useFeatureFlag } from '../FeatureFlags/index.js';
10
+ import { OverflowMenu as OverflowMenu$2 } from './next/index.js';
8
11
  import { OverflowMenu as OverflowMenu$1 } from './OverflowMenu.js';
9
12
  import { createClassWrapper } from '../../internal/createClassWrapper.js';
10
13
 
11
- const OverflowMenu = createClassWrapper(OverflowMenu$1);
14
+ const OverflowMenuV11 = createClassWrapper(OverflowMenu$1);
15
+ function OverflowMenu(props) {
16
+ const enableV12OverflowMenu = useFeatureFlag('enable-v12-overflowmenu');
17
+ return enableV12OverflowMenu ? /*#__PURE__*/React__default.createElement(OverflowMenu$2, props) : /*#__PURE__*/React__default.createElement(OverflowMenuV11, props);
18
+ }
19
+ OverflowMenu.displayName = 'OverflowMenu';
12
20
 
13
21
  export { OverflowMenu, OverflowMenu as default };
@@ -0,0 +1,98 @@
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
+ import { extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import React__default, { useRef } from 'react';
10
+ import PropTypes from 'prop-types';
11
+ import cx from 'classnames';
12
+ import { OverflowMenuVertical } from '@carbon/icons-react';
13
+ import { IconButton } from '../../IconButton/index.js';
14
+ import { Menu } from '../../Menu/Menu.js';
15
+ import { useId } from '../../../internal/useId.js';
16
+ import { usePrefix } from '../../../internal/usePrefix.js';
17
+ import { useAttachedMenu } from '../../../internal/useAttachedMenu.js';
18
+
19
+ const defaultSize = 'md';
20
+ const OverflowMenu = /*#__PURE__*/React__default.forwardRef(function OverflowMenu(_ref, forwardRef) {
21
+ let {
22
+ children,
23
+ className,
24
+ label = 'Options',
25
+ renderIcon: IconElement = OverflowMenuVertical,
26
+ size = defaultSize,
27
+ tooltipAlignment,
28
+ ...rest
29
+ } = _ref;
30
+ const id = useId('overflowmenu');
31
+ const prefix = usePrefix();
32
+ const triggerRef = useRef(null);
33
+ const {
34
+ open,
35
+ x,
36
+ y,
37
+ handleClick,
38
+ handleMousedown,
39
+ handleClose
40
+ } = useAttachedMenu(triggerRef);
41
+ const containerClasses = cx(className, `${prefix}--overflow-menu__container`);
42
+ const triggerClasses = cx(`${prefix}--overflow-menu`, {
43
+ [`${prefix}--overflow-menu--open`]: open
44
+ }, size !== defaultSize && `${prefix}--overflow-menu--${size}`);
45
+ return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
46
+ className: containerClasses,
47
+ "aria-owns": open ? id : null,
48
+ ref: forwardRef
49
+ }), /*#__PURE__*/React__default.createElement(IconButton, {
50
+ "aria-controls": open ? id : null,
51
+ "aria-haspopup": true,
52
+ "aria-expanded": open,
53
+ className: triggerClasses,
54
+ onClick: handleClick,
55
+ onMouseDown: handleMousedown,
56
+ ref: triggerRef,
57
+ label: label,
58
+ align: tooltipAlignment
59
+ }, /*#__PURE__*/React__default.createElement(IconElement, {
60
+ className: `${prefix}--overflow-menu__icon`
61
+ })), /*#__PURE__*/React__default.createElement(Menu, {
62
+ id: id,
63
+ size: size,
64
+ open: open,
65
+ onClose: handleClose,
66
+ x: x,
67
+ y: y,
68
+ label: label
69
+ }, children));
70
+ });
71
+ OverflowMenu.propTypes = {
72
+ /**
73
+ * A collection of MenuItems to be rendered within this OverflowMenu.
74
+ */
75
+ children: PropTypes.node,
76
+ /**
77
+ * Additional CSS class names for the trigger button.
78
+ */
79
+ className: PropTypes.string,
80
+ /**
81
+ * A label describing the options available. Is used in the trigger tooltip and as the menu's accessible label.
82
+ */
83
+ label: PropTypes.string,
84
+ /**
85
+ * Otionally provide a custom icon to be rendered on the trigger button.
86
+ */
87
+ renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
88
+ /**
89
+ * Specify the size of the menu, from a list of available sizes.
90
+ */
91
+ size: PropTypes.oneOf(['sm', 'md', 'lg']),
92
+ /**
93
+ * Specify how the trigger tooltip should be aligned.
94
+ */
95
+ tooltipAlignment: PropTypes.oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right'])
96
+ };
97
+
98
+ export { OverflowMenu };
@@ -5,80 +5,22 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
- import React__default, { useRef } from 'react';
10
- import PropTypes from 'prop-types';
11
- import cx from 'classnames';
12
- import { OverflowMenuVertical } from '@carbon/icons-react';
13
- import { Menu } from '../Menu/Menu.js';
14
- import { useId } from '../../internal/useId.js';
15
- import { usePrefix } from '../../internal/usePrefix.js';
16
- import { useAttachedMenu } from '../../internal/useAttachedMenu.js';
8
+ import React__default from 'react';
9
+ import { warning } from '../../internal/warning.js';
10
+ import { FeatureFlags } from '../FeatureFlags/index.js';
11
+ import OverflowMenu from '../OverflowMenu/index.js';
17
12
 
18
- const defaultSize = 'md';
19
- function OverflowMenuV2(_ref) {
20
- let {
21
- children,
22
- className,
23
- renderIcon: IconElement = OverflowMenuVertical,
24
- size = defaultSize,
25
- ...rest
26
- } = _ref;
27
- const id = useId('overflowmenu');
28
- const prefix = usePrefix();
29
- const triggerRef = useRef(null);
30
- const {
31
- open,
32
- x,
33
- y,
34
- handleClick,
35
- handleMousedown,
36
- handleClose
37
- } = useAttachedMenu(triggerRef);
38
- const containerClasses = cx(`${prefix}--overflow-menu__container`);
39
- const triggerClasses = cx(`${prefix}--overflow-menu`, {
40
- [`${prefix}--overflow-menu--open`]: open,
41
- [className]: className
42
- }, size !== defaultSize && `${prefix}--overflow-menu--${size}`);
43
- return /*#__PURE__*/React__default.createElement("div", {
44
- className: containerClasses,
45
- "aria-owns": id
46
- }, /*#__PURE__*/React__default.createElement("button", _extends({}, rest, {
47
- type: "button",
48
- "aria-haspopup": true,
49
- "aria-expanded": open,
50
- className: triggerClasses,
51
- onClick: handleClick,
52
- onMouseDown: handleMousedown,
53
- ref: triggerRef
54
- }), /*#__PURE__*/React__default.createElement(IconElement, {
55
- className: `${prefix}--overflow-menu__icon`
56
- })), /*#__PURE__*/React__default.createElement(Menu, {
57
- id: id,
58
- size: size,
59
- open: open,
60
- onClose: handleClose,
61
- x: x,
62
- y: y
63
- }, children));
13
+ let didWarnAboutDeprecation = false;
14
+ function OverflowMenuV2(props) {
15
+ if (process.env.NODE_ENV !== "production") {
16
+ process.env.NODE_ENV !== "production" ? warning(didWarnAboutDeprecation, '`<OverflowMenuV2>` is deprecated and will be removed in the next major version. Use `<OverflowMenu>` with the `enable-v12-overflowmenu` feature flag instead.') : void 0;
17
+ didWarnAboutDeprecation = true;
18
+ }
19
+ return /*#__PURE__*/React__default.createElement(FeatureFlags, {
20
+ flags: {
21
+ 'enable-v12-overflowmenu': true
22
+ }
23
+ }, /*#__PURE__*/React__default.createElement(OverflowMenu, props));
64
24
  }
65
- OverflowMenuV2.propTypes = {
66
- /**
67
- * A collection of MenuItems to be rendered within this OverflowMenu.
68
- */
69
- children: PropTypes.node,
70
- /**
71
- * Additional CSS class names for the trigger button.
72
- */
73
- className: PropTypes.string,
74
- /**
75
- * Otionally provide a custom icon to be rendered on the trigger button.
76
- */
77
- renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
78
- /**
79
- * Specify the size of the menu, from a list of available sizes.
80
- */
81
- size: PropTypes.oneOf(['sm', 'md', 'lg'])
82
- };
83
25
 
84
26
  export { OverflowMenuV2 };
@@ -106,7 +106,6 @@ const RadioButtonGroup = /*#__PURE__*/React__default.forwardRef((props, ref) =>
106
106
  className: fieldsetClasses,
107
107
  disabled: disabled,
108
108
  "data-invalid": invalid ? true : undefined,
109
- "aria-readonly": readOnly,
110
109
  "aria-describedby": showHelper && helperText ? helperId : undefined
111
110
  }, rest), legendText && /*#__PURE__*/React__default.createElement(Legend, {
112
111
  className: `${prefix}--label`
@@ -28,6 +28,10 @@ export interface SearchProps extends InputPropsBase {
28
28
  * Specify whether the `<input>` should be disabled
29
29
  */
30
30
  disabled?: boolean;
31
+ /**
32
+ * Specify whether or not ExpandableSearch should render expanded or not
33
+ */
34
+ isExpanded?: boolean;
31
35
  /**
32
36
  * Specify a custom `id` for the input
33
37
  */
@@ -29,6 +29,7 @@ const Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forw
29
29
  closeButtonLabelText = 'Clear search input',
30
30
  defaultValue,
31
31
  disabled,
32
+ isExpanded = true,
32
33
  id,
33
34
  labelText,
34
35
  // @ts-expect-error: deprecated prop
@@ -45,6 +46,7 @@ const Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forw
45
46
  value,
46
47
  ...rest
47
48
  } = _ref;
49
+ const hasPropValue = value || defaultValue ? true : false;
48
50
  const prefix = usePrefix();
49
51
  const {
50
52
  isFluid
@@ -54,7 +56,7 @@ const Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forw
54
56
  const inputId = useId('search-input');
55
57
  const uniqueId = id || inputId;
56
58
  const searchId = `${uniqueId}-search`;
57
- const [hasContent, setHasContent] = useState(value || defaultValue || false);
59
+ const [hasContent, setHasContent] = useState(hasPropValue || false);
58
60
  const [prevValue, setPrevValue] = useState(value);
59
61
  const searchClasses = cx({
60
62
  [`${prefix}--search`]: true,
@@ -67,7 +69,7 @@ const Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forw
67
69
  }, className);
68
70
  const clearClasses = cx({
69
71
  [`${prefix}--search-close`]: true,
70
- [`${prefix}--search-close--hidden`]: !hasContent
72
+ [`${prefix}--search-close--hidden`]: !hasContent || !isExpanded
71
73
  });
72
74
  if (value !== prevValue) {
73
75
  setHasContent(!!value);
@@ -162,6 +164,10 @@ Search.propTypes = {
162
164
  * Specify a custom `id` for the input
163
165
  */
164
166
  id: PropTypes.string,
167
+ /**
168
+ * Specify whether or not ExpandableSearch should render expanded or not
169
+ */
170
+ isExpanded: PropTypes.bool,
165
171
  /**
166
172
  * Provide the label text for the Search icon
167
173
  */
@@ -85,5 +85,5 @@ interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, ExcludedAttr
85
85
  */
86
86
  warnText?: ReactNode;
87
87
  }
88
- declare const Select: React.ForwardRefExoticComponent<Pick<SelectProps, "value" | "children" | "className" | "disabled" | "size" | "form" | "slot" | "style" | "title" | "dir" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "autoComplete" | "multiple" | "key" | "id" | "onAnimationEnd" | "aria-controls" | "aria-expanded" | "onClick" | "onKeyDown" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "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" | "inline" | "invalid" | "name" | "readOnly" | "required" | "labelText" | "helperText" | "invalidText" | "hideLabel" | "warn" | "warnText" | "light" | "noLabel"> & React.RefAttributes<HTMLSelectElement>>;
88
+ declare const Select: React.ForwardRefExoticComponent<Pick<SelectProps, "value" | "children" | "className" | "disabled" | "size" | "form" | "slot" | "style" | "title" | "dir" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "autoComplete" | "multiple" | "key" | "id" | "onAnimationEnd" | "aria-controls" | "aria-expanded" | "onClick" | "onKeyDown" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "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" | "inline" | "name" | "readOnly" | "required" | "invalid" | "labelText" | "helperText" | "invalidText" | "hideLabel" | "warn" | "warnText" | "light" | "noLabel"> & React.RefAttributes<HTMLSelectElement>>;
89
89
  export default Select;
@@ -541,7 +541,11 @@ const Tab = /*#__PURE__*/React__default.forwardRef(function Tab(_ref5, forwardRe
541
541
  type: "button"
542
542
  }), /*#__PURE__*/React__default.createElement("div", {
543
543
  className: `${prefix}--tabs__nav-item-label-wrapper`
544
- }, /*#__PURE__*/React__default.createElement("span", {
544
+ }, dismissable && Icon && /*#__PURE__*/React__default.createElement("div", {
545
+ className: `${prefix}--tabs__nav-item--icon-left`
546
+ }, /*#__PURE__*/React__default.createElement(Icon, {
547
+ size: 16
548
+ })), /*#__PURE__*/React__default.createElement("span", {
545
549
  className: `${prefix}--tabs__nav-item-label`
546
550
  }, children), /*#__PURE__*/React__default.createElement("div", {
547
551
  className: cx(`${prefix}--tabs__nav-item--icon`, {
@@ -49,6 +49,8 @@ const Tag = _ref => {
49
49
  [`${prefix}--tag--disabled`]: disabled,
50
50
  [`${prefix}--tag--filter`]: filter,
51
51
  [`${prefix}--tag--${size}`]: size,
52
+ // TODO: V12 - Remove this class
53
+ [`${prefix}--layout--size-${size}`]: size,
52
54
  [`${prefix}--tag--${type}`]: type,
53
55
  [`${prefix}--tag--interactive`]: other.onClick && !filter
54
56
  });
@@ -36,6 +36,5 @@ TextAreaSkeleton.propTypes = {
36
36
  */
37
37
  hideLabel: PropTypes.bool
38
38
  };
39
- var TextAreaSkeleton$1 = TextAreaSkeleton;
40
39
 
41
- export { TextAreaSkeleton, TextAreaSkeleton$1 as default };
40
+ export { TextAreaSkeleton, TextAreaSkeleton as default };
@@ -269,6 +269,5 @@ TextArea.defaultProps = {
269
269
  warn: false,
270
270
  warnText: ''
271
271
  };
272
- var TextArea$1 = TextArea;
273
272
 
274
- export { TextArea$1 as default };
273
+ export { TextArea as default };
@@ -0,0 +1,10 @@
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 TextArea from './TextArea';
8
+ export { default as TextAreaSkeleton } from './TextArea.Skeleton';
9
+ export default TextArea;
10
+ export { TextArea };
@@ -275,6 +275,5 @@ PasswordInput.propTypes = {
275
275
  */
276
276
  warnText: PropTypes.node
277
277
  };
278
- var PasswordInput$1 = PasswordInput;
279
278
 
280
- export { PasswordInput$1 as default };
279
+ export { PasswordInput as default };
@@ -36,6 +36,5 @@ TextInputSkeleton.propTypes = {
36
36
  */
37
37
  hideLabel: PropTypes.bool
38
38
  };
39
- var TextInputSkeleton$1 = TextInputSkeleton;
40
39
 
41
- export { TextInputSkeleton, TextInputSkeleton$1 as default };
40
+ export { TextInputSkeleton, TextInputSkeleton as default };