@carbon/react 1.56.0-rc.1 → 1.57.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 (43) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +848 -848
  2. package/es/components/ContainedList/ContainedList.d.ts +41 -0
  3. package/es/components/ContainedList/ContainedList.js +18 -4
  4. package/es/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +35 -0
  5. package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +5 -3
  6. package/es/components/DataTable/TableToolbarSearch.js +1 -1
  7. package/es/components/ExpandableSearch/ExpandableSearch.d.ts +1 -5
  8. package/es/components/ExpandableSearch/ExpandableSearch.js +4 -3
  9. package/es/components/OverflowMenu/OverflowMenu.d.ts +300 -0
  10. package/es/components/OverflowMenu/OverflowMenu.js +22 -14
  11. package/es/components/OverflowMenu/next/index.d.ts +39 -0
  12. package/es/components/OverflowMenu/next/index.js +4 -3
  13. package/es/components/RadioTile/RadioTile.d.ts +4 -0
  14. package/es/components/RadioTile/RadioTile.js +7 -1
  15. package/es/components/Slider/Slider.js +9 -5
  16. package/es/components/StructuredList/StructuredList.js +6 -2
  17. package/es/components/TextInput/PasswordInput.js +25 -7
  18. package/es/components/TileGroup/TileGroup.d.ts +8 -0
  19. package/es/components/TileGroup/TileGroup.js +7 -1
  20. package/es/index.js +1 -1
  21. package/es/internal/Selection.js +4 -1
  22. package/lib/components/ContainedList/ContainedList.d.ts +41 -0
  23. package/lib/components/ContainedList/ContainedList.js +18 -4
  24. package/lib/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +35 -0
  25. package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +5 -3
  26. package/lib/components/DataTable/TableToolbarSearch.js +1 -1
  27. package/lib/components/ExpandableSearch/ExpandableSearch.d.ts +1 -5
  28. package/lib/components/ExpandableSearch/ExpandableSearch.js +4 -3
  29. package/lib/components/OverflowMenu/OverflowMenu.d.ts +300 -0
  30. package/lib/components/OverflowMenu/OverflowMenu.js +21 -13
  31. package/lib/components/OverflowMenu/next/index.d.ts +39 -0
  32. package/lib/components/OverflowMenu/next/index.js +4 -3
  33. package/lib/components/RadioTile/RadioTile.d.ts +4 -0
  34. package/lib/components/RadioTile/RadioTile.js +7 -1
  35. package/lib/components/Slider/Slider.js +9 -5
  36. package/lib/components/StructuredList/StructuredList.js +6 -2
  37. package/lib/components/TextInput/PasswordInput.js +25 -7
  38. package/lib/components/TileGroup/TileGroup.d.ts +8 -0
  39. package/lib/components/TileGroup/TileGroup.js +7 -1
  40. package/lib/index.js +2 -2
  41. package/lib/internal/Selection.js +4 -1
  42. package/package.json +8 -8
  43. package/telemetry.yml +1 -1
