@carbon/react 1.106.0-rc.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 (155) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1006 -971
  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/DatePickerInput/DatePickerInput.js +9 -2
  20. package/es/components/Dropdown/Dropdown.d.ts +1 -1
  21. package/es/components/FluidTimePicker/FluidTimePicker.d.ts +1 -1
  22. package/es/components/FluidTimePicker/FluidTimePicker.js +6 -4
  23. package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.d.ts +4 -0
  24. package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +2 -1
  25. package/es/components/FluidTimePickerSelect/index.js +18 -0
  26. package/es/components/Grid/CSSGrid.js +11 -6
  27. package/es/components/Grid/Column.d.ts +2 -2
  28. package/es/components/Grid/ColumnHang.d.ts +3 -3
  29. package/es/components/Grid/ColumnHang.js +1 -1
  30. package/es/components/Grid/FlexGrid.js +5 -3
  31. package/es/components/Grid/Grid.js +2 -1
  32. package/es/components/Grid/GridTypes.d.ts +5 -0
  33. package/es/components/Grid/Row.d.ts +3 -3
  34. package/es/components/Grid/Row.js +1 -1
  35. package/es/components/Menu/Menu.js +1 -1
  36. package/es/components/Menu/MenuItem.js +4 -0
  37. package/es/components/Modal/Modal.js +3 -0
  38. package/es/components/MultiSelect/FilterableMultiSelect.d.ts +1 -1
  39. package/es/components/MultiSelect/FilterableMultiSelect.js +3 -2
  40. package/es/components/MultiSelect/MultiSelect.d.ts +1 -1
  41. package/es/components/OverflowMenu/OverflowMenu.js +11 -12
  42. package/es/components/Pagination/Pagination.d.ts +1 -1
  43. package/es/components/Pagination/Pagination.js +2 -0
  44. package/es/components/Popover/index.js +14 -1
  45. package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
  46. package/es/components/RadioButtonGroup/RadioButtonGroup.js +8 -6
  47. package/es/components/Search/Search.Skeleton.d.ts +12 -3
  48. package/es/components/Search/Search.Skeleton.js +16 -8
  49. package/es/components/Search/Search.d.ts +1 -1
  50. package/es/components/Search/Search.js +4 -4
  51. package/es/components/Select/Select.d.ts +1 -1
  52. package/es/components/Select/Select.js +7 -6
  53. package/es/components/Slider/Slider.js +46 -62
  54. package/es/components/Tabs/Tabs.js +2 -2
  55. package/es/components/TextArea/TextArea.js +5 -2
  56. package/es/components/TextInput/ControlledPasswordInput.js +2 -1
  57. package/es/components/TextInput/PasswordInput.d.ts +2 -2
  58. package/es/components/TextInput/PasswordInput.js +33 -21
  59. package/es/components/TextInput/TextInput.Skeleton.d.ts +10 -2
  60. package/es/components/TextInput/TextInput.Skeleton.js +10 -4
  61. package/es/components/TextInput/TextInput.d.ts +1 -1
  62. package/es/components/TextInput/TextInput.js +39 -30
  63. package/es/components/TextInput/util.d.ts +1 -0
  64. package/es/components/TextInput/util.js +1 -1
  65. package/es/components/Theme/index.d.ts +2 -2
  66. package/es/components/Theme/index.js +3 -3
  67. package/es/components/TimePicker/TimePicker.js +5 -2
  68. package/es/components/TreeView/TreeNode.js +2 -2
  69. package/es/components/UIShell/HeaderGlobalBar.d.ts +1 -1
  70. package/es/components/UIShell/HeaderMenu.d.ts +1 -1
  71. package/es/components/UIShell/HeaderMenu.js +5 -3
  72. package/es/index.js +2 -2
  73. package/es/internal/FloatingMenu.d.ts +5 -1
  74. package/es/internal/hasHelperText.d.ts +8 -0
  75. package/es/internal/hasHelperText.js +11 -0
  76. package/es/tools/wrapComponent.d.ts +3 -3
  77. package/es/tools/wrapComponent.js +1 -1
  78. package/lib/components/Accordion/AccordionItem.d.ts +2 -2
  79. package/lib/components/Button/Button.js +1 -1
  80. package/lib/components/Checkbox/Checkbox.js +2 -1
  81. package/lib/components/CheckboxGroup/CheckboxGroup.js +2 -1
  82. package/lib/components/ComboBox/ComboBox.d.ts +1 -1
  83. package/lib/components/ComboBox/ComboBox.js +1 -1
  84. package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +1 -1
  85. package/lib/components/ContentSwitcher/ContentSwitcher.js +22 -13
  86. package/lib/components/DataTable/DataTable.d.ts +3 -3
  87. package/lib/components/DataTable/TableActionList.d.ts +1 -1
  88. package/lib/components/DataTable/TableHead.d.ts +1 -1
  89. package/lib/components/DataTable/TableSlugRow.d.ts +2 -2
  90. package/lib/components/DataTable/TableSlugRow.js +7 -10
  91. package/lib/components/DataTable/TableToolbarContent.d.ts +1 -1
  92. package/lib/components/DataTable/TableToolbarSearch.d.ts +5 -1
  93. package/lib/components/DatePicker/DatePicker.js +15 -13
  94. package/lib/components/DatePicker/plugins/fixEventsPlugin.js +1 -2
  95. package/lib/components/DatePickerInput/DatePickerInput.js +9 -2
  96. package/lib/components/Dropdown/Dropdown.d.ts +1 -1
  97. package/lib/components/FluidTimePicker/FluidTimePicker.d.ts +1 -1
  98. package/lib/components/FluidTimePicker/FluidTimePicker.js +5 -3
  99. package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.d.ts +4 -0
  100. package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +2 -1
  101. package/lib/components/FluidTimePickerSelect/index.js +17 -0
  102. package/lib/components/Grid/CSSGrid.js +11 -6
  103. package/lib/components/Grid/Column.d.ts +2 -2
  104. package/lib/components/Grid/ColumnHang.d.ts +3 -3
  105. package/lib/components/Grid/ColumnHang.js +1 -1
  106. package/lib/components/Grid/FlexGrid.js +5 -3
  107. package/lib/components/Grid/Grid.js +2 -1
  108. package/lib/components/Grid/GridTypes.d.ts +5 -0
  109. package/lib/components/Grid/Row.d.ts +3 -3
  110. package/lib/components/Grid/Row.js +1 -1
  111. package/lib/components/Menu/Menu.js +1 -1
  112. package/lib/components/Menu/MenuItem.js +4 -0
  113. package/lib/components/Modal/Modal.js +3 -0
  114. package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +1 -1
  115. package/lib/components/MultiSelect/FilterableMultiSelect.js +3 -2
  116. package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
  117. package/lib/components/OverflowMenu/OverflowMenu.js +10 -11
  118. package/lib/components/Pagination/Pagination.d.ts +1 -1
  119. package/lib/components/Pagination/Pagination.js +2 -0
  120. package/lib/components/Popover/index.js +14 -1
  121. package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
  122. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +7 -5
  123. package/lib/components/Search/Search.Skeleton.d.ts +12 -3
  124. package/lib/components/Search/Search.Skeleton.js +15 -7
  125. package/lib/components/Search/Search.d.ts +1 -1
  126. package/lib/components/Search/Search.js +4 -4
  127. package/lib/components/Select/Select.d.ts +1 -1
  128. package/lib/components/Select/Select.js +7 -6
  129. package/lib/components/Slider/Slider.js +46 -62
  130. package/lib/components/Tabs/Tabs.js +2 -2
  131. package/lib/components/TextArea/TextArea.js +5 -2
  132. package/lib/components/TextInput/ControlledPasswordInput.js +2 -1
  133. package/lib/components/TextInput/PasswordInput.d.ts +2 -2
  134. package/lib/components/TextInput/PasswordInput.js +33 -21
  135. package/lib/components/TextInput/TextInput.Skeleton.d.ts +10 -2
  136. package/lib/components/TextInput/TextInput.Skeleton.js +10 -4
  137. package/lib/components/TextInput/TextInput.d.ts +1 -1
  138. package/lib/components/TextInput/TextInput.js +39 -30
  139. package/lib/components/TextInput/util.d.ts +1 -0
  140. package/lib/components/TextInput/util.js +1 -1
  141. package/lib/components/Theme/index.d.ts +2 -2
  142. package/lib/components/Theme/index.js +2 -2
  143. package/lib/components/TimePicker/TimePicker.js +5 -2
  144. package/lib/components/TreeView/TreeNode.js +1 -1
  145. package/lib/components/UIShell/HeaderGlobalBar.d.ts +1 -1
  146. package/lib/components/UIShell/HeaderMenu.d.ts +1 -1
  147. package/lib/components/UIShell/HeaderMenu.js +5 -3
  148. package/lib/index.js +2 -2
  149. package/lib/internal/FloatingMenu.d.ts +5 -1
  150. package/lib/internal/hasHelperText.d.ts +8 -0
  151. package/lib/internal/hasHelperText.js +11 -0
  152. package/lib/tools/wrapComponent.d.ts +3 -3
  153. package/lib/tools/wrapComponent.js +1 -1
  154. package/package.json +8 -8
  155. package/telemetry.yml +1 -0
