@carbon/react 1.90.0 → 1.91.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 (131) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +986 -926
  2. package/es/components/Breadcrumb/Breadcrumb.Skeleton.d.ts +27 -2
  3. package/es/components/Breadcrumb/Breadcrumb.Skeleton.js +27 -4
  4. package/es/components/Breadcrumb/Breadcrumb.js +2 -1
  5. package/es/components/CodeSnippet/CodeSnippet.d.ts +1 -1
  6. package/es/components/CodeSnippet/CodeSnippet.js +1 -1
  7. package/es/components/ComboBox/ComboBox.js +1 -12
  8. package/es/components/ComboButton/index.js +1 -1
  9. package/es/components/ComposedModal/ComposedModal.js +1 -1
  10. package/es/components/ContentSwitcher/ContentSwitcher.js +2 -2
  11. package/es/components/Copy/Copy.d.ts +1 -1
  12. package/es/components/Copy/Copy.js +1 -1
  13. package/es/components/CopyButton/CopyButton.d.ts +1 -1
  14. package/es/components/CopyButton/CopyButton.js +1 -1
  15. package/es/components/DataTable/DataTable.d.ts +60 -15
  16. package/es/components/DataTable/DataTable.js +106 -179
  17. package/es/components/DataTable/Table.d.ts +2 -2
  18. package/es/components/DataTable/Table.js +1 -1
  19. package/es/components/DataTable/TableExpandHeader.d.ts +1 -1
  20. package/es/components/DataTable/TableExpandHeader.js +1 -1
  21. package/es/components/DatePicker/DatePicker.d.ts +0 -12
  22. package/es/components/DatePicker/DatePicker.js +3 -3
  23. package/es/components/DatePicker/plugins/rangePlugin.d.ts +19 -2
  24. package/es/components/DatePicker/plugins/rangePlugin.js +18 -14
  25. package/es/components/Dropdown/Dropdown.js +1 -12
  26. package/es/components/FeatureFlags/index.js +1 -0
  27. package/es/components/IconButton/index.js +1 -1
  28. package/es/components/Menu/MenuItem.d.ts +1 -1
  29. package/es/components/Menu/MenuItem.js +5 -5
  30. package/es/components/Modal/Modal.js +1 -1
  31. package/es/components/MultiSelect/FilterableMultiSelect.js +1 -1
  32. package/es/components/MultiSelect/MultiSelect.js +1 -12
  33. package/es/components/Notification/Notification.d.ts +6 -6
  34. package/es/components/Notification/Notification.js +6 -6
  35. package/es/components/OverflowMenu/OverflowMenu.js +1 -1
  36. package/es/components/OverflowMenu/next/index.js +1 -1
  37. package/es/components/PaginationNav/PaginationNav.d.ts +20 -0
  38. package/es/components/PaginationNav/PaginationNav.js +34 -5
  39. package/es/components/Popover/index.js +1 -1
  40. package/es/components/Search/Search.d.ts +4 -2
  41. package/es/components/Search/Search.js +5 -4
  42. package/es/components/Slider/Slider.d.ts +144 -188
  43. package/es/components/Slider/Slider.js +787 -710
  44. package/es/components/Slider/index.d.ts +2 -2
  45. package/es/components/Tabs/Tabs.d.ts +4 -0
  46. package/es/components/TextArea/TextArea.js +13 -6
  47. package/es/components/TextInput/ControlledPasswordInput.js +2 -2
  48. package/es/components/TextInput/PasswordInput.js +2 -2
  49. package/es/components/TextInput/TextInput.js +2 -2
  50. package/es/components/TextInput/util.d.ts +17 -5
  51. package/es/components/TextInput/util.js +2 -7
  52. package/es/components/UIShell/HeaderPanel.d.ts +1 -1
  53. package/es/index.d.ts +27 -24
  54. package/es/index.js +43 -41
  55. package/es/internal/defaultItemToString.d.ts +7 -0
  56. package/es/internal/defaultItemToString.js +17 -0
  57. package/es/internal/index.d.ts +1 -0
  58. package/es/prop-types/deprecateValuesWithin.d.ts +8 -1
  59. package/es/prop-types/deprecateValuesWithin.js +6 -6
  60. package/es/prop-types/requiredIfGivenPropIsTruthy.d.ts +8 -7
  61. package/es/prop-types/requiredIfGivenPropIsTruthy.js +10 -10
  62. package/lib/components/Breadcrumb/Breadcrumb.Skeleton.d.ts +27 -2
  63. package/lib/components/Breadcrumb/Breadcrumb.Skeleton.js +27 -4
  64. package/lib/components/Breadcrumb/Breadcrumb.js +2 -1
  65. package/lib/components/CodeSnippet/CodeSnippet.d.ts +1 -1
  66. package/lib/components/CodeSnippet/CodeSnippet.js +1 -1
  67. package/lib/components/ComboBox/ComboBox.js +3 -14
  68. package/lib/components/ComboButton/index.js +1 -1
  69. package/lib/components/ComposedModal/ComposedModal.js +1 -1
  70. package/lib/components/ContentSwitcher/ContentSwitcher.js +1 -1
  71. package/lib/components/Copy/Copy.d.ts +1 -1
  72. package/lib/components/Copy/Copy.js +1 -1
  73. package/lib/components/CopyButton/CopyButton.d.ts +1 -1
  74. package/lib/components/CopyButton/CopyButton.js +1 -1
  75. package/lib/components/DataTable/DataTable.d.ts +60 -15
  76. package/lib/components/DataTable/DataTable.js +106 -179
  77. package/lib/components/DataTable/Table.d.ts +2 -2
  78. package/lib/components/DataTable/Table.js +1 -1
  79. package/lib/components/DataTable/TableExpandHeader.d.ts +1 -1
  80. package/lib/components/DataTable/TableExpandHeader.js +3 -3
  81. package/lib/components/DatePicker/DatePicker.d.ts +0 -12
  82. package/lib/components/DatePicker/DatePicker.js +2 -2
  83. package/lib/components/DatePicker/plugins/rangePlugin.d.ts +19 -2
  84. package/lib/components/DatePicker/plugins/rangePlugin.js +18 -16
  85. package/lib/components/Dropdown/Dropdown.js +3 -14
  86. package/lib/components/FeatureFlags/index.js +1 -0
  87. package/lib/components/IconButton/index.js +1 -1
  88. package/lib/components/Menu/MenuItem.d.ts +1 -1
  89. package/lib/components/Menu/MenuItem.js +6 -6
  90. package/lib/components/Modal/Modal.js +1 -1
  91. package/lib/components/MultiSelect/FilterableMultiSelect.js +8 -8
  92. package/lib/components/MultiSelect/MultiSelect.js +2 -13
  93. package/lib/components/Notification/Notification.d.ts +6 -6
  94. package/lib/components/Notification/Notification.js +6 -6
  95. package/lib/components/OverflowMenu/OverflowMenu.js +1 -1
  96. package/lib/components/OverflowMenu/next/index.js +1 -1
  97. package/lib/components/PaginationNav/PaginationNav.d.ts +20 -0
  98. package/lib/components/PaginationNav/PaginationNav.js +34 -5
  99. package/lib/components/Popover/index.js +1 -1
  100. package/lib/components/Search/Search.d.ts +4 -2
  101. package/lib/components/Search/Search.js +5 -4
  102. package/lib/components/Slider/Slider.d.ts +144 -188
  103. package/lib/components/Slider/Slider.js +784 -709
  104. package/lib/components/Slider/index.d.ts +2 -2
  105. package/lib/components/Tabs/Tabs.d.ts +4 -0
  106. package/lib/components/TextArea/TextArea.js +13 -6
  107. package/lib/components/TextInput/ControlledPasswordInput.js +1 -1
  108. package/lib/components/TextInput/PasswordInput.js +1 -1
  109. package/lib/components/TextInput/TextInput.js +1 -1
  110. package/lib/components/TextInput/util.d.ts +17 -5
  111. package/lib/components/TextInput/util.js +2 -7
  112. package/lib/components/UIShell/HeaderPanel.d.ts +1 -1
  113. package/lib/index.d.ts +27 -24
  114. package/lib/index.js +95 -28
  115. package/lib/internal/defaultItemToString.d.ts +7 -0
  116. package/lib/internal/defaultItemToString.js +19 -0
  117. package/lib/internal/index.d.ts +1 -0
  118. package/lib/prop-types/deprecateValuesWithin.d.ts +8 -1
  119. package/lib/prop-types/deprecateValuesWithin.js +6 -8
  120. package/lib/prop-types/requiredIfGivenPropIsTruthy.d.ts +8 -7
  121. package/lib/prop-types/requiredIfGivenPropIsTruthy.js +10 -12
  122. package/package.json +8 -7
  123. package/telemetry.yml +1 -2
  124. package/es/components/MultiSelect/tools/itemToString.d.ts +0 -1
  125. package/es/components/MultiSelect/tools/itemToString.js +0 -21
  126. package/es/components/Slider/index.js +0 -14
  127. package/es/internal/createClassWrapper.js +0 -23
  128. package/lib/components/MultiSelect/tools/itemToString.d.ts +0 -1
  129. package/lib/components/MultiSelect/tools/itemToString.js +0 -23
  130. package/lib/components/Slider/index.js +0 -20
  131. package/lib/internal/createClassWrapper.js +0 -25
