@carbon/react 1.46.1 → 1.47.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 (101) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1071 -955
  2. package/es/components/Accordion/AccordionItem.js +3 -1
  3. package/es/components/ContentSwitcher/index.d.ts +11 -0
  4. package/es/components/DataTable/TableExpandRow.d.ts +1 -1
  5. package/es/components/DataTable/TableHeader.d.ts +1 -1
  6. package/es/components/ErrorBoundary/ErrorBoundary.d.ts +47 -0
  7. package/es/components/ErrorBoundary/ErrorBoundary.js +2 -0
  8. package/es/components/ErrorBoundary/ErrorBoundaryContext.d.ts +11 -0
  9. package/es/components/ErrorBoundary/index.d.ts +8 -0
  10. package/es/components/FeatureFlags/index.js +2 -2
  11. package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +3 -2
  12. package/es/components/InlineCheckbox/InlineCheckbox.js +8 -1
  13. package/es/components/ModalWrapper/ModalWrapper.d.ts +75 -0
  14. package/es/components/ModalWrapper/ModalWrapper.js +15 -14
  15. package/es/components/ModalWrapper/index.d.ts +9 -0
  16. package/es/components/OverflowMenu/OverflowMenu.js +1 -1
  17. package/es/components/PrimaryButton/PrimaryButton.d.ts +10 -0
  18. package/es/components/PrimaryButton/PrimaryButton.js +1 -2
  19. package/es/components/PrimaryButton/index.d.ts +9 -0
  20. package/es/components/ProgressBar/ProgressBar.d.ts +88 -0
  21. package/es/components/ProgressBar/ProgressBar.js +13 -11
  22. package/es/components/ProgressBar/index.d.ts +9 -0
  23. package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.d.ts +33 -0
  24. package/es/components/ProgressIndicator/ProgressIndicator.d.ts +179 -0
  25. package/es/components/ProgressIndicator/ProgressIndicator.js +4 -6
  26. package/es/components/ProgressIndicator/index.d.ts +8 -0
  27. package/es/components/Search/Search.js +3 -2
  28. package/es/components/SecondaryButton/SecondaryButton.d.ts +10 -0
  29. package/es/components/SecondaryButton/SecondaryButton.js +1 -2
  30. package/es/components/SecondaryButton/index.d.ts +9 -0
  31. package/es/components/SkeletonIcon/SkeletonIcon.js +1 -2
  32. package/es/components/SkeletonIcon/index.d.ts +9 -0
  33. package/es/components/Slider/Slider.Skeleton.js +1 -2
  34. package/es/components/Slider/Slider.d.ts +1 -1
  35. package/es/components/Slider/index.d.ts +11 -0
  36. package/es/components/Stack/Stack.d.ts +58 -0
  37. package/es/components/Stack/Stack.js +0 -1
  38. package/es/components/Stack/index.d.ts +11 -0
  39. package/es/components/Switch/Switch.js +1 -2
  40. package/es/components/Switch/index.d.ts +10 -0
  41. package/es/components/TextArea/TextArea.d.ts +5 -0
  42. package/es/components/TextArea/TextArea.js +9 -0
  43. package/es/components/TileGroup/TileGroup.d.ts +83 -0
  44. package/es/components/TileGroup/TileGroup.js +67 -79
  45. package/es/components/Toggle/Toggle.d.ts +1 -1
  46. package/es/components/TreeView/TreeNode.js +3 -0
  47. package/es/components/UIShell/SideNavMenu.js +0 -8
  48. package/es/components/UIShell/SideNavSwitcher.d.ts +1 -1
  49. package/es/index.js +12 -12
  50. package/es/internal/createClassWrapper.d.ts +12 -0
  51. package/es/internal/createClassWrapper.js +0 -3
  52. package/lib/components/Accordion/AccordionItem.js +3 -1
  53. package/lib/components/ContentSwitcher/index.d.ts +11 -0
  54. package/lib/components/DataTable/TableExpandRow.d.ts +1 -1
  55. package/lib/components/DataTable/TableHeader.d.ts +1 -1
  56. package/lib/components/ErrorBoundary/ErrorBoundary.d.ts +47 -0
  57. package/lib/components/ErrorBoundary/ErrorBoundary.js +2 -0
  58. package/lib/components/ErrorBoundary/ErrorBoundaryContext.d.ts +11 -0
  59. package/lib/components/ErrorBoundary/index.d.ts +8 -0
  60. package/lib/components/FluidDropdown/FluidDropdown.Skeleton.js +3 -2
  61. package/lib/components/InlineCheckbox/InlineCheckbox.js +8 -1
  62. package/lib/components/ModalWrapper/ModalWrapper.d.ts +75 -0
  63. package/lib/components/ModalWrapper/ModalWrapper.js +15 -14
  64. package/lib/components/ModalWrapper/index.d.ts +9 -0
  65. package/lib/components/OverflowMenu/OverflowMenu.js +1 -1
  66. package/lib/components/PrimaryButton/PrimaryButton.d.ts +10 -0
  67. package/lib/components/PrimaryButton/PrimaryButton.js +1 -2
  68. package/lib/components/PrimaryButton/index.d.ts +9 -0
  69. package/lib/components/ProgressBar/ProgressBar.d.ts +88 -0
  70. package/lib/components/ProgressBar/ProgressBar.js +13 -11
  71. package/lib/components/ProgressBar/index.d.ts +9 -0
  72. package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.d.ts +33 -0
  73. package/lib/components/ProgressIndicator/ProgressIndicator.d.ts +179 -0
  74. package/lib/components/ProgressIndicator/ProgressIndicator.js +4 -6
  75. package/lib/components/ProgressIndicator/index.d.ts +8 -0
  76. package/lib/components/Search/Search.js +3 -2
  77. package/lib/components/SecondaryButton/SecondaryButton.d.ts +10 -0
  78. package/lib/components/SecondaryButton/SecondaryButton.js +1 -2
  79. package/lib/components/SecondaryButton/index.d.ts +9 -0
  80. package/lib/components/SkeletonIcon/SkeletonIcon.js +1 -2
  81. package/lib/components/SkeletonIcon/index.d.ts +9 -0
  82. package/lib/components/Slider/Slider.Skeleton.js +1 -2
  83. package/lib/components/Slider/Slider.d.ts +1 -1
  84. package/lib/components/Slider/index.d.ts +11 -0
  85. package/lib/components/Stack/Stack.d.ts +58 -0
  86. package/lib/components/Stack/Stack.js +0 -1
  87. package/lib/components/Stack/index.d.ts +11 -0
  88. package/lib/components/Switch/Switch.js +1 -2
  89. package/lib/components/Switch/index.d.ts +10 -0
  90. package/lib/components/TextArea/TextArea.d.ts +5 -0
  91. package/lib/components/TextArea/TextArea.js +9 -0
  92. package/lib/components/TileGroup/TileGroup.d.ts +83 -0
  93. package/lib/components/TileGroup/TileGroup.js +64 -76
  94. package/lib/components/Toggle/Toggle.d.ts +1 -1
  95. package/lib/components/TreeView/TreeNode.js +3 -0
  96. package/lib/components/UIShell/SideNavMenu.js +0 -8
  97. package/lib/components/UIShell/SideNavSwitcher.d.ts +1 -1
  98. package/lib/index.js +25 -25
  99. package/lib/internal/createClassWrapper.d.ts +12 -0
  100. package/lib/internal/createClassWrapper.js +0 -3
  101. package/package.json +6 -5
