@carbon/react 1.61.0-rc.1 → 1.62.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.
@@ -30,6 +30,7 @@ var index$2 = require('../IconButton/index.js');
30
30
  var noopFn = require('../../internal/noopFn.js');
31
31
  require('../Text/index.js');
32
32
  var index = require('../FeatureFlags/index.js');
33
+ var events = require('../../tools/events.js');
33
34
  var Text = require('../Text/Text.js');
34
35
  var match = require('../../internal/keyboard/match.js');
35
36
  var keys = require('../../internal/keyboard/keys.js');
@@ -117,7 +118,7 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
117
118
  }
118
119
  }
119
120
  }
120
- function handleMousedown(evt) {
121
+ function handleOnClick(evt) {
121
122
  const target = evt.target;
122
123
  evt.stopPropagation();
123
124
  if (!preventCloseOnClickOutside && !wrapFocus.elementOrParentIsFloatingMenu(target, selectorsFloatingMenus) && innerModal.current && !innerModal.current.contains(target)) {
@@ -316,7 +317,7 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
316
317
  return /*#__PURE__*/React__default["default"].createElement(index$1.Layer, _rollupPluginBabelHelpers["extends"]({}, rest, {
317
318
  level: 0,
318
319
  onKeyDown: handleKeyDown,
319
- onMouseDown: handleMousedown,
320
+ onClick: events.composeEventHandlers([rest?.onClick, handleOnClick]),
320
321
  onBlur: !focusTrapWithoutSentinels ? handleBlur : () => {},
321
322
  className: modalClasses,
322
323
  role: "presentation",
@@ -130,15 +130,15 @@ const Search = /*#__PURE__*/React__default["default"].forwardRef(function Search
130
130
  "aria-label": placeholder,
131
131
  className: searchClasses
132
132
  }, /*#__PURE__*/React__default["default"].createElement("div", {
133
- "aria-label": "button",
133
+ "aria-label": onExpand ? 'button' : undefined,
134
134
  "aria-labelledby": onExpand ? uniqueId : undefined,
135
- role: "button",
135
+ role: onExpand ? 'button' : undefined,
136
136
  className: `${prefix}--search-magnifier`,
137
137
  onClick: onExpand,
138
138
  onKeyDown: handleExpandButtonKeyDown,
139
139
  tabIndex: onExpand && !isExpanded ? 0 : -1,
140
140
  ref: expandButtonRef,
141
- "aria-expanded": onExpand && isExpanded ? true : false,
141
+ "aria-expanded": onExpand && isExpanded ? true : onExpand && !isExpanded ? false : undefined,
142
142
  "aria-controls": onExpand ? uniqueId : undefined
143
143
  }, /*#__PURE__*/React__default["default"].createElement(CustomSearchIcon, {
144
144
  icon: renderIcon
@@ -36,7 +36,7 @@ export interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputEle
36
36
  */
37
37
  disabled?: boolean;
38
38
  /**
39
- * The callback to format the label associated with the minimum/maximum value.
39
+ * The callback to format the label associated with the minimum/maximum value and the value tooltip when hideTextInput is true.
40
40
  */
41
41
  formatLabel?: (value: number, label: string | undefined) => string;
42
42
  /**
@@ -1103,13 +1103,14 @@ class Slider extends React.PureComponent {
1103
1103
  }, other), /*#__PURE__*/React__default["default"].createElement(ThumbWrapper, _rollupPluginBabelHelpers["extends"]({
1104
1104
  hasTooltip: hideTextInput,
1105
1105
  className: lowerThumbWrapperClasses,
1106
- label: `${value}`,
1106
+ label: `${formatLabel(value, '')}`,
1107
1107
  align: "top"
1108
1108
  }, lowerThumbWrapperProps), /*#__PURE__*/React__default["default"].createElement("div", {
1109
1109
  className: lowerThumbClasses,
1110
1110
  role: "slider",
1111
1111
  id: twoHandles ? undefined : id,
1112
1112
  tabIndex: !readOnly ? 0 : -1,
1113
+ "aria-valuetext": `${formatLabel(value, '')}`,
1113
1114
  "aria-valuemax": twoHandles ? valueUpper : max,
1114
1115
  "aria-valuemin": min,
1115
1116
  "aria-valuenow": value,
@@ -1122,7 +1123,7 @@ class Slider extends React.PureComponent {
1122
1123
  }, twoHandles && !isRtl ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, _LowerHandle || (_LowerHandle = /*#__PURE__*/React__default["default"].createElement(SliderHandles.LowerHandle, null)), _LowerHandleFocus || (_LowerHandleFocus = /*#__PURE__*/React__default["default"].createElement(SliderHandles.LowerHandleFocus, null))) : twoHandles && isRtl ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, _UpperHandle || (_UpperHandle = /*#__PURE__*/React__default["default"].createElement(SliderHandles.UpperHandle, null)), _UpperHandleFocus || (_UpperHandleFocus = /*#__PURE__*/React__default["default"].createElement(SliderHandles.UpperHandleFocus, null))) : undefined)), twoHandles ? /*#__PURE__*/React__default["default"].createElement(ThumbWrapper, _rollupPluginBabelHelpers["extends"]({
1123
1124
  hasTooltip: hideTextInput,
1124
1125
  className: upperThumbWrapperClasses,
1125
- label: `${valueUpper}`,
1126
+ label: `${formatLabel(valueUpper || 0, '')}`,
1126
1127
  align: "top"
1127
1128
  }, upperThumbWrapperProps), /*#__PURE__*/React__default["default"].createElement("div", {
1128
1129
  className: upperThumbClasses,
@@ -77,6 +77,63 @@ declare namespace Tabs {
77
77
  selectedIndex: PropTypes.Requireable<number>;
78
78
  };
79
79
  }
80
+ export interface TabsVerticalProps {
81
+ /**
82
+ * Provide child elements to be rendered inside the `TabsVertical`.
83
+ * These elements should render either `TabsListVertical` or `TabsPanels`
84
+ */
85
+ children?: ReactNode;
86
+ /**
87
+ * Specify which content tab should be initially selected when the component
88
+ * is first rendered
89
+ */
90
+ defaultSelectedIndex?: number;
91
+ /**
92
+ * Option to set a height style only if using vertical variation
93
+ */
94
+ height?: string;
95
+ /**
96
+ * Provide an optional function which is called
97
+ * whenever the state of the `Tabs` changes
98
+ */
99
+ onChange?(state: {
100
+ selectedIndex: number;
101
+ }): void;
102
+ /**
103
+ * Control which content panel is currently selected. This puts the component
104
+ * in a controlled mode and should be used along with `onChange`
105
+ */
106
+ selectedIndex?: number;
107
+ }
108
+ declare function TabsVertical({ children, height, defaultSelectedIndex, onChange, selectedIndex: controlledSelectedIndex, ...rest }: TabsVerticalProps): import("react/jsx-runtime").JSX.Element;
109
+ declare namespace TabsVertical {
110
+ var propTypes: {
111
+ /**
112
+ * Provide child elements to be rendered inside the `TabsVertical`.
113
+ * These elements should render either `TabsListVertical` or `TabsPanels`
114
+ */
115
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
116
+ /**
117
+ * Specify which content tab should be initially selected when the component
118
+ * is first rendered
119
+ */
120
+ defaultSelectedIndex: PropTypes.Requireable<number>;
121
+ /**
122
+ * Option to set a height style only if using vertical variation
123
+ */
124
+ height: PropTypes.Requireable<string>;
125
+ /**
126
+ * Provide an optional function which is called whenever the state of the
127
+ * `Tabs` changes
128
+ */
129
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
130
+ /**
131
+ * Control which content panel is currently selected. This puts the component
132
+ * in a controlled mode and should be used along with `onChange`
133
+ */
134
+ selectedIndex: PropTypes.Requireable<number>;
135
+ };
136
+ }
80
137
  /**
81
138
  * TabList
82
139
  */
@@ -195,6 +252,59 @@ declare namespace TabList {
195
252
  scrollIntoView: PropTypes.Requireable<boolean>;
196
253
  };
197
254
  }
255
+ /**
256
+ * TabListVertical
257
+ */
258
+ export interface TabListVerticalProps extends DivAttributes {
259
+ /**
260
+ * Specify whether the content tab should be activated automatically or
261
+ * manually
262
+ */
263
+ activation?: 'automatic' | 'manual';
264
+ /**
265
+ * Provide an accessible label to be read when a user interacts with this
266
+ * component
267
+ */
268
+ 'aria-label': string;
269
+ /**
270
+ * Provide child elements to be rendered inside `ContentTabs`.
271
+ * These elements should render a `ContentTab`
272
+ */
273
+ children?: ReactNode;
274
+ /**
275
+ * Specify an optional className to be added to the container node
276
+ */
277
+ className?: string;
278
+ /**
279
+ * Choose whether to automatically scroll to newly selected tabs
280
+ * on component rerender
281
+ */
282
+ scrollIntoView?: boolean;
283
+ }
284
+ declare function TabListVertical({ activation, 'aria-label': label, children, className: customClassName, scrollIntoView, ...rest }: TabListVerticalProps): import("react/jsx-runtime").JSX.Element;
285
+ declare namespace TabListVertical {
286
+ var propTypes: {
287
+ /**
288
+ * Specify whether the content tab should be activated automatically or
289
+ * manually
290
+ */
291
+ activation: PropTypes.Requireable<string>;
292
+ /**
293
+ * Provide an accessible label to be read when a user interacts with this
294
+ * component
295
+ */
296
+ 'aria-label': PropTypes.Validator<string>;
297
+ /**
298
+ * Provide child elements to be rendered inside `ContentTabs`.
299
+ * These elements should render a `ContentTab`
300
+ */
301
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
302
+ /**
303
+ * Specify an optional className to be added to the container node
304
+ */
305
+ className: PropTypes.Requireable<string>;
306
+ };
307
+ }
198
308
  /**
199
309
  * Tab
200
310
  */
@@ -308,4 +418,4 @@ declare namespace TabPanels {
308
418
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
309
419
  };
310
420
  }
311
- export { Tabs, Tab, IconTab, TabPanel, TabPanels, TabList };
421
+ export { Tabs, TabsVertical, Tab, IconTab, TabPanel, TabPanels, TabList, TabListVertical, };