@@ -0,0 +1,300 @@
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
+ import React from 'react';
9
+ /**
10
+ * @param {Element} menuBody The menu body with the menu arrow.
11
+ * @param {string} direction The floating menu direction.
12
+ * @returns {FloatingMenu~offset} The adjustment of the floating menu position, upon the position of the menu arrow.
13
+ * @private
14
+ */
15
+ export declare const getMenuOffset: (menuBody: any, direction: any, trigger: any, flip: any) => {
16
+ left: number;
17
+ top: number;
18
+ } | undefined;
19
+ interface Offset {
20
+ top: number;
21
+ left: number;
22
+ }
23
+ interface OverflowMenuProps {
24
+ /**
25
+ * Specify a label to be read by screen readers on the container node
26
+ */
27
+ ['aria-label']: string;
28
+ /**
29
+ * Deprecated, please use `aria-label` instead.
30
+ * Specify a label to be read by screen readers on the container note.
31
+ * @deprecated
32
+ * */
33
+ ariaLabel: string;
34
+ /**
35
+ * The child nodes.
36
+ * */
37
+ children: React.ReactNode;
38
+ /**
39
+ * The CSS class names.
40
+ * */
41
+ className?: string;
42
+ /**
43
+ * The menu direction.
44
+ */
45
+ direction?: string;
46
+ /**
47
+ * `true` if the menu alignment should be flipped.
48
+ */
49
+ flipped?: boolean;
50
+ /**
51
+ * Enable or disable focus trap behavior
52
+ */
53
+ focusTrap?: boolean;
54
+ /**
55
+ * The CSS class for the icon.
56
+ */
57
+ iconClass?: string;
58
+ /**
59
+ * The element ID.
60
+ */
61
+ id?: string;
62
+ /**
63
+ * The icon description.
64
+ */
65
+ iconDescription?: string;
66
+ /**
67
+ * `true` to use the light version. For use on $ui-01 backgrounds only.
68
+ * Don't use this to make OverflowMenu background color same as container background color.
69
+ */
70
+ light?: boolean;
71
+ /**
72
+ * The adjustment in position applied to the floating menu.
73
+ */
74
+ menuOffset?: Offset | (() => void);
75
+ /**
76
+ * The adjustment in position applied to the floating menu.
77
+ */
78
+ menuOffsetFlip?: Offset | (() => void);
79
+ /**
80
+ * The class to apply to the menu options
81
+ */
82
+ menuOptionsClass?: string;
83
+ /**
84
+ * The event handler for the `click` event.
85
+ */
86
+ onClick?: (evt?: any) => void;
87
+ /**
88
+ * Function called when menu is closed
89
+ */
90
+ onClose?: () => void;
91
+ /**
92
+ * Function called when menu is opened
93
+ */
94
+ onOpen?: () => void;
95
+ /**
96
+ * `true` if the menu should be open.
97
+ */
98
+ open?: boolean;
99
+ /**
100
+ * Function called to override icon rendering.
101
+ */
102
+ renderIcon?: React.ElementType;
103
+ /**
104
+ * Specify a CSS selector that matches the DOM element that should
105
+ * be focused when the OverflowMenu opens
106
+ */
107
+ selectorPrimaryFocus?: string;
108
+ /**
109
+ * Specify the size of the OverflowMenu. Currently supports either `sm`, 'md' (default) or 'lg` as an option.
110
+ */
111
+ size?: 'sm' | 'md' | 'lg';
112
+ /**
113
+ * The ref to the HTML element that should receive focus when the OverflowMenu opens
114
+ */
115
+ innerRef?: React.Ref<any>;
116
+ }
117
+ interface OverflowMenuState {
118
+ open: boolean;
119
+ prevOpen?: boolean;
120
+ hasMountedTrigger: boolean;
121
+ click: boolean;
122
+ }
123
+ interface ReleaseHandle {
124
+ release: () => null;
125
+ }
126
+ declare class OverflowMenu extends React.Component<OverflowMenuProps, OverflowMenuState> {
127
+ state: OverflowMenuState;
128
+ instanceId: number;
129
+ static propTypes: {
130
+ /**
131
+ * Specify a label to be read by screen readers on the container node
132
+ */
133
+ "aria-label": PropTypes.Requireable<string>;
134
+ /**
135
+ * Deprecated, please use `aria-label` instead.
136
+ * Specify a label to be read by screen readers on the container note.
137
+ */
138
+ ariaLabel: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
139
+ /**
140
+ * The child nodes.
141
+ */
142
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
143
+ /**
144
+ * The CSS class names.
145
+ */
146
+ className: PropTypes.Requireable<string>;
147
+ /**
148
+ * The menu direction.
149
+ */
150
+ direction: PropTypes.Requireable<string>;
151
+ /**
152
+ * `true` if the menu alignment should be flipped.
153
+ */
154
+ flipped: PropTypes.Requireable<boolean>;
155
+ /**
156
+ * Enable or disable focus trap behavior
157
+ */
158
+ focusTrap: PropTypes.Requireable<boolean>;
159
+ /**
160
+ * The CSS class for the icon.
161
+ */
162
+ iconClass: PropTypes.Requireable<string>;
163
+ /**
164
+ * The icon description.
165
+ */
166
+ iconDescription: PropTypes.Requireable<string>;
167
+ /**
168
+ * The element ID.
169
+ */
170
+ id: PropTypes.Requireable<string>;
171
+ /**
172
+ * `true` to use the light version. For use on $ui-01 backgrounds only.
173
+ * Don't use this to make OverflowMenu background color same as container background color.
174
+ */
175
+ light: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
176
+ /**
177
+ * The adjustment in position applied to the floating menu.
178
+ */
179
+ menuOffset: PropTypes.Requireable<NonNullable<((...args: any[]) => any) | PropTypes.InferProps<{
180
+ top: PropTypes.Requireable<number>;
181
+ left: PropTypes.Requireable<number>;
182
+ }> | null | undefined>>;
183
+ /**
184
+ * The adjustment in position applied to the floating menu.
185
+ */
186
+ menuOffsetFlip: PropTypes.Requireable<NonNullable<((...args: any[]) => any) | PropTypes.InferProps<{
187
+ top: PropTypes.Requireable<number>;
188
+ left: PropTypes.Requireable<number>;
189
+ }> | null | undefined>>;
190
+ /**
191
+ * The class to apply to the menu options
192
+ */
193
+ menuOptionsClass: PropTypes.Requireable<string>;
194
+ /**
195
+ * The event handler for the `click` event.
196
+ */
197
+ onClick: PropTypes.Requireable<(...args: any[]) => any>;
198
+ /**
199
+ * Function called when menu is closed
200
+ */
201
+ onClose: PropTypes.Requireable<(...args: any[]) => any>;
202
+ /**
203
+ * The event handler for the `focus` event.
204
+ */
205
+ onFocus: PropTypes.Requireable<(...args: any[]) => any>;
206
+ /**
207
+ * The event handler for the `keydown` event.
208
+ */
209
+ onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
210
+ /**
211
+ * Function called when menu is opened
212
+ */
213
+ onOpen: PropTypes.Requireable<(...args: any[]) => any>;
214
+ /**
215
+ * `true` if the menu should be open.
216
+ */
217
+ open: PropTypes.Requireable<boolean>;
218
+ /**
219
+ * Function called to override icon rendering.
220
+ */
221
+ renderIcon: PropTypes.Requireable<object>;
222
+ /**
223
+ * Specify a CSS selector that matches the DOM element that should
224
+ * be focused when the OverflowMenu opens
225
+ */
226
+ selectorPrimaryFocus: PropTypes.Requireable<string>;
227
+ /**
228
+ * Specify the size of the OverflowMenu. Currently supports either `sm`, 'md' (default) or 'lg` as an option.
229
+ */
230
+ size: PropTypes.Requireable<string>;
231
+ };
232
+ static contextType: React.Context<string>;
233
+ /**
234
+ * The handle of `onfocusin` or `focus` event handler.
235
+ * @private
236
+ */
237
+ _hFocusIn: ReleaseHandle | null;
238
+ /**
239
+ * The timeout handle for handling `blur` event.
240
+ * @private
241
+ */
242
+ _hBlurTimeout: any;
243
+ /**
244
+ * The element ref of the tooltip's trigger button.
245
+ * @type {React.RefObject<Element>}
246
+ * @private
247
+ */
248
+ _triggerRef: React.RefObject<unknown>;
249
+ componentDidUpdate(_: any, prevState: any): void;
250
+ componentDidMount(): void;
251
+ static getDerivedStateFromProps({ open }: {
252
+ open: any;
253
+ }, state: any): {
254
+ open: any;
255
+ prevOpen: any;
256
+ } | null;
257
+ componentWillUnmount(): void;
258
+ handleClick: (evt: any) => void;
259
+ closeMenuAndFocus: () => void;
260
+ closeMenuOnEscape: () => void;
261
+ handleKeyPress: (evt: any) => void;
262
+ handleClickOutside: (evt: any) => void;
263
+ closeMenu: (onCloseMenu?: any) => void;
264
+ focusMenuEl: () => void;
265
+ /**
266
+ * Focuses the next enabled overflow menu item given the currently focused
267
+ * item index and direction to move
268
+ * @param {object} params
269
+ * @param {number} params.currentIndex - the index of the currently focused
270
+ * overflow menu item in the list of overflow menu items
271
+ * @param {number} params.direction - number denoting the direction to move
272
+ * focus (1 for forwards, -1 for backwards)
273
+ */
274
+ handleOverflowMenuItemFocus: ({ currentIndex, direction }: {
275
+ currentIndex: any;
276
+ direction: any;
277
+ }) => void;
278
+ /**
279
+ * Handles the floating menu being unmounted or non-floating menu being
280
+ * mounted or unmounted.
281
+ * @param {Element} menuBody The DOM element of the menu body.
282
+ * @private
283
+ */
284
+ _menuBody: HTMLElement | null;
285
+ _bindMenuBody: (menuBody: HTMLElement | null) => void;
286
+ /**
287
+ * Handles the floating menu being placed.
288
+ * @param {Element} menuBody The DOM element of the menu body.
289
+ * @private
290
+ */
291
+ _handlePlace: (menuBody: any) => void;
292
+ /**
293
+ * @returns {Element} The DOM element where the floating menu is placed in.
294
+ */
295
+ _getTarget: () => Element;
296
+ render(): import("react/jsx-runtime").JSX.Element;
297
+ }
298
+ export { OverflowMenu };
299
+ declare const _default: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
300
+ export default _default;
@@ -104,10 +104,16 @@ const getMenuOffset = (menuBody, direction, trigger, flip) => {
104
104
  }