@@ -0,0 +1,58 @@
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 React from 'react';
8
+ /**
9
+ * The steps in the spacing scale
10
+ * @type {Array<number>}
11
+ */
12
+ declare const SPACING_STEPS: number[];
13
+ interface StackProps extends React.HTMLAttributes<HTMLElement> {
14
+ /**
15
+ * Provide a custom element type to render as the outermost element in
16
+ * the Stack component. By default, this component will render a `div`.
17
+ */
18
+ as?: (() => React.ReactNode) | string | React.ElementType;
19
+ /**
20
+ * Provide the elements that will be rendered as children inside of the Stack
21
+ * component. These elements will have having spacing between them according
22
+ * to the `step` and `orientation` prop
23
+ */
24
+ children?: React.ReactNode;
25
+ /**
26
+ * Provide a custom class name to be used by the outermost element rendered by
27
+ * Stack
28
+ */
29
+ className?: string;
30
+ /**
31
+ * Provide either a custom value or a step from the spacing scale to be used
32
+ * as the gap in the layout
33
+ */
34
+ gap?: string | (typeof SPACING_STEPS)[number];
35
+ /**
36
+ * Specify the orientation of them items in the Stack
37
+ */
38
+ orientation?: 'horizontal' | 'vertical';
39
+ }
40
+ /**
41
+ * The Stack component is a useful layout utility in a component-based model.
42
+ * This allows components to not use margin and instead delegate the
43
+ * responsibility of positioning and layout to parent components.
44
+ *
45
+ * In the case of the Stack component, it uses the spacing scale from the
46
+ * Design Language in order to determine how much space there should be between
47
+ * items rendered by the Stack component. It also supports a custom `gap` prop
48
+ * which will allow a user to provide a custom value for the gap of the layout.
49
+ *
50
+ * This component supports both horizontal and vertical orientations.
51
+ *
52
+ * Inspiration for this component:
53
+ *
54
+ * - https://paste.twilio.design/layout/stack/
55
+ * - https://github.com/Workday/canvas-kit/blob/f2f599654876700f483a1d8c5de82a41315c76f1/modules/labs-react/layout/lib/Stack.tsx
56
+ */
57
+ declare const Stack: React.ForwardRefExoticComponent<StackProps & React.RefAttributes<React.ReactNode>>;
58
+ export { Stack };
@@ -31,7 +31,6 @@ const SPACING_STEPS = Array.from({
31
31
  }).map((_, step) => {
32
32
  return step + 1;
33
33
  });
