@carbon/react 1.57.0 → 1.58.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 (90) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +870 -911
  2. package/es/components/Button/Button.js +2 -2
  3. package/es/components/Checkbox/Checkbox.d.ts +6 -7
  4. package/es/components/ComboBox/ComboBox.d.ts +4 -5
  5. package/es/components/ComboBox/ComboBox.js +268 -261
  6. package/es/components/ComposedModal/ComposedModal.d.ts +1 -2
  7. package/es/components/DataTable/TableHeader.d.ts +4 -5
  8. package/es/components/DataTable/TableSlugRow.d.ts +3 -2
  9. package/es/components/DatePicker/DatePicker.d.ts +4 -5
  10. package/es/components/Dropdown/Dropdown.d.ts +5 -6
  11. package/es/components/IconButton/index.d.ts +3 -4
  12. package/es/components/ListBox/next/ListBoxTrigger.js +1 -0
  13. package/es/components/Menu/Menu.js +1 -1
  14. package/es/components/Menu/MenuItem.js +13 -2
  15. package/es/components/Modal/Modal.d.ts +8 -9
  16. package/es/components/MultiSelect/FilterableMultiSelect.d.ts +1 -2
  17. package/es/components/MultiSelect/MultiSelect.d.ts +10 -9
  18. package/es/components/Notification/Notification.d.ts +2 -2
  19. package/es/components/NumberInput/NumberInput.d.ts +1 -2
  20. package/es/components/PasswordInput/index.d.ts +3 -0
  21. package/es/components/Popover/index.d.ts +8 -2
  22. package/es/components/Popover/index.js +26 -1
  23. package/es/components/RadioButton/RadioButton.d.ts +3 -4
  24. package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +7 -8
  25. package/es/components/Select/Select.d.ts +1 -2
  26. package/es/components/Slider/Slider.d.ts +5 -5
  27. package/es/components/Slider/Slider.js +1 -1
  28. package/es/components/Tag/DismissibleTag.d.ts +3 -3
  29. package/es/components/Tag/OperationalTag.d.ts +3 -3
  30. package/es/components/Tag/SelectableTag.d.ts +3 -3
  31. package/es/components/Tag/Tag.d.ts +3 -3
  32. package/es/components/TextArea/TextArea.d.ts +6 -7
  33. package/es/components/TextInput/PasswordInput.d.ts +5 -6
  34. package/es/components/TextInput/PasswordInput.js +2 -2
  35. package/es/components/TextInput/TextInput.d.ts +1 -2
  36. package/es/components/Theme/index.d.ts +1 -0
  37. package/es/components/Theme/index.js +8 -2
  38. package/es/components/Tile/Tile.d.ts +3 -4
  39. package/es/components/TileGroup/TileGroup.d.ts +3 -2
  40. package/es/components/TileGroup/index.d.ts +9 -0
  41. package/es/components/Toggle/Toggle.js +1 -1
  42. package/es/components/Tooltip/DefinitionTooltip.js +1 -1
  43. package/es/index.js +4 -4
  44. package/es/prop-types/deprecateValuesWithin.js +35 -0
  45. package/lib/components/Button/Button.js +2 -2
  46. package/lib/components/Checkbox/Checkbox.d.ts +6 -7
  47. package/lib/components/ComboBox/ComboBox.d.ts +4 -5
  48. package/lib/components/ComboBox/ComboBox.js +267 -261
  49. package/lib/components/ComposedModal/ComposedModal.d.ts +1 -2
  50. package/lib/components/DataTable/TableHeader.d.ts +4 -5
  51. package/lib/components/DataTable/TableSlugRow.d.ts +3 -2
  52. package/lib/components/DatePicker/DatePicker.d.ts +4 -5
  53. package/lib/components/Dropdown/Dropdown.d.ts +5 -6
  54. package/lib/components/IconButton/index.d.ts +3 -4
  55. package/lib/components/ListBox/next/ListBoxTrigger.js +1 -0
  56. package/lib/components/Menu/Menu.js +1 -1
  57. package/lib/components/Menu/MenuItem.js +13 -2
  58. package/lib/components/Modal/Modal.d.ts +8 -9
  59. package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +1 -2
  60. package/lib/components/MultiSelect/MultiSelect.d.ts +10 -9
  61. package/lib/components/Notification/Notification.d.ts +2 -2
  62. package/lib/components/NumberInput/NumberInput.d.ts +1 -2
  63. package/lib/components/PasswordInput/index.d.ts +3 -0
  64. package/lib/components/Popover/index.d.ts +8 -2
  65. package/lib/components/Popover/index.js +26 -1
  66. package/lib/components/RadioButton/RadioButton.d.ts +3 -4
  67. package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +7 -8
  68. package/lib/components/Select/Select.d.ts +1 -2
  69. package/lib/components/Slider/Slider.d.ts +5 -5
  70. package/lib/components/Slider/Slider.js +1 -1
  71. package/lib/components/Tag/DismissibleTag.d.ts +3 -3
  72. package/lib/components/Tag/OperationalTag.d.ts +3 -3
  73. package/lib/components/Tag/SelectableTag.d.ts +3 -3
  74. package/lib/components/Tag/Tag.d.ts +3 -3
  75. package/lib/components/TextArea/TextArea.d.ts +6 -7
  76. package/lib/components/TextInput/PasswordInput.d.ts +5 -6
  77. package/lib/components/TextInput/PasswordInput.js +2 -2
  78. package/lib/components/TextInput/TextInput.d.ts +1 -2
  79. package/lib/components/Theme/index.d.ts +1 -0
  80. package/lib/components/Theme/index.js +8 -1
  81. package/lib/components/Tile/Tile.d.ts +3 -4
  82. package/lib/components/TileGroup/TileGroup.d.ts +3 -2
  83. package/lib/components/TileGroup/index.d.ts +9 -0
  84. package/lib/components/Toggle/Toggle.js +1 -1
  85. package/lib/components/Tooltip/DefinitionTooltip.js +1 -1
  86. package/lib/index.js +30 -29
  87. package/lib/prop-types/deprecateValuesWithin.js +39 -0
  88. package/package.json +5 -5
  89. package/es/components/TileGroup/index.js +0 -13
  90. package/lib/components/TileGroup/index.js +0 -18
