@carbon/react 1.57.0-rc.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 (126) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1022 -1028
  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 -260
  6. package/es/components/ComposedModal/ComposedModal.d.ts +1 -2
  7. package/es/components/ContainedList/ContainedList.d.ts +7 -3
  8. package/es/components/ContainedList/ContainedList.js +3 -2
  9. package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +1 -2
  10. package/es/components/ContainedList/ContainedListItem/index.d.ts +9 -0
  11. package/es/components/ContainedList/index.d.ts +11 -0
  12. package/es/components/ContainedList/index.js +13 -0
  13. package/es/components/DataTable/TableHeader.d.ts +4 -5
  14. package/es/components/DataTable/TableSlugRow.d.ts +3 -2
  15. package/es/components/DataTable/stories/examples/TableToolbarFilter.d.ts +51 -0
  16. package/es/components/DatePicker/DatePicker.d.ts +9 -9
  17. package/es/components/DatePicker/plugins/rangePlugin.js +5 -6
  18. package/es/components/Dialog/index.d.ts +31 -0
  19. package/es/components/Dropdown/Dropdown.d.ts +5 -6
  20. package/es/components/IconButton/index.d.ts +3 -4
  21. package/es/components/ListBox/next/ListBoxTrigger.js +5 -3
  22. package/es/components/Menu/Menu.js +1 -1
  23. package/es/components/Menu/MenuItem.js +13 -2
  24. package/es/components/Modal/Modal.d.ts +8 -9
  25. package/es/components/MultiSelect/FilterableMultiSelect.d.ts +176 -0
  26. package/es/components/MultiSelect/FilterableMultiSelect.js +388 -313
  27. package/es/components/MultiSelect/MultiSelect.d.ts +10 -9
  28. package/es/components/MultiSelect/MultiSelect.js +1 -2
  29. package/es/components/MultiSelect/MultiSelectPropTypes.d.ts +62 -0
  30. package/es/components/MultiSelect/index.d.ts +10 -0
  31. package/es/components/MultiSelect/index.js +2 -0
  32. package/es/components/Notification/Notification.d.ts +2 -2
  33. package/es/components/NumberInput/NumberInput.d.ts +1 -2
  34. package/es/components/Pagination/Pagination.js +9 -9
  35. package/es/components/PasswordInput/index.d.ts +3 -0
  36. package/es/components/Popover/index.d.ts +8 -2
  37. package/es/components/Popover/index.js +26 -1
  38. package/es/components/RadioButton/RadioButton.d.ts +7 -4
  39. package/es/components/RadioButton/RadioButton.js +7 -1
  40. package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +11 -8
  41. package/es/components/RadioButtonGroup/RadioButtonGroup.js +7 -1
  42. package/es/components/Select/Select.d.ts +1 -2
  43. package/es/components/Slider/Slider.d.ts +5 -5
  44. package/es/components/Slider/Slider.js +1 -1
  45. package/es/components/Tag/DismissibleTag.d.ts +3 -3
  46. package/es/components/Tag/OperationalTag.d.ts +3 -3
  47. package/es/components/Tag/SelectableTag.d.ts +3 -3
  48. package/es/components/Tag/Tag.d.ts +3 -3
  49. package/es/components/TextArea/TextArea.d.ts +6 -7
  50. package/es/components/TextInput/PasswordInput.d.ts +5 -6
  51. package/es/components/TextInput/PasswordInput.js +2 -2
  52. package/es/components/TextInput/TextInput.d.ts +1 -2
  53. package/es/components/Theme/index.d.ts +1 -0
  54. package/es/components/Theme/index.js +8 -2
  55. package/es/components/Tile/Tile.d.ts +3 -4
  56. package/es/components/TileGroup/TileGroup.d.ts +3 -2
  57. package/es/components/TileGroup/index.d.ts +9 -0
  58. package/es/components/TimePicker/TimePicker.js +1 -1
  59. package/es/components/Toggle/Toggle.js +1 -1
  60. package/es/components/Tooltip/DefinitionTooltip.js +1 -1
  61. package/es/index.js +7 -5
  62. package/es/prop-types/deprecateValuesWithin.js +35 -0
  63. package/lib/components/Button/Button.js +2 -2
  64. package/lib/components/Checkbox/Checkbox.d.ts +6 -7
  65. package/lib/components/ComboBox/ComboBox.d.ts +4 -5
  66. package/lib/components/ComboBox/ComboBox.js +267 -260
  67. package/lib/components/ComposedModal/ComposedModal.d.ts +1 -2
  68. package/lib/components/ContainedList/ContainedList.d.ts +7 -3
  69. package/lib/components/ContainedList/ContainedList.js +3 -2
  70. package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +1 -2
  71. package/lib/components/ContainedList/ContainedListItem/index.d.ts +9 -0
  72. package/lib/components/ContainedList/index.d.ts +11 -0
  73. package/lib/components/ContainedList/index.js +19 -0
  74. package/lib/components/DataTable/TableHeader.d.ts +4 -5
  75. package/lib/components/DataTable/TableSlugRow.d.ts +3 -2
  76. package/lib/components/DataTable/stories/examples/TableToolbarFilter.d.ts +51 -0
  77. package/lib/components/DatePicker/DatePicker.d.ts +9 -9
  78. package/lib/components/DatePicker/plugins/rangePlugin.js +5 -6
  79. package/lib/components/Dialog/index.d.ts +31 -0
  80. package/lib/components/Dropdown/Dropdown.d.ts +5 -6
  81. package/lib/components/IconButton/index.d.ts +3 -4
  82. package/lib/components/ListBox/next/ListBoxTrigger.js +5 -3
  83. package/lib/components/Menu/Menu.js +1 -1
  84. package/lib/components/Menu/MenuItem.js +13 -2
  85. package/lib/components/Modal/Modal.d.ts +8 -9
  86. package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +176 -0
  87. package/lib/components/MultiSelect/FilterableMultiSelect.js +387 -312
  88. package/lib/components/MultiSelect/MultiSelect.d.ts +10 -9
  89. package/lib/components/MultiSelect/MultiSelect.js +1 -2
  90. package/lib/components/MultiSelect/MultiSelectPropTypes.d.ts +62 -0
  91. package/lib/components/MultiSelect/index.d.ts +10 -0
  92. package/lib/components/MultiSelect/index.js +2 -0
  93. package/lib/components/Notification/Notification.d.ts +2 -2
  94. package/lib/components/NumberInput/NumberInput.d.ts +1 -2
  95. package/lib/components/Pagination/Pagination.js +9 -9
  96. package/lib/components/PasswordInput/index.d.ts +3 -0
  97. package/lib/components/Popover/index.d.ts +8 -2
  98. package/lib/components/Popover/index.js +26 -1
  99. package/lib/components/RadioButton/RadioButton.d.ts +7 -4
  100. package/lib/components/RadioButton/RadioButton.js +7 -1
  101. package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +11 -8
  102. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +7 -1
  103. package/lib/components/Select/Select.d.ts +1 -2
  104. package/lib/components/Slider/Slider.d.ts +5 -5
  105. package/lib/components/Slider/Slider.js +1 -1
  106. package/lib/components/Tag/DismissibleTag.d.ts +3 -3
  107. package/lib/components/Tag/OperationalTag.d.ts +3 -3
  108. package/lib/components/Tag/SelectableTag.d.ts +3 -3
  109. package/lib/components/Tag/Tag.d.ts +3 -3
  110. package/lib/components/TextArea/TextArea.d.ts +6 -7
  111. package/lib/components/TextInput/PasswordInput.d.ts +5 -6
  112. package/lib/components/TextInput/PasswordInput.js +2 -2
  113. package/lib/components/TextInput/TextInput.d.ts +1 -2
  114. package/lib/components/Theme/index.d.ts +1 -0
  115. package/lib/components/Theme/index.js +8 -1
  116. package/lib/components/Tile/Tile.d.ts +3 -4
  117. package/lib/components/TileGroup/TileGroup.d.ts +3 -2
  118. package/lib/components/TileGroup/index.d.ts +9 -0
  119. package/lib/components/TimePicker/TimePicker.js +1 -1
  120. package/lib/components/Toggle/Toggle.js +1 -1
  121. package/lib/components/Tooltip/DefinitionTooltip.js +1 -1
  122. package/lib/index.js +34 -31
  123. package/lib/prop-types/deprecateValuesWithin.js +39 -0
  124. package/package.json +8 -8
  125. package/es/components/TileGroup/index.js +0 -13
  126. package/lib/components/TileGroup/index.js +0 -18