105
105
  }
106
106
  };
107
- class OverflowMenu extends React.Component {
107
+ class OverflowMenu extends React__default["default"].Component {
108
108
  constructor() {
109
109
  super(...arguments);
110
- _rollupPluginBabelHelpers.defineProperty(this, "state", {});
110
+ _rollupPluginBabelHelpers.defineProperty(this, "state", {
111
+ open: false,
112
+ // Set a default value for 'open'
113
+ hasMountedTrigger: false,
114
+ // Set a default value for 'hasMountedTrigger'
115
+ click: false // Set a default value for 'click'
116
+ });
111
117
  _rollupPluginBabelHelpers.defineProperty(this, "instanceId", getInstanceId());
112
118
  /**
113
119
  * The handle of `onfocusin` or `focus` event handler.
@@ -141,8 +147,8 @@ class OverflowMenu extends React.Component {
141
147
  }
142
148
  });
143
149
  _rollupPluginBabelHelpers.defineProperty(this, "closeMenuAndFocus", () => {
144
- let wasClicked = this.state.click;
145
- let wasOpen = this.state.open;
150
+ const wasClicked = this.state.click;
151
+ const wasOpen = this.state.open;
146
152
  this.closeMenu(() => {
147
153
  if (wasOpen && !wasClicked) {
148
154
  this.focusMenuEl();
@@ -150,7 +156,7 @@ class OverflowMenu extends React.Component {
150
156
  });
151
157
  });
152
158
  _rollupPluginBabelHelpers.defineProperty(this, "closeMenuOnEscape", () => {
153
- let wasOpen = this.state.open;
159
+ const wasOpen = this.state.open;
154
160
  this.closeMenu(() => {
155
161
  if (wasOpen) {
156
162
  this.focusMenuEl();
@@ -212,7 +218,7 @@ class OverflowMenu extends React.Component {
212
218
  direction
213
219
  } = _ref;
214
220
  const enabledIndices = React__default["default"].Children.toArray(this.props.children).reduce((acc, curr, i) => {
215
- if (!curr.props.disabled) {
221
+ if ( /*#__PURE__*/React__default["default"].isValidElement(curr) && !curr.props.disabled) {
216
222
  acc.push(i);
217
223
  }
218
224
  return acc;
@@ -237,6 +243,7 @@ class OverflowMenu extends React.Component {
237
243
  * @param {Element} menuBody The DOM element of the menu body.
238
244
  * @private
239
245
  */
246
+ _rollupPluginBabelHelpers.defineProperty(this, "_menuBody", null);
240
247
  _rollupPluginBabelHelpers.defineProperty(this, "_bindMenuBody", menuBody => {
241
248
  if (!menuBody) {
242
249
  this._menuBody = menuBody;
@@ -279,7 +286,7 @@ class OverflowMenu extends React.Component {
279
286
  const {
280
287
  current: triggerEl
281
288
  } = this._triggerRef;
282
- return triggerEl && triggerEl.closest('[data-floating-menu-container]') || document.body;
289
+ return triggerEl instanceof Element && triggerEl.closest('[data-floating-menu-container]') || document.body;
283
290
  });
284
291
  }
285
292
  componentDidUpdate(_, prevState) {
@@ -360,18 +367,19 @@ class OverflowMenu extends React.Component {
360
367
  [`${prefix}--overflow-menu-options--${size}`]: size
361
368
  });
362
369
  const overflowMenuIconClasses = cx__default["default"](`${prefix}--overflow-menu__icon`, iconClass);
363
- const childrenWithProps = React__default["default"].Children.toArray(children).map((child, index) => /*#__PURE__*/React__default["default"].cloneElement(child, {
364
- closeMenu: child?.props?.closeMenu || this.closeMenuAndFocus,
370
+ const childrenWithProps = React__default["default"].Children.toArray(children).map((child, index) => /*#__PURE__*/React__default["default"].isValidElement(child) ? /*#__PURE__*/React__default["default"].cloneElement(child, {
371
+ // @ts-expect-error: PropTypes are not expressive enough to cover this case
372
+ closeMenu: child.props.closeMenu || this.closeMenuAndFocus,
365
373
  handleOverflowMenuItemFocus: this.handleOverflowMenuItemFocus,
366
374
  ref: e => {
367
375
  this[`overflowMenuItem${index}`] = e;
368
376
  },
369
377
  index
370
- }));
378
+ }) : null);
371
379
  const menuBodyId = `overflow-menu-${this.instanceId}__menu-body`;
372
380
  const menuBody = /*#__PURE__*/React__default["default"].createElement("ul", {
373
381
  className: overflowMenuOptionsClasses,
374
- tabIndex: "-1",
382
+ tabIndex: -1,
375
383
  role: "menu",
376
384
  "aria-label": ariaLabel || deprecatedAriaLabel,
377
385
  onKeyDown: this.handleKeyPress,
@@ -398,12 +406,12 @@ class OverflowMenu extends React.Component {
398
406
  onClickOutside: this.handleClickOutside
399
407
  }, /*#__PURE__*/React__default["default"].createElement("span", {
400
408
  className: `${prefix}--overflow-menu__wrapper`,
401
- "aria-owns": open ? menuBodyId : null
409
+ "aria-owns": open ? menuBodyId : undefined
402
410
  }, /*#__PURE__*/React__default["default"].createElement(index.IconButton, _rollupPluginBabelHelpers["extends"]({}, other, {
403
411
  type: "button",
404
412
  "aria-haspopup": true,
405
413
  "aria-expanded": open,
406
- "aria-controls": open ? menuBodyId : null,
414
+ "aria-controls": open ? menuBodyId : undefined,
407
415
  className: overflowMenuClasses,
408
416
  onClick: this.handleClick,
409
417
  id: id,
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 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 React, { type ComponentType, type FunctionComponent } from 'react';
8
+ interface OverflowMenuProps {
9
+ /**
10
+ * A collection of MenuItems to be rendered within this OverflowMenu.
11
+ */
12
+ children?: React.ReactNode;
13
+ /**
14
+ * Additional CSS class names for the trigger button.
15
+ */
16
+ className?: string;
17
+ /**
18
+ * A label describing the options available. Is used in the trigger tooltip and as the menu's accessible label.
19
+ */
20
+ label?: string;
21
+ /**
22
+ * Experimental property. Specify how the menu should align with the button element
23
+ */
24
+ menuAlignment?: 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end';
25
+ /**
26
+ * Optionally provide a custom icon to be rendered on the trigger button.
27
+ */
28
+ renderIcon?: ComponentType | FunctionComponent;
29
+ /**
30
+ * Specify the size of the menu, from a list of available sizes.
31
+ */
32
+ size?: 'sm' | 'md' | 'lg';
33
+ /**
34
+ * Specify how the trigger tooltip should be aligned.
35
+ */
36
+ tooltipAlignment?: 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'right';
37
+ }
38
+ declare const OverflowMenu: React.ForwardRefExoticComponent<OverflowMenuProps & React.RefAttributes<HTMLDivElement>>;
39
+ export { OverflowMenu };
@@ -62,10 +62,10 @@ const OverflowMenu = /*#__PURE__*/React__default["default"].forwardRef(function
62
62
  }, size !== defaultSize && `${prefix}--overflow-menu--${size}`);
63
63
  return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
64
64
  className: containerClasses,
65
- "aria-owns": open ? id : null,
65
+ "aria-owns": open ? id : undefined,
66
66
  ref: forwardRef
67
67
  }), /*#__PURE__*/React__default["default"].createElement(index.IconButton, {
68
- "aria-controls": open ? id : null,
68
+ "aria-controls": open ? id : undefined,
69
69
  "aria-haspopup": true,
70
70
  "aria-expanded": open,
71
71
  className: triggerClasses,
@@ -107,8 +107,9 @@ OverflowMenu.propTypes = {
107
107
  */
108
108
  menuAlignment: PropTypes__default["default"].oneOf(['top-start', 'top-end', 'bottom-start', 'bottom-end']),
109
109
  /**
110
- * Otionally provide a custom icon to be rendered on the trigger button.
110
+ * Optionally provide a custom icon to be rendered on the trigger button.
111
111
  */
112
+ // @ts-expect-error: PropTypes are not expressive enough to cover this case
112
113
  renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object]),
113
114
  /**
114
115
  * Specify the size of the menu, from a list of available sizes.
@@ -50,6 +50,10 @@ export interface RadioTileProps {
50
50
  * Specify the value of the underlying `<input>`.
51
51
  */
52
52
  value: string | number;
53
+ /**
54
+ * `true` to specify if the input is required.
55
+ */
56
+ required?: boolean;
53
57
  }
54
58
  declare const RadioTile: React.ForwardRefExoticComponent<RadioTileProps & React.RefAttributes<HTMLInputElement>>;
55
59
  export default RadioTile;
@@ -43,6 +43,7 @@ const RadioTile = /*#__PURE__*/React__default["default"].forwardRef(function Rad
43
43
  id,
44
44
  onChange = noopFn.noopFn,
45
45
  tabIndex = 0,
46
+ required,
46
47
  ...rest
47
48
  } = _ref;
48
49
  const prefix = usePrefix.usePrefix();
@@ -84,7 +85,8 @@ const RadioTile = /*#__PURE__*/React__default["default"].forwardRef(function Rad
84
85
  tabIndex: !disabled ? tabIndex : undefined,
85
86
  type: "radio",
86
87
  value: value,
87
- ref: ref
88
+ ref: ref,
89
+ required: required
88
90
  }), /*#__PURE__*/React__default["default"].createElement("label", _rollupPluginBabelHelpers["extends"]({}, rest, {
89
91
  htmlFor: inputId,
90
92
  className: className
@@ -130,6 +132,10 @@ RadioTile.propTypes = {
130
132
  * the underlying `<input>` changes.
131
133
  */
132
134
  onChange: PropTypes__default["default"].func,
135
+ /**
136
+ * `true` to specify if the control is required.
137
+ */
138
+ required: PropTypes__default["default"].bool,
133
139
  /**
134
140
  * Specify the tab index of the underlying `<input>`.
135
141
  */
@@ -438,6 +438,10 @@ class Slider extends React.PureComponent {
438
438
  }
439
439
  });
440
440
  _rollupPluginBabelHelpers.defineProperty(this, "processNewInputValue", input => {
441
+ this.setState({
442
+ correctedValue: null,
443
+ correctedPosition: null
444
+ });
441
445
  const targetValue = Number.parseFloat(input.value);
442
446
  const validity = !isNaN(targetValue);
443
447
 
@@ -518,7 +522,7 @@ class Slider extends React.PureComponent {
518
522
  if (clientX) {
519
523
  const leftOffset = this.state.isRtl ? (boundingRect?.right ?? 0) - clientX : clientX - (boundingRect?.left ?? 0);
520
524
  return leftOffset / width;
521
- } else if (value && range) {
525
+ } else if (value !== null && value !== undefined && range) {
522
526
  // Prevent NaN calculation if the range is 0.
523
527
  return range === 0 ? 0 : (value - this.props.min) / range;
524
528
  }
@@ -989,8 +993,8 @@ class Slider extends React.PureComponent {
989
993
  correctedPosition,
990
994
  isRtl
991
995
  } = this.state;
992
- const showWarning = !readOnly && warn && isValid || typeof correctedValue !== null && correctedPosition === HandlePosition.LOWER;
993
- const showWarningUpper = !readOnly && warn && (twoHandles ? isValidUpper : isValid) || typeof correctedValue !== null && correctedPosition === (twoHandles ? HandlePosition.UPPER : HandlePosition.LOWER);
996
+ const showWarning = !readOnly && warn || typeof correctedValue !== null && correctedPosition === HandlePosition.LOWER && isValid;
997
+ const showWarningUpper = !readOnly && warn || typeof correctedValue !== null && correctedPosition === (twoHandles ? HandlePosition.UPPER : HandlePosition.LOWER) && (twoHandles ? isValidUpper : isValid);
994
998
  return /*#__PURE__*/React__default["default"].createElement(usePrefix.PrefixContext.Consumer, null, prefix => {
995
999
  const labelId = `${id}-label`;
996
1000
  const labelClasses = cx__default["default"](`${prefix}--label`, {
@@ -1100,7 +1104,7 @@ class Slider extends React.PureComponent {
1100
1104
  hasTooltip: hideTextInput,
1101
1105
  className: lowerThumbWrapperClasses,
1102
1106
  label: `${value}`,
1103
- align: twoHandles ? 'top-right' : 'top'
1107
+ align: "top"
1104
1108
  }, lowerThumbWrapperProps), /*#__PURE__*/React__default["default"].createElement("div", {
1105
1109
  className: lowerThumbClasses,
1106
1110
  role: "slider",
@@ -1119,7 +1123,7 @@ class Slider extends React.PureComponent {
1119
1123
  hasTooltip: hideTextInput,
1120
1124
  className: upperThumbWrapperClasses,
1121
1125
  label: `${valueUpper}`,
1122
- align: "top-left"
1126
+ align: "top"
1123
1127
  }, upperThumbWrapperProps), /*#__PURE__*/React__default["default"].createElement("div", {
1124
1128
  className: upperThumbClasses,
1125
1129
  role: "slider",
@@ -27,7 +27,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
27
27
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
28
28
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
29
29
 
30
- var _StructuredListCell, _RadioButtonChecked, _RadioButton;
30
+ var _StructuredListCell;
31
31
  const GridSelectedRowStateContext = /*#__PURE__*/React__default["default"].createContext(null);
32
32
  const GridSelectedRowDispatchContext = /*#__PURE__*/React__default["default"].createContext(null);
33
33
  function StructuredListWrapper(props) {
@@ -202,7 +202,11 @@ function StructuredListRow(props) {
202
202
  onKeyDown: onKeyDown
203
203
  }), /*#__PURE__*/React__default["default"].createElement(GridRowContext.Provider, {
204
204
  value: value
205
- }, selection && /*#__PURE__*/React__default["default"].createElement(StructuredListCell, null, selectedRow === id ? _RadioButtonChecked || (_RadioButtonChecked = /*#__PURE__*/React__default["default"].createElement(iconsReact.RadioButtonChecked, null)) : _RadioButton || (_RadioButton = /*#__PURE__*/React__default["default"].createElement(iconsReact.RadioButton, null))), children));
205
+ }, selection && /*#__PURE__*/React__default["default"].createElement(StructuredListCell, null, selectedRow === id ? /*#__PURE__*/React__default["default"].createElement(iconsReact.RadioButtonChecked, {
206
+ className: `${prefix}--structured-list__icon`
207
+ }) : /*#__PURE__*/React__default["default"].createElement(iconsReact.RadioButton, {
208
+ className: `${prefix}--structured-list__icon`
209
+ })), children));
206
210
  }
207
211
  StructuredListRow.propTypes = {
208
212
  /**
@@ -18,6 +18,8 @@ var useNormalizedInputProps = require('../../internal/useNormalizedInputProps.js
18
18
  var util = require('./util.js');
19
19
  require('../FluidForm/FluidForm.js');
20
20
  var FormContext = require('../FluidForm/FormContext.js');
21
+ require('../Tooltip/DefinitionTooltip.js');
22
+ var Tooltip = require('../Tooltip/Tooltip.js');
21
23
  var deprecate = require('../../prop-types/deprecate.js');
22
24
  var usePrefix = require('../../internal/usePrefix.js');
23
25
 
@@ -48,7 +50,7 @@ const PasswordInput = /*#__PURE__*/React__default["default"].forwardRef(function
48
50
  size = 'md',
49
51
  showPasswordLabel = 'Show password',
50
52
  tooltipPosition = 'bottom',
51
- tooltipAlignment = 'center',
53
+ tooltipAlignment = 'end',
52
54
  type = 'password',
53
55
  warn = false,
54
56
  warnText,
@@ -137,11 +139,25 @@ const PasswordInput = /*#__PURE__*/React__default["default"].forwardRef(function
137
139
  }) : /*#__PURE__*/React__default["default"].createElement(iconsReact.View, {
138
140
  className: `${prefix}--icon-visibility-on`
139
141
  });
140
- const passwordVisibilityToggleClasses = cx__default["default"](`${prefix}--text-input--password__visibility__toggle`, `${prefix}--btn`, `${prefix}--btn--icon-only`, `${prefix}--tooltip__trigger`, `${prefix}--tooltip--a11y`, {
141
- [`${prefix}--btn--disabled`]: disabled,
142
+ const passwordVisibilityToggleClasses = cx__default["default"](`${prefix}--text-input--password__visibility__toggle`, `${prefix}--btn`, `${prefix}--tooltip__trigger`, `${prefix}--tooltip--a11y`, {
142
143
  [`${prefix}--tooltip--${tooltipPosition}`]: tooltipPosition,
143
144
  [`${prefix}--tooltip--align-${tooltipAlignment}`]: tooltipAlignment
144
145
  });
146
+ let align = undefined;
147
+ if (tooltipPosition === 'top' || tooltipPosition === 'bottom') {
148
+ if (tooltipAlignment === 'center') {
149
+ align = tooltipPosition;
150
+ }
151
+ if (tooltipAlignment === 'end') {
152
+ align = `${tooltipPosition}-right`;
153
+ }
154
+ if (tooltipAlignment === 'start') {
155
+ align = `${tooltipPosition}-left`;
156
+ }
157
+ }
158
+ if (tooltipPosition === 'right' || tooltipPosition === 'left') {
159
+ align = tooltipPosition;
160
+ }
145
161
  const input = /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("input", _rollupPluginBabelHelpers["extends"]({}, util.textInputProps({
146
162
  sharedTextInputProps,
147
163
  invalid: normalizedProps.invalid,
@@ -155,14 +171,16 @@ const PasswordInput = /*#__PURE__*/React__default["default"].forwardRef(function
155
171
  "data-toggle-password-visibility": inputType === 'password'
156
172
  })), isFluid && /*#__PURE__*/React__default["default"].createElement("hr", {
157
173
  className: `${prefix}--text-input__divider`
158
- }), /*#__PURE__*/React__default["default"].createElement("button", {
174
+ }), /*#__PURE__*/React__default["default"].createElement(Tooltip.Tooltip, {
175
+ align: align,
176
+ className: `${prefix}--toggle-password-tooltip`,
177
+ label: passwordIsVisible ? hidePasswordLabel : showPasswordLabel
178
+ }, /*#__PURE__*/React__default["default"].createElement("button", {
159
179
  type: "button",
160
180
  className: passwordVisibilityToggleClasses,
161
181
  disabled: disabled,
162
182
  onClick: handleTogglePasswordVisibility
163
- }, !disabled && /*#__PURE__*/React__default["default"].createElement("span", {
164
- className: `${prefix}--assistive-text`
165
- }, passwordIsVisible ? hidePasswordLabel : showPasswordLabel), passwordVisibilityIcon));
183
+ }, passwordVisibilityIcon)));
166
184
  React.useEffect(() => {
167
185
  setInputType(type);
168
186
  }, [type]);
@@ -40,6 +40,10 @@ export interface TileGroupProps extends Omit<ReactAttr<HTMLFieldSetElement>, Exc
40
40
  * Specify the value that is currently selected in the group
41
41
  */
42
42
  valueSelected?: string | number;
43
+ /**
44
+ * `true` to specify if input selection in group is required.
45
+ */
46
+ required?: boolean;
43
47
  }
44
48
  declare const TileGroup: {
45
49
  (props: any): import("react/jsx-runtime").JSX.Element;
@@ -73,6 +77,10 @@ declare const TileGroup: {
73
77
  * the group changes
74
78
  */
75
79
  onChange: PropTypes.Requireable<(...args: any[]) => any>;
80
+ /**
81
+ * `true` to specify if input selection in group is required.
82
+ */
83
+ required: PropTypes.Requireable<boolean>;
76
84
  /**
77
85
  * Specify the value that is currently selected in the group
78
86
  */