@@ -4,14 +4,13 @@
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 { ReactNodeLike } from 'prop-types';
8
- import React, { type MouseEventHandler } from 'react';
7
+ import React, { type MouseEventHandler, ReactNode } from 'react';
9
8
  import { sortStates } from './state/sorting';
10
9
  import { ReactAttr } from '../../types/common';
11
10
  import { DataTableSortState } from './state/sortStates';
12
11
  export type TableHeaderTranslationKey = 'carbon.table.header.icon.description';
13
12
  export interface TableHeaderTranslationArgs {
14
- header: React.ReactNode;
13
+ header: ReactNode;
15
14
  isSortHeader?: boolean;
16
15
  sortDirection?: DataTableSortState;
17
16
  sortStates: typeof sortStates;
@@ -20,7 +19,7 @@ interface TableHeaderProps extends ReactAttr<HTMLTableCellElement & HTMLButtonEl
20
19
  /**
21
20
  * Pass in children that will be embedded in the table header label
22
21
  */
23
- children?: React.ReactNode;
22
+ children?: ReactNode;
24
23
  /**
25
24
  * Specify an optional className to be applied to the container node
26
25
  */
@@ -56,7 +55,7 @@ interface TableHeaderProps extends ReactAttr<HTMLTableCellElement & HTMLButtonEl
56
55
  /**
57
56
  * **Experimental**: Provide a `Slug` component to be rendered inside the `TableSlugRow` component
58
57
  */
59
- slug?: ReactNodeLike;
58
+ slug?: ReactNode;
60
59
  /**
61
60
  * Specify which direction we are currently sorting by, should be one of DESC,
62
61
  * NONE, or ASC.
@@ -4,7 +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 PropTypes, { ReactNodeLike } from 'prop-types';
7
+ import PropTypes from 'prop-types';
8
+ import { ReactNode } from 'react';
8
9
  export interface TableSlugRowProps {
9
10
  /**
10
11
  * The CSS class names of the cell that wraps the underlying input control
@@ -13,7 +14,7 @@ export interface TableSlugRowProps {
13
14
  /**
14
15
  * Provide a `Slug` component to be rendered inside the `TableSlugRow` component
15
16
  */
16
- slug?: ReactNodeLike;
17
+ slug?: ReactNode;
17
18
  }