@@ -10,8 +10,10 @@ const require_usePrefix = require("../../internal/usePrefix.js");
10
10
  const require_useId = require("../../internal/useId.js");
11
11
  const require_deprecate = require("../../prop-types/deprecate.js");
12
12
  const require_utils = require("../../internal/utils.js");
13
+ const require_hasHelperText = require("../../internal/hasHelperText.js");
13
14
  const require_index = require("../AILabel/index.js");
14
15
  const require_mergeRefs = require("../../tools/mergeRefs.js");
16
+ const require_index$1 = require("../RadioButton/index.js");
15
17
  const require_createTextComponent = require("../Text/createTextComponent.js");
16
18
  let classnames = require("classnames");
17
19
  classnames = require_runtime.__toESM(classnames);
@@ -35,8 +37,8 @@ const RadioButtonGroup = react.default.forwardRef((props, ref) => {
35
37
  }
36
38
  }, [valueSelected]);
37
39
  function getRadioButtons() {
38
- return react.default.Children.map(children, (radioButton) => {
39
- if (!radioButton) return;
40
+ return react.Children.map(children, (radioButton) => {
41
+ if (!require_utils.isComponentElement(radioButton, require_index$1.default)) return radioButton;
40
42
  const newProps = {
41
43
  name,
42
44
  key: radioButton.props.value,
@@ -46,7 +48,7 @@ const RadioButtonGroup = react.default.forwardRef((props, ref) => {
46
48
  required
47
49
  };
48
50
  if (!selected && radioButton.props.checked) newProps.checked = true;
49
- return react.default.cloneElement(radioButton, newProps);
51
+ return (0, react.cloneElement)(radioButton, newProps);
50
52
  });
51
53
  }
52
54
  function handleOnChange(newSelection, value, evt) {
@@ -70,7 +72,7 @@ const RadioButtonGroup = react.default.forwardRef((props, ref) => {
70
72
  [`${prefix}--radio-button-group--decorator`]: decorator
71
73
  });
72
74
  const helperClasses = (0, classnames.default)(`${prefix}--form__helper-text`, { [`${prefix}--form__helper-text--disabled`]: disabled });
73
- const hasHelper = typeof helperText !== "undefined" && helperText !== null;
75
+ const hasHelper = require_hasHelperText.hasHelperText(helperText);
74
76
  const helperId = !hasHelper ? void 0 : `radio-button-group-helper-text-${radioButtonGroupInstanceId}`;
75
77
  const helper = hasHelper && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
76
78
  id: helperId,
@@ -91,7 +93,7 @@ const RadioButtonGroup = react.default.forwardRef((props, ref) => {
91
93
  className: fieldsetClasses,
92
94
  disabled,
93
95
  "data-invalid": invalid ? true : void 0,
94
- "aria-describedby": showHelper && helperText ? helperId : void 0,
96
+ "aria-describedby": showHelper && hasHelper ? helperId : void 0,
95
97
  ...rest,
96
98
  children: [legendText && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_createTextComponent.Legend, {
97
99
  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;
@@ -7,6 +7,7 @@
7
7
 
8
8
  const require_runtime = require("../../_virtual/_rolldown/runtime.js");
9
9
  const require_usePrefix = require("../../internal/usePrefix.js");
10
+ const require_deprecate = require("../../prop-types/deprecate.js");
10
11
  let classnames = require("classnames");
11
12
  classnames = require_runtime.__toESM(classnames);
12
13
  let react = require("react");
@@ -16,26 +17,33 @@ prop_types = require_runtime.__toESM(prop_types);
16
17
  let react_jsx_runtime = require("react/jsx-runtime");
17
18
  //#region src/components/Search/Search.Skeleton.tsx
18
19
  /**
19
- * Copyright IBM Corp. 2016, 2023
20
+ * Copyright IBM Corp. 2016, 2026
20
21
  *
21
22
  * This source code is licensed under the Apache-2.0 license found in the
22
23
  * LICENSE file in the root directory of this source tree.
23
24
  */
24
- const SearchSkeleton = ({ small = false, className, ...rest }) => {
25
+ const SearchSkeleton = ({ small = false, size, className, ...rest }) => {
25
26
  const prefix = require_usePrefix.usePrefix();
26
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
27
+ const normalizedSize = small ? "sm" : size;
28
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
27
29
  className: (0, classnames.default)(className, {
28
30
  [`${prefix}--skeleton`]: true,
29
- [`${prefix}--search--xl`]: !small,
30
- [`${prefix}--search--sm`]: small
31
+ [`${prefix}--search--sm`]: small,
32
+ [`${prefix}--layout--size-${normalizedSize}`]: normalizedSize
31
33
  }),
32
34
  ...rest,
33
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: `${prefix}--label` }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: `${prefix}--search-input` })]
35
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: `${prefix}--search-input` })
34
36
  });
35
37
  };
36
38
  SearchSkeleton.propTypes = {
37
39
  className: prop_types.default.string,
38
- small: prop_types.default.bool
40
+ size: prop_types.default.oneOf([
41
+ "xs",
42
+ "sm",
43
+ "md",
44
+ "lg"
45
+ ]),
46
+ small: require_deprecate.deprecate(prop_types.default.bool, "The `small` prop has been deprecated and will be removed in the next major release. Please use the `size` prop instead.")
39
47
  };
40
48
  //#endregion
41
49
  exports.default = SearchSkeleton;
@@ -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
  */
@@ -32,7 +32,7 @@ let _carbon_icons_react = require("@carbon/icons-react");
32
32
  * This source code is licensed under the Apache-2.0 license found in the
33
33
  * LICENSE file in the root directory of this source tree.
34
34
  */
35
- const Search = react.default.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) => {
35
+ const Search = react.default.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) => {
36
36
  const hasPropValue = require_utils.isSearchValuePresent(value) || require_utils.isSearchValuePresent(defaultValue);
37
37
  const prefix = require_usePrefix.usePrefix();
38
38
  const { isFluid } = (0, react.useContext)(require_FormContext.FormContext);
@@ -45,9 +45,8 @@ const Search = react.default.forwardRef(({ autoComplete = "off", className, clos
45
45
  const [hasContent, setHasContent] = (0, react.useState)(hasPropValue || false);
46
46
  const searchClasses = (0, classnames.default)({
47
47
  [`${prefix}--search`]: true,
48
- [`${prefix}--search--sm`]: size === "sm",
49
- [`${prefix}--search--md`]: size === "md",
50
- [`${prefix}--search--lg`]: size === "lg",
48
+ [`${prefix}--search--${size}`]: size,
49
+ [`${prefix}--layout--size-${size}`]: size,
51
50
  [`${prefix}--search--light`]: light,
52
51
  [`${prefix}--search--disabled`]: disabled,
53
52
  [`${prefix}--search--fluid`]: isFluid
@@ -177,6 +176,7 @@ Search.propTypes = {
177
176
  renderIcon: prop_types.default.oneOfType([prop_types.default.func, prop_types.default.object]),
178
177
  role: require_deprecate.deprecate(prop_types.default.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."),
179
178
  size: prop_types.default.oneOf([
179
+ "xs",
180
180
  "sm",
181
181
  "md",
182
182
  "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
@@ -10,6 +10,7 @@ const require_usePrefix = require("../../internal/usePrefix.js");
10
10
  const require_Text = require("../Text/Text.js");
11
11
  const require_deprecate = require("../../prop-types/deprecate.js");
12
12
  const require_utils = require("../../internal/utils.js");
13
+ const require_hasHelperText = require("../../internal/hasHelperText.js");
13
14
  const require_useNormalizedInputProps = require("../../internal/useNormalizedInputProps.js");
14
15
  const require_index = require("../AILabel/index.js");
15
16
  const require_events = require("../../tools/events.js");
@@ -57,19 +58,18 @@ const Select = (0, react.forwardRef)(({ className, decorator, id, inline = false
57
58
  [`${prefix}--select--fluid--invalid`]: isFluid && normalizedProps.invalid,
58
59
  [`${prefix}--select--fluid--focus`]: isFluid && isFocused,
59
60
  [`${prefix}--select--slug`]: slug,
60
- [`${prefix}--select--decorator`]: decorator
61
+ [`${prefix}--select--decorator`]: decorator,
62
+ [`${prefix}--select--${size}`]: size,
63
+ [`${prefix}--layout--size-${size}`]: size
61
64
  });
62
65
  const labelClasses = (0, classnames.default)(`${prefix}--label`, {
63
66
  [`${prefix}--visually-hidden`]: hideLabel,
64
67
  [`${prefix}--label--disabled`]: normalizedProps.disabled
65
68
  });
66
- const inputClasses = (0, classnames.default)({
67
- [`${prefix}--select-input`]: true,
68
- [`${prefix}--select-input--${size}`]: size
69
- });
69
+ const inputClasses = (0, classnames.default)({ [`${prefix}--select-input`]: true });
70
70
  const error = normalizedProps.validation;
71
71
  const helperTextClasses = (0, classnames.default)(`${prefix}--form__helper-text`, { [`${prefix}--form__helper-text--disabled`]: normalizedProps.disabled });
72
- const helper = typeof helperText !== "undefined" && helperText !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, {
72
+ const helper = require_hasHelperText.hasHelperText(helperText) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, {
73
73
  as: "div",
74
74
  id: normalizedProps.helperId,
75
75
  className: helperTextClasses,
@@ -179,6 +179,7 @@ Select.propTypes = {
179
179
  onChange: prop_types.default.func,
180
180
  readOnly: prop_types.default.bool,
181
181
  size: prop_types.default.oneOf([
182
+ "xs",
182
183
  "sm",
183
184
  "md",
184
185
  "lg"
@@ -72,18 +72,13 @@ const DRAG_STOP_EVENT_TYPES = new Set([
72
72
  "touchcancel"
73
73
  ]);
74
74
  const Slider = (props) => {
75
- const controlledValue = props.value;
76
- const controlledValueUpper = props.unstable_valueUpper;
77
- const controlledMax = props.max;
78
- const controlledMin = props.min;
79
- const onChange = props.onChange;
80
- const onRelease = props.onRelease;
75
+ const { ariaLabelInput, unstable_ariaLabelInputUpper: ariaLabelInputUpper, className, hideTextInput = false, id: idProp, min, minLabel, max, maxLabel, formatLabel = defaultFormatLabel, labelText, hideLabel, step = 1, inputType = "number", invalidText, required, disabled = false, name, unstable_nameUpper: nameUpper, light, readOnly = false, value: controlledValue, unstable_valueUpper: controlledValueUpper, invalid, onBlur, onChange, onInputKeyUp, onRelease, stepMultiplier = 4, warn = false, warnText, translateWithId: t = defaultTranslateWithId, ...other } = props;
81
76
  const [state, setState] = (0, react.useReducer)((prev, args) => ({
82
77
  ...prev,
83
78
  ...args
84
79
  }), {
85
- value: props.value,
86
- valueUpper: props.unstable_valueUpper,
80
+ value: controlledValue,
81
+ valueUpper: controlledValueUpper,
87
82
  left: 0,
88
83
  leftUpper: 0,
89
84
  needsOnRelease: false,
@@ -98,15 +93,10 @@ const Slider = (props) => {
98
93
  (0, react.useEffect)(() => {
99
94
  stateRef.current = state;
100
95
  }, [state]);
101
- const propsRef = (0, react.useRef)(props);
102
- (0, react.useEffect)(() => {
103
- propsRef.current = props;
104
- }, [props]);
105
96
  const thumbRef = (0, react.useRef)(null);
106
97
  const thumbRefUpper = (0, react.useRef)(null);
107
98
  const filledTrackRef = (0, react.useRef)(null);
108
99
  const elementRef = (0, react.useRef)(null);
109
- const trackRef = (0, react.useRef)(null);
110
100
  const generatedId = require_useId.useId();
111
101
  const prefix = require_usePrefix.usePrefix();
112
102
  const twoHandles = hasUpperValue(state.valueUpper);
@@ -196,23 +186,23 @@ const Slider = (props) => {
196
186
  const next = [
197
187
  controlledValue,
198
188
  controlledValueUpper,
199
- controlledMax,
200
- controlledMin
189
+ max,
190
+ min
201
191
  ];
202
192
  if (!prev || prev[0] !== next[0] || prev[1] !== next[1] || prev[2] !== next[2] || prev[3] !== next[3]) {
203
193
  setState({
204
194
  value: controlledValue,
205
195
  left: calcRawLeftPercent({
206
- max: controlledMax,
207
- min: controlledMin,
196
+ max,
197
+ min,
208
198
  value: controlledValue
209
199
  }) * 100
210
200
  });
211
201
  if (typeof controlledValueUpper !== "undefined") setState({
212
202
  valueUpper: controlledValueUpper,
213
203
  leftUpper: calcRawLeftPercent({
214
- max: controlledMax,
215
- min: controlledMin,
204
+ max,
205
+ min,
216
206
  value: controlledValueUpper
217
207
  }) * 100
218
208
  });
@@ -223,10 +213,10 @@ const Slider = (props) => {
223
213
  prevSyncKeysRef.current = next;
224
214
  }
225
215
  }, [
226
- controlledMax,
227
- controlledMin,
228
216
  controlledValue,
229
- controlledValueUpper
217
+ controlledValueUpper,
218
+ max,
219
+ min
230
220
  ]);
231
221
  /**
232
222
  * Rounds a given value to the nearest step defined by the slider's `step`
@@ -236,7 +226,7 @@ const Slider = (props) => {
236
226
  * @returns The value rounded to the precision determined by the step.
237
227
  */
238
228
  const nearestStepValue = (value = 0) => {
239
- const decimals = (props.step?.toString().split(".")[1] ?? "").length;
229
+ const decimals = (step.toString().split(".")[1] ?? "").length;
240
230
  return Number(value.toFixed(decimals));
241
231
  };
242
232
  const handleDrag = (event) => {
@@ -248,7 +238,7 @@ const Slider = (props) => {
248
238
  * event.
249
239
  */
250
240
  const onDragStart = (evt) => {
251
- if (props.disabled || props.readOnly) return;
241
+ if (disabled || readOnly) return;
252
242
  evt.preventDefault();
253
243
  DRAG_STOP_EVENT_TYPES.forEach((element) => {
254
244
  elementRef.current?.ownerDocument.addEventListener(element, onDragStop);
@@ -277,7 +267,7 @@ const Slider = (props) => {
277
267
  * indicating that the `onRelease` callback should be called.
278
268
  */
279
269
  const onDragStop = () => {
280
- if (props.disabled || props.readOnly) return;
270
+ if (disabled || readOnly) return;
281
271
  DRAG_STOP_EVENT_TYPES.forEach((element) => {
282
272
  elementRef.current?.ownerDocument.removeEventListener(element, onDragStop);
283
273
  });
@@ -301,7 +291,7 @@ const Slider = (props) => {
301
291
  const _onDragRef = (0, react.useRef)(null);
302
292
  _onDragRef.current = (evt, activeHandle) => {
303
293
  activeHandle = activeHandle ?? stateRef.current.activeHandle;
304
- if (propsRef.current.disabled || propsRef.current.readOnly) return;
294
+ if (disabled || readOnly) return;
305
295
  const { value, left } = calcValue({
306
296
  clientX: getClientXFromEvent(evt),
307
297
  value: stateRef.current.value
@@ -335,21 +325,20 @@ const Slider = (props) => {
335
325
  * state accordingly.
336
326
  */
337
327
  const onKeyDown = (evt) => {
338
- if (props.disabled || props.readOnly) return;
339
- const { step = 1, stepMultiplier = 4 } = props;
328
+ if (disabled || readOnly) return;
340
329
  let delta = 0;
341
330
  if (require_match.matches(evt, [require_keys.ArrowDown, require_keys.ArrowLeft])) delta = -step;
342
331
  else if (require_match.matches(evt, [require_keys.ArrowUp, require_keys.ArrowRight])) delta = step;
343
332
  else return;
344
333
  if (evt.shiftKey) delta *= stepMultiplier;
345
334
  if (twoHandles && state.activeHandle) {
346
- const { value, left } = calcValue({ value: calcValueForDelta((state.activeHandle === "lower" ? state.value : state.valueUpper) ?? props.min, delta, props.step) });
335
+ const { value, left } = calcValue({ value: calcValueForDelta((state.activeHandle === "lower" ? state.value : state.valueUpper) ?? min, delta, step) });
347
336
  setValueLeftForHandle(state.activeHandle, {
348
337
  value: nearestStepValue(value),
349
338
  left
350
339
  });
351
340
  } else {
352
- const { value, left } = calcValue({ value: calcValueForDelta(state.value, delta, props.step) });
341
+ const { value, left } = calcValue({ value: calcValueForDelta(state.value, delta, step) });
353
342
  setState({
354
343
  value: nearestStepValue(value),
355
344
  left,
@@ -367,22 +356,22 @@ const Slider = (props) => {
367
356
  * setting state accordingly.
368
357
  */
369
358
  const onChangeInput = (evt) => {
370
- if (props.disabled || props.readOnly) return;
359
+ if (disabled || readOnly) return;
371
360
  const activeHandle = evt.target.dataset.handlePosition ?? "lower";
372
361
  const targetValue = Number.parseFloat(evt.target.value);
373
362
  if (twoHandles) if (isNaN(targetValue)) setValueForHandle(activeHandle, evt.target.value);
374
363
  else if (isValidValueForPosition({
375
364
  handle: activeHandle,
376
365
  value: targetValue,
377
- min: props.min,
378
- max: props.max
366
+ min,
367
+ max
379
368
  })) processNewInputValue(evt.target);
380
369
  else setValueForHandle(activeHandle, targetValue);
381
370
  else if (isNaN(targetValue)) setState({ value: evt.target.value });
382
371
  else if (isValidValue({
383
372
  value: targetValue,
384
- min: props.min,
385
- max: props.max
373
+ min,
374
+ max
386
375
  })) processNewInputValue(evt.target);
387
376
  else setState({ value: targetValue });
388
377
  };
@@ -393,13 +382,13 @@ const Slider = (props) => {
393
382
  const onBlurInput = (evt) => {
394
383
  const { value: targetValue } = evt.target;
395
384
  processNewInputValue(evt.target);
396
- props.onBlur?.({
385
+ onBlur?.({
397
386
  value: targetValue,
398
387
  handlePosition: evt.target.dataset.handlePosition
399
388
  });
400
389
  };
401
390
  const onInputKeyDown = (evt) => {
402
- if (props.disabled || props.readOnly || !(evt.target instanceof HTMLInputElement)) return;
391
+ if (disabled || readOnly || !(evt.target instanceof HTMLInputElement)) return;
403
392
  if (require_match.matches(evt, [require_keys.Enter])) processNewInputValue(evt.target);
404
393
  };
405
394
  const processNewInputValue = (input) => {
@@ -417,12 +406,12 @@ const Slider = (props) => {
417
406
  const adjustedValue = handlePosition ? getAdjustedValueForPosition({
418
407
  handle: handlePosition,
419
408
  value: targetValue,
420
- min: props.min,
421
- max: props.max
409
+ min,
410
+ max
422
411
  }) : getAdjustedValue({
423
412
  value: targetValue,
424
- min: props.min,
425
- max: props.max
413
+ min,
414
+ max
426
415
  });
427
416
  if (adjustedValue !== targetValue) setState({
428
417
  correctedValue: targetValue.toString(),
@@ -449,12 +438,12 @@ const Slider = (props) => {
449
438
  const calcLeftPercent = ({ clientX, value }) => {
450
439
  const boundingRect = elementRef.current?.getBoundingClientRect?.();
451
440
  let width = boundingRect ? boundingRect.right - boundingRect.left : 0;
452
- const nextValue = value ?? props.min;
441
+ const nextValue = value ?? min;
453
442
  if (width <= 0) width = 1;
454
443
  if (clientX) return (state.isRtl ? (boundingRect?.right ?? 0) - clientX : clientX - (boundingRect?.left ?? 0)) / width;
455
444
  return calcRawLeftPercent({
456
- max: props.max,
457
- min: props.min,
445
+ max,
446
+ min,
458
447
  value: nextValue
459
448
  });
460
449
  };
@@ -463,7 +452,6 @@ const Slider = (props) => {
463
452
  * with the corresponding handle position percentage.
464
453
  */
465
454
  const calcDiscreteValueAndPercent = ({ leftPercent }) => {
466
- const { step = 1, min, max } = props;
467
455
  const numSteps = Math.floor((max - min) / step) + 1;
468
456
  /** Index of the step that corresponds to `leftPercent`. */
469
457
  const stepIndex = Math.round(leftPercent * (numSteps - 1));
@@ -590,16 +578,15 @@ const Slider = (props) => {
590
578
  (0, react.useEffect)(() => {
591
579
  const { isValid, isValidUpper } = stateRef.current;
592
580
  const derivedState = {};
593
- if (props.invalid === true) {
581
+ if (invalid === true) {
594
582
  if (isValid === true) derivedState.isValid = false;
595
583
  if (isValidUpper === true) derivedState.isValidUpper = false;
596
- } else if (props.invalid === false) {
584
+ } else if (invalid === false) {
597
585
  if (isValid === false) derivedState.isValid = true;
598
586
  if (isValidUpper === false) derivedState.isValidUpper = true;
599
587
  }
600
588
  if (Object.keys(derivedState).length) setState(derivedState);
601
- }, [props.invalid]);
602
- const { ariaLabelInput, unstable_ariaLabelInputUpper: ariaLabelInputUpper, className, hideTextInput = false, id: idProp, min, minLabel, max, maxLabel, formatLabel = defaultFormatLabel, labelText, hideLabel, step = 1, inputType = "number", invalidText, required, disabled = false, name, unstable_nameUpper: nameUpper, light, readOnly = false, warn = false, warnText, translateWithId: t = defaultTranslateWithId, ...other } = props;
589
+ }, [invalid]);
603
590
  const id = idProp ?? generatedId;
604
591
  const { value, valueUpper, isValid, isValidUpper, correctedValue, correctedPosition, isRtl } = state;
605
592
  const normalizedProps = require_useNormalizedInputProps.useNormalizedInputProps({
@@ -616,10 +603,12 @@ const Slider = (props) => {
616
603
  invalid: !isValidUpper,
617
604
  warn
618
605
  });
619
- delete other.invalid;
620
- delete other.onRelease;
621
- delete other.stepMultiplier;
622
- delete other.unstable_valueUpper;
606
+ const passthroughProps = {
607
+ ...other,
608
+ onBlur,
609
+ onChange,
610
+ value: controlledValue
611
+ };
623
612
  const showWarning = normalizedProps.warn || correctedPosition === "lower" && isValid;
624
613
  const showWarningUpper = normalizedUpperProps.warn || correctedPosition === (twoHandles ? "upper" : "lower") && (twoHandles ? isValidUpper : isValid);
625
614
  const labelId = `${id}-label`;
@@ -719,7 +708,7 @@ const Slider = (props) => {
719
708
  step,
720
709
  onChange: onChangeInput,
721
710
  onBlur: onBlurInput,
722
- onKeyUp: props.onInputKeyUp,
711
+ onKeyUp: onInputKeyUp,
723
712
  onKeyDown: onInputKeyDown,
724
713
  "data-invalid": normalizedProps.invalid ? true : null,
725
714
  "data-handle-position": "lower",
@@ -745,7 +734,7 @@ const Slider = (props) => {
745
734
  role: "presentation",
746
735
  tabIndex: -1,
747
736
  "data-invalid": (twoHandles ? normalizedProps.invalid || normalizedUpperProps.invalid : normalizedProps.invalid) ? true : null,
748
- ...other,
737
+ ...passthroughProps,
749
738
  children: [
750
739
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThumbWrapper, {
751
740
  hasTooltip: hideTextInput,
@@ -788,12 +777,7 @@ const Slider = (props) => {
788
777
  children: !isRtl ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SliderHandles.UpperHandle, { "aria-label": ariaLabelInputUpper }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SliderHandles.UpperHandleFocus, { "aria-label": ariaLabelInputUpper })] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SliderHandles.LowerHandle, { "aria-label": ariaLabelInput }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SliderHandles.LowerHandleFocus, { "aria-label": ariaLabelInput })] })
789
778
  })
790
779
  }) : null,
791
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
792
- className: `${prefix}--slider__track`,
793
- ref: (node) => {
794
- trackRef.current = node;
795
- }
796
- }),
780
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: `${prefix}--slider__track` }),
797
781
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
798
782
  className: `${prefix}--slider__filled-track`,
799
783
  ref: filledTrackRef
@@ -823,7 +807,7 @@ const Slider = (props) => {
823
807
  onChange: onChangeInput,
824
808
  onBlur: onBlurInput,
825
809
  onKeyDown: onInputKeyDown,
826
- onKeyUp: props.onInputKeyUp,
810
+ onKeyUp: onInputKeyUp,
827
811
  "data-invalid": (twoHandles ? normalizedUpperProps.invalid : normalizedProps.invalid) ? true : null,
828
812
  "data-handle-position": twoHandles ? "upper" : null,
829
813
  "aria-invalid": (twoHandles ? normalizedUpperProps.invalid : normalizedProps.invalid) ? true : void 0,
@@ -169,7 +169,7 @@ function TabList({ activation = "automatic", "aria-label": label, children, clas
169
169
  [`${prefix}--tabs--full-width`]: distributeWidth,
170
170
  [`${prefix}--tabs--dismissable`]: dismissable
171
171
  }, customClassName);
172
- const [isNextButtonVisible, setIsNextButtonVisible] = (0, react.useState)(ref.current ? scrollLeft + buttonWidth + ref.current.clientWidth < ref.current.scrollWidth : false);
172
+ const [isNextButtonVisible, setIsNextButtonVisible] = (0, react.useState)(ref.current ? scrollLeft + ref.current.clientWidth < ref.current.scrollWidth : false);
173
173
  const isPreviousButtonVisible = ref.current ? isScrollable && scrollLeft > 0 : false;
174
174
  const previousButtonClasses = (0, classnames.default)(`${prefix}--tab--overflow-nav-button`, `${prefix}--tab--overflow-nav-button--previous`, { [`${prefix}--tab--overflow-nav-button--hidden`]: !isPreviousButtonVisible });
175
175
  const nextButtonClasses = (0, classnames.default)(`${prefix}--tab--overflow-nav-button`, `${prefix}--tab--overflow-nav-button--next`, { [`${prefix}--tab--overflow-nav-button--hidden`]: !isNextButtonVisible });
@@ -224,7 +224,7 @@ function TabList({ activation = "automatic", "aria-label": label, children, clas
224
224
  });
225
225
  }, []);
226
226
  (0, react.useEffect)(() => {
227
- setIsNextButtonVisible(ref.current ? scrollLeft + buttonWidth + ref.current.clientWidth + 1 < ref.current.scrollWidth : false);
227
+ setIsNextButtonVisible(ref.current ? scrollLeft + ref.current.clientWidth + 1 < ref.current.scrollWidth : false);
228
228
  if (dismissable && ref.current) setIsScrollable(ref.current.scrollWidth > ref.current.clientWidth + 1);
229
229
  }, [
230
230
  children,
@@ -14,6 +14,7 @@ const require_noopFn = require("../../internal/noopFn.js");
14
14
  const require_deprecate = require("../../prop-types/deprecate.js");
15
15
  const require_utils = require("../../internal/utils.js");
16
16
  const require_useMergedRefs = require("../../internal/useMergedRefs.js");
17
+ const require_hasHelperText = require("../../internal/hasHelperText.js");
17
18
  const require_index = require("../AILabel/index.js");
18
19
  const require_FormContext = require("../FluidForm/FormContext.js");
19
20
  const require_getAnnouncement = require("../../internal/getAnnouncement.js");
@@ -175,7 +176,7 @@ const TextArea = (0, react.forwardRef)((props, forwardRef) => {
175
176
  children: `${textCount}/${maxCount}`
176
177
  }) : null;
177
178
  const counterDescriptionId = enableCounter && maxCount ? `${id}-counter-desc` : void 0;
178
- const hasHelper = typeof helperText !== "undefined" && helperText !== null;
179
+ const hasHelper = require_hasHelperText.hasHelperText(helperText);
179
180
  const helperId = !hasHelper ? void 0 : `text-area-helper-text-${textAreaInstanceId}`;
180
181
  const helper = hasHelper && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, {
181
182
  as: "div",
@@ -203,7 +204,8 @@ const TextArea = (0, react.forwardRef)((props, forwardRef) => {
203
204
  children: [warnText, isFluid && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_carbon_icons_react.WarningAltFilled, { className: `${prefix}--text-area__invalid-icon ${prefix}--text-area__invalid-icon--warning` })]
204
205
  }) : null;
205
206
  let ariaDescribedBy;
206
- if (invalid) ariaDescribedBy = errorId;
207
+ let ariaErrorMessage;
208
+ if (invalid) ariaErrorMessage = errorId;
207
209
  else if (warn && !isFluid) ariaDescribedBy = warnId;
208
210
  else {
209
211
  const ids = [];
@@ -246,6 +248,7 @@ const TextArea = (0, react.forwardRef)((props, forwardRef) => {
246
248
  className: textareaClasses,
247
249
  "aria-invalid": invalid,
248
250
  "aria-describedby": ariaDescribedBy,
251
+ "aria-errormessage": ariaErrorMessage,
249
252
  disabled,
250
253
  rows,
251
254
  readOnly: other.readOnly,
@@ -10,6 +10,7 @@ const require_usePrefix = require("../../internal/usePrefix.js");
10
10
  const require_useId = require("../../internal/useId.js");
11
11
  const require_noopFn = require("../../internal/noopFn.js");
12
12
  const require_deprecate = require("../../prop-types/deprecate.js");
13
+ const require_hasHelperText = require("../../internal/hasHelperText.js");
13
14
  const require_util = require("./util.js");
14
15
  let classnames = require("classnames");
15
16
  classnames = require_runtime.__toESM(classnames);
@@ -69,7 +70,7 @@ const ControlledPasswordInput = (0, react.forwardRef)(({ labelText, className, i
69
70
  [`${prefix}--tooltip--${tooltipPosition}`]: tooltipPosition,
70
71
  [`${prefix}--tooltip--align-${tooltipAlignment}`]: tooltipAlignment
71
72
  });
72
- const hasHelper = typeof helperText !== "undefined" && helperText !== null;
73
+ const hasHelper = require_hasHelperText.hasHelperText(helperText);
73
74
  const helperId = !hasHelper ? void 0 : `controlled-password-helper-text-${controlledPasswordInstanceId}`;
74
75
  const input = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
75
76
  ...require_util.getTextInputProps({
@@ -96,9 +96,9 @@ export interface PasswordInputProps extends Omit<InputHTMLAttributes<HTMLInputEl
96
96
  */
97
97
  showPasswordLabel?: string;
98
98
  /**
99
- * Specify the size of the Text Input. Supports `sm`, `md`, or `lg`.
99
+ * Specify the size of the Text Input. Supports `xs`, `sm`, `md`, or `lg`.
100
100
  */
101
- size?: 'sm' | 'md' | 'lg';
101
+ size?: 'xs' | 'sm' | 'md' | 'lg';
102
102
  /**
103
103
  * Specify the alignment of the tooltip to the icon-only button.
104
104
  * Can be one of: `start`, `center`, or `end`.