34
-
35
34
  /**
36
35
  * The Stack component is a useful layout utility in a component-based model.
37
36
  * This allows components to not use margin and instead delegate the
@@ -0,0 +1,11 @@
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 React from 'react';
8
+ import { Stack } from './Stack';
9
+ declare const HStack: React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
10
+ declare const VStack: React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
11
+ export { HStack, Stack, VStack };
@@ -115,6 +115,5 @@ Switch.propTypes = {
115
115
  */
116
116
  text: PropTypes__default["default"].string
117
117
  };
118
- var Switch$1 = Switch;
119
118
 
120
- exports["default"] = Switch$1;
119
+ exports["default"] = Switch;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import Switch from './Switch';
8
+ import IconSwitch from './IconSwitch';
9
+ export default Switch;
10
+ export { Switch, IconSwitch };
@@ -73,6 +73,11 @@ export interface TextAreaProps extends React.InputHTMLAttributes<HTMLTextAreaEle
73
73
  * `<textarea>` is clicked
74
74
  */
75
75
  onClick?: (evt: React.MouseEvent<HTMLTextAreaElement>) => void;
76
+ /**
77
+ * Optionally provide an `onKeyDown` handler that is called whenever `<textarea>`
78
+ * is keyed
79
+ */
80
+ onKeyDown?: (evt: React.KeyboardEvent<HTMLTextAreaElement>) => void;
76
81
  /**
77
82
  * Specify the placeholder attribute for the `<textarea>`
78
83
  */
