@carbon/react 1.66.0-rc.0 → 1.67.0-rc.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 (150) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1031 -1047
  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/CodeSnippet/CodeSnippet.d.ts +9 -1
  9. package/es/components/CodeSnippet/CodeSnippet.js +7 -0
  10. package/es/components/ComboBox/ComboBox.js +37 -14
  11. package/es/components/ComboButton/index.js +1 -1
  12. package/es/components/Copy/Copy.d.ts +9 -1
  13. package/es/components/Copy/Copy.js +6 -0
  14. package/es/components/CopyButton/CopyButton.d.ts +9 -1
  15. package/es/components/CopyButton/CopyButton.js +6 -0
  16. package/es/components/DataTable/TableExpandHeader.d.ts +2 -2
  17. package/es/components/DataTable/TableExpandHeader.js +1 -1
  18. package/es/components/DatePicker/DatePicker.js +1 -0
  19. package/es/components/Dropdown/Dropdown.js +2 -2
  20. package/es/components/FeatureFlags/index.js +27 -7
  21. package/es/components/FluidNumberInput/FluidNumberInput.Skeleton.d.ts +15 -0
  22. package/es/components/FluidNumberInput/FluidNumberInput.d.ts +95 -0
  23. package/es/components/FluidNumberInput/index.d.ts +11 -0
  24. package/es/components/FluidSearch/FluidSearch.Skeleton.d.ts +15 -0
  25. package/es/components/FluidSearch/FluidSearch.Skeleton.js +2 -2
  26. package/es/components/FluidSearch/FluidSearch.d.ts +73 -0
  27. package/es/components/FluidSearch/FluidSearch.js +1 -2
  28. package/es/components/FluidSearch/index.d.ts +11 -0
  29. package/es/components/FluidSelect/FluidSelect.Skeleton.d.ts +15 -0
  30. package/es/components/FluidSelect/FluidSelect.Skeleton.js +1 -2
  31. package/es/components/FluidSelect/FluidSelect.d.ts +57 -0
  32. package/es/components/FluidSelect/FluidSelect.js +1 -2
  33. package/es/components/FluidSelect/index.d.ts +13 -0
  34. package/es/components/FluidSelect/index.js +1 -0
  35. package/es/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +20 -0
  36. package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +3 -20
  37. package/es/components/FluidTextArea/FluidTextArea.d.ts +96 -0
  38. package/es/components/FluidTextArea/FluidTextArea.js +2 -2
  39. package/es/components/FluidTextArea/index.d.ts +12 -0
  40. package/es/components/FluidTextInput/FluidPasswordInput.d.ts +83 -0
  41. package/es/components/FluidTextInput/FluidPasswordInput.js +87 -0
  42. package/es/components/FluidTextInput/FluidTextInput.Skeleton.d.ts +15 -0
  43. package/es/components/FluidTextInput/FluidTextInput.Skeleton.js +2 -2
  44. package/es/components/FluidTextInput/FluidTextInput.d.ts +70 -0
  45. package/es/components/FluidTextInput/FluidTextInput.js +6 -4
  46. package/es/components/FluidTextInput/index.d.ts +15 -0
  47. package/es/components/FluidTextInput/index.js +2 -0
  48. package/es/components/FluidTimePicker/FluidTimePicker.Skeleton.d.ts +35 -0
  49. package/es/components/FluidTimePicker/FluidTimePicker.Skeleton.js +4 -2
  50. package/es/components/FluidTimePicker/FluidTimePicker.d.ts +45 -0
  51. package/es/components/FluidTimePicker/FluidTimePicker.js +5 -5
  52. package/es/components/FluidTimePicker/index.d.ts +13 -0
  53. package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.d.ts +41 -0
  54. package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +2 -2
  55. package/es/components/FluidTimePickerSelect/index.d.ts +11 -0
  56. package/es/components/IconButton/index.d.ts +4 -0
  57. package/es/components/IconButton/index.js +6 -0
  58. package/es/components/Menu/Menu.js +2 -1
  59. package/es/components/MultiSelect/FilterableMultiSelect.js +6 -5
  60. package/es/components/MultiSelect/MultiSelect.js +2 -1
  61. package/es/components/Notification/Notification.js +4 -2
  62. package/es/components/OverflowMenu/next/index.js +3 -1
  63. package/es/components/OverflowMenuV2/index.js +1 -3
  64. package/es/components/Pagination/Pagination.js +1 -1
  65. package/es/components/Popover/index.js +2 -2
  66. package/es/components/Tabs/Tabs.js +1 -1
  67. package/es/components/Tag/DismissibleTag.d.ts +9 -1
  68. package/es/components/Tag/DismissibleTag.js +7 -3
  69. package/es/components/Tag/Tag.js +2 -2
  70. package/es/components/Toggletip/index.js +2 -1
  71. package/es/components/UIShell/HeaderPanel.js +1 -1
  72. package/es/index.js +12 -11
  73. package/es/node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js +757 -4
  74. package/es/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js +76 -0
  75. package/es/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs.js +106 -6
  76. package/lib/components/AILabel/index.d.ts +37 -0
  77. package/lib/components/AILabel/index.js +38 -14
  78. package/lib/components/Accordion/Accordion.d.ts +5 -1
  79. package/lib/components/Breadcrumb/BreadcrumbItem.js +1 -1
  80. package/lib/components/Button/Button.d.ts +2 -1
  81. package/lib/components/Button/Button.js +13 -2
  82. package/lib/components/CodeSnippet/CodeSnippet.d.ts +9 -1
  83. package/lib/components/CodeSnippet/CodeSnippet.js +7 -0
  84. package/lib/components/ComboBox/ComboBox.js +38 -15
  85. package/lib/components/ComboButton/index.js +2 -2
  86. package/lib/components/Copy/Copy.d.ts +9 -1
  87. package/lib/components/Copy/Copy.js +6 -0
  88. package/lib/components/CopyButton/CopyButton.d.ts +9 -1
  89. package/lib/components/CopyButton/CopyButton.js +6 -0
  90. package/lib/components/DataTable/TableExpandHeader.d.ts +2 -2
  91. package/lib/components/DataTable/TableExpandHeader.js +1 -1
  92. package/lib/components/DatePicker/DatePicker.js +1 -0
  93. package/lib/components/Dropdown/Dropdown.js +3 -3
  94. package/lib/components/FeatureFlags/index.js +27 -7
  95. package/lib/components/FluidNumberInput/FluidNumberInput.Skeleton.d.ts +15 -0
  96. package/lib/components/FluidNumberInput/FluidNumberInput.d.ts +95 -0
  97. package/lib/components/FluidNumberInput/index.d.ts +11 -0
  98. package/lib/components/FluidSearch/FluidSearch.Skeleton.d.ts +15 -0
  99. package/lib/components/FluidSearch/FluidSearch.Skeleton.js +2 -2
  100. package/lib/components/FluidSearch/FluidSearch.d.ts +73 -0
  101. package/lib/components/FluidSearch/FluidSearch.js +1 -2
  102. package/lib/components/FluidSearch/index.d.ts +11 -0
  103. package/lib/components/FluidSelect/FluidSelect.Skeleton.d.ts +15 -0
  104. package/lib/components/FluidSelect/FluidSelect.Skeleton.js +1 -2
  105. package/lib/components/FluidSelect/FluidSelect.d.ts +57 -0
  106. package/lib/components/FluidSelect/FluidSelect.js +1 -2
  107. package/lib/components/FluidSelect/index.d.ts +13 -0
  108. package/lib/components/FluidSelect/index.js +2 -0
  109. package/lib/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +20 -0
  110. package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +3 -22
  111. package/lib/components/FluidTextArea/FluidTextArea.d.ts +96 -0
  112. package/lib/components/FluidTextArea/FluidTextArea.js +2 -2
  113. package/lib/components/FluidTextArea/index.d.ts +12 -0
  114. package/lib/components/FluidTextInput/FluidPasswordInput.d.ts +83 -0
  115. package/lib/components/FluidTextInput/FluidPasswordInput.js +93 -0
  116. package/lib/components/FluidTextInput/FluidTextInput.Skeleton.d.ts +15 -0
  117. package/lib/components/FluidTextInput/FluidTextInput.Skeleton.js +2 -2
  118. package/lib/components/FluidTextInput/FluidTextInput.d.ts +70 -0
  119. package/lib/components/FluidTextInput/FluidTextInput.js +6 -4
  120. package/lib/components/FluidTextInput/index.d.ts +15 -0
  121. package/lib/components/FluidTextInput/index.js +3 -0
  122. package/lib/components/FluidTimePicker/FluidTimePicker.Skeleton.d.ts +35 -0
  123. package/lib/components/FluidTimePicker/FluidTimePicker.Skeleton.js +4 -2
  124. package/lib/components/FluidTimePicker/FluidTimePicker.d.ts +45 -0
  125. package/lib/components/FluidTimePicker/FluidTimePicker.js +6 -6
  126. package/lib/components/FluidTimePicker/index.d.ts +13 -0
  127. package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.d.ts +41 -0
  128. package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +2 -2
  129. package/lib/components/FluidTimePickerSelect/index.d.ts +11 -0
  130. package/lib/components/IconButton/index.d.ts +4 -0
  131. package/lib/components/IconButton/index.js +6 -0
  132. package/lib/components/Menu/Menu.js +2 -1
  133. package/lib/components/MultiSelect/FilterableMultiSelect.js +7 -6
  134. package/lib/components/MultiSelect/MultiSelect.js +3 -2
  135. package/lib/components/Notification/Notification.js +4 -2
  136. package/lib/components/OverflowMenu/next/index.js +3 -1
  137. package/lib/components/OverflowMenuV2/index.js +1 -3
  138. package/lib/components/Pagination/Pagination.js +1 -1
  139. package/lib/components/Popover/index.js +3 -3
  140. package/lib/components/Tabs/Tabs.js +1 -1
  141. package/lib/components/Tag/DismissibleTag.d.ts +9 -1
  142. package/lib/components/Tag/DismissibleTag.js +7 -3
  143. package/lib/components/Tag/Tag.js +2 -2
  144. package/lib/components/Toggletip/index.js +2 -1
  145. package/lib/components/UIShell/HeaderPanel.js +1 -1
  146. package/lib/index.js +23 -22
  147. package/lib/node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js +763 -2
  148. package/lib/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js +80 -0
  149. package/lib/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs.js +121 -5
  150. package/package.json +10 -10
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2024
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 type AILabelContentProps = React.HTMLAttributes<HTMLSpanElement>;
9
+ export declare const AILabelContent: React.ForwardRefExoticComponent<AILabelContentProps & React.RefAttributes<unknown>>;
10
+ export type AILabelActionsProps = React.HTMLAttributes<HTMLSpanElement>;
11
+ export declare const AILabelActions: React.ForwardRefExoticComponent<AILabelActionsProps & React.RefAttributes<unknown>>;
12
+ /**
13
+ * Deprecated popover alignment values.
14
+ * @deprecated Use NewPopoverAlignment instead.
15
+ */
16
+ export type DeprecatedAlignment = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'left-bottom' | 'left-top' | 'right-bottom' | 'right-top';
17
+ export type NewAlignment = 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-end' | 'left-start' | 'right-end' | 'right-start';
18
+ export type Alignment = DeprecatedAlignment | NewAlignment;
19
+ interface AILabelProps {
20
+ AILabelContent?: React.ReactNode;
21
+ aiText?: string;
22
+ aiTextLabel?: string;
23
+ textLabel?: string;
24
+ align?: Alignment;
25
+ autoAlign?: boolean;
26
+ children?: React.ReactNode;
27
+ className?: string;
28
+ kind?: 'default' | 'inline';
29
+ onRevertClick?: (evt: React.MouseEvent<HTMLButtonElement>) => void;
30
+ revertActive?: boolean;
31
+ revertLabel?: string;
32
+ size?: 'mini' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
33
+ 'aria-label'?: string;
34
+ slugLabel?: string;
35
+ }
36
+ export declare const AILabel: React.ForwardRefExoticComponent<AILabelProps & React.RefAttributes<HTMLDivElement>>;
37
+ export {};
@@ -8,10 +8,12 @@
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import cx from 'classnames';
10
10
  import PropTypes from 'prop-types';