@@ -5,36 +5,40 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import rangePlugin from 'flatpickr/dist/plugins/rangePlugin';
8
+ import baseRangePlugin from 'flatpickr/dist/plugins/rangePlugin';
9
9
 
10
10
  /**
11
- * @param {object} config Plugin configuration.
12
- * @returns {Plugin} An extension of Flatpickr `rangePlugin` that does the following:
11
+ * @param config Plugin configuration.
12
+ * @returns An extension of Flatpickr `rangePlugin` that does the following:
13
13
  * * Better ensures the calendar dropdown is always aligned to the `<input>` for the starting date.
14
14
  * Workaround for: https://github.com/flatpickr/flatpickr/issues/1944
15
15
  * * A logic to ensure `fp.setDate()` call won't end up with "startDate to endDate" set to the first `<input>`
16
16
  */
17
- var carbonFlatpickrRangePlugin = config => {
18
- const factory = rangePlugin(Object.assign({
17
+ const rangePlugin = (config = {}) => {
18
+ const factory = baseRangePlugin(Object.assign({
19
19
  position: 'left'
20
20
  }, config));
21
21
  return fp => {
22
- const origSetDate = fp.setDate;
22
+ const {
23
+ setDate: origSetDate
24
+ } = fp;
23
25
  const init = () => {
24
- fp.setDate = function setDate(dates, triggerChange, format) {
25
- origSetDate.call(this, dates, triggerChange, format);
26
+ fp.setDate = (dates, triggerChange, format) => {
27
+ origSetDate(dates, triggerChange, format);
26
28
  // If `triggerChange` is `true`, `onValueUpdate` Flatpickr event is fired
27
29
  // where Flatpickr's range plugin takes care of fixing the first `<input>`
28
- if (!triggerChange && dates.length === 2) {
30
+ if (!triggerChange && Array.isArray(dates) && dates.length === 2) {
29
31
  const {
32
+ formatDate,
30
33
  _input: inputFrom
31
34
  } = fp;
32
35
  const {
33
36
  input: inputTo
34
37
  } = config;
35
- [inputFrom, inputTo].forEach((input, i) => {
36
- if (input) {
37
- input.value = !dates[i] ? '' : fp.formatDate(new Date(dates[i]), fp.config.dateFormat);
38
+ const inputToElement = typeof inputTo === 'string' ? document.querySelector(inputTo) : inputTo;
39
+ [inputFrom, inputToElement].forEach((input, i) => {
40
+ if (input && input instanceof HTMLInputElement) {
41
+ input.value = !dates[i] ? '' : formatDate(new Date(dates[i]), fp.config.dateFormat);
38
42
  }
39
43
  });
40
44
  }
@@ -46,9 +50,9 @@ var carbonFlatpickrRangePlugin = config => {
46
50
  } = origRangePlugin;
47
51
  return Object.assign(origRangePlugin, {
48
52
  onReady: [init, origOnReady],
49
- onPreCalendarPosition() {}
53
+ onPreCalendarPosition: () => {}
50
54
  });
51
55
  };
52
56
  };
53
57
 
54
- export { carbonFlatpickrRangePlugin as default };
58
+ export { rangePlugin };
@@ -21,6 +21,7 @@ import { useId } from '../../internal/useId.js';
21
21
  import { useFloating, autoUpdate, size, flip, hide } from '@floating-ui/react';
22
22
  import { useFeatureFlag } from '../FeatureFlags/index.js';
23
23
  import { AILabel } from '../AILabel/index.js';
24
+ import { defaultItemToString } from '../../internal/defaultItemToString.js';
24
25
  import { isComponentElement } from '../../internal/utils.js';
25
26
  import { ListBoxTypePropType, ListBoxSizePropType } from '../ListBox/ListBoxPropTypes.js';
26
27
 
@@ -28,18 +29,6 @@ const {
28
29
  ItemMouseMove,
29
30
  MenuMouseLeave
30
31
  } = useSelect.stateChangeTypes;
31
- const defaultItemToString = item => {
32
- if (typeof item === 'string') {
33
- return item;
34
- }
35
- if (typeof item === 'number') {
36
- return `${item}`;
37
- }
38
- if (item !== null && typeof item === 'object' && 'label' in item && typeof item['label'] === 'string') {
39
- return item['label'];
40
- }
41
- return '';
42
- };
43
32
  /**
44
33
  * Custom state reducer for `useSelect` in Downshift, providing control over
45
34
  * state changes.
@@ -10,6 +10,7 @@ import PropTypes from 'prop-types';
10
10
  import React, { useContext, createContext, useState, useRef, useEffect } from 'react';
11
11
  import { deprecate } from '../../prop-types/deprecate.js';
12
12
 
13
+ // TODO: Can this variable be deleted now? It isn't used anywhere.
13
14
  /**
14
15
  * Our FeatureFlagContext is used alongside the FeatureFlags component to enable
15
16
  * or disable feature flags in a given React tree
@@ -14,7 +14,7 @@ import { Tooltip } from '../Tooltip/Tooltip.js';
14
14
  import { useId } from '../../internal/useId.js';
15
15
  import { usePrefix } from '../../internal/usePrefix.js';
16
16
  import ButtonBase from '../Button/ButtonBase.js';
17
- import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
17
+ import { deprecateValuesWithin } from '../../prop-types/deprecateValuesWithin.js';
18
18
  import { BadgeIndicator } from '../BadgeIndicator/index.js';
19
19
  import { mapPopoverAlign } from '../../tools/mapPopoverAlign.js';
20
20
 
@@ -80,7 +80,7 @@ export interface MenuItemRadioGroupProps<Item> extends Omit<ComponentProps<'ul'>
80
80
  */
81
81
  defaultSelectedItem?: Item;
82
82
  /**
83
- * Provide a function to convert an item to the string that will be rendered. Defaults to item.toString().
83
+ * Converts an item into a string for display.
84
84
  */
85
85
  itemToString?: (item: Item) => string;
86
86
  /**
@@ -21,6 +21,7 @@ import { MenuContext } from './MenuContext.js';
21
21
  import '../LayoutDirection/LayoutDirection.js';
22
22
  import { useLayoutDirection } from '../LayoutDirection/useLayoutDirection.js';
23
23
  import '../Text/index.js';
24
+ import { defaultItemToString } from '../../internal/defaultItemToString.js';
24
25
  import { Text } from '../Text/Text.js';
25
26
 
26
27
  var _Checkmark, _CaretLeft, _CaretRight;
@@ -178,15 +179,15 @@ const MenuItem = /*#__PURE__*/forwardRef(function MenuItem({
178
179
  "aria-expanded": hasChildren ? submenuOpen : undefined,
179
180
  onClick: handleClick,
180
181
  onKeyDown: handleKeyDown,
181
- onKeyUp: handleKeyUp
182
+ onKeyUp: handleKeyUp,
183
+ title: label
182
184
  }, getReferenceProps()), /*#__PURE__*/React.createElement("div", {
183
185
  className: `${prefix}--menu-item__selection-icon`
184
186
  }, rest['aria-checked'] && (_Checkmark || (_Checkmark = /*#__PURE__*/React.createElement(Checkmark, null)))), /*#__PURE__*/React.createElement("div", {
185
187
  className: `${prefix}--menu-item__icon`
186
188
  }, IconElement && /*#__PURE__*/React.createElement(IconElement, null)), /*#__PURE__*/React.createElement(Text, {
187
189
  as: "div",
188
- className: `${prefix}--menu-item__label`,
189
- title: label
190
+ className: `${prefix}--menu-item__label`
190
191
  }, label), shortcut && !hasChildren && /*#__PURE__*/React.createElement("div", {
191
192
  className: `${prefix}--menu-item__shortcut`
192
193
  }, shortcut), hasChildren && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
@@ -324,7 +325,6 @@ MenuItemGroup.propTypes = {
324
325
  */
325
326
  label: PropTypes.string.isRequired
326
327
  };
327
- const defaultItemToString = item => item.toString();
328
328
  const MenuItemRadioGroup = /*#__PURE__*/forwardRef(function MenuItemRadioGroup({
329
329
  className,
330
330
  defaultSelectedItem,
@@ -382,7 +382,7 @@ MenuItemRadioGroup.propTypes = {
382
382
  */
383
383
  defaultSelectedItem: PropTypes.any,
384
384
  /**
385
- * Provide a function to convert an item to the string that will be rendered. Defaults to item.toString().
385
+ * Converts an item into a string for display.
386
386
  */
387
387
  itemToString: PropTypes.func,
388
388
  /**
@@ -16,7 +16,7 @@ import '../Button/Button.Skeleton.js';
16
16
  import ButtonSet from '../ButtonSet/ButtonSet.js';
17
17
  import InlineLoading from '../InlineLoading/InlineLoading.js';
18
18
  import { Layer } from '../Layer/index.js';
19
- import requiredIfGivenPropIsTruthy from '../../prop-types/requiredIfGivenPropIsTruthy.js';
19
+ import { requiredIfGivenPropIsTruthy } from '../../prop-types/requiredIfGivenPropIsTruthy.js';
20
20
  import { wrapFocus, wrapFocusWithoutSentinels, elementOrParentIsFloatingMenu } from '../../internal/wrapFocus.js';
21
21
  import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
22
22
  import { useId } from '../../internal/useId.js';
@@ -21,7 +21,6 @@ import ListBoxSelection from '../ListBox/next/ListBoxSelection.js';
21
21
  import ListBoxTrigger from '../ListBox/next/ListBoxTrigger.js';
22
22
  import { Space, Enter, Delete, Escape, Tab, Home, End } from '../../internal/keyboard/keys.js';
23
23
  import { match } from '../../internal/keyboard/match.js';
24
- import { defaultItemToString } from './tools/itemToString.js';
25
24
  import mergeRefs from '../../tools/mergeRefs.js';
26
25
  import { deprecate } from '../../prop-types/deprecate.js';
27
26
  import { useId } from '../../internal/useId.js';
@@ -32,6 +31,7 @@ import { FormContext } from '../FluidForm/FormContext.js';
32
31
  import { useSelection } from '../../internal/Selection.js';
33
32
  import { useFloating, autoUpdate, flip, size, hide } from '@floating-ui/react';
34
33
  import { AILabel } from '../AILabel/index.js';
34
+ import { defaultItemToString } from '../../internal/defaultItemToString.js';
35
35
  import { isComponentElement } from '../../internal/utils.js';
36
36
  import { ListBoxTypePropType, ListBoxSizePropType } from '../ListBox/ListBoxPropTypes.js';
37
37
 
@@ -30,6 +30,7 @@ import { noopFn } from '../../internal/noopFn.js';
30
30
  import { useFloating, autoUpdate, flip, size, hide } from '@floating-ui/react';
31
31
  import { useFeatureFlag } from '../FeatureFlags/index.js';
32
32
  import { AILabel } from '../AILabel/index.js';
33
+ import { defaultItemToString } from '../../internal/defaultItemToString.js';
33
34
  import { isComponentElement } from '../../internal/utils.js';
34
35
  import { ListBoxTypePropType, ListBoxSizePropType } from '../ListBox/ListBoxPropTypes.js';
35
36
 
@@ -48,18 +49,6 @@ const {
48
49
  ToggleButtonKeyDownPageUp,
49
50
  FunctionSetHighlightedIndex
50
51
  } = useSelect.stateChangeTypes;
51
- const defaultItemToString = item => {
52
- if (typeof item === 'string') {
53
- return item;
54
- }
55
- if (typeof item === 'number') {
56
- return `${item}`;
57
- }
58
- if (item !== null && typeof item === 'object' && 'label' in item && typeof item['label'] === 'string') {
59
- return item['label'];
60
- }
61
- return '';
62
- };
63
52
  const MultiSelect = /*#__PURE__*/React.forwardRef(({
64
53
  autoAlign = false,
65
54
  className: containerClassName,
@@ -5,8 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
- import React, { type ReactNode, type MouseEvent, type ButtonHTMLAttributes, type HTMLAttributes } from 'react';
9
- import { type ButtonProps } from '../Button';
8
+ import React, { type ReactNode, type MouseEvent, type ButtonHTMLAttributes, type HTMLAttributes, type ComponentProps } from 'react';
9
+ import Button, { type ButtonProps } from '../Button';
10
10
  export interface NotificationActionButtonProps extends ButtonProps<'button'> {
11
11
  /**
12
12
  * Specify the content of the notification action button.
@@ -23,7 +23,7 @@ export interface NotificationActionButtonProps extends ButtonProps<'button'> {
23
23
  /**
24
24
  * Optionally specify a click handler for the notification action button.
25
25
  */
26
- onClick?(): void;
26
+ onClick?: ComponentProps<typeof Button>['onClick'];
27
27
  }
28
28
  export declare function NotificationActionButton({ children, className: customClassName, onClick, inline, ...rest }: NotificationActionButtonProps): import("react/jsx-runtime").JSX.Element;
29
29
  export declare namespace NotificationActionButton {
@@ -404,7 +404,7 @@ export interface ActionableNotificationProps extends HTMLAttributes<HTMLDivEleme
404
404
  /**
405
405
  * Provide a function that is called when the action is clicked
406
406
  */
407
- onActionButtonClick?(): void;
407
+ onActionButtonClick?: ComponentProps<typeof NotificationActionButton>['onClick'];
408
408
  /**
409
409
  * Provide a function that is called when menu is closed.
410
410
  * Default behavior of hiding the notification is prevented if this function returns false.
@@ -551,7 +551,7 @@ export interface CalloutProps extends HTMLAttributes<HTMLDivElement> {
551
551
  /**
552
552
  * Provide a function that is called when the action is clicked
553
553
  */
554
- onActionButtonClick?(): void;
554
+ onActionButtonClick?: ComponentProps<typeof NotificationActionButton>['onClick'];
555
555
  /**
556
556
  * Provide a description for "status" icon that can be read by screen readers
557
557
  */
@@ -587,7 +587,7 @@ export declare namespace Callout {
587
587
  /**
588
588
  * Specify what state the notification represents
589
589
  */
590
- kind: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
590
+ kind: PropTypes.Requireable<string> | PropTypes.Validator<string>;
591
591
  /**
592
592
  * Specify whether you are using the low contrast variant of the Callout.
593
593
  */
@@ -24,7 +24,7 @@ import { noopFn } from '../../internal/noopFn.js';
24
24
  import { wrapFocusWithoutSentinels, wrapFocus } from '../../internal/wrapFocus.js';
25
25
  import { useFeatureFlag } from '../FeatureFlags/index.js';
26
26
  import { warning } from '../../internal/warning.js';
27
- import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
27
+ import { deprecateValuesWithin } from '../../prop-types/deprecateValuesWithin.js';
28
28
  import { Text } from '../Text/Text.js';
29
29
 
30
30
  /**
@@ -699,12 +699,12 @@ ActionableNotification.propTypes = {
699
699
  * @deprecated Use NewKindProps instead.
700
700
  */
701
701
 
702
+ const mapping = {
703
+ error: 'warning',
704
+ // only redirect error -> warning
705
+ success: 'info' // only redirect success -> info
706
+ };
702
707
  const propMappingFunction = deprecatedValue => {
703
- const mapping = {
704
- error: 'warning',
705
- // only redirect error -> warning
706
- success: 'info' // only redirect success -> info
707
- };
708
708
  return mapping[deprecatedValue];
709
709
  };
710
710
  function Callout({
@@ -21,7 +21,7 @@ import mergeRefs from '../../tools/mergeRefs.js';
21
21
  import { setupGetInstanceId } from '../../tools/setupGetInstanceId.js';
22
22
  import { IconButton } from '../IconButton/index.js';
23
23
  import { useOutsideClick } from '../../internal/useOutsideClick.js';
24
- import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
24
+ import { deprecateValuesWithin } from '../../prop-types/deprecateValuesWithin.js';
25
25
  import { mapPopoverAlign } from '../../tools/mapPopoverAlign.js';
26
26
 
27
27
  const getInstanceId = setupGetInstanceId();
@@ -19,7 +19,7 @@ import mergeRefs from '../../../tools/mergeRefs.js';
19
19
  import { useId } from '../../../internal/useId.js';
20
20
  import { usePrefix } from '../../../internal/usePrefix.js';
21
21
  import { useAttachedMenu } from '../../../internal/useAttachedMenu.js';
22
- import deprecateValuesWithin from '../../../prop-types/deprecateValuesWithin.js';
22
+ import { deprecateValuesWithin } from '../../../prop-types/deprecateValuesWithin.js';
23
23
  import { mapPopoverAlign } from '../../../tools/mapPopoverAlign.js';
24
24
 
25
25
  const defaultSize = 'md';
@@ -6,6 +6,8 @@
6
6
  */
7
7
  import React from 'react';
8
8
  import { TranslateWithId } from '../../types/common';
9
+ type TooltipAlignment = 'start' | 'center' | 'end';
10
+ type TooltipPosition = 'top' | 'right' | 'bottom' | 'left';
9
11
  declare const translationIds: {
10
12
  readonly 'carbon.pagination-nav.next': "Next";
11
13
  readonly 'carbon.pagination-nav.previous': "Previous";
@@ -34,6 +36,14 @@ export interface DirectionButtonProps {
34
36
  * The callback function called when the button is clicked.
35
37
  */
36
38
  onClick?: React.MouseEventHandler;
39
+ /**
40
+ * Specify the alignment of the tooltip for the icon-only next/prev buttons.
41
+ */
42
+ tooltipAlignment?: TooltipAlignment;
43
+ /**
44
+ * Specify the position of the tooltip for the icon-only next/prev buttons.
45
+ */
46
+ tooltipPosition?: TooltipPosition;
37
47
  }
38
48
  export interface PaginationItemProps extends TranslateWithId<'carbon.pagination-nav.item' | 'carbon.pagination-nav.active'> {
39
49
  /**
@@ -98,6 +108,16 @@ export interface PaginationNavProps extends Omit<React.HTMLAttributes<HTMLElemen
98
108
  * Specify the size of the PaginationNav.
99
109
  */
100
110
  size?: 'sm' | 'md' | 'lg';
111
+ /**
112
+ * Specify the alignment of the tooltip for the icon-only next/prev buttons.
113
+ * Can be one of: start, center, or end.
114
+ */
115
+ tooltipAlignment?: TooltipAlignment;
116
+ /**
117
+ * Specify the position of the tooltip for the icon-only next/prev buttons.
118
+ * Can be one of: top, right, bottom, or left.
119
+ */
120
+ tooltipPosition?: TooltipPosition;
101
121
  /**
102
122
  * The total number of items.
103
123
  */
@@ -68,13 +68,16 @@ function DirectionButton({
68
68
  direction,
69
69
  label,
70
70
  disabled,
71
- onClick
71
+ onClick,
72
+ tooltipAlignment = 'center',
73
+ tooltipPosition = 'bottom'
72
74
  }) {
73
75
  const prefix = usePrefix();
76
+ const align = tooltipAlignment === 'center' ? tooltipPosition : `${tooltipPosition}-${tooltipAlignment}`;
74
77
  return /*#__PURE__*/React.createElement("li", {
75
78
  className: `${prefix}--pagination-nav__list-item`
76
79
  }, /*#__PURE__*/React.createElement(IconButton, {
77
- align: "bottom",
80
+ align: align,
78
81
  disabled: disabled,
79
82
  kind: "ghost",
80
83
  label: label,
@@ -173,6 +176,8 @@ const PaginationNav = /*#__PURE__*/React.forwardRef(({
173
176
  page = 0,
174
177
  loop = false,
175
178
  size = 'lg',
179
+ tooltipAlignment,
180
+ tooltipPosition,
176
181
  translateWithId: t = translateWithId,
177
182
  ...rest
178
183
  }, ref) => {
@@ -276,7 +281,9 @@ const PaginationNav = /*#__PURE__*/React.forwardRef(({
276
281
  "aria-label": t('carbon.pagination-nav.previous'),
277
282
  label: t('carbon.pagination-nav.previous'),
278
283
  disabled: backwardButtonDisabled,
279
- onClick: jumpToPrevious
284
+ onClick: jumpToPrevious,
285
+ tooltipAlignment: tooltipAlignment,
286
+ tooltipPosition: tooltipPosition
280
287
  }),
281
288
  // render first item if at least 5 items can be displayed or
282
289
  // 4 items can be displayed and the current page is either 0 or 1
@@ -321,7 +328,9 @@ const PaginationNav = /*#__PURE__*/React.forwardRef(({
321
328
  "aria-label": t('carbon.pagination-nav.next'),
322
329
  label: t('carbon.pagination-nav.next'),
323
330
  disabled: forwardButtonDisabled,
324
- onClick: jumpToNext
331
+ onClick: jumpToNext,
332
+ tooltipAlignment: tooltipAlignment,
333
+ tooltipPosition: tooltipPosition
325
334
  })), /*#__PURE__*/React.createElement("div", {
326
335
  "aria-live": "polite",
327
336
  "aria-atomic": "true",
@@ -344,7 +353,17 @@ DirectionButton.propTypes = {
344
353
  /**
345
354
  * The callback function called when the button is clicked.
346
355
  */
347
- onClick: PropTypes.func
356
+ onClick: PropTypes.func,
357
+ /**
358
+ * Specify how the tooltip should align with the navigation button.
359
+ * Can be one of: start, center, or end.
360
+ */
361
+ tooltipAlignment: PropTypes.oneOf(['start', 'center', 'end']),
362
+ /**
363
+ * Specify the position of the tooltip relative to the navigation button.
364
+ * Can be one of: top, right, bottom, or left.
365
+ */
366
+ tooltipPosition: PropTypes.oneOf(['top', 'right', 'bottom', 'left'])
348
367
  };
349
368
  PaginationItem.propTypes = {
350
369
  /**
@@ -415,6 +434,16 @@ PaginationNav.propTypes = {
415
434
  * Specify the size of the PaginationNav.
416
435
  */
417
436
  size: PropTypes.oneOf(['sm', 'md', 'lg']),
437
+ /**
438
+ * Specify the alignment of the tooltip for the icon-only prev/next buttons.
439
+ * Can be one of: start, center, or end.
440
+ */
441
+ tooltipAlignment: PropTypes.oneOf(['start', 'center', 'end']),
442
+ /**
443
+ * Specify the position of the tooltip for the icon-only prev/next buttons.
444
+ * Can be one of: top, right, bottom, or left.
445
+ */
446
+ tooltipPosition: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
418
447
  /**
419
448
  * The total number of items.
420
449
  */
@@ -8,7 +8,7 @@
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
+ import { deprecateValuesWithin } from '../../prop-types/deprecateValuesWithin.js';
12
12
  import React, { useRef, useMemo, useEffect } from 'react';
13
13
  import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
14
14
  import { useMergedRefs } from '../../internal/useMergedRefs.js';
@@ -63,7 +63,9 @@ export interface SearchProps extends InputPropsBase {
63
63
  */
64
64
  renderIcon?: ComponentType | FunctionComponent;
65
65
  /**
66
- * Specify the role for the underlying `<input>`, defaults to `searchbox`
66
+ * @deprecated Specify the role for the underlying `<input>`.
67
+ * No longer needed since `<input type="search">` already provides the correct semantics.
68
+ * This prop will be removed in the next major release of Carbon.
67
69
  */
68
70
  role?: string;
69
71
  /**
@@ -71,7 +73,7 @@ export interface SearchProps extends InputPropsBase {
71
73
  */
72
74
  size?: 'sm' | 'md' | 'lg';
73
75
  /**
74
- * Optional prop to specify the type of the `<input>`
76
+ * Specify the type of the `<input>`
75
77
  */
76
78
  type?: string;
77
79
  /**
@@ -39,9 +39,9 @@ const Search = /*#__PURE__*/React.forwardRef(({
39
39
  onExpand,
40
40
  placeholder = 'Search',
41
41
  renderIcon,
42
- role = 'searchbox',
42
+ role,
43
43
  size = 'md',
44
- type = 'text',
44
+ type = 'search',
45
45
  value,
46
46
  ...rest
47
47
  }, forwardRef) => {
@@ -238,15 +238,16 @@ Search.propTypes = {
238
238
  */
239
239
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
240
240
  /**
241
+ * Deprecated, since <input type="search"> already provides correct semantics.
241
242
  * Specify the role for the underlying `<input>`, defaults to `searchbox`
242
243
  */
243
- role: PropTypes.string,
244
+ role: deprecate(PropTypes.string, 'The `role` prop has been deprecated since <input type="search"> already provides correct semantics. ' + 'It will be removed in the next major release of Carbon.'),
244
245
  /**
245
246
  * Specify the size of the Search
246
247
  */
247
248
  size: PropTypes.oneOf(['sm', 'md', 'lg']),
248
249
  /**
249
- * Optional prop to specify the type of the `<input>`
250
+ * Specify the type of the `<input>`
250
251
  */
251
252
  type: PropTypes.string,
252
253
  /**