@@ -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 {
@@ -615,6 +615,5 @@ MultiSelect.propTypes = {
615
615
  */
616
616
  warnText: PropTypes.node
617
617
  };
618
- var MultiSelect$1 = MultiSelect;
619
618
 
620
- export { MultiSelect$1 as default };
619
+ export { MultiSelect as default };
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import PropTypes from 'prop-types';
8
+ export declare const sortingPropTypes: {
9
+ /**
10
+ * Provide a compare function that is used to determine the ordering of
11
+ * options. `compareItems` has the following function signature:
12
+ *
13
+ * compareFunction :
14
+ * (itemA: string, itemB: string, { locale: string }) => number
15
+ */
16
+ compareItems: PropTypes.Requireable<(...args: any[]) => any>;
17
+ /**
18
+ * Provide a method that sorts all options in the control. Overriding this
19
+ * prop means that you also have to handle the sort logic for selected versus
20
+ * un-selected items. If you just want to control ordering, consider the
21
+ * `compareItems` prop instead.
22
+ *
23
+ * `sortItems` has the following signature:
24
+ *
25
+ * sortItems :
26
+ * (items: Array<Item>, {
27
+ * selectedItems: Array<Item>,
28
+ * itemToString: Item => string,
29
+ * compareItems: (itemA: string, itemB: string, {
30
+ * locale: string
31
+ * }) => number,
32
+ * locale: string,
33
+ * }) => Array<Item>
34
+ */
35
+ sortItems: PropTypes.Requireable<(...args: any[]) => any>;
36
+ };
37
+ export interface ItemBase {
38
+ disabled?: boolean;
39
+ }
40
+ export interface SortingPropTypes<Item extends ItemBase> {
41
+ /**
42
+ * Provide a compare function that is used
43
+ * to determine the ordering of options.
44
+ */
45
+ compareItems(itemA: string, itemB: string, ctx: {
46
+ locale: string;
47
+ }): number;
48
+ /**
49
+ * Provide a method that sorts all options in the control. Overriding this
50
+ * prop means that you also have to handle the sort logic for selected versus
51
+ * un-selected items. If you just want to control ordering, consider the
52
+ * `compareItems` prop instead.
53
+ */
54
+ sortItems(items: Item[], state: {
55
+ selectedItems: Item[];
56
+ itemToString(item: Item): string;
57
+ compareItems(itemA: string, itemB: string, ctx: {
58
+ locale: string;
59
+ }): number;
60
+ locale: string;
61
+ }): Item[];
62
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import MultiSelect from './MultiSelect';
8
+ import { default as FilterableMultiSelect } from './FilterableMultiSelect';
9
+ export { FilterableMultiSelect, MultiSelect };
10
+ export default MultiSelect;
@@ -12,6 +12,8 @@ import FilterableMultiSelect from './FilterableMultiSelect.js';
12
12
  export { default as FilterableMultiSelect } from './FilterableMultiSelect.js';
13
13
 
14
14
  FilterableMultiSelect.displayName = 'MultiSelect.Filterable';
15
+ // @ts-expect-error: The attribute indeed does not exist on the object,
16
+ // but since it is already deprecated, we do not have to fix it.
15
17
  MultiSelect.Filterable = FilterableMultiSelect;
16
18
  if (process.env.NODE_ENV !== "production") {
17
19
  deprecateFieldOnObject(MultiSelect, 'Filterable', FilterableMultiSelect);
@@ -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
  */
@@ -68,10 +68,10 @@ const Pagination = /*#__PURE__*/React__default.forwardRef(function Pagination(_r
68
68
  pageSize: controlledPageSize,
69
69
  pageSizeInputDisabled,
70
70
  pageSizes: controlledPageSizes,
71
- pageText = (page, pagesUnknown) => `page ${pagesUnknown ? '' : page}`,
71
+ pageText = page => `page ${page}`,
72
72
  pagesUnknown = false,
73
73
  size = 'md',
74
- totalItems = 1,
74
+ totalItems,
75
75
  ...rest
76
76
  } = _ref;
77
77
  const prefix = usePrefix();
@@ -93,7 +93,7 @@ const Pagination = /*#__PURE__*/React__default.forwardRef(function Pagination(_r
93
93
  [`${prefix}--pagination--${size}`]: size,
94
94
  [customClassName]: !!customClassName
95
95
  });
96
- const totalPages = Math.max(Math.ceil(totalItems / pageSize), 1);
96
+ const totalPages = totalItems ? Math.max(Math.ceil(totalItems / pageSize), 1) : NaN;
97
97
  const backButtonDisabled = disabled || page === 1;
98
98
  const backButtonClasses = cx({
99
99
  [`${prefix}--pagination__button`]: true,
@@ -145,7 +145,7 @@ const Pagination = /*#__PURE__*/React__default.forwardRef(function Pagination(_r
145
145
  }
146
146
  function handlePageInputChange(event) {
147
147
  const page = Number(event.target.value);
148
- if (page > 0 && page <= Math.max(Math.ceil(totalItems / pageSize), 1)) {
148
+ if (page > 0 && totalItems && page <= Math.max(Math.ceil(totalItems / pageSize), 1)) {
149
149
  setPage(page);
150
150
  if (onChange) {
151
151
  onChange({
@@ -218,11 +218,11 @@ const Pagination = /*#__PURE__*/React__default.forwardRef(function Pagination(_r
218
218
  text: String(sizeObj.text)
219
219
  }))), /*#__PURE__*/React__default.createElement("span", {
220
220
  className: `${prefix}--pagination__text ${prefix}--pagination__items-count`
221
- }, pagesUnknown ? itemText(pageSize * (page - 1) + 1, page * pageSize) : itemRangeText(Math.min(pageSize * (page - 1) + 1, totalItems), Math.min(page * pageSize, totalItems), totalItems))), /*#__PURE__*/React__default.createElement("div", {
221
+ }, pagesUnknown || !totalItems ? itemText(pageSize * (page - 1) + 1, page * pageSize) : itemRangeText(Math.min(pageSize * (page - 1) + 1, totalItems), Math.min(page * pageSize, totalItems), totalItems))), /*#__PURE__*/React__default.createElement("div", {
222
222
  className: `${prefix}--pagination__right`
223
223
  }, pagesUnknown ? /*#__PURE__*/React__default.createElement("span", {
224
- className: `${prefix}--pagination__text ${prefix}--pagination__page-text`
225
- }, pagesUnknown ? pageText(page, pagesUnknown) : pageRangeText(page, totalPages)) : null, /*#__PURE__*/React__default.createElement(Select, {
224
+ className: `${prefix}--pagination__text ${prefix}--pagination__page-text ${prefix}--pagination__unknown-pages-text`
225
+ }, pageText(page)) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Select, {
226
226
  id: `${prefix}-pagination-select-${inputId}-right`,
227
227
  className: `${prefix}--select__page-number`,
228
228
  labelText: `Page number, of ${totalPages} pages`,
@@ -231,9 +231,9 @@ const Pagination = /*#__PURE__*/React__default.forwardRef(function Pagination(_r
231
231
  onChange: handlePageInputChange,
232
232
  value: page,
233
233
  disabled: pageInputDisabled || disabled
234
- }, selectItems), pagesUnknown ? null : /*#__PURE__*/React__default.createElement("span", {
234
+ }, selectItems), /*#__PURE__*/React__default.createElement("span", {
235
235
  className: `${prefix}--pagination__text`
236
- }, pagesUnknown ? pageText(page, pagesUnknown) : pageRangeText(page, totalPages)), /*#__PURE__*/React__default.createElement("div", {
236
+ }, pageRangeText(page, totalPages))), /*#__PURE__*/React__default.createElement("div", {
237
237
  className: `${prefix}--pagination__control-buttons`
238
238
  }, /*#__PURE__*/React__default.createElement(IconButton, {
239
239
  align: "top",
@@ -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
  /**
@@ -8,6 +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
12
  import React__default, { useRef, useMemo, useEffect } from 'react';
12
13
  import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
13
14
  import { useMergedRefs } from '../../internal/useMergedRefs.js';
@@ -25,6 +26,25 @@ const PopoverContext = /*#__PURE__*/React__default.createContext({
25
26
  },
26
27
  autoAlign: null
27
28
  });
29
+
30
+ /**
31
+ * Deprecated popover alignment values.
32
+ * @deprecated Use NewPopoverAlignment instead.
33
+ */
34
+
35
+ const propMappingFunction = deprecatedValue => {
36
+ const mapping = {
37
+ 'top-left': 'top-start',
38
+ 'top-right': 'top-end',
39
+ 'bottom-left': 'bottom-start',
40
+ 'bottom-right': 'bottom-end',
41
+ 'left-bottom': 'left-end',
42
+ 'left-top': 'left-start',
43
+ 'right-bottom': 'right-end',
44
+ 'right-top': 'right-start'
45
+ };
46
+ return mapping[deprecatedValue];
47
+ };
28
48
  const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFunction(_ref, forwardRef) {
29
49
  let {
30
50
  isTabTip,
@@ -223,8 +243,9 @@ if (process.env.NODE_ENV !== "production") {
223
243
  Popover.propTypes = {
224
244
  /**
225
245
  * Specify how the popover should align with the trigger element
246
+
226
247
  */
227
- align: PropTypes.oneOf(['top', 'top-left',
248
+ align: deprecateValuesWithin(PropTypes.oneOf(['top', 'top-left',
228
249
  // deprecated use top-start instead
229
250
  'top-right',
230
251
  // deprecated use top-end instead
@@ -246,6 +267,10 @@ Popover.propTypes = {
246
267
 
247
268
  // new values to match floating-ui
248
269
  'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
270
+ //allowed prop values
271
+ ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
272
+ //optional mapper function
273
+ propMappingFunction),
249
274
  /**
250
275
  * Provide a custom element or component to render the top-level node for the
251
276
  * 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,11 +57,15 @@ 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
  */
65
64
  value?: string | number;
65
+ /**
66
+ * `true` to specify if the input is required.
67
+ */
68
+ required?: boolean;
66
69
  }
67
70
  declare const RadioButton: React.ForwardRefExoticComponent<RadioButtonProps & React.RefAttributes<unknown>>;
68
71
  export default RadioButton;
@@ -27,6 +27,7 @@ const RadioButton = /*#__PURE__*/React__default.forwardRef((props, ref) => {
27
27
  onChange = () => {},
28
28
  value = '',
29
29
  slug,
30
+ required,
30
31
  ...rest
31
32
  } = props;
32
33
  const prefix = usePrefix();
@@ -60,7 +61,8 @@ const RadioButton = /*#__PURE__*/React__default.forwardRef((props, ref) => {
60
61
  ref: mergeRefs(inputRef, ref),
61
62
  disabled: disabled,
62
63
  value: value,
63
- name: name
64
+ name: name,
65
+ required: required
64
66
  })), /*#__PURE__*/React__default.createElement("label", {
65
67
  htmlFor: uniqueId,
66
68
  className: `${prefix}--radio-button__label`
@@ -119,6 +121,10 @@ RadioButton.propTypes = {
119
121
  * Provide a handler that is invoked when a user clicks on the control
120
122
  */
121
123
  onClick: PropTypes.func,
124
+ /**
125
+ * `true` to specify if the control is required.
126
+ */
127
+ required: PropTypes.bool,
122
128
  /**
123
129
  * **Experimental**: Provide a `Slug` component to be rendered inside the `RadioButton` component
124
130
  */
@@ -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,11 +73,15 @@ 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
  */
81
80
  valueSelected?: string | number;
81
+ /**
82
+ * `true` to specify if input selection in group is required.
83
+ */
84
+ required?: boolean;
82
85
  }
83
86
  declare const RadioButtonGroup: React.ForwardRefExoticComponent<RadioButtonGroupProps & React.RefAttributes<unknown>>;
84
87
  export default RadioButtonGroup;
@@ -35,6 +35,7 @@ const RadioButtonGroup = /*#__PURE__*/React__default.forwardRef((props, ref) =>
35
35
  warn = false,
36
36
  warnText,
37
37
  slug,
38
+ required,
38
39
  ...rest
39
40
  } = props;
40
41
  const prefix = usePrefix();
@@ -62,7 +63,8 @@ const RadioButtonGroup = /*#__PURE__*/React__default.forwardRef((props, ref) =>
62
63
  key: value,
63
64
  value: value,
64
65
  onChange: handleOnChange,
65
- checked: value === selected
66
+ checked: value === selected,
67
+ required: required
66
68
  };
67
69
  if (!selected && radioButton?.props.checked) {
68
70
  newProps.checked = true;
@@ -187,6 +189,10 @@ RadioButtonGroup.propTypes = {
187
189
  * Whether the RadioButtonGroup should be read-only
188
190
  */
189
191
  readOnly: PropTypes.bool,
192
+ /**
193
+ * `true` to specify if radio selection in group is required.
194
+ */
195
+ required: PropTypes.bool,
190
196
  /**
191
197
  * **Experimental**: Provide a `Slug` component to be rendered inside the `RadioButtonGroup` component
192
198
  */
@@ -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.
@@ -463,7 +463,7 @@ class Slider extends PureComponent {
463
463
  });
464
464
  if (adjustedValue !== targetValue) {
465
465
  this.setState({
466
- correctedValue: targetValue,
466
+ correctedValue: targetValue.toString(),
467
467
  correctedPosition: handlePosition
468
468
  });
469
469
  } else {
@@ -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 PropTypes, { ReactNodeLike } from 'prop-types';
8
- import React from 'react';
7
+ import PropTypes from 'prop-types';
8
+ import React, { ReactNode } from 'react';
9
9
  import { PolymorphicProps } from '../../types/common';
10
10
  import { SIZES, TYPES } from './Tag';
11
11
  export interface DismissibleTagBaseProps {
@@ -42,7 +42,7 @@ export interface DismissibleTagBaseProps {
42
42
  /**
43
43
  * **Experimental:** Provide a `Slug` component to be rendered inside the `DismissibleTag` component
44
44
  */
45
- slug?: ReactNodeLike;
45
+ slug?: ReactNode;
46
46
  /**
47
47
  * Text to show on clear filters
48
48
  */
@@ -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 PropTypes, { ReactNodeLike } from 'prop-types';
8
- import React, { MouseEventHandler } from 'react';
7
+ import PropTypes from 'prop-types';
8
+ import React, { MouseEventHandler, ReactNode } from 'react';
9
9
  import { PolymorphicProps } from '../../types/common';
10
10
  import { SIZES } from './Tag';
11
11
  declare const TYPES: {
@@ -51,7 +51,7 @@ export interface OperationalTagBaseProps {
51
51
  /**
52
52
  * **Experimental:** Provide a `Slug` component to be rendered inside the `OperationalTag` component
53
53
  */
54
- slug?: ReactNodeLike;
54
+ slug?: ReactNode;
55
55
  /**
56
56
  * Specify the type of the `Tag`
57
57
  */
@@ -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 PropTypes, { ReactNodeLike } from 'prop-types';
8
- import React from 'react';
7
+ import PropTypes from 'prop-types';
8
+ import React, { ReactNode } from 'react';
9
9
  import { PolymorphicProps } from '../../types/common';
10
10
  import { SIZES } from './Tag';
11
11
  export interface SelectableTagBaseProps {
@@ -42,7 +42,7 @@ export interface SelectableTagBaseProps {
42
42
  /**
43
43
  * **Experimental:** Provide a `Slug` component to be rendered inside the `SelectableTag` component
44
44
  */
45
- slug?: ReactNodeLike;
45
+ slug?: ReactNode;
46
46
  }
47
47
  export type SelectableTagProps<T extends React.ElementType> = PolymorphicProps<T, SelectableTagBaseProps>;
48
48
  declare const SelectableTag: {
@@ -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 PropTypes, { ReactNodeLike } from 'prop-types';
8
- import React from 'react';
7
+ import PropTypes from 'prop-types';
8
+ import React, { ReactNode } from 'react';
9
9
  import { PolymorphicProps } from '../../types/common';
10
10
  export declare const TYPES: {
11
11
  red: string;
@@ -64,7 +64,7 @@ export interface TagBaseProps {
64
64
  /**
65
65
  * **Experimental:** Provide a `Slug` component to be rendered inside the `Tag` component
66
66
  */
67
- slug?: ReactNodeLike;
67
+ slug?: ReactNode;
68
68
  /**
69
69
  * @deprecated This property is deprecated and will be removed in the next major version. Use DismissibleTag instead.
70
70
  */