@carbon/react 1.106.0 → 1.107.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 (153) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1038 -1003
  2. package/es/components/Accordion/AccordionItem.d.ts +2 -2
  3. package/es/components/Button/Button.js +1 -1
  4. package/es/components/Checkbox/Checkbox.js +2 -1
  5. package/es/components/CheckboxGroup/CheckboxGroup.js +2 -1
  6. package/es/components/ComboBox/ComboBox.d.ts +1 -1
  7. package/es/components/ComboBox/ComboBox.js +1 -1
  8. package/es/components/ContentSwitcher/ContentSwitcher.d.ts +1 -1
  9. package/es/components/ContentSwitcher/ContentSwitcher.js +24 -15
  10. package/es/components/DataTable/DataTable.d.ts +3 -3
  11. package/es/components/DataTable/TableActionList.d.ts +1 -1
  12. package/es/components/DataTable/TableHead.d.ts +1 -1
  13. package/es/components/DataTable/TableSlugRow.d.ts +2 -2
  14. package/es/components/DataTable/TableSlugRow.js +8 -11
  15. package/es/components/DataTable/TableToolbarContent.d.ts +1 -1
  16. package/es/components/DataTable/TableToolbarSearch.d.ts +5 -1
  17. package/es/components/DatePicker/DatePicker.js +15 -13
  18. package/es/components/DatePicker/plugins/fixEventsPlugin.js +2 -3
  19. package/es/components/Dropdown/Dropdown.d.ts +1 -1
  20. package/es/components/FluidTimePicker/FluidTimePicker.d.ts +1 -1
  21. package/es/components/FluidTimePicker/FluidTimePicker.js +6 -4
  22. package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.d.ts +4 -0
  23. package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +2 -1
  24. package/es/components/FluidTimePickerSelect/index.js +18 -0
  25. package/es/components/Grid/CSSGrid.js +11 -6
  26. package/es/components/Grid/Column.d.ts +2 -2
  27. package/es/components/Grid/ColumnHang.d.ts +3 -3
  28. package/es/components/Grid/ColumnHang.js +1 -1
  29. package/es/components/Grid/FlexGrid.js +5 -3
  30. package/es/components/Grid/Grid.js +2 -1
  31. package/es/components/Grid/GridTypes.d.ts +5 -0
  32. package/es/components/Grid/Row.d.ts +3 -3
  33. package/es/components/Grid/Row.js +1 -1
  34. package/es/components/Menu/Menu.js +1 -1
  35. package/es/components/Menu/MenuItem.js +4 -0
  36. package/es/components/Modal/Modal.js +3 -0
  37. package/es/components/MultiSelect/FilterableMultiSelect.d.ts +1 -1
  38. package/es/components/MultiSelect/FilterableMultiSelect.js +3 -2
  39. package/es/components/MultiSelect/MultiSelect.d.ts +1 -1
  40. package/es/components/OverflowMenu/OverflowMenu.js +11 -12
  41. package/es/components/Pagination/Pagination.d.ts +1 -1
  42. package/es/components/Pagination/Pagination.js +2 -0
  43. package/es/components/Popover/index.js +14 -1
  44. package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
  45. package/es/components/RadioButtonGroup/RadioButtonGroup.js +8 -6
  46. package/es/components/Search/Search.Skeleton.d.ts +12 -3
  47. package/es/components/Search/Search.Skeleton.js +16 -8
  48. package/es/components/Search/Search.d.ts +1 -1
  49. package/es/components/Search/Search.js +4 -4
  50. package/es/components/Select/Select.d.ts +1 -1
  51. package/es/components/Select/Select.js +7 -6
  52. package/es/components/Slider/Slider.js +46 -62
  53. package/es/components/Tabs/Tabs.js +2 -2
  54. package/es/components/TextArea/TextArea.js +5 -2
  55. package/es/components/TextInput/ControlledPasswordInput.js +2 -1
  56. package/es/components/TextInput/PasswordInput.d.ts +2 -2
  57. package/es/components/TextInput/PasswordInput.js +33 -21
  58. package/es/components/TextInput/TextInput.Skeleton.d.ts +10 -2
  59. package/es/components/TextInput/TextInput.Skeleton.js +10 -4
  60. package/es/components/TextInput/TextInput.d.ts +1 -1
  61. package/es/components/TextInput/TextInput.js +39 -30
  62. package/es/components/TextInput/util.d.ts +1 -0
  63. package/es/components/TextInput/util.js +1 -1
  64. package/es/components/Theme/index.d.ts +2 -2
  65. package/es/components/Theme/index.js +3 -3
  66. package/es/components/TimePicker/TimePicker.js +5 -2
  67. package/es/components/TreeView/TreeNode.js +2 -2
  68. package/es/components/UIShell/HeaderGlobalBar.d.ts +1 -1
  69. package/es/components/UIShell/HeaderMenu.d.ts +1 -1
  70. package/es/components/UIShell/HeaderMenu.js +5 -3
  71. package/es/index.js +2 -2
  72. package/es/internal/FloatingMenu.d.ts +5 -1
  73. package/es/internal/hasHelperText.d.ts +8 -0
  74. package/es/internal/hasHelperText.js +11 -0
  75. package/es/tools/wrapComponent.d.ts +3 -3
  76. package/es/tools/wrapComponent.js +1 -1
  77. package/lib/components/Accordion/AccordionItem.d.ts +2 -2
  78. package/lib/components/Button/Button.js +1 -1
  79. package/lib/components/Checkbox/Checkbox.js +2 -1
  80. package/lib/components/CheckboxGroup/CheckboxGroup.js +2 -1
  81. package/lib/components/ComboBox/ComboBox.d.ts +1 -1
  82. package/lib/components/ComboBox/ComboBox.js +1 -1
  83. package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +1 -1
  84. package/lib/components/ContentSwitcher/ContentSwitcher.js +22 -13
  85. package/lib/components/DataTable/DataTable.d.ts +3 -3
  86. package/lib/components/DataTable/TableActionList.d.ts +1 -1
  87. package/lib/components/DataTable/TableHead.d.ts +1 -1
  88. package/lib/components/DataTable/TableSlugRow.d.ts +2 -2
  89. package/lib/components/DataTable/TableSlugRow.js +7 -10
  90. package/lib/components/DataTable/TableToolbarContent.d.ts +1 -1
  91. package/lib/components/DataTable/TableToolbarSearch.d.ts +5 -1
  92. package/lib/components/DatePicker/DatePicker.js +15 -13
  93. package/lib/components/DatePicker/plugins/fixEventsPlugin.js +1 -2
  94. package/lib/components/Dropdown/Dropdown.d.ts +1 -1
  95. package/lib/components/FluidTimePicker/FluidTimePicker.d.ts +1 -1
  96. package/lib/components/FluidTimePicker/FluidTimePicker.js +5 -3
  97. package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.d.ts +4 -0
  98. package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +2 -1
  99. package/lib/components/FluidTimePickerSelect/index.js +17 -0
  100. package/lib/components/Grid/CSSGrid.js +11 -6
  101. package/lib/components/Grid/Column.d.ts +2 -2
  102. package/lib/components/Grid/ColumnHang.d.ts +3 -3
  103. package/lib/components/Grid/ColumnHang.js +1 -1
  104. package/lib/components/Grid/FlexGrid.js +5 -3
  105. package/lib/components/Grid/Grid.js +2 -1
  106. package/lib/components/Grid/GridTypes.d.ts +5 -0
  107. package/lib/components/Grid/Row.d.ts +3 -3
  108. package/lib/components/Grid/Row.js +1 -1
  109. package/lib/components/Menu/Menu.js +1 -1
  110. package/lib/components/Menu/MenuItem.js +4 -0
  111. package/lib/components/Modal/Modal.js +3 -0
  112. package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +1 -1
  113. package/lib/components/MultiSelect/FilterableMultiSelect.js +3 -2
  114. package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
  115. package/lib/components/OverflowMenu/OverflowMenu.js +10 -11
  116. package/lib/components/Pagination/Pagination.d.ts +1 -1
  117. package/lib/components/Pagination/Pagination.js +2 -0
  118. package/lib/components/Popover/index.js +14 -1
  119. package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
  120. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +7 -5
  121. package/lib/components/Search/Search.Skeleton.d.ts +12 -3
  122. package/lib/components/Search/Search.Skeleton.js +15 -7
  123. package/lib/components/Search/Search.d.ts +1 -1
  124. package/lib/components/Search/Search.js +4 -4
  125. package/lib/components/Select/Select.d.ts +1 -1
  126. package/lib/components/Select/Select.js +7 -6
  127. package/lib/components/Slider/Slider.js +46 -62
  128. package/lib/components/Tabs/Tabs.js +2 -2
  129. package/lib/components/TextArea/TextArea.js +5 -2
  130. package/lib/components/TextInput/ControlledPasswordInput.js +2 -1
  131. package/lib/components/TextInput/PasswordInput.d.ts +2 -2
  132. package/lib/components/TextInput/PasswordInput.js +33 -21
  133. package/lib/components/TextInput/TextInput.Skeleton.d.ts +10 -2
  134. package/lib/components/TextInput/TextInput.Skeleton.js +10 -4
  135. package/lib/components/TextInput/TextInput.d.ts +1 -1
  136. package/lib/components/TextInput/TextInput.js +39 -30
  137. package/lib/components/TextInput/util.d.ts +1 -0
  138. package/lib/components/TextInput/util.js +1 -1
  139. package/lib/components/Theme/index.d.ts +2 -2
  140. package/lib/components/Theme/index.js +2 -2
  141. package/lib/components/TimePicker/TimePicker.js +5 -2
  142. package/lib/components/TreeView/TreeNode.js +1 -1
  143. package/lib/components/UIShell/HeaderGlobalBar.d.ts +1 -1
  144. package/lib/components/UIShell/HeaderMenu.d.ts +1 -1
  145. package/lib/components/UIShell/HeaderMenu.js +5 -3
  146. package/lib/index.js +2 -2
  147. package/lib/internal/FloatingMenu.d.ts +5 -1
  148. package/lib/internal/hasHelperText.d.ts +8 -0
  149. package/lib/internal/hasHelperText.js +11 -0
  150. package/lib/tools/wrapComponent.d.ts +3 -3
  151. package/lib/tools/wrapComponent.js +1 -1
  152. package/package.json +5 -5
  153. package/telemetry.yml +1 -0
