@carbon/react 1.63.1 → 1.64.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 (114) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1558 -1265
  2. package/es/components/{Slug → AILabel}/index.js +47 -35
  3. package/es/components/{AiSkeleton/AiSkeletonIcon.d.ts → AISkeleton/AISkeletonIcon.d.ts} +4 -4
  4. package/es/components/{AiSkeleton/AiSkeletonIcon.js → AISkeleton/AISkeletonIcon.js} +5 -5
  5. package/es/components/{AiSkeleton/AiSkeletonPlaceholder.d.ts → AISkeleton/AISkeletonPlaceholder.d.ts} +4 -4
  6. package/es/components/{AiSkeleton/AiSkeletonPlaceholder.js → AISkeleton/AISkeletonPlaceholder.js} +5 -5
  7. package/es/components/{AiSkeleton/AiSkeletonText.d.ts → AISkeleton/AISkeletonText.d.ts} +4 -4
  8. package/es/components/{AiSkeleton/AiSkeletonText.js → AISkeleton/AISkeletonText.js} +3 -3
  9. package/es/components/AISkeleton/index.d.ts +10 -0
  10. package/es/components/CheckboxGroup/CheckboxGroup.js +1 -1
  11. package/es/components/ComboBox/ComboBox.d.ts +21 -6
  12. package/es/components/ComboBox/ComboBox.js +52 -14
  13. package/es/components/ComposedModal/ComposedModal.js +1 -1
  14. package/es/components/DataTable/DataTable.js +1 -1
  15. package/es/components/DataTable/TableSelectRow.js +2 -1
  16. package/es/components/DataTable/TableToolbarSearch.js +2 -2
  17. package/es/components/DatePicker/DatePicker.js +65 -14
  18. package/es/components/DatePicker/plugins/fixEventsPlugin.js +11 -0
  19. package/es/components/DatePickerInput/DatePickerInput.js +1 -1
  20. package/es/components/Dropdown/Dropdown.d.ts +6 -4
  21. package/es/components/Dropdown/Dropdown.js +18 -10
  22. package/es/components/FluidMultiSelect/FluidMultiSelect.js +10 -6
  23. package/es/components/Menu/MenuItem.js +45 -63
  24. package/es/components/Modal/Modal.js +1 -1
  25. package/es/components/MultiSelect/FilterableMultiSelect.d.ts +6 -4
  26. package/es/components/MultiSelect/FilterableMultiSelect.js +50 -27
  27. package/es/components/MultiSelect/MultiSelect.d.ts +6 -4
  28. package/es/components/MultiSelect/MultiSelect.js +12 -8
  29. package/es/components/NumberInput/NumberInput.js +2 -2
  30. package/es/components/OverflowMenu/OverflowMenu.js +2 -1
  31. package/es/components/OverflowMenu/next/index.js +2 -1
  32. package/es/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
  33. package/es/components/RadioTile/RadioTile.js +1 -1
  34. package/es/components/Select/Select.js +1 -1
  35. package/es/components/Tabs/Tabs.js +3 -3
  36. package/es/components/Tag/DismissibleTag.js +1 -1
  37. package/es/components/Tag/OperationalTag.js +1 -1
  38. package/es/components/Tag/SelectableTag.js +3 -1
  39. package/es/components/Tag/Tag.js +1 -1
  40. package/es/components/TextArea/TextArea.js +1 -1
  41. package/es/components/TextInput/PasswordInput.js +5 -0
  42. package/es/components/TextInput/TextInput.js +1 -1
  43. package/es/components/Tile/Tile.js +2 -2
  44. package/es/components/TreeView/TreeNode.d.ts +150 -0
  45. package/es/components/TreeView/TreeNode.js +22 -15
  46. package/es/components/TreeView/TreeView.d.ts +59 -0
  47. package/es/components/TreeView/TreeView.js +37 -23
  48. package/es/components/TreeView/index.d.ts +11 -0
  49. package/es/components/UIShell/SwitcherItem.d.ts +4 -0
  50. package/es/components/UIShell/SwitcherItem.js +7 -1
  51. package/es/index.d.ts +4 -2
  52. package/es/index.js +6 -6
  53. package/es/node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js +143 -0
  54. package/es/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs.js +39 -0
  55. package/lib/components/{Slug → AILabel}/index.js +49 -37
  56. package/lib/components/{AiSkeleton/AiSkeletonIcon.d.ts → AISkeleton/AISkeletonIcon.d.ts} +4 -4
  57. package/lib/components/{AiSkeleton/AiSkeletonIcon.js → AISkeleton/AISkeletonIcon.js} +5 -5
  58. package/lib/components/{AiSkeleton/AiSkeletonPlaceholder.d.ts → AISkeleton/AISkeletonPlaceholder.d.ts} +4 -4
  59. package/lib/components/{AiSkeleton/AiSkeletonPlaceholder.js → AISkeleton/AISkeletonPlaceholder.js} +5 -5
  60. package/lib/components/{AiSkeleton/AiSkeletonText.d.ts → AISkeleton/AISkeletonText.d.ts} +4 -4
  61. package/lib/components/{AiSkeleton/AiSkeletonText.js → AISkeleton/AISkeletonText.js} +3 -3
  62. package/lib/components/AISkeleton/index.d.ts +10 -0
  63. package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -1
  64. package/lib/components/ComboBox/ComboBox.d.ts +21 -6
  65. package/lib/components/ComboBox/ComboBox.js +52 -14
  66. package/lib/components/ComposedModal/ComposedModal.js +1 -1
  67. package/lib/components/DataTable/DataTable.js +2 -2
  68. package/lib/components/DataTable/TableSelectRow.js +2 -1
  69. package/lib/components/DataTable/TableToolbarSearch.js +2 -2
  70. package/lib/components/DatePicker/DatePicker.js +65 -14
  71. package/lib/components/DatePicker/plugins/fixEventsPlugin.js +11 -0
  72. package/lib/components/DatePickerInput/DatePickerInput.js +1 -1
  73. package/lib/components/Dropdown/Dropdown.d.ts +6 -4
  74. package/lib/components/Dropdown/Dropdown.js +18 -10
  75. package/lib/components/FluidMultiSelect/FluidMultiSelect.js +10 -6
  76. package/lib/components/Menu/MenuItem.js +44 -62
  77. package/lib/components/Modal/Modal.js +1 -1
  78. package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +6 -4
  79. package/lib/components/MultiSelect/FilterableMultiSelect.js +49 -26
  80. package/lib/components/MultiSelect/MultiSelect.d.ts +6 -4
  81. package/lib/components/MultiSelect/MultiSelect.js +12 -8
  82. package/lib/components/NumberInput/NumberInput.js +2 -2
  83. package/lib/components/OverflowMenu/OverflowMenu.js +2 -1
  84. package/lib/components/OverflowMenu/next/index.js +2 -1
  85. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
  86. package/lib/components/RadioTile/RadioTile.js +1 -1
  87. package/lib/components/Select/Select.js +1 -1
  88. package/lib/components/Tabs/Tabs.js +2 -2
  89. package/lib/components/Tag/DismissibleTag.js +1 -1
  90. package/lib/components/Tag/OperationalTag.js +1 -1
  91. package/lib/components/Tag/SelectableTag.js +3 -1
  92. package/lib/components/Tag/Tag.js +1 -1
  93. package/lib/components/TextArea/TextArea.js +1 -1
  94. package/lib/components/TextInput/PasswordInput.js +5 -0
  95. package/lib/components/TextInput/TextInput.js +1 -1
  96. package/lib/components/Tile/Tile.js +2 -2
  97. package/lib/components/TreeView/TreeNode.d.ts +150 -0
  98. package/lib/components/TreeView/TreeNode.js +24 -17
  99. package/lib/components/TreeView/TreeView.d.ts +59 -0
  100. package/lib/components/TreeView/TreeView.js +39 -25
  101. package/lib/components/TreeView/index.d.ts +11 -0
  102. package/lib/components/UIShell/SwitcherItem.d.ts +4 -0
  103. package/lib/components/UIShell/SwitcherItem.js +7 -1
  104. package/lib/index.d.ts +4 -2
  105. package/lib/index.js +20 -14
  106. package/lib/node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js +148 -0
  107. package/lib/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs.js +47 -0
  108. package/package.json +4 -4
  109. package/scss/components/ai-label/_ai-label.scss +9 -0
  110. package/scss/components/ai-label/_index.scss +9 -0
  111. package/es/components/AiSkeleton/index.d.ts +0 -10
  112. package/es/components/DataTable/tools/instanceId.js +0 -20
  113. package/lib/components/AiSkeleton/index.d.ts +0 -10
  114. package/lib/components/DataTable/tools/instanceId.js +0 -24
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
8
  import React from 'react';