@@ -42,6 +42,7 @@ const TextArea = /*#__PURE__*/React__default["default"].forwardRef((props, forwa
42
42
  hideLabel,
43
43
  onChange = noopFn.noopFn,
44
44
  onClick = noopFn.noopFn,
45
+ onKeyDown = noopFn.noopFn,
45
46
  invalid = false,
46
47
  invalidText = '',
47
48
  helperText = '',
@@ -100,6 +101,9 @@ const TextArea = /*#__PURE__*/React__default["default"].forwardRef((props, forwa
100
101
  evt.preventDefault();
101
102
  }
102
103
  }
104
+ if (!disabled && onKeyDown) {
105
+ onKeyDown(evt);
106
+ }
103
107
  },
104
108
  onPaste: evt => {
105
109
  if (!disabled) {
@@ -330,6 +334,11 @@ TextArea.propTypes = {
330
334
  * `<textarea>` is clicked
331
335
  */
332
336
  onClick: PropTypes__default["default"].func,
337
+ /**
338
+ * Optionally provide an `onKeyDown` handler that is called whenever `<textarea>`
339
+ * is keyed
340
+ */
341
+ onKeyDown: PropTypes__default["default"].func,
333
342
  /**
334
343
  * Specify the placeholder attribute for the `<textarea>`
335
344
  */
@@ -0,0 +1,83 @@
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, { ReactNodeLike } from 'prop-types';
8
+ import { ReactAttr } from '../../types/common';
9
+ type ExcludedAttributes = 'onChange';
10
+ export interface TileGroupProps extends Omit<ReactAttr<HTMLFieldSetElement>, ExcludedAttributes> {
11
+ /**
12
+ * Provide a collection of <RadioTile> components to render in the group
13
+ */
14
+ children?: ReactNodeLike;
15
+ /**
16
+ * Provide an optional className to be applied to the container node
17
+ */
18
+ className?: string;
19
+ /**
20
+ * Specify the the value of <RadioTile> to be selected by default
21
+ */
22
+ defaultSelected?: string | number;
23
+ /**
24
+ * Specify whether the group is disabled
25
+ */
26
+ disabled?: boolean;
27
+ /**
28
+ * Provide an optional legend for this group
29
+ */
30
+ legend?: string;
31
+ /**
32
+ * Specify the name of the underlying `<input>` nodes
33
+ */
34
+ name: string;
35
+ /**
36
+ * Provide an optional `onChange` hook that is called whenever the value of the group changes
37
+ */
38
+ onChange?: (selection: unknown, name: string, evt: unknown) => void;
39
+ /**
40
+ * Specify the value that is currently selected in the group
41
+ */
42
+ valueSelected?: string | number;
43
+ }
44
+ declare const TileGroup: {
45
+ (props: any): JSX.Element;
46
+ propTypes: {
47
+ /**
48
+ * Provide a collection of <RadioTile> components to render in the group
49
+ */
50
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
51
+ /**
52
+ * Provide an optional className to be applied to the container node
53
+ */
54
+ className: PropTypes.Requireable<string>;
55
+ /**
56
+ * Specify the the value of <RadioTile> to be selected by default
57
+ */
58
+ defaultSelected: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
59
+ /**
60
+ * Specify whether the group is disabled
61
+ */
62
+ disabled: PropTypes.Requireable<boolean>;
63
+ /**
64
+ * Provide an optional legend for this group
65
+ */
66
+ legend: PropTypes.Requireable<string>;
67
+ /**
68
+ * Specify the name of the underlying `<input>` nodes
69
+ */
70
+ name: PropTypes.Validator<string>;
71
+ /**
72
+ * Provide an optional `onChange` hook that is called whenever the value of
73
+ * the group changes
74
+ */
75
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
76
+ /**
77
+ * Specify the value that is currently selected in the group
78
+ */
79
+ valueSelected: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
80
+ };
81
+ displayName: string;
82
+ };
83
+ export default TileGroup;
@@ -22,84 +22,71 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
22
22
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
23
23
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
24
24
 
25
- class TileGroup extends React__default["default"].Component {
26
- constructor() {
27
- super(...arguments);
28
- _rollupPluginBabelHelpers.defineProperty(this, "state", {
29
- selected: this.props.valueSelected || this.props.defaultSelected || null,
30
- prevValueSelected: this.props.valueSelected
31
- });
32
- _rollupPluginBabelHelpers.defineProperty(this, "getRadioTiles", () => {
33
- const childrenArray = React__default["default"].Children.toArray(this.props.children);
34
- const children = childrenArray.map(tileRadio => {
35
- const {
36
- value,
37
- ...other
38
- } = tileRadio.props;
39
- /* istanbul ignore if */
40
- if (typeof tileRadio.props.checked !== 'undefined') {
41
- process.env.NODE_ENV !== "production" ? warning.warning(false, `Instead of using the checked property on the RadioTile, set
42
- the defaultSelected property or valueSelected property on the TileGroup.`) : void 0;
43
- }
44
- return /*#__PURE__*/React__default["default"].createElement(RadioTile["default"], _rollupPluginBabelHelpers["extends"]({}, other, {
45
- name: this.props.name,
46
- key: value,
47
- value: value,
48
- onChange: this.handleChange,
49
- checked: value === this.state.selected
50
- }));
51
- });
52
- return children;
53
- });
54
- _rollupPluginBabelHelpers.defineProperty(this, "handleChange", (newSelection, value, evt) => {
25
+ const TileGroup = props => {
26
+ const {
27
+ children,
28
+ className,
29
+ defaultSelected,
30
+ disabled,
31
+ legend,
32
+ name,
33
+ onChange = noopFn.noopFn,
34
+ valueSelected
35
+ } = props;
36
+ const prefix = usePrefix.usePrefix();
37
+ const [selected, setSelected] = React.useState(valueSelected ?? defaultSelected);
38
+ const [prevValueSelected, setPrevValueSelected] = React.useState(valueSelected);
39
+
40
+ /**
41
+ * prop + state alignment - getDerivedStateFromProps
42
+ * only update if selected prop changes
43
+ */
44
+ if (valueSelected !== prevValueSelected) {
45
+ setSelected(valueSelected);
46
+ setPrevValueSelected(valueSelected);
47
+ }
48
+ const getRadioTiles = () => {
49
+ const childrenArray = React__default["default"].Children.toArray(children);
50
+ const radioTiles = childrenArray.map(tileRadio => {
51
+ const tileRadioProps = tileRadio.props ?? undefined;
55
52
  const {
56
- onChange = noopFn.noopFn
57
- } = this.props;
58
- if (newSelection !== this.state.selected) {
59
- this.setState({
60
- selected: newSelection
61
- });
62
- onChange(newSelection, this.props.name, evt);
63
- }
64
- });
65
- _rollupPluginBabelHelpers.defineProperty(this, "renderLegend", legend => {
66
- if (legend) {
67
- return /*#__PURE__*/React__default["default"].createElement("legend", {
68
- className: `${this.context}--label`
69
- }, legend);
53
+ value,
54
+ ...other
55
+ } = tileRadioProps;
56
+ /* istanbul ignore if */
57
+ if (typeof tileRadioProps.checked !== 'undefined') {
58
+ process.env.NODE_ENV !== "production" ? warning.warning(false, `Instead of using the checked property on the RadioTile, set
59
+ the defaultSelected property or valueSelected property on the TileGroup.`) : void 0;
70
60
  }
61
+ return /*#__PURE__*/React__default["default"].createElement(RadioTile["default"], _rollupPluginBabelHelpers["extends"]({}, other, {
62
+ name: name,
63
+ key: value,
64
+ value: value,
65
+ onChange: handleChange,
66
+ checked: value === selected
67
+ }));
71
68
  });
72
- }
73
- static getDerivedStateFromProps(_ref, state) {
74
- let {
75
- valueSelected,
76
- defaultSelected
77
- } = _ref;
78
- const {
79
- prevValueSelected
80
- } = state;
81
- return prevValueSelected === valueSelected ? null : {
82
- selected: valueSelected || defaultSelected || null,
83
- prevValueSelected: valueSelected
84
- };
85
- }
86
- render() {
87
- const {
88
- context: prefix
89
- } = this;
90
- const {
91
- disabled,
92
- className = `${prefix}--tile-group`,
93
- legend
94
- } = this.props;
95
- return /*#__PURE__*/React__default["default"].createElement("fieldset", {
96
- className: className,
97
- disabled: disabled
98
- }, this.renderLegend(legend), /*#__PURE__*/React__default["default"].createElement("div", null, this.getRadioTiles()));
99
- }
100
- }
101
- _rollupPluginBabelHelpers.defineProperty(TileGroup, "contextType", usePrefix.PrefixContext);
102
- _rollupPluginBabelHelpers.defineProperty(TileGroup, "propTypes", {
69
+ return radioTiles;
70
+ };
71
+ const handleChange = (newSelection, value, evt) => {
72
+ if (newSelection !== selected) {
73
+ setSelected(newSelection);
74
+ onChange(newSelection, name, evt);
75
+ }
76
+ };
77
+ const renderLegend = legend => {
78
+ if (legend) {
79
+ return /*#__PURE__*/React__default["default"].createElement("legend", {
80
+ className: `${prefix}--label`
81
+ }, legend);
82
+ }
83
+ };
84
+ return /*#__PURE__*/React__default["default"].createElement("fieldset", {
85
+ className: className ?? `${prefix}--tile-group`,
86
+ disabled: disabled
87
+ }, renderLegend(legend), /*#__PURE__*/React__default["default"].createElement("div", null, getRadioTiles()));
88
+ };
89
+ TileGroup.propTypes = {
103
90
  /**
104
91
  * Provide a collection of <RadioTile> components to render in the group
105
92
  */
@@ -133,6 +120,7 @@ _rollupPluginBabelHelpers.defineProperty(TileGroup, "propTypes", {
133
120
  * Specify the value that is currently selected in the group
134
121
  */
135
122
  valueSelected: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number])
136
- });
123
+ };
124
+ TileGroup.displayName = 'TileGroup';
137
125
 
138
126
  exports["default"] = TileGroup;
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import React, { KeyboardEventHandler, MouseEventHandler } from 'react';
7
+ import React, { type KeyboardEventHandler, type MouseEventHandler } from 'react';
8
8
  import PropTypes from 'prop-types';
9
9
  type ExcludedAttributes = 'aria-labelledby' | 'aria-checked' | 'type' | 'role' | 'id' | 'size' | 'onClick';
10
10
  export interface ToggleProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, ExcludedAttributes> {
@@ -79,6 +79,9 @@ const TreeNode = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
79
79
  if (disabled) {
80
80
  return;
81
81
  }
82
+
83
+ // Prevent the node from being selected
84
+ event.stopPropagation();
82
85
  onToggle?.(event, {
83
86
  id,
84
87
  isExpanded: !expanded,
@@ -41,7 +41,6 @@ const SideNavMenu = /*#__PURE__*/React__default["default"].forwardRef(function S
41
41
  const isRail = React.useContext(SideNav.SideNavContext);
42
42
  const prefix = usePrefix.usePrefix();
43
43
  const [isExpanded, setIsExpanded] = React.useState(defaultExpanded);
44
- const [prevExpanded, setPrevExpanded] = React.useState(defaultExpanded);
45
44
  const className = cx__default["default"]({
46
45
  [`${prefix}--side-nav__item`]: true,
47
46
  [`${prefix}--side-nav__item--active`]: isActive || hasActiveDescendant(children) && !isExpanded,
@@ -49,13 +48,6 @@ const SideNavMenu = /*#__PURE__*/React__default["default"].forwardRef(function S
49
48
  [`${prefix}--side-nav__item--large`]: large,
50
49
  [customClassName]: !!customClassName
51
50
  });
52
- if (isSideNavExpanded === false && isExpanded === true) {
53
- setIsExpanded(false);
54
- setPrevExpanded(true);
55
- } else if (isSideNavExpanded === true && prevExpanded === true) {
56
- setIsExpanded(true);
57
- setPrevExpanded(false);
58
- }
59
51
  return (
60
52
  /*#__PURE__*/
61
53
  // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import React, { ChangeEventHandler } from 'react';
7
+ import React, { type ChangeEventHandler } from 'react';
8
8
  interface SideNavSwitcherProps {
9
9
  /**
10
10
  * Provide an optional class to be applied to the containing node
package/lib/index.js CHANGED
@@ -37,6 +37,8 @@ var DatePicker_Skeleton = require('./components/DatePicker/DatePicker.Skeleton.j
37
37
  var DatePickerInput = require('./components/DatePickerInput/DatePickerInput.js');
38
38
  var Dropdown = require('./components/Dropdown/Dropdown.js');
39
39
  var Dropdown_Skeleton = require('./components/Dropdown/Dropdown.Skeleton.js');
40
+ var ErrorBoundary = require('./components/ErrorBoundary/ErrorBoundary.js');
41
+ var ErrorBoundaryContext = require('./components/ErrorBoundary/ErrorBoundaryContext.js');
40
42
  var ExpandableSearch = require('./components/ExpandableSearch/ExpandableSearch.js');
41
43
  var FileUploader = require('./components/FileUploader/FileUploader.js');
42
44
  var Filename = require('./components/FileUploader/Filename.js');
@@ -64,6 +66,7 @@ var ListItem = require('./components/ListItem/ListItem.js');
64
66
  var Loading = require('./components/Loading/Loading.js');
65
67
  var index$8 = require('./components/MenuButton/index.js');
66
68
  var Modal = require('./components/Modal/Modal.js');
69
+ var ModalWrapper = require('./components/ModalWrapper/ModalWrapper.js');
67
70
  var Notification = require('./components/Notification/Notification.js');
68
71
  var NumberInput_Skeleton = require('./components/NumberInput/NumberInput.Skeleton.js');
69
72
  var NumberInput = require('./components/NumberInput/NumberInput.js');
@@ -71,20 +74,27 @@ var OrderedList = require('./components/OrderedList/OrderedList.js');
71
74
  var index$9 = require('./components/OverflowMenu/index.js');
72
75
  var OverflowMenuItem = require('./components/OverflowMenuItem/OverflowMenuItem.js');
73
76
  var Pagination_Skeleton = require('./components/Pagination/Pagination.Skeleton.js');
77
+ var PrimaryButton = require('./components/PrimaryButton/PrimaryButton.js');
78
+ var ProgressIndicator_Skeleton = require('./components/ProgressIndicator/ProgressIndicator.Skeleton.js');
79
+ var ProgressIndicator = require('./components/ProgressIndicator/ProgressIndicator.js');
74
80
  var RadioButton = require('./components/RadioButton/RadioButton.js');
75
81
  var RadioButton_Skeleton = require('./components/RadioButton/RadioButton.Skeleton.js');
76
82
  var RadioButtonGroup = require('./components/RadioButtonGroup/RadioButtonGroup.js');
77
83
  var Search = require('./components/Search/Search.js');
78
84
  var Search_Skeleton = require('./components/Search/Search.Skeleton.js');
85
+ var SecondaryButton = require('./components/SecondaryButton/SecondaryButton.js');
79
86
  var Select = require('./components/Select/Select.js');
80
87
  var Select_Skeleton = require('./components/Select/Select.Skeleton.js');
81
88
  var SelectItem = require('./components/SelectItem/SelectItem.js');
82
89
  var SelectItemGroup = require('./components/SelectItemGroup/SelectItemGroup.js');
90
+ var SkeletonIcon = require('./components/SkeletonIcon/SkeletonIcon.js');
83
91
  var SkeletonPlaceholder = require('./components/SkeletonPlaceholder/SkeletonPlaceholder.js');
84
92
  var SkeletonText = require('./components/SkeletonText/SkeletonText.js');
85
93
  var index$a = require('./components/Slider/index.js');
86
94
  var StructuredList = require('./components/StructuredList/StructuredList.js');
87
95
  var StructuredList_Skeleton = require('./components/StructuredList/StructuredList.Skeleton.js');
96
+ var Switch = require('./components/Switch/Switch.js');
97
+ var IconSwitch = require('./components/Switch/IconSwitch.js');
88
98
  var Tabs = require('./components/Tabs/Tabs.js');
89
99
  var TabContent = require('./components/TabContent/TabContent.js');
90
100
  var Tabs_Skeleton = require('./components/Tabs/Tabs.Skeleton.js');
@@ -138,6 +148,7 @@ var index$f = require('./components/Layer/index.js');
138
148
  var index$1 = require('./components/Layout/index.js');
139
149
  var index$2 = require('./components/OverflowMenuV2/index.js');
140
150
  var index$g = require('./components/Popover/index.js');
151
+ var ProgressBar = require('./components/ProgressBar/ProgressBar.js');
141
152
  var index$3 = require('./components/Slug/index.js');
142
153
  var index$h = require('./components/Stack/index.js');
143
154
  var DefinitionTooltip = require('./components/Tooltip/DefinitionTooltip.js');
@@ -161,13 +172,10 @@ var ContainedList = require('./components/ContainedList/ContainedList.js');
161
172
  var useContextMenu = require('./components/ContextMenu/useContextMenu.js');
162
173
  var Copy = require('./components/Copy/Copy.js');
163
174
  var CopyButton = require('./components/CopyButton/CopyButton.js');
164
- var ErrorBoundary = require('./components/ErrorBoundary/ErrorBoundary.js');
165
- var ModalWrapper = require('./components/ModalWrapper/ModalWrapper.js');
166
- var ProgressIndicator_Skeleton = require('./components/ProgressIndicator/ProgressIndicator.Skeleton.js');
175
+ var Slider_Skeleton = require('./components/Slider/Slider.Skeleton.js');
167
176
  var TextInput_Skeleton = require('./components/TextInput/TextInput.Skeleton.js');
168
177
  var TextInput = require('./components/TextInput/TextInput.js');
169
178
  var TreeView = require('./components/TreeView/TreeView.js');
170
- var ProgressBar = require('./components/ProgressBar/ProgressBar.js');
171
179
  var FluidComboBox = require('./components/FluidComboBox/FluidComboBox.js');
172
180
  var FluidComboBox_Skeleton = require('./components/FluidComboBox/FluidComboBox.Skeleton.js');
173
181
  var FluidDatePicker = require('./components/FluidDatePicker/FluidDatePicker.js');
@@ -207,7 +215,6 @@ var TableToolbarAction = require('./components/DataTable/TableToolbarAction.js')
207
215
  var TableToolbarContent = require('./components/DataTable/TableToolbarContent.js');
208
216
  var TableToolbarSearch = require('./components/DataTable/TableToolbarSearch.js');
209
217
  var TableToolbarMenu = require('./components/DataTable/TableToolbarMenu.js');
210
- var ErrorBoundaryContext = require('./components/ErrorBoundary/ErrorBoundaryContext.js');
211
218
  var FilterableMultiSelect = require('./components/MultiSelect/FilterableMultiSelect.js');
212
219
  var Menu = require('./components/Menu/Menu.js');
213
220
  var MenuItem = require('./components/Menu/MenuItem.js');
@@ -216,14 +223,7 @@ var Pagination$1 = require('./components/Pagination/Pagination.js');
216
223
  var PaginationNav = require('./components/PaginationNav/PaginationNav.js');
217
224
  var ControlledPasswordInput = require('./components/TextInput/ControlledPasswordInput.js');
218
225
  var PasswordInput = require('./components/TextInput/PasswordInput.js');
219
- var PrimaryButton = require('./components/PrimaryButton/PrimaryButton.js');
220
- var ProgressIndicator = require('./components/ProgressIndicator/ProgressIndicator.js');
221
226
  var RadioTile = require('./components/RadioTile/RadioTile.js');
222
- var SecondaryButton = require('./components/SecondaryButton/SecondaryButton.js');
223
- var SkeletonIcon = require('./components/SkeletonIcon/SkeletonIcon.js');
224
- var Slider_Skeleton = require('./components/Slider/Slider.Skeleton.js');
225
- var Switch = require('./components/Switch/Switch.js');
226
- var IconSwitch = require('./components/Switch/IconSwitch.js');
227
227
  var TreeNode = require('./components/TreeView/TreeNode.js');
228
228
  var Stack = require('./components/Stack/Stack.js');
229
229
 
@@ -260,6 +260,8 @@ exports.DatePickerSkeleton = DatePicker_Skeleton["default"];
260
260
  exports.DatePickerInput = DatePickerInput["default"];
261
261
  exports.Dropdown = Dropdown["default"];
262
262
  exports.DropdownSkeleton = Dropdown_Skeleton["default"];
263
+ exports.ErrorBoundary = ErrorBoundary["default"];
264
+ exports.ErrorBoundaryContext = ErrorBoundaryContext.ErrorBoundaryContext;
263
265
  exports.ExpandableSearch = ExpandableSearch["default"];
264
266
  exports.FileUploader = FileUploader["default"];
265
267
  exports.Filename = Filename["default"];
@@ -287,6 +289,7 @@ exports.ListItem = ListItem["default"];
287
289
  exports.Loading = Loading["default"];
288
290
  exports.MenuButton = index$8.MenuButton;
289
291
  exports.Modal = Modal["default"];
292
+ exports.ModalWrapper = ModalWrapper["default"];
290
293
  exports.ActionableNotification = Notification.ActionableNotification;
291
294
  exports.InlineNotification = Notification.InlineNotification;
292
295
  exports.NotificationActionButton = Notification.NotificationActionButton;
@@ -298,15 +301,21 @@ exports.OrderedList = OrderedList["default"];
298
301
  exports.OverflowMenu = index$9["default"];
299
302
  exports.OverflowMenuItem = OverflowMenuItem["default"];
300
303
  exports.PaginationSkeleton = Pagination_Skeleton["default"];
304
+ exports.PrimaryButton = PrimaryButton["default"];
305
+ exports.ProgressIndicatorSkeleton = ProgressIndicator_Skeleton["default"];
306
+ exports.ProgressIndicator = ProgressIndicator.ProgressIndicator;
307
+ exports.ProgressStep = ProgressIndicator.ProgressStep;
301
308
  exports.RadioButton = RadioButton["default"];
302
309
  exports.RadioButtonSkeleton = RadioButton_Skeleton["default"];
303
310
  exports.RadioButtonGroup = RadioButtonGroup["default"];
304
311
  exports.Search = Search["default"];
305
312
  exports.SearchSkeleton = Search_Skeleton["default"];
313
+ exports.SecondaryButton = SecondaryButton["default"];
306
314
  exports.Select = Select["default"];
307
315
  exports.SelectSkeleton = Select_Skeleton["default"];
308
316
  exports.SelectItem = SelectItem["default"];
309
317
  exports.SelectItemGroup = SelectItemGroup["default"];
318
+ exports.SkeletonIcon = SkeletonIcon["default"];
310
319
  exports.SkeletonPlaceholder = SkeletonPlaceholder["default"];
311
320
  exports.SkeletonText = SkeletonText["default"];
312
321
  exports.Slider = index$a["default"];
@@ -317,6 +326,8 @@ exports.StructuredListInput = StructuredList.StructuredListInput;
317
326
  exports.StructuredListRow = StructuredList.StructuredListRow;
318
327
  exports.StructuredListWrapper = StructuredList.StructuredListWrapper;
319
328
  exports.StructuredListSkeleton = StructuredList_Skeleton["default"];
329
+ exports.Switch = Switch["default"];
330
+ exports.IconSwitch = IconSwitch["default"];
320
331
  exports.IconTab = Tabs.IconTab;
321
332
  exports.Tab = Tabs.Tab;
322
333
  exports.TabList = Tabs.TabList;
@@ -389,6 +400,7 @@ exports.unstable_Layout = index$1.Layout;
389
400
  exports.unstable_OverflowMenuV2 = index$2.OverflowMenuV2;
390
401
  exports.Popover = index$g.Popover;
391
402
  exports.PopoverContent = index$g.PopoverContent;
403
+ exports.ProgressBar = ProgressBar["default"];
392
404
  exports.unstable__Slug = index$3.Slug;
393
405
  exports.unstable__SlugActions = index$3.SlugActions;
394
406
  exports.unstable__SlugContent = index$3.SlugContent;
@@ -418,13 +430,10 @@ exports.ContainedList = ContainedList["default"];
418
430
  exports.useContextMenu = useContextMenu["default"];
419
431
  exports.Copy = Copy["default"];
420
432
  exports.CopyButton = CopyButton["default"];
421
- exports.ErrorBoundary = ErrorBoundary["default"];
422
- exports.ModalWrapper = ModalWrapper["default"];
423
- exports.ProgressIndicatorSkeleton = ProgressIndicator_Skeleton["default"];
433
+ exports.SliderSkeleton = Slider_Skeleton["default"];
424
434
  exports.TextInputSkeleton = TextInput_Skeleton["default"];
425
435
  exports.TextInput = TextInput["default"];
426
436
  exports.TreeView = TreeView["default"];
427
- exports.ProgressBar = ProgressBar["default"];
428
437
  exports.unstable__FluidComboBox = FluidComboBox["default"];
429
438
  exports.unstable__FluidComboBoxSkeleton = FluidComboBox_Skeleton["default"];
430
439
  exports.unstable__FluidDatePicker = FluidDatePicker["default"];
@@ -464,7 +473,6 @@ exports.TableToolbarAction = TableToolbarAction["default"];
464
473
  exports.TableToolbarContent = TableToolbarContent["default"];
465
474
  exports.TableToolbarSearch = TableToolbarSearch["default"];
466
475
  exports.TableToolbarMenu = TableToolbarMenu["default"];
467
- exports.ErrorBoundaryContext = ErrorBoundaryContext.ErrorBoundaryContext;
468
476
  exports.FilterableMultiSelect = FilterableMultiSelect["default"];
469
477
  exports.Menu = Menu.Menu;
470
478
  exports.MenuItem = MenuItem.MenuItem;
@@ -477,14 +485,6 @@ exports.Pagination = Pagination$1["default"];
477
485
  exports.PaginationNav = PaginationNav["default"];
478
486
  exports.ControlledPasswordInput = ControlledPasswordInput["default"];
479
487
  exports.PasswordInput = PasswordInput["default"];
480
- exports.PrimaryButton = PrimaryButton["default"];
481
- exports.ProgressIndicator = ProgressIndicator.ProgressIndicator;
482
- exports.ProgressStep = ProgressIndicator.ProgressStep;
483
488
  exports.RadioTile = RadioTile["default"];
484
- exports.SecondaryButton = SecondaryButton["default"];
485
- exports.SkeletonIcon = SkeletonIcon["default"];
486
- exports.SliderSkeleton = Slider_Skeleton["default"];
487
- exports.Switch = Switch["default"];
488
- exports.IconSwitch = IconSwitch["default"];
489
489
  exports.TreeNode = TreeNode["default"];
490
490
  exports.Stack = Stack.Stack;
@@ -0,0 +1,12 @@
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 { ComponentClass, FunctionComponent } from 'react';
8
+ /**
9
+ * Wrap a class component with a functional component. This prevents an end-user
10
+ * from being able to pass `ref` and access the underlying class instance.
11
+ */
12
+ export declare function createClassWrapper<Props>(Component: ComponentClass<Props>): FunctionComponent<Props>;
@@ -18,9 +18,6 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
18
18
  /**
19
19
  * Wrap a class component with a functional component. This prevents an end-user
20
20
  * from being able to pass `ref` and access the underlying class instance.
21
- *
22
- * @param {ReactNode} Component
23
- * @returns {ReactNode}
24
21
  */
25
22
  function createClassWrapper(Component) {
26
23
  function ClassWrapper(props) {