@@ -33,7 +33,8 @@ Grid.propTypes = {
33
33
  className: PropTypes.string,
34
34
  condensed: PropTypes.bool,
35
35
  fullWidth: PropTypes.bool,
36
- narrow: PropTypes.bool
36
+ narrow: PropTypes.bool,
37
+ withRowGap: PropTypes.bool
37
38
  };
38
39
  const GridAsGridComponent = Grid;
39
40
  //#endregion
@@ -33,6 +33,11 @@ export interface GridBaseProps {
33
33
  * typographic alignment with and without containers.
34
34
  */
35
35
  narrow?: boolean;
36
+ /**
37
+ * Add a row gap to the grid that matches the current gutter size.
38
+ * This is useful when you want consistent vertical spacing between rows.
39
+ */
40
+ withRowGap?: boolean;
36
41
  }
37
42
  export type GridProps<T extends React.ElementType> = PolymorphicComponentPropWithRef<T, GridBaseProps>;
38
43
  export interface GridComponent {
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2023
2
+ * Copyright IBM Corp. 2016, 2026
3
3
  *
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 from 'react';
7
+ import React, { type ReactElement } from 'react';
8
8
  import { PolymorphicProps } from '../../types/common';
9
9
  export interface RowBaseProps {
10
10
  /**
@@ -28,7 +28,7 @@ export interface RowBaseProps {
28
28
  }
29
29
  export type RowProps<T extends React.ElementType> = PolymorphicProps<T, RowBaseProps>;
30
30
  export interface RowComponent {
31
- <T extends React.ElementType>(props: RowProps<T>, context?: any): React.ReactElement<any, any> | null;
31
+ <T extends React.ElementType>(props: RowProps<T>, context?: any): ReactElement | null;
32
32
  }
33
33
  declare const _default: RowComponent;
34
34
  export default _default;
@@ -12,7 +12,7 @@ import PropTypes from "prop-types";
12
12
  import { jsx } from "react/jsx-runtime";
13
13
  //#region src/components/Grid/Row.tsx
14
14
  /**
15
- * Copyright IBM Corp. 2016, 2023
15
+ * Copyright IBM Corp. 2016, 2026
16
16
  *
17
17
  * This source code is licensed under the Apache-2.0 license found in the
18
18
  * LICENSE file in the root directory of this source tree.
@@ -108,7 +108,7 @@ const Menu = forwardRef(function Menu({ backgroundToken = "layer", border = fals
108
108
  }
109
109
  }
110
110
  function handleBlur(e) {
111
- if (open && onClose && isRoot && e.relatedTarget && !menu.current?.contains(e.relatedTarget)) handleClose();
111
+ if (open && onClose && isRoot && !menu.current?.contains(e.relatedTarget)) handleClose();
112
112
  }
113
113
  function fitValue(range, axis) {
114
114
  if (!menu.current) return;
@@ -84,6 +84,9 @@ const MenuItem = forwardRef(function MenuItem({ children, className, dangerDescr
84
84
  }
85
85
  const pendingKeyboardClick = useRef(false);
86
86
  const keyboardClickEvent = (e) => match(e, Enter) || match(e, Space);
87
+ function handleMouseDown(e) {
88
+ if (isDisabled) e.preventDefault();
89
+ }
87
90
  function handleKeyDown(e) {
88
91
  if (hasChildren && match(e, ArrowRight$1)) {
89
92
  openSubmenu();
@@ -138,6 +141,7 @@ const MenuItem = forwardRef(function MenuItem({ children, className, dangerDescr
138
141
  "aria-disabled": isDisabled ?? void 0,
139
142
  "aria-haspopup": hasChildren ?? void 0,
140
143
  "aria-expanded": hasChildren ? submenuOpen : void 0,
144
+ onMouseDown: handleMouseDown,
141
145
  onClick: handleClick,
142
146
  onKeyDown: handleKeyDown,
143
147
  onKeyUp: handleKeyUp,
@@ -136,6 +136,9 @@ const ModalDialog = React.forwardRef(function ModalDialog({ "aria-label": ariaLa
136
136
  }
137
137
  const modalContent = document.querySelector(`.${prefix}--modal-content`);
138
138
  if (!modalContent || !modalContent.classList.contains(`${prefix}--modal-scroll-content`) || !currentActiveNode || !modalContent.contains(currentActiveNode)) return;
139
+ const modalRect = modalContent.getBoundingClientRect();
140
+ const elementRect = currentActiveNode.getBoundingClientRect();
141
+ if (elementRect.top >= modalRect.top && elementRect.bottom <= modalRect.bottom) return;
139
142
  currentActiveNode.scrollIntoView({ block: "center" });
140
143
  }
141
144
  const onSecondaryButtonClick = onSecondarySubmit ? onSecondarySubmit : onRequestClose;
@@ -195,7 +195,7 @@ export interface FilterableMultiSelectProps<ItemType> extends MultiSelectSorting
195
195
  inputProps?: React.InputHTMLAttributes<HTMLInputElement>;
196
196
  }
197
197
  export declare const FilterableMultiSelect: {
198
- <ItemType>(props: FilterableMultiSelectProps<ItemType>): ReactElement<any>;
198
+ <ItemType>(props: FilterableMultiSelectProps<ItemType>): ReactElement;
199
199
  propTypes?: any;
200
200
  contextTypes?: any;
201
201
  defaultProps?: any;
@@ -13,6 +13,7 @@ import { useId } from "../../internal/useId.js";
13
13
  import { deprecate } from "../../prop-types/deprecate.js";
14
14
  import { defaultItemToString } from "../../internal/defaultItemToString.js";
15
15
  import { isComponentElement } from "../../internal/utils.js";
16
+ import { hasHelperText } from "../../internal/hasHelperText.js";
16
17
  import { useNormalizedInputProps } from "../../internal/useNormalizedInputProps.js";
17
18
  import { AILabel } from "../AILabel/index.js";
18
19
  import Checkbox_default from "../Checkbox/index.js";
@@ -175,7 +176,7 @@ const FilterableMultiSelect = forwardRef(function FilterableMultiSelect({ autoAl
175
176
  [`${prefix}--list-box__wrapper--decorator`]: decorator,
176
177
  [`${prefix}--autoalign`]: autoAlign
177
178
  });
178
- const hasHelper = typeof helperText !== "undefined" && helperText !== null;
179
+ const hasHelper = hasHelperText(helperText);
179
180
  const helperId = !hasHelper ? void 0 : `filterablemultiselect-helper-text-${filterableMultiSelectInstanceId}`;
180
181
  const labelId = `${id}-label`;
181
182
  const titleClasses = classNames({
@@ -394,7 +395,7 @@ const FilterableMultiSelect = forwardRef(function FilterableMultiSelect({ autoAl
394
395
  });
395
396
  const inputProp = getInputProps(getDropdownProps({
396
397
  "aria-controls": isOpen ? menuId : void 0,
397
- "aria-describedby": helperText && showHelperText ? helperId : void 0,
398
+ "aria-describedby": hasHelper && showHelperText ? helperId : void 0,
398
399
  "aria-haspopup": "listbox",
399
400
  "aria-labelledby": void 0,
400
401
  disabled,
@@ -178,6 +178,6 @@ type MultiSelectComponentProps<ItemType> = React.PropsWithChildren<MultiSelectPr
178
178
  interface MultiSelectComponent {
179
179
  propTypes: Record<string, any>;
180
180
  displayName: string;
181
- <ItemType>(props: MultiSelectComponentProps<ItemType>): React.ReactElement<any> | null;
181
+ <ItemType>(props: MultiSelectComponentProps<ItemType>): React.ReactElement | null;
182
182
  }
183
183
  export {};
@@ -12,13 +12,15 @@ import { setupGetInstanceId } from "../../tools/setupGetInstanceId.js";
12
12
  import { noopFn } from "../../internal/noopFn.js";
13
13
  import { deprecate } from "../../prop-types/deprecate.js";
14
14
  import { deprecateValuesWithin } from "../../prop-types/deprecateValuesWithin.js";
15
+ import { isComponentElement } from "../../internal/utils.js";
15
16
  import { mapPopoverAlign } from "../../tools/mapPopoverAlign.js";
16
17
  import { IconButton } from "../IconButton/index.js";
17
18
  import { mergeRefs } from "../../tools/mergeRefs.js";
19
+ import OverflowMenuItem from "../OverflowMenuItem/OverflowMenuItem.js";
18
20
  import { DIRECTION_BOTTOM, FloatingMenu } from "../../internal/FloatingMenu.js";
19
21
  import { useOutsideClick } from "../../internal/useOutsideClick.js";
20
22
  import classNames from "classnames";
21
- import React, { Children, cloneElement, forwardRef, isValidElement, useCallback, useContext, useEffect, useRef, useState } from "react";
23
+ import React, { Children, cloneElement, forwardRef, useCallback, useContext, useEffect, useRef, useState } from "react";
22
24
  import PropTypes from "prop-types";
23
25
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
24
26
  import { OverflowMenuVertical } from "@carbon/icons-react";
@@ -222,17 +224,14 @@ const OverflowMenu = forwardRef(({ align, ["aria-label"]: ariaLabel = null, aria
222
224
  });
223
225
  const overflowMenuIconClasses = classNames(`${prefix}--overflow-menu__icon`, iconClass);
224
226
  const childrenWithProps = Children.toArray(children).map((child, index) => {
225
- if (isValidElement(child)) {
226
- const childElement = child;
227
- return cloneElement(childElement, {
228
- closeMenu: childElement.props.closeMenu || closeMenuAndFocus,
229
- handleOverflowMenuItemFocus,
230
- ref: (el) => {
231
- menuItemRefs.current[index] = el;
232
- },
233
- index
234
- });
235
- }
227
+ if (isComponentElement(child, OverflowMenuItem)) return cloneElement(child, {
228
+ closeMenu: child.props.closeMenu || closeMenuAndFocus,
229
+ handleOverflowMenuItemFocus,
230
+ ref: (el) => {
231
+ menuItemRefs.current[index] = el;
232
+ },
233
+ index
234
+ });
236
235
  return null;
237
236
  });
238
237
  const wrappedMenuBody = /* @__PURE__ */ jsx(FloatingMenu, {
@@ -96,7 +96,7 @@ export interface PaginationProps extends Omit<React.HTMLAttributes<HTMLDivElemen
96
96
  /**
97
97
  * Specify the size of the Pagination.
98
98
  */
99
- size?: 'sm' | 'md' | 'lg';
99
+ size?: 'xs' | 'sm' | 'md' | 'lg';
100
100
  /**
101
101
  * The total number of items.
102
102
  */
@@ -70,6 +70,7 @@ const Pagination = React.forwardRef(({ backwardText = "Previous page", className
70
70
  const className = classNames({
71
71
  [`${prefix}--pagination`]: true,
72
72
  [`${prefix}--pagination--${size}`]: size,
73
+ [`${prefix}--layout--size-${size}`]: size,
73
74
  [customClassName]: !!customClassName
74
75
  });
75
76
  const totalPages = totalItems ? Math.max(Math.ceil(totalItems / pageSize), 1) : 1;
@@ -287,6 +288,7 @@ Pagination.propTypes = {
287
288
  pageText: PropTypes.func,
288
289
  pagesUnknown: PropTypes.bool,
289
290
  size: PropTypes.oneOf([
291
+ "xs",
290
292
  "sm",
291
293
  "md",
292
294
  "lg"
@@ -37,6 +37,18 @@ const Popover = React.forwardRef(function PopoverRenderFunction({ isTabTip, alig
37
37
  const popover = useRef(null);
38
38
  const enableFloatingStyles = useFeatureFlag("enable-v12-dynamic-floating-styles") || autoAlign;
39
39
  const lastClickWasInsidePopoverContent = useRef(false);
40
+ const isTargetInDatePickerInsidePopover = (target) => {
41
+ if (!popover.current) return false;
42
+ const calendar = target instanceof Element && target.closest(".flatpickr-calendar");
43
+ if (!calendar) return false;
44
+ const inputs = popover.current.querySelectorAll("input");
45
+ for (const input of inputs) {
46
+ if (!("_flatpickr" in input)) continue;
47
+ const fp = input._flatpickr;
48
+ if (fp && typeof fp === "object" && "calendarContainer" in fp && fp.calendarContainer === calendar) return true;
49
+ }
50
+ return false;
51
+ };
40
52
  let align = mapPopoverAlign(initialAlign);
41
53
  useEvent(popover, "mousedown", (event) => {
42
54
  const target = event.target;
@@ -54,13 +66,14 @@ const Popover = React.forwardRef(function PopoverRenderFunction({ isTabTip, alig
54
66
  }
55
67
  onRequestClose?.();
56
68
  } else if (relatedTarget && !popover.current?.contains(relatedTarget)) {
69
+ if (isTargetInDatePickerInsidePopover(relatedTarget)) return;
57
70
  const isOutsideFloating = enableFloatingStyles && refs.floating.current ? !refs.floating.current.contains(relatedTarget) : true;
58
71
  const isFocusableWrapper = relatedTarget && popover.current && relatedTarget.contains(popover.current);
59
72
  if (isOutsideFloating && !isFocusableWrapper) onRequestClose?.();
60
73
  }
61
74
  });
62
75
  useWindowEvent("click", ({ target }) => {
63
- if (open && target instanceof Node && !popover.current?.contains(target)) onRequestClose?.();
76
+ if (open && target instanceof Node && !popover.current?.contains(target) && !isTargetInDatePickerInsidePopover(target)) onRequestClose?.();
64
77
  });
65
78
  const popoverDimensions = useRef({
66
79
  offset: 10,
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React, { type ReactNode } from 'react';
8
- import type { RadioButtonProps } from '../RadioButton';
8
+ import { type RadioButtonProps } from '../RadioButton';
9
9
  export declare const RadioButtonGroupContext: React.Context<null>;
10
10
  type ExcludedAttributes = 'onChange';
11
11
  export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HTMLFieldSetElement>, ExcludedAttributes> {
@@ -9,11 +9,13 @@ import { usePrefix } from "../../internal/usePrefix.js";
9
9
  import { useId } from "../../internal/useId.js";
10
10
  import { deprecate } from "../../prop-types/deprecate.js";
11
11
  import { isComponentElement } from "../../internal/utils.js";
12
+ import { hasHelperText } from "../../internal/hasHelperText.js";
12
13
  import { AILabel } from "../AILabel/index.js";
13
14
  import { mergeRefs } from "../../tools/mergeRefs.js";
15
+ import RadioButton_default from "../RadioButton/index.js";
14
16
  import { Legend } from "../Text/createTextComponent.js";
15
17
  import classNames from "classnames";
16
- import React, { cloneElement, createContext, useEffect, useRef, useState } from "react";
18
+ import React, { Children, cloneElement, createContext, useEffect, useRef, useState } from "react";
17
19
  import PropTypes from "prop-types";
18
20
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
19
21
  import { WarningAltFilled, WarningFilled } from "@carbon/icons-react";
@@ -31,8 +33,8 @@ const RadioButtonGroup = React.forwardRef((props, ref) => {
31
33
  }
32
34
  }, [valueSelected]);
33
35
  function getRadioButtons() {
34
- return React.Children.map(children, (radioButton) => {
35
- if (!radioButton) return;
36
+ return Children.map(children, (radioButton) => {
37
+ if (!isComponentElement(radioButton, RadioButton_default)) return radioButton;
36
38
  const newProps = {
37
39
  name,
38
40
  key: radioButton.props.value,
@@ -42,7 +44,7 @@ const RadioButtonGroup = React.forwardRef((props, ref) => {
42
44
  required
43
45
  };
44
46
  if (!selected && radioButton.props.checked) newProps.checked = true;
45
- return React.cloneElement(radioButton, newProps);
47
+ return cloneElement(radioButton, newProps);
46
48
  });
47
49
  }
48
50
  function handleOnChange(newSelection, value, evt) {
@@ -66,7 +68,7 @@ const RadioButtonGroup = React.forwardRef((props, ref) => {
66
68
  [`${prefix}--radio-button-group--decorator`]: decorator
67
69
  });
68
70
  const helperClasses = classNames(`${prefix}--form__helper-text`, { [`${prefix}--form__helper-text--disabled`]: disabled });
69
- const hasHelper = typeof helperText !== "undefined" && helperText !== null;
71
+ const hasHelper = hasHelperText(helperText);
70
72
  const helperId = !hasHelper ? void 0 : `radio-button-group-helper-text-${radioButtonGroupInstanceId}`;
71
73
  const helper = hasHelper && /* @__PURE__ */ jsx("div", {
72
74
  id: helperId,
@@ -87,7 +89,7 @@ const RadioButtonGroup = React.forwardRef((props, ref) => {
87
89
  className: fieldsetClasses,
88
90
  disabled,
89
91
  "data-invalid": invalid ? true : void 0,
90
- "aria-describedby": showHelper && helperText ? helperId : void 0,
92
+ "aria-describedby": showHelper && hasHelper ? helperId : void 0,
91
93
  ...rest,
92
94
  children: [legendText && /* @__PURE__ */ jsxs(Legend, {
93
95
  className: `${prefix}--label`,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2023
2
+ * Copyright IBM Corp. 2016, 2026
3
3
  *
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.
@@ -11,22 +11,31 @@ export interface SearchSkeletonProps extends React.HTMLAttributes<HTMLDivElement
11
11
  * Specify an optional className to add.
12
12
  */
13
13
  className?: string;
14
+ /**
15
+ * Specify the size of the SearchSkeleton
16
+ */
17
+ size?: 'xs' | 'sm' | 'md' | 'lg';
14
18
  /**
15
19
  * Specify whether the Search should be a small variant.
20
+ * @deprecated Use `size` prop instead. This prop will be removed in the next major release.
16
21
  */
17
22
  small?: boolean;
18
23
  }
19
24
  declare const SearchSkeleton: {
20
- ({ small, className, ...rest }: SearchSkeletonProps): import("react/jsx-runtime").JSX.Element;
25
+ ({ small, size, className, ...rest }: SearchSkeletonProps): import("react/jsx-runtime").JSX.Element;
21
26
  propTypes: {
22
27
  /**
23
28
  * Specify an optional className to add.
24
29
  */
25
30
  className: PropTypes.Requireable<string>;
31
+ /**
32
+ * Specify the size of the SearchSkeleton
33
+ */
34
+ size: PropTypes.Requireable<string>;
26
35
  /**
27
36
  * Specify whether the Search should be a small variant
28
37
  */
29
- small: PropTypes.Requireable<boolean>;
38
+ small: (props: Record<string, any>, propName: string, componentName: string, ...rest: any[]) => any;
30
39
  };
31
40
  };
32
41
  export default SearchSkeleton;
@@ -6,32 +6,40 @@
6
6
  */
7
7
 
8
8
  import { usePrefix } from "../../internal/usePrefix.js";
9
+ import { deprecate } from "../../prop-types/deprecate.js";
9
10
  import classNames from "classnames";
10
11
  import "react";
11
12
  import PropTypes from "prop-types";
12
- import { jsx, jsxs } from "react/jsx-runtime";
13
+ import { jsx } from "react/jsx-runtime";
13
14
  //#region src/components/Search/Search.Skeleton.tsx
14
15
  /**
15
- * Copyright IBM Corp. 2016, 2023
16
+ * Copyright IBM Corp. 2016, 2026
16
17
  *
17
18
  * This source code is licensed under the Apache-2.0 license found in the
18
19
  * LICENSE file in the root directory of this source tree.
19
20
  */
20
- const SearchSkeleton = ({ small = false, className, ...rest }) => {
21
+ const SearchSkeleton = ({ small = false, size, className, ...rest }) => {
21
22
  const prefix = usePrefix();
22
- return /* @__PURE__ */ jsxs("div", {
23
+ const normalizedSize = small ? "sm" : size;
24
+ return /* @__PURE__ */ jsx("div", {
23
25
  className: classNames(className, {
24
26
  [`${prefix}--skeleton`]: true,
25
- [`${prefix}--search--xl`]: !small,
26
- [`${prefix}--search--sm`]: small
27
+ [`${prefix}--search--sm`]: small,
28
+ [`${prefix}--layout--size-${normalizedSize}`]: normalizedSize
27
29
  }),
28
30
  ...rest,
29
- children: [/* @__PURE__ */ jsx("span", { className: `${prefix}--label` }), /* @__PURE__ */ jsx("div", { className: `${prefix}--search-input` })]
31
+ children: /* @__PURE__ */ jsx("div", { className: `${prefix}--search-input` })
30
32
  });
31
33
  };
32
34
  SearchSkeleton.propTypes = {
33
35
  className: PropTypes.string,
34
- small: PropTypes.bool
36
+ size: PropTypes.oneOf([
37
+ "xs",
38
+ "sm",
39
+ "md",
40
+ "lg"
41
+ ]),
42
+ small: deprecate(PropTypes.bool, "The `small` prop has been deprecated and will be removed in the next major release. Please use the `size` prop instead.")
35
43
  };
36
44
  //#endregion
37
45
  export { SearchSkeleton as default };
@@ -71,7 +71,7 @@ export interface SearchProps extends InputPropsBase {
71
71
  /**
72
72
  * Specify the size of the Search
73
73
  */
74
- size?: 'sm' | 'md' | 'lg';
74
+ size?: 'xs' | 'sm' | 'md' | 'lg';
75
75
  /**
76
76
  * Specify the type of the `<input>`
77
77
  */
@@ -28,7 +28,7 @@ import { Close, Search } from "@carbon/icons-react";
28
28
  * This source code is licensed under the Apache-2.0 license found in the
29
29
  * LICENSE file in the root directory of this source tree.
30
30
  */
31
- const Search$1 = React.forwardRef(({ autoComplete = "off", className, closeButtonLabelText = "Clear search input", defaultValue, disabled, isExpanded = true, id, labelText, light, onChange = () => {}, onClear = () => {}, onKeyDown, onExpand, placeholder = "Search", renderIcon, role, size = "md", type = "search", value, ...rest }, forwardRef) => {
31
+ const Search$1 = React.forwardRef(({ autoComplete = "off", className, closeButtonLabelText = "Clear search input", defaultValue, disabled, isExpanded = true, id, labelText, light, onChange = () => {}, onClear = () => {}, onKeyDown, onExpand, placeholder = "Search", renderIcon, role, size, type = "search", value, ...rest }, forwardRef) => {
32
32
  const hasPropValue = isSearchValuePresent(value) || isSearchValuePresent(defaultValue);
33
33
  const prefix = usePrefix();
34
34
  const { isFluid } = useContext(FormContext);
@@ -41,9 +41,8 @@ const Search$1 = React.forwardRef(({ autoComplete = "off", className, closeButto
41
41
  const [hasContent, setHasContent] = useState(hasPropValue || false);
42
42
  const searchClasses = classNames({
43
43
  [`${prefix}--search`]: true,
44
- [`${prefix}--search--sm`]: size === "sm",
45
- [`${prefix}--search--md`]: size === "md",
46
- [`${prefix}--search--lg`]: size === "lg",
44
+ [`${prefix}--search--${size}`]: size,
45
+ [`${prefix}--layout--size-${size}`]: size,
47
46
  [`${prefix}--search--light`]: light,
48
47
  [`${prefix}--search--disabled`]: disabled,
49
48
  [`${prefix}--search--fluid`]: isFluid
@@ -173,6 +172,7 @@ Search$1.propTypes = {
173
172
  renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
174
173
  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."),
175
174
  size: PropTypes.oneOf([
175
+ "xs",
176
176
  "sm",
177
177
  "md",
178
178
  "lg"
@@ -79,7 +79,7 @@ export interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, Exclu
79
79
  /**
80
80
  * Specify the size of the Select Input.
81
81
  */
82
- size?: 'sm' | 'md' | 'lg';
82
+ size?: 'xs' | 'sm' | 'md' | 'lg';
83
83
  /**
84
84
  * @deprecated please use decorator instead.
85
85
  * **Experimental**: Provide a `Slug` component to be rendered inside the `Dropdown` component
@@ -9,6 +9,7 @@ import { usePrefix } from "../../internal/usePrefix.js";
9
9
  import { Text } from "../Text/Text.js";
10
10
  import { deprecate } from "../../prop-types/deprecate.js";
11
11
  import { isComponentElement } from "../../internal/utils.js";
12
+ import { hasHelperText } from "../../internal/hasHelperText.js";
12
13
  import { useNormalizedInputProps } from "../../internal/useNormalizedInputProps.js";
13
14
  import { AILabel } from "../AILabel/index.js";
14
15
  import { composeEventHandlers } from "../../tools/events.js";
@@ -53,19 +54,18 @@ const Select = forwardRef(({ className, decorator, id, inline = false, labelText
53
54
  [`${prefix}--select--fluid--invalid`]: isFluid && normalizedProps.invalid,
54
55
  [`${prefix}--select--fluid--focus`]: isFluid && isFocused,
55
56
  [`${prefix}--select--slug`]: slug,
56
- [`${prefix}--select--decorator`]: decorator
57
+ [`${prefix}--select--decorator`]: decorator,
58
+ [`${prefix}--select--${size}`]: size,
59
+ [`${prefix}--layout--size-${size}`]: size
57
60
  });
58
61
  const labelClasses = classNames(`${prefix}--label`, {
59
62
  [`${prefix}--visually-hidden`]: hideLabel,
60
63
  [`${prefix}--label--disabled`]: normalizedProps.disabled
61
64
  });
62
- const inputClasses = classNames({
63
- [`${prefix}--select-input`]: true,
64
- [`${prefix}--select-input--${size}`]: size
65
- });
65
+ const inputClasses = classNames({ [`${prefix}--select-input`]: true });
66
66
  const error = normalizedProps.validation;
67
67
  const helperTextClasses = classNames(`${prefix}--form__helper-text`, { [`${prefix}--form__helper-text--disabled`]: normalizedProps.disabled });
68
- const helper = typeof helperText !== "undefined" && helperText !== null ? /* @__PURE__ */ jsx(Text, {
68
+ const helper = hasHelperText(helperText) ? /* @__PURE__ */ jsx(Text, {
69
69
  as: "div",
70
70
  id: normalizedProps.helperId,
71
71
  className: helperTextClasses,
@@ -175,6 +175,7 @@ Select.propTypes = {
175
175
  onChange: PropTypes.func,
176
176
  readOnly: PropTypes.bool,
177
177
  size: PropTypes.oneOf([
178
+ "xs",
178
179
  "sm",
179
180
  "md",
180
181
  "lg"