18
19
  declare const TableSlugRow: {
19
20
  ({ className, slug }: TableSlugRowProps): import("react/jsx-runtime").JSX.Element;
@@ -4,8 +4,7 @@
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 { ReactNodeLike } from 'prop-types';
8
- import React from 'react';
7
+ import React, { ReactNode } from 'react';
9
8
  import flatpickr from 'flatpickr';
10
9
  import { DateLimit, DateOption } from 'flatpickr/dist/types/options';
11
10
  export type DatePickerTypes = 'simple' | 'single' | 'range';
@@ -34,7 +33,7 @@ interface DatePickerProps {
34
33
  /**
35
34
  * The child nodes.
36
35
  */
37
- children: React.ReactNode | object;
36
+ children: ReactNode | object;
38
37
  /**
39
38
  * The CSS class names.
40
39
  */
@@ -74,7 +73,7 @@ interface DatePickerProps {
74
73
  /**
75
74
  * Provide the text that is displayed when the control is in error state (Fluid Only)
76
75
  */
77
- invalidText?: ReactNodeLike;
76
+ invalidText?: ReactNode;
78
77
  /**
79
78
  * `true` to use the light version.
80
79
  */
@@ -129,7 +128,7 @@ interface DatePickerProps {
129
128
  /**
130
129
  * Provide the text that is displayed when the control is in warning state (Fluid only)
131
130
  */
132
- warnText?: ReactNodeLike;
131
+ warnText?: ReactNode;
133
132
  }
134
133
  declare const DatePicker: React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<HTMLDivElement>>;
135
134
  export default DatePicker;
@@ -6,7 +6,6 @@
6
6
  */
7
7
  import React, { ReactNode } from 'react';
8
8
  import { UseSelectProps } from 'downshift';
9
- import { ReactNodeLike } from 'prop-types';
10
9
  import { type ListBoxMenuIconTranslationKey, ListBoxSize, ListBoxType } from '../ListBox';
11
10
  import { ReactAttr } from '../../types/common';
12
11
  type ExcludedAttributes = 'id' | 'onChange';
@@ -40,7 +39,7 @@ export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>,
40
39
  * Provide helper text that is used alongside the control label for
41
40
  * additional help
42
41
  */
43
- helperText?: React.ReactNode;
42
+ helperText?: ReactNode;
44
43
  /**
45
44
  * Specify whether the title text should be hidden or not
46
45
  */
@@ -61,7 +60,7 @@ export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>,
61
60
  /**
62
61
  * Message which is displayed if the value is invalid.
63
62
  */
64
- invalidText?: React.ReactNode;
63
+ invalidText?: ReactNode;
65
64
  /**
66
65
  * Function to render items as custom components instead of strings.
67
66
  * Defaults to null and is overridden by a getter
@@ -114,12 +113,12 @@ export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>,
114
113
  /**
115
114
  * **Experimental**: Provide a `Slug` component to be rendered inside the `Dropdown` component
116
115
  */
117
- slug?: ReactNodeLike;
116
+ slug?: ReactNode;
118
117
  /**
119
118
  * Provide the title text that will be read by a screen reader when
120
119
  * visiting this control
121
120
  */
122
- titleText?: React.ReactNode;
121
+ titleText?: ReactNode;
123
122
  /**
124
123
  * Callback function for translating ListBoxMenuIcon SVG title
125
124
  */
@@ -135,7 +134,7 @@ export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>,
135
134
  /**
136
135
  * Provide the text that is displayed when the control is in warning state
137
136
  */
138
- warnText?: React.ReactNode;
137
+ warnText?: ReactNode;
139
138
  }
140
139
  export type DropdownTranslationKey = ListBoxMenuIconTranslationKey;
141
140
  type DropdownComponentProps<ItemType> = React.PropsWithoutRef<React.PropsWithChildren<DropdownProps<ItemType>> & React.RefAttributes<HTMLButtonElement>>;
@@ -4,8 +4,7 @@
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 { ReactNodeLike } from 'prop-types';
8
- import React from 'react';
7
+ import React, { ReactNode } from 'react';
9
8
  import { ButtonSize } from '../Button';
10
9
  export declare const IconButtonKinds: readonly ["primary", "secondary", "ghost", "tertiary"];
11
10
  export type IconButtonKind = (typeof IconButtonKinds)[number];
@@ -17,7 +16,7 @@ interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>
17
16
  /**
18
17
  * Provide an icon or asset to be rendered inside of the IconButton
19
18
  */
20
- children?: React.ReactNode;
19
+ children?: ReactNode;
21
20
  /**
22
21
  * Specify an optional className to be added to your Button
23
22
  */
@@ -52,7 +51,7 @@ interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>
52
51
  * This means that if you have text in the child node it will not be
53
52
  * announced to the screen reader.
54
53
  */
55
- label: ReactNodeLike;
54
+ label: ReactNode;
56
55
  /**
57
56
  * Specify the duration in milliseconds to delay before hiding the tooltip
58
57
  */
@@ -37,6 +37,7 @@ const defaultTranslateWithId = id => defaultTranslations[id];
37
37
  * `ListBoxTrigger` is used to orient the icon up or down depending on the
38
38
  * state of the menu for a given `ListBox`
39
39
  */
40
+
40
41
  const ListBoxTrigger = /*#__PURE__*/React__default["default"].forwardRef(function ListBoxTrigger(_ref, ref) {
41
42
  let {
42
43
  isOpen,
@@ -140,7 +140,7 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(_ref, forwardRef) {
140
140
  }
141
141
  }
142
142
  function focusItem(e) {
143
- const currentItem = focusableItems.findIndex(item => item.ref.current.contains(document.activeElement));
143
+ const currentItem = focusableItems.findIndex(item => item.ref?.current?.contains(document.activeElement));
144
144
  let indexToFocus = currentItem;
145
145
 
146
146
  // if currentItem is -1, no menu item is focused yet.
@@ -34,6 +34,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
34
34
 
35
35
  var _CaretLeft, _CaretRight;
36
36
  const hoverIntentDelay = 150; // in ms
37
+ const leaveIntentDelay = 300; // in ms
37
38
 
38
39
  const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem(_ref, forwardRef) {
39
40
  let {
@@ -59,6 +60,7 @@ const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem(_ref, forwardRe
59
60
  const hasChildren = Boolean(children);
60
61
  const [submenuOpen, setSubmenuOpen] = React.useState(false);
61
62
  const hoverIntentTimeout = React.useRef(null);
63
+ const leaveIntentTimeout = React.useRef(null);
62
64
  const isDisabled = disabled && !hasChildren;
63
65
  const isDanger = kind === 'danger' && !hasChildren;
64
66
  function registerItem() {
@@ -113,6 +115,11 @@ const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem(_ref, forwardRe
113
115
  }
114
116
  }
115
117
  function handleMouseEnter() {
118
+ if (leaveIntentTimeout.current) {
119
+ // When mouse reenters before closing keep sub menu open
120
+ clearTimeout(leaveIntentTimeout.current);
121
+ leaveIntentTimeout.current = null;
122
+ }
116
123
  hoverIntentTimeout.current = setTimeout(() => {
117
124
  openSubmenu();
118
125
  }, hoverIntentDelay);
@@ -120,8 +127,12 @@ const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem(_ref, forwardRe
120
127
  function handleMouseLeave() {
121
128
  if (hoverIntentTimeout.current) {
122
129
  clearTimeout(hoverIntentTimeout.current);
123
- closeSubmenu();
124
- menuItem.current?.focus();
130
+ // Avoid closing the sub menu as soon as mouse leaves
131
+ // prevents accidental closure due to scroll bar
132
+ leaveIntentTimeout.current = setTimeout(() => {
133
+ closeSubmenu();
134
+ menuItem.current?.focus();
135
+ }, leaveIntentDelay);
125
136
  }
126
137
  }
127
138
  function handleKeyDown(e) {
@@ -4,14 +4,13 @@
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 { ReactNodeLike } from 'prop-types';
8
- import React from 'react';
7
+ import React, { ReactNode } from 'react';
9
8
  import { ReactAttr } from '../../types/common';
10
9
  import { InlineLoadingStatus } from '../InlineLoading/InlineLoading';
11
10
  export declare const ModalSizes: readonly ["xs", "sm", "md", "lg"];
12
11
  export type ModalSize = (typeof ModalSizes)[number];
13
12
  export interface ModalSecondaryButton {
14
- buttonText?: string | React.ReactNode;
13
+ buttonText?: string | ReactNode;
15
14
  onClick?: React.MouseEventHandler<HTMLButtonElement>;
16
15
  }
17
16
  export interface ModalProps extends ReactAttr<HTMLDivElement> {
@@ -27,7 +26,7 @@ export interface ModalProps extends ReactAttr<HTMLDivElement> {
27
26
  /**
28
27
  * Provide the contents of your Modal
29
28
  */
30
- children?: React.ReactNode;
29
+ children?: ReactNode;
31
30
  /**
32
31
  * Specify an optional className to be applied to the modal root node
33
32
  */
@@ -75,11 +74,11 @@ export interface ModalProps extends ReactAttr<HTMLDivElement> {
75
74
  /**
76
75
  * Specify the content of the modal header title.
77
76
  */
78
- modalHeading?: React.ReactNode;
77
+ modalHeading?: ReactNode;
79
78
  /**
80
79
  * Specify the content of the modal header label.
81
80
  */
82
- modalLabel?: React.ReactNode;
81
+ modalLabel?: ReactNode;
83
82
  /**
84
83
  * Specify a handler for keypresses.
85
84
  * @deprecated this property is unused
@@ -124,11 +123,11 @@ export interface ModalProps extends ReactAttr<HTMLDivElement> {
124
123
  /**
125
124
  * Specify the text for the primary button
126
125
  */
127
- primaryButtonText?: React.ReactNode;
126
+ primaryButtonText?: ReactNode;
128
127
  /**
129
128
  * Specify the text for the secondary button
130
129
  */
131
- secondaryButtonText?: React.ReactNode;
130
+ secondaryButtonText?: ReactNode;
132
131
  /**
133
132
  * Specify an array of config objects for secondary buttons
134
133
  */
@@ -154,7 +153,7 @@ export interface ModalProps extends ReactAttr<HTMLDivElement> {
154
153
  /**
155
154
  * **Experimental**: Provide a `Slug` component to be rendered inside the `Modal` component
156
155
  */
157
- slug?: ReactNodeLike;
156
+ slug?: ReactNode;
158
157
  }
159
158
  declare const Modal: React.ForwardRefExoticComponent<ModalProps & React.RefAttributes<HTMLDivElement>>;
160
159
  export default Modal;
@@ -5,7 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import { type UseComboboxProps, type UseMultipleSelectionProps } from 'downshift';
8
- import { ReactNodeLike } from 'prop-types';
9
8
  import { ReactNode, FunctionComponent, ReactElement } from 'react';
10
9
  import { type ItemBase, type SortingPropTypes } from './MultiSelectPropTypes';
11
10
  export interface FilterableMultiSelectProps<Item extends ItemBase> extends SortingPropTypes<Item> {
@@ -143,7 +142,7 @@ export interface FilterableMultiSelectProps<Item extends ItemBase> extends Sorti
143
142
  /**
144
143
  * **Experimental**: Provide a `Slug` component to be rendered inside the `Checkbox` component
145
144
  */
146
- slug?: ReactNodeLike;
145
+ slug?: ReactNode;
147
146
  /**
148
147
  * Provide text to be used in a `<label>` element that is tied to the
149
148
  * combobox via ARIA attributes.
@@ -5,11 +5,9 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import { UseSelectProps } from 'downshift';
8
- import { ReactNodeLike } from 'prop-types';
9
- import React from 'react';
8
+ import React, { ReactNode } from 'react';
10
9
  import { ListBoxSize, ListBoxType } from '../ListBox';
11
10
  import { ListBoxProps } from '../ListBox/ListBox';
12
- import { OnChangeData } from '../Dropdown';
13
11
  import type { InternationalProps } from '../../types/common';
14
12
  interface SharedOptions {
15
13
  locale: string;
@@ -49,6 +47,9 @@ interface MultiSelectSortingProps<ItemType> {
49
47
  */
50
48
  sortItems?(items: ReadonlyArray<ItemType>, options: SortItemsOptions<ItemType>): ItemType[];
51
49
  }
50
+ interface OnChangeData<ItemType> {
51
+ selectedItems: ItemType[] | null;
52
+ }
52
53
  export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<ItemType>, InternationalProps<'close.menu' | 'open.menu' | 'clear.all' | 'clear.selection'> {
53
54
  className?: string;
54
55
  /**
@@ -79,7 +80,7 @@ export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<Item
79
80
  * Provide helper text that is used alongside the control label for
80
81
  * additional help
81
82
  */
82
- helperText?: React.ReactNode;
83
+ helperText?: ReactNode;
83
84
  /**
84
85
  * Specify whether the title text should be hidden or not
85
86
  */
@@ -100,7 +101,7 @@ export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<Item
100
101
  /**
101
102
  * If invalid, what is the error?
102
103
  */
103
- invalidText?: React.ReactNode;
104
+ invalidText?: ReactNode;
104
105
  /**
105
106
  * Function to render items as custom components instead of strings.
106
107
  * Defaults to null and is overridden by a getter
@@ -121,7 +122,7 @@ export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<Item
121
122
  * Generic `label` that will be used as the textual representation of what
122
123
  * this field is for
123
124
  */
124
- label: NonNullable<React.ReactNode>;
125
+ label: NonNullable<ReactNode>;
125
126
  /**
126
127
  * `true` to use the light version.
127
128
  *
@@ -170,12 +171,12 @@ export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<Item
170
171
  /**
171
172
  * **Experimental**: Provide a `Slug` component to be rendered inside the `MultiSelect` component
172
173
  */
173
- slug?: ReactNodeLike;
174
+ slug?: ReactNode;
174
175
  /**
175
176
  * Provide text to be used in a `<label>` element that is tied to the
176
177
  * multiselect via ARIA attributes.
177
178
  */
178
- titleText?: React.ReactNode;
179
+ titleText?: ReactNode;
179
180
  /**
180
181
  * Specify 'inline' to create an inline multi-select.
181
182
  */
@@ -191,7 +192,7 @@ export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<Item
191
192
  /**
192
193
  * Provide the text that is displayed when the control is in warning state
193
194
  */
194
- warnText?: React.ReactNode;
195
+ warnText?: ReactNode;
195
196
  }
196
197
  type MultiSelectComponentProps<ItemType> = React.PropsWithChildren<MultiSelectProps<ItemType>> & React.RefAttributes<HTMLButtonElement>;
197
198
  interface MultiSelectComponent {
@@ -388,8 +388,8 @@ export interface ActionableNotificationProps extends HTMLAttributes<HTMLDivEleme
388
388
  */
389
389
  closeOnEscape?: boolean;
390
390
  /**
391
- * @deprecated use StaticNotification once it's available. Issue #15532
392
- * Specify if focus should be moved to the component when the notification contains actions
391
+ * @deprecated This prop will be removed in the next major version, v12.
392
+ * Specify if focus should be moved to the component on render. To meet the spec for alertdialog, this must always be true. If you're setting this to false, explore using StaticNotification instead. https://github.com/carbon-design-system/carbon/pull/15532
393
393
  */
394
394
  hasFocus?: boolean;
395
395
  /**
@@ -4,7 +4,6 @@
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 { ReactNodeLike } from 'prop-types';
8
7
  import React, { ReactNode } from 'react';
9
8
  export declare const translationIds: {
10
9
  'increment.number': string;
@@ -111,7 +110,7 @@ export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
111
110
  /**
112
111
  * **Experimental**: Provide a `Slug` component to be rendered inside the `TextInput` component
113
112
  */
114
- slug?: ReactNodeLike;
113
+ slug?: ReactNode;
115
114
  /**
116
115
  * Specify how much the values should increase/decrease upon clicking on up/down button
117
116
  */
@@ -0,0 +1,3 @@
1
+ import ControlledPasswordInput from '../TextInput/ControlledPasswordInput';
2
+ import PasswordInput from '../TextInput/PasswordInput';
3
+ export { ControlledPasswordInput, PasswordInput };
@@ -6,10 +6,16 @@
6
6
  */
7
7
  import React, { type ForwardedRef, type WeakValidationMap, type ElementType } from 'react';
8
8
  import { type PolymorphicProps } from '../../types/common';
9
- export type PopoverAlignment = 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'left-bottom' | 'left-top' | 'right' | 'right-bottom' | 'right-top' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-end' | 'left-start' | 'right-end' | 'right-start';
9
+ /**
10
+ * Deprecated popover alignment values.
11
+ * @deprecated Use NewPopoverAlignment instead.
12
+ */
13
+ export type DeprecatedPopoverAlignment = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'left-bottom' | 'left-top' | 'right-bottom' | 'right-top';
14
+ export type NewPopoverAlignment = 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-end' | 'left-start' | 'right-end' | 'right-start';
15
+ export type PopoverAlignment = DeprecatedPopoverAlignment | NewPopoverAlignment;
10
16
  interface PopoverBaseProps {
11
17
  /**
12
- * Specify how the popover should align with the trigger element
18
+ * Specify how the popover should align with the trigger element.
13
19
  */
14
20
  align?: PopoverAlignment;
15
21
  /**
@@ -12,6 +12,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
12
12
  var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
13
13
  var cx = require('classnames');
14
14
  var PropTypes = require('prop-types');
15
+ var deprecateValuesWithin = require('../../prop-types/deprecateValuesWithin.js');
15
16
  var React = require('react');
16
17
  var useIsomorphicEffect = require('../../internal/useIsomorphicEffect.js');
17
18
  var useMergedRefs = require('../../internal/useMergedRefs.js');
@@ -35,6 +36,25 @@ const PopoverContext = /*#__PURE__*/React__default["default"].createContext({
35
36
  },
36
37
  autoAlign: null
37
38
  });
39
+
40
+ /**
41
+ * Deprecated popover alignment values.
42
+ * @deprecated Use NewPopoverAlignment instead.
43
+ */
44
+
45
+ const propMappingFunction = deprecatedValue => {
46
+ const mapping = {
47
+ 'top-left': 'top-start',
48
+ 'top-right': 'top-end',
49
+ 'bottom-left': 'bottom-start',
50
+ 'bottom-right': 'bottom-end',
51
+ 'left-bottom': 'left-end',
52
+ 'left-top': 'left-start',
53
+ 'right-bottom': 'right-end',
54
+ 'right-top': 'right-start'
55
+ };
56
+ return mapping[deprecatedValue];
57
+ };
38
58
  const Popover = /*#__PURE__*/React__default["default"].forwardRef(function PopoverRenderFunction(_ref, forwardRef) {
39
59
  let {
40
60
  isTabTip,
@@ -233,8 +253,9 @@ if (process.env.NODE_ENV !== "production") {
233
253
  Popover.propTypes = {
234
254
  /**
235
255
  * Specify how the popover should align with the trigger element
256
+
236
257
  */
237
- align: PropTypes__default["default"].oneOf(['top', 'top-left',
258
+ align: deprecateValuesWithin["default"](PropTypes__default["default"].oneOf(['top', 'top-left',
238
259
  // deprecated use top-start instead
239
260
  'top-right',
240
261
  // deprecated use top-end instead
@@ -256,6 +277,10 @@ Popover.propTypes = {
256
277
 
257
278
  // new values to match floating-ui
258
279
  'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
280
+ //allowed prop values
281
+ ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
282
+ //optional mapper function
283
+ propMappingFunction),
259
284
  /**
260
285
  * Provide a custom element or component to render the top-level node for the
261
286
  * component.
@@ -4,8 +4,7 @@
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 { ReactNodeLike } from 'prop-types';
8
- import React from 'react';
7
+ import React, { ReactNode } from 'react';
9
8
  type ExcludedAttributes = 'onChange';
10
9
  export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes> {
11
10
  /**
@@ -41,7 +40,7 @@ export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInp
41
40
  * Provide label text to be read by screen readers when interacting with the
42
41
  * control
43
42
  */
44
- labelText: ReactNodeLike;
43
+ labelText: ReactNode;
45
44
  /**
46
45
  * Provide a name for the underlying `<input>` node
47
46
  */
@@ -58,7 +57,7 @@ export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInp
58
57
  /**
59
58
  * **Experimental**: Provide a `Slug` component to be rendered inside the `RadioButton` component
60
59
  */
61
- slug?: ReactNodeLike;
60
+ slug?: ReactNode;
62
61
  /**
63
62
  * Specify the value of the `<RadioButton>`
64
63
  */
@@ -4,15 +4,14 @@
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 { ReactNodeLike } from 'prop-types';
8
- import React from 'react';
7
+ import React, { ReactNode } from 'react';
9
8
  export declare const RadioButtonGroupContext: React.Context<null>;
10
9
  type ExcludedAttributes = 'onChange';
11
10
  export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HTMLFieldSetElement>, ExcludedAttributes> {
12
11
  /**
13
12
  * Provide a collection of `<RadioButton>` components to render in the group
14
13
  */
15
- children?: ReactNodeLike;
14
+ children?: ReactNode;
16
15
  /**
17
16
  * Provide an optional className to be applied to the container node
18
17
  */
@@ -28,7 +27,7 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
28
27
  /**
29
28
  * Provide text that is used alongside the control label for additional help
30
29
  */
31
- helperText?: ReactNodeLike;
30
+ helperText?: ReactNode;
32
31
  /**
33
32
  * Specify whether the control is currently invalid
34
33
  */
@@ -36,7 +35,7 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
36
35
  /**
37
36
  * Provide the text that is displayed when the control is in an invalid state
38
37
  */
39
- invalidText?: ReactNodeLike;
38
+ invalidText?: ReactNode;
40
39
  /**
41
40
  * Provide where label text should be placed
42
41
  */
@@ -45,7 +44,7 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
45
44
  * Provide a legend to the RadioButtonGroup input that you are
46
45
  * exposing to the user
47
46
  */
48
- legendText?: ReactNodeLike;
47
+ legendText?: ReactNode;
49
48
  /**
50
49
  * Specify the name of the underlying `<input>` nodes
51
50
  */
@@ -66,7 +65,7 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
66
65
  /**
67
66
  * **Experimental**: Provide a `Slug` component to be rendered inside the `RadioButtonGroup` component
68
67
  */
69
- slug?: ReactNodeLike;
68
+ slug?: ReactNode;
70
69
  /**
71
70
  * Specify whether the control is currently in warning state
72
71
  */
@@ -74,7 +73,7 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
74
73
  /**
75
74
  * Provide the text that is displayed when the control is in warning state
76
75
  */
77
- warnText?: ReactNodeLike;
76
+ warnText?: ReactNode;
78
77
  /**
79
78
  * Specify the value that is currently selected in the group
80
79
  */
@@ -4,7 +4,6 @@
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 { ReactNodeLike } from 'prop-types';
8
7
  import React, { ChangeEventHandler, ComponentPropsWithRef, ReactNode } from 'react';
9
8
  type ExcludedAttributes = 'size';
10
9
  interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, ExcludedAttributes> {
@@ -80,7 +79,7 @@ interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, ExcludedAttr
80
79
  /**
81
80
  * **Experimental**: Provide a `Slug` component to be rendered inside the `Dropdown` component
82
81
  */
83
- slug?: ReactNodeLike;
82
+ slug?: ReactNode;
84
83
  /**
85
84
  * Specify whether the control is currently in warning state
86
85
  */
@@ -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 React, { type KeyboardEventHandler, PureComponent } from 'react';
8
- import PropTypes, { ReactNodeLike } from 'prop-types';
7
+ import React, { type KeyboardEventHandler, PureComponent, ReactNode } from 'react';
8
+ import PropTypes from 'prop-types';
9
9
  /**
10
10
  * Distinguish two handles by lower and upper positions.
11
11
  */
@@ -26,7 +26,7 @@ export interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputEle
26
26
  /**
27
27
  * The child nodes.
28
28
  */
29
- children?: ReactNodeLike;
29
+ children?: ReactNode;
30
30
  /**
31
31
  * The CSS class name for the slider, set on the wrapping div.
32
32
  */
@@ -58,11 +58,11 @@ export interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputEle
58
58
  /**
59
59
  * Provide the text that is displayed when the Slider is in an invalid state
60
60
  */
61
- invalidText?: React.ReactNode;
61
+ invalidText?: ReactNode;
62
62
  /**
63
63
  * The label for the slider.
64
64
  */
65
- labelText?: ReactNodeLike;
65
+ labelText?: ReactNode;
66
66
  /**
67
67
  * @deprecated
68
68
  * `true` to use the light version.
@@ -474,7 +474,7 @@ class Slider extends React.PureComponent {
474
474
  });
475
475
  if (adjustedValue !== targetValue) {
476
476
  this.setState({
477
- correctedValue: targetValue,
477
+ correctedValue: targetValue.toString(),
478
478
  correctedPosition: handlePosition
479
479
  });
480
480
  } else {