9
- interface AiSkeletonIconProps {
9
+ interface AISkeletonIconProps {
10
10
  /**
11
11
  * Specify an optional className to add.
12
12
  */
@@ -16,8 +16,8 @@ interface AiSkeletonIconProps {
16
16
  */
17
17
  style?: React.CSSProperties;
18
18
  }
19
- declare const AiSkeletonIcon: {
20
- ({ className, ...rest }: AiSkeletonIconProps): import("react/jsx-runtime").JSX.Element;
19
+ declare const AISkeletonIcon: {
20
+ ({ className, ...rest }: AISkeletonIconProps): import("react/jsx-runtime").JSX.Element;
21
21
  propTypes: {
22
22
  /**
23
23
  * Specify an optional className to add.
@@ -29,4 +29,4 @@ declare const AiSkeletonIcon: {
29
29
  style: PropTypes.Requireable<object>;
30
30
  };
31
31
  };
32
- export default AiSkeletonIcon;
32
+ export default AISkeletonIcon;
@@ -22,20 +22,20 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
22
22
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
23
23
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
24
24
 
25
- const AiSkeletonIcon = _ref => {
25
+ const AISkeletonIcon = _ref => {
26
26
  let {
27
27
  className,
28
28
  ...rest
29
29
  } = _ref;
30
30
  const prefix = usePrefix.usePrefix();
31
- const AiSkeletonIconClasses = cx__default["default"](className, {
31
+ const AISkeletonIconClasses = cx__default["default"](className, {
32
32
  [`${prefix}--skeleton__icon--ai`]: true
33
33
  });
34
34
  return /*#__PURE__*/React__default["default"].createElement(SkeletonIcon["default"], _rollupPluginBabelHelpers["extends"]({
35
- className: AiSkeletonIconClasses
35
+ className: AISkeletonIconClasses
36
36
  }, rest));
37
37
  };
38
- AiSkeletonIcon.propTypes = {
38
+ AISkeletonIcon.propTypes = {
39
39
  /**
40
40
  * Specify an optional className to add.
41
41
  */
@@ -46,4 +46,4 @@ AiSkeletonIcon.propTypes = {
46
46
  style: PropTypes__default["default"].object
47
47
  };
48
48
 
49
- exports["default"] = AiSkeletonIcon;
49
+ exports["default"] = AISkeletonIcon;
@@ -5,14 +5,14 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
- export interface AiSkeletonPlaceholderProps {
8
+ export interface AISkeletonPlaceholderProps {
9
9
  /**
10
10
  * Add a custom class to the component to set the height and width
11
11
  */
12
12
  className?: string;
13
13
  }
14
- declare const AiSkeletonPlaceholder: {
15
- ({ className, ...other }: AiSkeletonPlaceholderProps): import("react/jsx-runtime").JSX.Element;
14
+ declare const AISkeletonPlaceholder: {
15
+ ({ className, ...other }: AISkeletonPlaceholderProps): import("react/jsx-runtime").JSX.Element;
16
16
  propTypes: {
17
17
  /**
18
18
  * Add a custom class to the component
@@ -21,4 +21,4 @@ declare const AiSkeletonPlaceholder: {
21
21
  className: PropTypes.Requireable<string>;
22
22
  };
23
23
  };
24
- export default AiSkeletonPlaceholder;
24
+ export default AISkeletonPlaceholder;
@@ -22,21 +22,21 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
22
22
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
23
23
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
24
24
 
25
- const AiSkeletonPlaceholder = _ref => {
25
+ const AISkeletonPlaceholder = _ref => {
26
26
  let {
27
27
  className,
28
28
  ...other
29
29
  } = _ref;
30
30
  const prefix = usePrefix.usePrefix();
31
- const AiSkeletonPlaceholderClasses = cx__default["default"]({
31
+ const AISkeletonPlaceholderClasses = cx__default["default"]({
32
32
  className,
33
33
  [`${prefix}--skeleton__placeholder--ai`]: true
34
34
  }, className);
35
35
  return /*#__PURE__*/React__default["default"].createElement(SkeletonPlaceholder["default"], _rollupPluginBabelHelpers["extends"]({
36
- className: AiSkeletonPlaceholderClasses
36
+ className: AISkeletonPlaceholderClasses
37
37
  }, other));
38
38
  };
39
- AiSkeletonPlaceholder.propTypes = {
39
+ AISkeletonPlaceholder.propTypes = {
40
40
  /**
41
41
  * Add a custom class to the component
42
42
  * to set the height and width
@@ -44,4 +44,4 @@ AiSkeletonPlaceholder.propTypes = {
44
44
  className: PropTypes__default["default"].string
45
45
  };
46
46
 
47
- exports["default"] = AiSkeletonPlaceholder;
47
+ exports["default"] = AISkeletonPlaceholder;
@@ -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
- interface AiSkeletonTextProps {
8
+ interface AISkeletonTextProps {
9
9
  /**
10
10
  * Specify an optional className to be applied to the container node.
11
11
  */
@@ -27,8 +27,8 @@ interface AiSkeletonTextProps {
27
27
  */
28
28
  width?: string;
29
29
  }
30
- declare const AiSkeletonText: {
31
- ({ className, ...rest }: AiSkeletonTextProps): import("react/jsx-runtime").JSX.Element;
30
+ declare const AISkeletonText: {
31
+ ({ className, ...rest }: AISkeletonTextProps): import("react/jsx-runtime").JSX.Element;
32
32
  propTypes: {
33
33
  /**
34
34
  * Specify an optional className to be applied to the container node
@@ -52,4 +52,4 @@ declare const AiSkeletonText: {
52
52
  width: PropTypes.Requireable<string>;
53
53
  };
54
54
  };
55
- export default AiSkeletonText;
55
+ export default AISkeletonText;
@@ -22,7 +22,7 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
22
22
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
23
23
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
24
24
 
25
- const AiSkeletonText = _ref => {
25
+ const AISkeletonText = _ref => {
26
26
  let {
27
27
  className,
28
28
  ...rest
@@ -35,7 +35,7 @@ const AiSkeletonText = _ref => {
35
35
  className: aiSkeletonTextClasses
36
36
  }, rest));
37
37
  };
38
- AiSkeletonText.propTypes = {
38
+ AISkeletonText.propTypes = {
39
39
  /**
40
40
  * Specify an optional className to be applied to the container node
41
41
  */
@@ -58,4 +58,4 @@ AiSkeletonText.propTypes = {
58
58
  width: PropTypes__default["default"].string
59
59
  };
60
60
 
61
- exports["default"] = AiSkeletonText;
61
+ exports["default"] = AISkeletonText;
@@ -0,0 +1,10 @@
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 AISkeletonPlaceholder from './AISkeletonPlaceholder';
8
+ import AISkeletonIcon from './AISkeletonIcon';
9
+ import AISkeletonText from './AISkeletonText';
10
+ export { AISkeletonText, AISkeletonIcon, AISkeletonPlaceholder };
@@ -58,7 +58,7 @@ const CheckboxGroup = _ref => {
58
58
 
59
59
  // Slug is always size `mini`
60
60
  let normalizedSlug;
61
- if ( /*#__PURE__*/React__default["default"].isValidElement(slug) && slug['type']?.displayName === 'Slug') {
61
+ if ( /*#__PURE__*/React__default["default"].isValidElement(slug) && slug['type']?.displayName === 'AILabel') {
62
62
  normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
63
63
  size: 'mini',
64
64
  kind: 'default'
@@ -4,8 +4,8 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import { UseComboboxProps } from 'downshift';
8
- import { type ReactNode, type ComponentType, type ReactElement, type RefAttributes, type PropsWithChildren, type PropsWithRef, type InputHTMLAttributes, type MouseEvent } from 'react';
7
+ import { UseComboboxProps, UseComboboxActions } from 'downshift';
8
+ import React, { type ReactNode, type ComponentType, type ReactElement, type RefAttributes, type PropsWithChildren, type PropsWithRef, type InputHTMLAttributes, type MouseEvent } from 'react';
9
9
  import { ListBoxSize } from '../ListBox';
10
10
  import { TranslateWithId } from '../../types/common';
11
11
  type ExcludedAttributes = 'id' | 'onChange' | 'onClick' | 'type' | 'size';
@@ -57,12 +57,27 @@ export interface ComboBoxProps<ItemType> extends Omit<InputHTMLAttributes<HTMLIn
57
57
  */
58
58
  disabled?: boolean;
59
59
  /**
60
- * Additional props passed to Downshift. Use with caution: anything you define
61
- * here overrides the components' internal handling of that prop. Downshift
62
- * internals are subject to change, and in some cases they can not be shimmed
63
- * to shield you from potentially breaking changes.
60
+ * Additional props passed to Downshift.
61
+ *
62
+ * **Use with caution:** anything you define here overrides the components'
63
+ * internal handling of that prop. Downshift APIs and internals are subject to
64
+ * change, and in some cases they can not be shimmed by Carbon to shield you
65
+ * from potentially breaking changes.
66
+ *
64
67
  */
65
68
  downshiftProps?: Partial<UseComboboxProps<ItemType>>;
69
+ /**
70
+ * Provide a ref that will be mutated to contain an object of downshift
71
+ * action functions. These can be called to change the internal state of the
72
+ * downshift useCombobox hook.
73
+ *
74
+ * **Use with caution:** calling these actions modifies the internal state of
75
+ * downshift. It may conflict with or override the state management used within
76
+ * Combobox. Downshift APIs and internals are subject to change, and in some
77
+ * cases they can not be shimmed by Carbon to shield you from potentially breaking
78
+ * changes.
79
+ */
80
+ downshiftActions?: React.MutableRefObject<UseComboboxActions<ItemType> | undefined>;
66
81
  /**
67
82
  * Provide helper text that is used alongside the control label for
68
83
  * additional help
@@ -109,6 +109,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
109
109
  className: containerClassName,
110
110
  direction = 'bottom',
111
111
  disabled = false,
112
+ downshiftActions,
112
113
  downshiftProps,
113
114
  helperText,
114
115
  id,
@@ -252,8 +253,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
252
253
  case ToggleButtonClick:
253
254
  if (changes.isOpen && !changes.selectedItem) {
254
255
  return {
255
- ...changes,
256
- highlightedIndex: 0
256
+ ...changes
257
257
  };
258
258
  }
259
259
  return changes;
@@ -293,6 +293,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
293
293
  };
294
294
  const showWarning = !invalid && warn;
295
295
  const className = cx__default["default"](`${prefix}--combo-box`, {
296
+ [`${prefix}--combo-box--invalid--focused`]: invalid && isFocused,
296
297
  [`${prefix}--list-box--up`]: direction === 'top',
297
298
  [`${prefix}--combo-box--warning`]: showWarning,
298
299
  [`${prefix}--combo-box--readonly`]: readOnly
@@ -313,7 +314,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
313
314
  }]);
314
315
  const inputClasses = cx__default["default"](`${prefix}--text-input`, {
315
316
  [`${prefix}--text-input--empty`]: !inputValue,
316
- [`${prefix}--combo-box--input--focus`]: isFocused && !isFluid
317
+ [`${prefix}--combo-box--input--focus`]: isFocused
317
318
  });
318
319
 
319
320
  // needs to be Capitalized for react to render it correctly
@@ -321,23 +322,30 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
321
322
 
322
323
  // Slug is always size `mini`
323
324
  let normalizedSlug;
324
- if (slug && slug['type']?.displayName === 'Slug') {
325
+ if (slug && slug['type']?.displayName === 'AILabel') {
325
326
  normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
326
327
  size: 'mini'
327
328
  });
328
329
  }
329
330
  const {
331
+ // Prop getters
330
332
  getInputProps,
331
333
  getItemProps,
332
334
  getLabelProps,
333
335
  getMenuProps,
334
336
  getToggleButtonProps,
337
+ // State
335
338
  isOpen,
336
339
  highlightedIndex,
337
- selectItem,
338
340
  selectedItem,
339
- toggleMenu,
340
- setHighlightedIndex
341
+ // Actions
342
+ closeMenu,
343
+ openMenu,
344
+ reset,
345
+ selectItem,
346
+ setHighlightedIndex,
347
+ setInputValue: downshiftSetInputValue,
348
+ toggleMenu
341
349
  } = Downshift.useCombobox({
342
350
  items: filterItems(items, itemToString, inputValue),
343
351
  inputValue: inputValue,
@@ -382,6 +390,22 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
382
390
  },
383
391
  ...downshiftProps
384
392
  });
393
+ React.useEffect(() => {
394
+ // Used to expose the downshift actions to consumers for use with downshiftProps
395
+ // An odd pattern, here we mutate the value stored in the ref provided from the consumer.
396
+ // A riff of https://gist.github.com/gaearon/1a018a023347fe1c2476073330cc5509
397
+ if (downshiftActions) {
398
+ downshiftActions.current = {
399
+ closeMenu,
400
+ openMenu,
401
+ reset,
402
+ selectItem,
403
+ setHighlightedIndex,
404
+ setInputValue: downshiftSetInputValue,
405
+ toggleMenu
406
+ };
407
+ }
408
+ }, [closeMenu, openMenu, reset, selectItem, setHighlightedIndex, downshiftSetInputValue, toggleMenu]);
385
409
  const buttonProps = getToggleButtonProps({
386
410
  disabled: disabled || readOnly,
387
411
  onClick: handleToggleClick(isOpen),
@@ -454,9 +478,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
454
478
  }, getInputProps({
455
479
  'aria-controls': isOpen ? undefined : menuProps.id,
456
480
  placeholder,
457
- ref: {
458
- ...mergeRefs["default"](textInput, ref)
459
- },
481
+ ref: mergeRefs["default"](textInput, ref),
460
482
  onKeyDown: event => {
461
483
  if (match.match(event, keys.Space)) {
462
484
  event.stopPropagation();
@@ -596,12 +618,28 @@ ComboBox.propTypes = {
596
618
  */
597
619
  disabled: PropTypes__default["default"].bool,
598
620
  /**
599
- * Additional props passed to Downshift. Use with caution: anything you define
600
- * here overrides the components' internal handling of that prop. Downshift
601
- * internals are subject to change, and in some cases they can not be shimmed
602
- * to shield you from potentially breaking changes.
621
+ * Additional props passed to Downshift.
622
+ *
623
+ * **Use with caution:** anything you define here overrides the components'
624
+ * internal handling of that prop. Downshift APIs and internals are subject to
625
+ * change, and in some cases they can not be shimmed by Carbon to shield you
626
+ * from potentially breaking changes.
603
627
  */
604
628
  downshiftProps: PropTypes__default["default"].object,
629
+ /**
630
+ * Provide a ref that will be mutated to contain an object of downshift
631
+ * action functions. These can be called to change the internal state of the
632
+ * downshift useCombobox hook.
633
+ *
634
+ * **Use with caution:** calling these actions modifies the internal state of
635
+ * downshift. It may conflict with or override the state management used within
636
+ * Combobox. Downshift APIs and internals are subject to change, and in some
637
+ * cases they can not be shimmed by Carbon to shield you from potentially breaking
638
+ * changes.
639
+ */
640
+ downshiftActions: PropTypes__default["default"].exact({
641
+ current: PropTypes__default["default"].any
642
+ }),
605
643
  /**
606
644
  * Provide helper text that is used alongside the control label for
607
645
  * additional help
@@ -257,7 +257,7 @@ const ComposedModal = /*#__PURE__*/React__default["default"].forwardRef(function
257
257
 
258
258
  // Slug is always size `sm`
259
259
  let normalizedSlug;
260
- if (slug && slug['type']?.displayName === 'Slug') {
260
+ if (slug && slug['type']?.displayName === 'AILabel') {
261
261
  normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
262
262
  size: 'sm'
263
263
  });
@@ -19,7 +19,7 @@ var cells = require('./tools/cells.js');
19
19
  var denormalize = require('./tools/denormalize.js');
20
20
  var events = require('../../tools/events.js');
21
21
  var filter = require('./tools/filter.js');
22
- var instanceId = require('./tools/instanceId.js');
22
+ var setupGetInstanceId = require('../../tools/setupGetInstanceId.js');
23
23
  var Table = require('./Table.js');
24
24
  var TableActionList = require('./TableActionList.js');
25
25
  var TableBatchAction = require('./TableBatchAction.js');
@@ -48,7 +48,7 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
48
48
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
49
49
  var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
50
50
 
51
- const getInstanceId = instanceId["default"]();
51
+ const getInstanceId = setupGetInstanceId["default"]();
52
52
  const translationKeys = {
53
53
  expandRow: 'carbon.table.row.expand',
54
54
  collapseRow: 'carbon.table.row.collapse',
@@ -15,6 +15,7 @@ var React = require('react');
15
15
  var cx = require('classnames');
16
16
  var InlineCheckbox = require('../InlineCheckbox/InlineCheckbox.js');
17
17
  var RadioButton = require('../RadioButton/RadioButton.js');
18
+ var useId = require('../../internal/useId.js');
18
19
  var usePrefix = require('../../internal/usePrefix.js');
19
20
  var deprecate = require('../../prop-types/deprecate.js');
20
21
 
@@ -38,7 +39,7 @@ const TableSelectRow = _ref => {
38
39
  className
39
40
  } = _ref;
40
41
  const prefix = usePrefix.usePrefix();
41
- const uniqueNameId = React.useId();
42
+ const uniqueNameId = useId.useId();
42
43
  const selectionInputProps = {
43
44
  id,
44
45
  name: name ? name : uniqueNameId,
@@ -64,7 +64,7 @@ const TableToolbarSearch = _ref => {
64
64
  const [expandedState, setExpandedState] = React.useState(Boolean(defaultExpanded || defaultValue));
65
65
  const expanded = controlled ? expandedProp : expandedState;
66
66
  const [value, setValue] = React.useState(defaultValue || '');
67
- const uniqueId = useId.useId();
67
+ const uniqueId = useId.useId('table-toolbar-search');
68
68
  const [focusTarget, setFocusTarget] = React.useState(null);
69
69
  const prefix = usePrefix.usePrefix();
70
70
  React.useEffect(() => {
@@ -111,7 +111,7 @@ const TableToolbarSearch = _ref => {
111
111
  disabled: disabled,
112
112
  className: searchClasses,
113
113
  value: value,
114
- id: typeof id !== 'undefined' ? id : `table-toolbar-search-${uniqueId.toString()}`,
114
+ id: typeof id !== 'undefined' ? id : uniqueId,
115
115
  labelText: labelText || t('carbon.table.toolbar.search.label'),
116
116
  placeholder: placeholder || t('carbon.table.toolbar.search.placeholder'),
117
117
  onChange: onChange,
@@ -185,25 +185,42 @@ const DatePicker = /*#__PURE__*/React__default["default"].forwardRef(function Da
185
185
  }
186
186
  }, []);
187
187
  const lastStartValue = React.useRef('');
188
+ const [calendarCloseEvent, setCalendarCloseEvent] = React.useState(null);
188
189
 
189
190
  // fix datepicker deleting the selectedDate when the calendar closes
190
- const onCalendarClose = (selectedDates, dateStr) => {
191
- endInputField?.current?.focus();
192
- calendarRef?.current?.calendarContainer?.classList.remove('open');
193
- setTimeout(() => {
194
- if (lastStartValue.current && selectedDates[0] && !startInputField.current.value) {
195
- startInputField.current.value = lastStartValue.current;
196
- calendarRef.current.setDate([startInputField.current.value, endInputField?.current?.value], true, calendarRef.current.config.dateFormat);
197
- }
198
- if (onClose) {
199
- onClose(calendarRef.current.selectedDates, dateStr, calendarRef.current);
200
- }
191
+ const handleCalendarClose = React.useCallback((selectedDates, dateStr, instance) => {
192
+ if (lastStartValue.current && selectedDates[0] && !startInputField.current.value) {
193
+ startInputField.current.value = lastStartValue.current;
194
+ calendarRef.current.setDate([startInputField.current.value, endInputField?.current?.value], true, calendarRef.current.config.dateFormat);
195
+ }
196
+ if (onClose) {
197
+ onClose(selectedDates, dateStr, instance);
198
+ }
199
+ }, [onClose]);
200
+ const onCalendarClose = (selectedDates, dateStr, instance, e) => {
201
+ if (e && e.type === 'clickOutside') {
202
+ return;
203
+ }
204
+ setCalendarCloseEvent({
205
+ selectedDates,
206
+ dateStr,
207
+ instance
201
208
  });
202
209
  };
210
+ React.useEffect(() => {
211
+ if (calendarCloseEvent) {
212
+ const {
213
+ selectedDates,
214
+ dateStr,
215
+ instance
216
+ } = calendarCloseEvent;
217
+ handleCalendarClose(selectedDates, dateStr, instance);
218
+ setCalendarCloseEvent(null);
219
+ }
220
+ }, [calendarCloseEvent, handleCalendarClose]);
203
221
  const endInputField = React.useRef(null);
204
222
  const calendarRef = React.useRef(null);
205
223
  const savedOnChange = useSavedCallback.useSavedCallback(onChange);
206
- const savedOnClose = useSavedCallback.useSavedCallback(datePickerType === 'range' ? onCalendarClose : onClose);
207
224
  const savedOnOpen = useSavedCallback.useSavedCallback(onOpen);
208
225
  const datePickerClasses = cx__default["default"](`${prefix}--date-picker`, {
209
226
  [`${prefix}--date-picker--short`]: short,
@@ -321,6 +338,7 @@ const DatePicker = /*#__PURE__*/React__default["default"].forwardRef(function Da
321
338
  } = endInputField;
322
339
  const flatpickerconfig = {
323
340
  inline: inline ?? false,
341
+ onClose: onCalendarClose,
324
342
  disableMobile: true,
325
343
  defaultDate: value,
326
344
  closeOnSelect: closeOnSelect,
@@ -355,7 +373,6 @@ const DatePicker = /*#__PURE__*/React__default["default"].forwardRef(function Da
355
373
  savedOnChange(...arguments);
356
374
  }
357
375
  },
358
- onClose: savedOnClose,
359
376
  onReady: onHook,
360
377
  onMonthChange: onHook,
361
378
  onYearChange: onHook,
@@ -452,7 +469,7 @@ const DatePicker = /*#__PURE__*/React__default["default"].forwardRef(function Da
452
469
  }
453
470
  };
454
471
  // eslint-disable-next-line react-hooks/exhaustive-deps
455
- }, [savedOnChange, savedOnClose, savedOnOpen, readOnly, closeOnSelect, hasInput]);
472
+ }, [savedOnChange, savedOnOpen, readOnly, closeOnSelect, hasInput]);
456
473
 
457
474
  // this hook allows consumers to access the flatpickr calendar
458
475
  // instance for cases where functions like open() or close()
@@ -499,6 +516,40 @@ const DatePicker = /*#__PURE__*/React__default["default"].forwardRef(function Da
499
516
  calendarRef.current.set('inline', inline);
500
517
  }
501
518
  }, [inline]);
519
+ React.useEffect(() => {
520
+ //when value prop is set to empty, this clears the faltpicker's calendar instance and text input
521
+ if (value === '') {
522
+ calendarRef.current?.clear();
523
+ if (startInputField.current) {
524
+ startInputField.current.value = '';
525
+ }
526
+ if (endInputField.current) {
527
+ endInputField.current.value = '';
528
+ }
529
+ }
530
+ }, [value]);
531
+ React.useEffect(() => {
532
+ const handleMouseDown = event => {
533
+ if (calendarRef.current && calendarRef.current.isOpen && !calendarRef.current.calendarContainer.contains(event.target) && !startInputField.current.contains(event.target) && !endInputField.current?.contains(event.target)) {
534
+ // Close the calendar immediately on mousedown
535
+ closeCalendar();
536
+ }
537
+ };
538
+ const closeCalendar = event => {
539
+ calendarRef.current.close();
540
+ // Remove focus from endDate calendar input
541
+ if (document.activeElement instanceof HTMLElement) {
542
+ document.activeElement.blur();
543
+ }
544
+ onCalendarClose(calendarRef.current.selectedDates, '', calendarRef.current, {
545
+ type: 'clickOutside'
546
+ });
547
+ };
548
+ document.addEventListener('mousedown', handleMouseDown, true);
549
+ return () => {
550
+ document.removeEventListener('mousedown', handleMouseDown, true);
551
+ };
552
+ }, [calendarRef, startInputField, endInputField, onCalendarClose]);
502
553
  React.useEffect(() => {
503
554
  if (calendarRef?.current?.set) {
504
555
  if (value !== undefined) {
@@ -22,6 +22,15 @@ var carbonFlatpickrFixEventsPlugin = (config => fp => {
22
22
  inputTo,
23
23
  lastStartValue
24
24
  } = config;
25
+ /**
26
+ * Handles `click` outside to close calendar
27
+ */
28
+ const handleClickOutside = event => {
29
+ if (!fp.isOpen || fp.calendarContainer.contains(event.target) || event.target === inputFrom || event.target === inputTo) {
30
+ return;
31
+ }
32
+ fp.close();
33
+ };
25
34
  /**
26
35
  * Handles `keydown` event.
27
36
  */
@@ -115,6 +124,7 @@ var carbonFlatpickrFixEventsPlugin = (config => fp => {
115
124
  inputTo.removeEventListener('blur', handleBlur, true);
116
125
  }
117
126
  inputFrom.removeEventListener('keydown', handleKeydown, true);
127
+ document.removeEventListener('click', handleClickOutside, true);
118
128
  };
119
129
 
120
130
  /**
@@ -131,6 +141,7 @@ var carbonFlatpickrFixEventsPlugin = (config => fp => {
131
141
  inputTo.addEventListener('keydown', handleKeydown, true);
132
142
  inputTo.addEventListener('blur', handleBlur, true);
133
143
  }
144
+ document.addEventListener('click', handleClickOutside, true);
134
145
  };
135
146
 
136
147
  /**
@@ -107,7 +107,7 @@ const DatePickerInput = /*#__PURE__*/React__default["default"].forwardRef(functi
107
107
 
108
108
  // Slug is always size `mini`
109
109
  let normalizedSlug;
110
- if (slug && slug['type']?.displayName === 'Slug') {
110
+ if (slug && slug['type']?.displayName === 'AILabel') {
111
111
  normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
112
112
  size: 'mini'
113
113
  });
@@ -36,10 +36,12 @@ export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>,
36
36
  */
37
37
  disabled?: boolean;
38
38
  /**
39
- * Additional props passed to Downshift. Use with caution: anything you define
40
- * here overrides the components' internal handling of that prop. Downshift
41
- * internals are subject to change, and in some cases they can not be shimmed
42
- * to shield you from potentially breaking changes.
39
+ * Additional props passed to Downshift.
40
+ *
41
+ * **Use with caution:** anything you define here overrides the components'
42
+ * internal handling of that prop. Downshift APIs and internals are subject to
43
+ * change, and in some cases they can not be shimmed by Carbon to shield you
44
+ * from potentially breaking changes.
43
45
  */
44
46
  downshiftProps?: Partial<UseSelectProps<ItemType>>;
45
47
  /**