11
+ import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
11
12
  import React__default from 'react';
12
13
  import { usePrefix } from '../../internal/usePrefix.js';
13
14
  import { ToggletipContent, ToggletipActions, Toggletip, ToggletipButton } from '../Toggletip/index.js';
14
15
  import { IconButton } from '../IconButton/index.js';
16
+ import { mapPopoverAlignProp } from '../../tools/createPropAdapter.js';
15
17
  import { Undo } from '@carbon/icons-react';
16
18
  import { useId } from '../../internal/useId.js';
17
19
  import deprecate from '../../prop-types/deprecate.js';
@@ -19,11 +21,15 @@ import deprecate from '../../prop-types/deprecate.js';
19
21
  var _Undo;
20
22
  const AILabelContent = /*#__PURE__*/React__default.forwardRef(function AILabelContent(_ref, ref) {
21
23
  let {
24
+ className,
22
25
  children,
23
- className
26
+ ...rest
24
27
  } = _ref;
25
28
  const prefix = usePrefix();
26
- const hasAILabelActions = React__default.Children.toArray(children).some(child => child.type?.displayName === 'AILabelActions');
29
+ const hasAILabelActions = React__default.Children.toArray(children).some(child => {
30
+ const item = child;
31
+ item.type?.displayName === 'AILabelActions';
32
+ });
27
33
  const aiLabelContentClasses = cx(className, {
28
34
  [`${prefix}--slug-content`]: true,
29
35
  [`${prefix}--slug-content--with-actions`]: hasAILabelActions
@@ -45,16 +51,16 @@ AILabelContent.propTypes = {
45
51
  };
46
52
  const AILabelActions = /*#__PURE__*/React__default.forwardRef(function AILabelActions(_ref2, ref) {
47
53
  let {
54
+ className,
48
55
  children,
49
- className
56
+ ...rest
50
57
  } = _ref2;
51
58
  const prefix = usePrefix();
52
59
  const aiLabelActionsClasses = cx(className, {
53
60
  [`${prefix}--slug-actions`]: true
54
61
  });
55
62
  return /*#__PURE__*/React__default.createElement(ToggletipActions, {
56
- className: aiLabelActionsClasses,
57
- ref: ref
63
+ className: aiLabelActionsClasses
58
64
  }, children);
59
65
  });
60
66
  AILabelActions.displayName = 'AILabelActions';
@@ -68,6 +74,15 @@ AILabelActions.propTypes = {
68
74
  */
69
75
  className: PropTypes.string
70
76
  };
77
+
78
+ /**
79
+ * Deprecated popover alignment values.
80
+ * @deprecated Use NewPopoverAlignment instead.
81
+ */
82
+
83
+ const propMappingFunction = deprecatedValue => {
84
+ return mapPopoverAlignProp(deprecatedValue);
85
+ };
71
86
  const AILabel = /*#__PURE__*/React__default.forwardRef(function AILabel(_ref3, ref) {
72
87
  let {
73
88
  aiText = 'AI',
@@ -143,23 +158,32 @@ AILabel.propTypes = {
143
158
  /**
144
159
  * Specify how the popover should align with the button
145
160
  */
146
- align: PropTypes.oneOf(['top', 'top-left',
161
+ align: deprecateValuesWithin(PropTypes.oneOf(['top', 'top-left',
147
162
  // deprecated use top-start instead
148
- 'top-start', 'top-right',
163
+ 'top-right',
149
164
  // deprecated use top-end instead
150
- 'top-end', 'bottom', 'bottom-left',
165
+
166
+ 'bottom', 'bottom-left',
151
167
  // deprecated use bottom-start instead
152
- 'bottom-start', 'bottom-right',
168
+ 'bottom-right',
153
169
  // deprecated use bottom-end instead
154
- 'bottom-end', 'left', 'left-bottom',
170
+
171
+ 'left', 'left-bottom',
155
172
  // deprecated use left-end instead
156
- 'left-end', 'left-top',
173
+ 'left-top',
157
174
  // deprecated use left-start instead
158
- 'left-start', 'right', 'right-bottom',
175
+
176
+ 'right', 'right-bottom',
159
177
  // deprecated use right-end instead
160
- 'right-end', 'right-top',
178
+ 'right-top',
161
179
  // deprecated use right-start instead
162
- 'right-start']),
180
+
181
+ // new values to match floating-ui
182
+ 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
183
+ //allowed prop values
184
+ ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
185
+ //optional mapper function
186
+ propMappingFunction),
163
187
  /**
164
188
  * Specify the text that will be provided to the aria-label of the `AILabel` button
165
189
  */
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
- import { PropsWithChildren } from 'react';
8
+ import { PropsWithChildren, ReactNode } from 'react';
9
9
  export interface AccordionProps {
10
10
  /**
11
11
  * Specify the alignment of the accordion heading
@@ -17,6 +17,10 @@ export interface AccordionProps {
17
17
  * the container node.
18
18
  */
19
19
  className?: string;
20
+ /**
21
+ * Pass in the children that will be rendered within the Accordion
22
+ */
23
+ children?: ReactNode;
20
24
  /**
21
25
  * Specify whether an individual AccordionItem
22
26
  * should be disabled.
@@ -54,7 +54,7 @@ const BreadcrumbItem = /*#__PURE__*/React__default.forwardRef(function Breadcrum
54
54
  ref: ref
55
55
  }, rest), href ? /*#__PURE__*/React__default.createElement(Link, {
56
56
  href: href,
57
- "aria-current": ariaCurrent
57
+ "aria-current": ariaCurrent || isCurrentPage
58
58
  }, children) : /*#__PURE__*/React__default.createElement(Text, {
59
59
  className: `${prefix}--link`
60
60
  }, children));
@@ -5,6 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React from 'react';
8
+ import { IconButtonKind } from '../IconButton';
8
9
  import { PolymorphicProps } from '../../types/common';
9
10
  export declare const ButtonKinds: readonly ["primary", "secondary", "danger", "ghost", "danger--primary", "danger--ghost", "danger--tertiary", "tertiary"];
10
11
  export type ButtonKind = (typeof ButtonKinds)[number];
@@ -43,7 +44,7 @@ export interface ButtonBaseProps extends React.ButtonHTMLAttributes<HTMLButtonEl
43
44
  /**
44
45
  * Specify the kind of Button you want to create
45
46
  */
46
- kind?: ButtonKind;
47
+ kind?: ButtonBaseProps['hasIconOnly'] extends true ? IconButtonKind : ButtonKind;
47
48
  /**
48
49
  * Optional prop to allow overriding the icon rendering.
49
50
  * Can be a React component class
@@ -8,7 +8,7 @@
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import PropTypes from 'prop-types';
10
10
  import React__default, { useRef } from 'react';
11
- import { IconButton } from '../IconButton/index.js';
11
+ import { IconButton, IconButtonKinds } from '../IconButton/index.js';
12
12
  import { composeEventHandlers } from '../../tools/events.js';
13
13
  import ButtonBase from './ButtonBase.js';
14
14
 
@@ -141,8 +141,19 @@ Button.propTypes = {
141
141
  /**
142
142
  * Specify the kind of Button you want to create
143
143
  */
144
- // TODO: this should be either ButtonKinds or IconButtonKinds based on the value of "hasIconOnly"
145
- kind: PropTypes.oneOf(ButtonKinds),
144
+ kind: (props, propName, componentName) => {
145
+ const {
146
+ hasIconOnly
147
+ } = props;
148
+ const validKinds = hasIconOnly ? IconButtonKinds : ButtonKinds;
149
+ if (props[propName] === undefined) {
150
+ return null;
151
+ }
152
+ if (!validKinds.includes(props[propName])) {
153
+ return new Error(`Invalid prop \`${propName}\` supplied to \`${componentName}\`. Expected one of ${validKinds.join(', ')}.`);
154
+ }
155
+ return null;
156
+ },
146
157
  /**
147
158
  * Provide an optional function to be called when the button element
148
159
  * loses focus
@@ -11,6 +11,10 @@ export interface CodeSnippetProps {
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 a label to be read by screen readers on the containing textbox
16
20
  * node
@@ -96,7 +100,7 @@ export interface CodeSnippetProps {
96
100
  */
97
101
  wrapText?: boolean;
98
102
  }
99
- declare function CodeSnippet({ align, className, type, children, disabled, feedback, feedbackTimeout, onClick, ['aria-label']: ariaLabel, ariaLabel: deprecatedAriaLabel, copyText, copyButtonDescription, light, showMoreText, showLessText, hideCopyButton, wrapText, maxCollapsedNumberOfRows, maxExpandedNumberOfRows, minCollapsedNumberOfRows, minExpandedNumberOfRows, ...rest }: PropsWithChildren<CodeSnippetProps>): import("react/jsx-runtime").JSX.Element;
103
+ declare function CodeSnippet({ align, autoAlign, className, type, children, disabled, feedback, feedbackTimeout, onClick, ['aria-label']: ariaLabel, ariaLabel: deprecatedAriaLabel, copyText, copyButtonDescription, light, showMoreText, showLessText, hideCopyButton, wrapText, maxCollapsedNumberOfRows, maxExpandedNumberOfRows, minCollapsedNumberOfRows, minExpandedNumberOfRows, ...rest }: PropsWithChildren<CodeSnippetProps>): import("react/jsx-runtime").JSX.Element;
100
104
  declare namespace CodeSnippet {
101
105
  var propTypes: {
102
106
  /**
@@ -114,6 +118,10 @@ declare namespace CodeSnippet {
114
118
  * node
115
119
  */
116
120
  ariaLabel: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
121
+ /**
122
+ * **Experimental**: Will attempt to automatically align the tooltip
123
+ */
124
+ autoAlign: PropTypes.Requireable<boolean>;
117
125
  /**
118
126
  * Provide the content of your CodeSnippet as a node or string
119
127
  */
@@ -28,6 +28,7 @@ const defaultMinExpandedNumberOfRows = 16;
28
28
  function CodeSnippet(_ref) {
29
29
  let {
30
30
  align = 'bottom',
31
+ autoAlign = false,
31
32
  className,
32
33
  type = 'single',
33
34
  children,
@@ -150,6 +151,7 @@ function CodeSnippet(_ref) {
150
151
  }
151
152
  return /*#__PURE__*/React__default.createElement(Copy, _extends({}, rest, {
152
153
  align: align,
154
+ autoAlign: autoAlign,
153
155
  onClick: handleCopyClick,
154
156
  "aria-label": deprecatedAriaLabel || ariaLabel,
155
157
  "aria-describedby": uid,
@@ -205,6 +207,7 @@ function CodeSnippet(_ref) {
205
207
  className: `${prefix}--snippet__overflow-indicator--right`
206
208
  }), !hideCopyButton && /*#__PURE__*/React__default.createElement(CopyButton, {
207
209
  align: align,
210
+ autoAlign: autoAlign,
208
211
  size: type === 'multi' ? 'sm' : 'md',
209
212
  disabled: disabled,
210
213
  onClick: handleCopyClick,
@@ -241,6 +244,10 @@ CodeSnippet.propTypes = {
241
244
  * node
242
245
  */
243
246
  ariaLabel: deprecate(PropTypes.string, 'This prop syntax has been deprecated. Please use the new `aria-label`.'),
247
+ /**
248
+ * **Experimental**: Will attempt to automatically align the tooltip
249
+ */
250
+ autoAlign: PropTypes.bool,
244
251
  /**
245
252
  * Provide the content of your CodeSnippet as a node or string
246
253
  */
@@ -22,7 +22,7 @@ import { usePrefix } from '../../internal/usePrefix.js';
22
22
  import '../FluidForm/FluidForm.js';
23
23
  import { FormContext } from '../FluidForm/FormContext.js';
24
24
  import { useFloating, flip, autoUpdate } from '@floating-ui/react';
25
- import { hide } from '../../node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js';
25
+ import { hide } from '../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js';
26
26
  import { Text } from '../Text/Text.js';
27
27
  import { match } from '../../internal/keyboard/match.js';
28
28
  import { ListBoxSize } from '../ListBox/ListBoxPropTypes.js';
@@ -36,7 +36,8 @@ const {
36
36
  ItemMouseMove,
37
37
  InputKeyDownArrowUp,
38
38
  InputKeyDownArrowDown,
39
- MenuMouseLeave
39
+ MenuMouseLeave,
40
+ FunctionSelectItem
40
41
  } = useCombobox.stateChangeTypes;
41
42
  const defaultItemToString = item => {
42
43
  if (typeof item === 'string') {
@@ -213,19 +214,40 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
213
214
  } = changes;
214
215
  switch (type) {
215
216
  case InputBlur:
216
- if (state.inputValue && highlightedIndex == '-1' && changes.selectedItem) {
217
- return {
218
- ...changes,
219
- inputValue: itemToString(changes.selectedItem)
220
- };
221
- } else if (state.inputValue && highlightedIndex == '-1' && !allowCustomValue && !changes.selectedItem) {
222
- return {
223
- ...changes,
224
- inputValue: ''
225
- };
226
- } else {
217
+ {
218
+ if (allowCustomValue && highlightedIndex == '-1') {
219
+ const customValue = inputValue;
220
+ changes.selectedItem = customValue;
221
+ if (onChange) {
222
+ onChange({
223
+ selectedItem: inputValue,
224
+ inputValue
225
+ });
226
+ }
227
+ return changes;
228
+ }
229
+ if (state.inputValue && highlightedIndex == '-1' && changes.selectedItem) {
230
+ return {
231
+ ...changes,
232
+ inputValue: itemToString(changes.selectedItem)
233
+ };
234
+ }
235
+ if (state.inputValue && highlightedIndex == '-1' && !allowCustomValue && !changes.selectedItem) {
236
+ return {
237
+ ...changes,
238
+ inputValue: ''
239
+ };
240
+ }
227
241
  return changes;
228
242
  }
243
+ case FunctionSelectItem:
244
+ if (onChange) {
245
+ onChange({
246
+ selectedItem: changes.selectedItem,
247
+ inputValue: changes.inputValue
248
+ });
249
+ }
250
+ return changes;
229
251
  case InputKeyDownEnter:
230
252
  if (allowCustomValue) {
231
253
  setInputValue(inputValue);
@@ -292,7 +314,8 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
292
314
  [`${prefix}--combo-box--invalid--focused`]: invalid && isFocused,
293
315
  [`${prefix}--list-box--up`]: direction === 'top',
294
316
  [`${prefix}--combo-box--warning`]: showWarning,
295
- [`${prefix}--combo-box--readonly`]: readOnly
317
+ [`${prefix}--combo-box--readonly`]: readOnly,
318
+ [`${prefix}--autoalign`]: autoAlign
296
319
  });
297
320
  const titleClasses = cx(`${prefix}--label`, {
298
321
  [`${prefix}--label--disabled`]: disabled
@@ -19,8 +19,8 @@ import { useAttachedMenu } from '../../internal/useAttachedMenu.js';
19
19
  import { useId } from '../../internal/useId.js';
20
20
  import { usePrefix } from '../../internal/usePrefix.js';
21
21
  import { flip, size, useFloating, autoUpdate } from '@floating-ui/react';
22
+ import { hide } from '../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js';
22
23
  import mergeRefs from '../../tools/mergeRefs.js';
23
- import { hide } from '../../node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js';
24
24
 
25
25
  var _ChevronDown;
26
26
  const defaultTranslations = {
@@ -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
  */
@@ -18,6 +18,7 @@ import { noopFn } from '../../internal/noopFn.js';
18
18
  function Copy(_ref) {
19
19
  let {
20
20
  align = 'bottom',
21
+ autoAlign = false,
21
22
  children,
22
23
  className,
23
24
  feedback = 'Copied!',
@@ -52,6 +53,7 @@ function Copy(_ref) {
52
53
  return /*#__PURE__*/React__default.createElement(IconButton, _extends({
53
54
  closeOnActivation: false,
54
55
  align: align,
56
+ autoAlign: autoAlign,
55
57
  className: classNames,
56
58
  label: animation ? feedback : initialLabel,
57
59
  onClick: composeEventHandlers([onClick, handleClick]),
@@ -65,6 +67,10 @@ Copy.propTypes = {
65
67
  * Specify how the trigger should align with the tooltip
66
68
  */
67
69
  align: PropTypes.oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right']),
70
+ /**
71
+ * **Experimental**: Will attempt to automatically align the tooltip
72
+ */
73
+ autoAlign: PropTypes.bool,
68
74
  /**
69
75
  * Pass in content to be rendered in the underlying `<button>`
70
76
  */
@@ -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
  */
@@ -18,6 +18,7 @@ import { noopFn } from '../../internal/noopFn.js';
18
18
  function CopyButton(_ref) {
19
19
  let {
20
20
  align = 'bottom',
21
+ autoAlign = false,
21
22
  feedback = 'Copied!',
22
23
  feedbackTimeout = 2000,
23
24
  iconDescription = 'Copy to clipboard',
@@ -36,6 +37,7 @@ function CopyButton(_ref) {
36
37
  feedbackTimeout: feedbackTimeout,
37
38
  onClick: onClick,
38
39
  align: align,
40
+ autoAlign: autoAlign,
39
41
  className: cx(className, `${prefix}--copy-btn`),
40
42
  "aria-label": iconDescription
41
43
  }, other), /*#__PURE__*/React__default.createElement(Copy$1, {
@@ -47,6 +49,10 @@ CopyButton.propTypes = {
47
49
  * Specify how the trigger should align with the tooltip
48
50
  */
49
51
  align: PropTypes.oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right']),
52
+ /**
53
+ * **Experimental**: Will attempt to automatically align the tooltip
54
+ */
55
+ autoAlign: PropTypes.bool,
50
56
  /**
51
57
  * Specify an optional className to be applied to the underlying `<button>`
52
58
  */
@@ -22,7 +22,7 @@ type TableExpandHeaderPropsBase = {
22
22
  * Specify the string read by a voice reader when the expand trigger is
23
23
  * focused
24
24
  */
25
- ['aria-label']: string;
25
+ ['aria-label']?: string;
26
26
  /**
27
27
  * @deprecated The enableExpando prop is being replaced by `enableToggle`
28
28
  */
@@ -79,7 +79,7 @@ declare const TableExpandHeader: {
79
79
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
80
80
  className: PropTypes.Requireable<string>;
81
81
  /**
82
- * The enableExpando prop is being replaced by enableToggle
82
+ * The enableExpando prop is being replaced by TableExpandHeader
83
83
  */
84
84
  enableExpando: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
85
85
  /**
@@ -69,7 +69,7 @@ TableExpandHeader.propTypes = {
69
69
  children: PropTypes.node,
70
70
  className: PropTypes.string,
71
71
  /**
72
- * The enableExpando prop is being replaced by enableToggle
72
+ * The enableExpando prop is being replaced by TableExpandHeader
73
73
  */
74
74
  enableExpando: deprecate(PropTypes.bool, 'The `enableExpando` prop has been deprecated in favor of `enableToggle`. This prop will be removed in the next major release.'),
75
75
  /**
@@ -554,6 +554,7 @@ const DatePicker = /*#__PURE__*/React__default.forwardRef(function DatePicker(_r
554
554
  if (!calendarRef.current || !startInputField.current) return;
555
555
  const handleKeyDown = event => {
556
556
  if (match(event, Tab) && !event.shiftKey && document.activeElement === endInputField.current && calendarRef.current.isOpen) {
557
+ event.preventDefault();
557
558
  calendarRef.current.close();
558
559
  // Remove focus from endDate calendar input
559
560
  document.activeElement instanceof HTMLElement &&
@@ -19,7 +19,7 @@ import '../FluidForm/FluidForm.js';
19
19
  import { FormContext } from '../FluidForm/FormContext.js';
20
20
  import { useId } from '../../internal/useId.js';
21
21
  import { useFloating, size, flip, autoUpdate } from '@floating-ui/react';
22
- import { hide } from '../../node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js';
22
+ import { hide } from '../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js';
23
23
  import { ListBoxSize, ListBoxType } from '../ListBox/ListBoxPropTypes.js';
24
24
 
25
25
  const {
@@ -185,7 +185,7 @@ const Dropdown = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
185
185
  [`${prefix}--dropdown--readonly`]: readOnly,
186
186
  [`${prefix}--dropdown--${size$1}`]: size$1,
187
187
  [`${prefix}--list-box--up`]: direction === 'top',
188
- [`${prefix}--dropdown--autoalign`]: autoAlign
188
+ [`${prefix}--autoalign`]: autoAlign
189
189
  });
190
190
  const titleClasses = cx(`${prefix}--label`, {
191
191
  [`${prefix}--label--disabled`]: disabled,
@@ -8,6 +8,7 @@
8
8
  import { FeatureFlags as FeatureFlags$1, createScope } from '@carbon/feature-flags';
9
9
  import PropTypes from 'prop-types';
10
10
  import React__default, { createContext, useContext, useState, useRef, useEffect } from 'react';
11
+ import deprecate from '../../prop-types/deprecate.js';
11
12
 
12
13
  /**
13
14
  * Our FeatureFlagContext is used alongside the FeatureFlags component to enable
@@ -23,17 +24,30 @@ const FeatureFlagContext = /*#__PURE__*/createContext(FeatureFlags$1);
23
24
  function FeatureFlags(_ref) {
24
25
  let {
25
26
  children,
26
- flags = {}
27
+ flags = {},
28
+ enableV12TileDefaultIcons = false,
29
+ enableV12TileRadioIcons = false,
30
+ enableV12Overflowmenu = false,
31
+ enableTreeviewControllable = false,
32
+ enableExperimentalFocusWrapWithoutSentinels = false
27
33
  } = _ref;
28
34
  const parentScope = useContext(FeatureFlagContext);
29
35
  const [prevParentScope, setPrevParentScope] = useState(parentScope);
36
+ const combinedFlags = {
37
+ 'enable-v12-tile-default-icons': enableV12TileDefaultIcons,
38
+ 'enable-v12-tile-radio-icons': enableV12TileRadioIcons,
39
+ 'enable-v12-overflowmenu': enableV12Overflowmenu,
40
+ 'enable-treeview-controllable': enableTreeviewControllable,
41
+ 'enable-experimental-focus-wrap-without-sentinels': enableExperimentalFocusWrapWithoutSentinels,
42
+ ...flags
43
+ };
30
44
  const [scope, updateScope] = useState(() => {
31
- const scope = createScope(flags);
45
+ const scope = createScope(combinedFlags);
32
46
  scope.mergeWithScope(parentScope);
33
47
  return scope;
34
48
  });
35
49
  if (parentScope !== prevParentScope) {
36
- const scope = createScope(flags);
50
+ const scope = createScope(combinedFlags);
37
51
  scope.mergeWithScope(parentScope);
38
52
  updateScope(scope);
39
53
  setPrevParentScope(parentScope);
@@ -42,7 +56,7 @@ function FeatureFlags(_ref) {
42
56
  // We use a custom hook to detect if any of the keys or their values change
43
57
  // for flags that are passed in. If they have changed, then we re-create the
44
58
  // FeatureFlagScope using the new flags
45
- useChangedValue(flags, isEqual, changedFlags => {
59
+ useChangedValue(combinedFlags, isEqual, changedFlags => {
46
60
  const scope = createScope(changedFlags);
47
61
  scope.mergeWithScope(parentScope);
48
62
  updateScope(scope);
@@ -54,9 +68,14 @@ function FeatureFlags(_ref) {
54
68
  FeatureFlags.propTypes = {
55
69
  children: PropTypes.node,
56
70
  /**
57
- * Provide the feature flags to enabled or disabled in the current React tree
71
+ * Provide the feature flags to enabled or disabled in the current Rea,ct tree
58
72
  */
59
- flags: PropTypes.objectOf(PropTypes.bool)
73
+ flags: deprecate(PropTypes.objectOf(PropTypes.bool), 'The `flags` prop for `FeatureFlag` has ' + 'been deprecated. Please run the `featureflag-deprecate-flags-prop` codemod to migrate to individual boolean props.' + `npx @carbon/upgrade migrate featureflag-deprecate-flags-prop --write`),
74
+ enableV12TileDefaultIcons: PropTypes.bool,
75
+ enableV12TileRadioIcons: PropTypes.bool,
76
+ enableV12Overflowmenu: PropTypes.bool,
77
+ enableTreeviewControllable: PropTypes.bool,
78
+ enableExperimentalFocusWrapWithoutSentinels: PropTypes.bool
60
79
  };
61
80
 
62
81
  /**
@@ -98,7 +117,8 @@ function useChangedValue(value, compare, callback) {
98
117
  */
99
118
  function useFeatureFlag(flag) {
100
119
  const scope = useContext(FeatureFlagContext);
101
- return scope.enabled(flag);
120
+ //updated to return false for undefined flags
121
+ return scope.enabled(flag) ?? false;
102
122
  }
103
123
 
104
124
  /**
@@ -0,0 +1,15 @@
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 FluidNumberInputSkeletonProps {
9
+ /**
10
+ * Specify an optional className to be applied to the outer FluidForm wrapper
11
+ */
12
+ className?: string;
13
+ }
14
+ declare const FluidNumberInputSkeleton: React.FC<FluidNumberInputSkeletonProps>;
15
+ export default FluidNumberInputSkeleton;