@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
@@ -5,92 +5,79 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
8
+ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import PropTypes from 'prop-types';
10
- import React__default from 'react';
10
+ import React__default, { useState } from 'react';
11
11
  import RadioTile from '../RadioTile/RadioTile.js';
12
12
  import { warning } from '../../internal/warning.js';
13
- import { PrefixContext } from '../../internal/usePrefix.js';
13
+ import { usePrefix } from '../../internal/usePrefix.js';
14
14
  import { noopFn } from '../../internal/noopFn.js';
15
15
 
16
- class TileGroup extends React__default.Component {
17
- constructor() {
18
- super(...arguments);
19
- _defineProperty(this, "state", {
20
- selected: this.props.valueSelected || this.props.defaultSelected || null,
21
- prevValueSelected: this.props.valueSelected
22
- });
23
- _defineProperty(this, "getRadioTiles", () => {
24
- const childrenArray = React__default.Children.toArray(this.props.children);
25
- const children = childrenArray.map(tileRadio => {
26
- const {
27
- value,
28
- ...other
29
- } = tileRadio.props;
30
- /* istanbul ignore if */
31
- if (typeof tileRadio.props.checked !== 'undefined') {
32
- process.env.NODE_ENV !== "production" ? warning(false, `Instead of using the checked property on the RadioTile, set
33
- the defaultSelected property or valueSelected property on the TileGroup.`) : void 0;
34
- }
35
- return /*#__PURE__*/React__default.createElement(RadioTile, _extends({}, other, {
36
- name: this.props.name,
37
- key: value,
38
- value: value,
39
- onChange: this.handleChange,
40
- checked: value === this.state.selected
41
- }));
42
- });
43
- return children;
44
- });
45
- _defineProperty(this, "handleChange", (newSelection, value, evt) => {
16
+ const TileGroup = props => {
17
+ const {
18
+ children,
19
+ className,
20
+ defaultSelected,
21
+ disabled,
22
+ legend,
23
+ name,
24
+ onChange = noopFn,
25
+ valueSelected
26
+ } = props;
27
+ const prefix = usePrefix();
28
+ const [selected, setSelected] = useState(valueSelected ?? defaultSelected);
29
+ const [prevValueSelected, setPrevValueSelected] = useState(valueSelected);
30
+
31
+ /**
32
+ * prop + state alignment - getDerivedStateFromProps
33
+ * only update if selected prop changes
34
+ */
35
+ if (valueSelected !== prevValueSelected) {
36
+ setSelected(valueSelected);
37
+ setPrevValueSelected(valueSelected);
38
+ }
39
+ const getRadioTiles = () => {
40
+ const childrenArray = React__default.Children.toArray(children);
41
+ const radioTiles = childrenArray.map(tileRadio => {
42
+ const tileRadioProps = tileRadio.props ?? undefined;
46
43
  const {
47
- onChange = noopFn
48
- } = this.props;
49
- if (newSelection !== this.state.selected) {
50
- this.setState({
51
- selected: newSelection
52
- });
53
- onChange(newSelection, this.props.name, evt);
54
- }
55
- });
56
- _defineProperty(this, "renderLegend", legend => {
57
- if (legend) {
58
- return /*#__PURE__*/React__default.createElement("legend", {
59
- className: `${this.context}--label`
60
- }, legend);
44
+ value,
45
+ ...other
46
+ } = tileRadioProps;
47
+ /* istanbul ignore if */
48
+ if (typeof tileRadioProps.checked !== 'undefined') {
49
+ process.env.NODE_ENV !== "production" ? warning(false, `Instead of using the checked property on the RadioTile, set
50
+ the defaultSelected property or valueSelected property on the TileGroup.`) : void 0;
61
51
  }
52
+ return /*#__PURE__*/React__default.createElement(RadioTile, _extends({}, other, {
53
+ name: name,
54
+ key: value,
55
+ value: value,
56
+ onChange: handleChange,
57
+ checked: value === selected
58
+ }));
62
59
  });
63
- }
64
- static getDerivedStateFromProps(_ref, state) {
65
- let {
66
- valueSelected,
67
- defaultSelected
68
- } = _ref;
69
- const {
70
- prevValueSelected
71
- } = state;
72
- return prevValueSelected === valueSelected ? null : {
73
- selected: valueSelected || defaultSelected || null,
74
- prevValueSelected: valueSelected
75
- };
76
- }
77
- render() {
78
- const {
79
- context: prefix
80
- } = this;
81
- const {
82
- disabled,
83
- className = `${prefix}--tile-group`,
84
- legend
85
- } = this.props;
86
- return /*#__PURE__*/React__default.createElement("fieldset", {
87
- className: className,
88
- disabled: disabled
89
- }, this.renderLegend(legend), /*#__PURE__*/React__default.createElement("div", null, this.getRadioTiles()));
90
- }
91
- }
92
- _defineProperty(TileGroup, "contextType", PrefixContext);
93
- _defineProperty(TileGroup, "propTypes", {
60
+ return radioTiles;
61
+ };
62
+ const handleChange = (newSelection, value, evt) => {
63
+ if (newSelection !== selected) {
64
+ setSelected(newSelection);
65
+ onChange(newSelection, name, evt);
66
+ }
67
+ };
68
+ const renderLegend = legend => {
69
+ if (legend) {
70
+ return /*#__PURE__*/React__default.createElement("legend", {
71
+ className: `${prefix}--label`
72
+ }, legend);
73
+ }
74
+ };
75
+ return /*#__PURE__*/React__default.createElement("fieldset", {
76
+ className: className ?? `${prefix}--tile-group`,
77
+ disabled: disabled
78
+ }, renderLegend(legend), /*#__PURE__*/React__default.createElement("div", null, getRadioTiles()));
79
+ };
80
+ TileGroup.propTypes = {
94
81
  /**
95
82
  * Provide a collection of <RadioTile> components to render in the group
96
83
  */
@@ -124,6 +111,7 @@ _defineProperty(TileGroup, "propTypes", {
124
111
  * Specify the value that is currently selected in the group
125
112
  */
126
113
  valueSelected: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
127
- });
114
+ };
115
+ TileGroup.displayName = 'TileGroup';
128
116
 
129
117
  export { TileGroup as default };
@@ -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> {
@@ -69,6 +69,9 @@ const TreeNode = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
69
69
  if (disabled) {
70
70
  return;
71
71
  }
72
+
73
+ // Prevent the node from being selected
74
+ event.stopPropagation();
72
75
  onToggle?.(event, {
73
76
  id,
74
77
  isExpanded: !expanded,
@@ -31,7 +31,6 @@ const SideNavMenu = /*#__PURE__*/React__default.forwardRef(function SideNavMenu(
31
31
  const isRail = useContext(SideNavContext);
32
32
  const prefix = usePrefix();
33
33
  const [isExpanded, setIsExpanded] = useState(defaultExpanded);
34
- const [prevExpanded, setPrevExpanded] = useState(defaultExpanded);
35
34
  const className = cx({
36
35
  [`${prefix}--side-nav__item`]: true,
37
36
  [`${prefix}--side-nav__item--active`]: isActive || hasActiveDescendant(children) && !isExpanded,
@@ -39,13 +38,6 @@ const SideNavMenu = /*#__PURE__*/React__default.forwardRef(function SideNavMenu(
39
38
  [`${prefix}--side-nav__item--large`]: large,
40
39
  [customClassName]: !!customClassName
41
40
  });
42
- if (isSideNavExpanded === false && isExpanded === true) {
43
- setIsExpanded(false);
44
- setPrevExpanded(true);
45
- } else if (isSideNavExpanded === true && prevExpanded === true) {
46
- setIsExpanded(true);
47
- setPrevExpanded(false);
48
- }
49
41
  return (
50
42
  /*#__PURE__*/
51
43
  // 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/es/index.js CHANGED
@@ -33,6 +33,8 @@ export { default as DatePickerSkeleton } from './components/DatePicker/DatePicke
33
33
  export { default as DatePickerInput } from './components/DatePickerInput/DatePickerInput.js';
34
34
  export { default as Dropdown } from './components/Dropdown/Dropdown.js';
35
35
  export { default as DropdownSkeleton } from './components/Dropdown/Dropdown.Skeleton.js';
36
+ export { default as ErrorBoundary } from './components/ErrorBoundary/ErrorBoundary.js';
37
+ export { ErrorBoundaryContext } from './components/ErrorBoundary/ErrorBoundaryContext.js';
36
38
  export { default as ExpandableSearch } from './components/ExpandableSearch/ExpandableSearch.js';
37
39
  export { default as FileUploader } from './components/FileUploader/FileUploader.js';
38
40
  export { default as Filename } from './components/FileUploader/Filename.js';
@@ -60,6 +62,7 @@ export { default as ListItem } from './components/ListItem/ListItem.js';
60
62
  export { default as Loading } from './components/Loading/Loading.js';
61
63
  export { MenuButton } from './components/MenuButton/index.js';
62
64
  export { default as Modal } from './components/Modal/Modal.js';
65
+ export { default as ModalWrapper } from './components/ModalWrapper/ModalWrapper.js';
63
66
  export { ActionableNotification, InlineNotification, NotificationActionButton, NotificationButton, ToastNotification } from './components/Notification/Notification.js';
64
67
  export { default as NumberInputSkeleton } from './components/NumberInput/NumberInput.Skeleton.js';
65
68
  export { NumberInput } from './components/NumberInput/NumberInput.js';
@@ -67,20 +70,27 @@ export { default as OrderedList } from './components/OrderedList/OrderedList.js'
67
70
  export { default as OverflowMenu } from './components/OverflowMenu/index.js';
68
71
  export { default as OverflowMenuItem } from './components/OverflowMenuItem/OverflowMenuItem.js';
69
72
  export { default as PaginationSkeleton } from './components/Pagination/Pagination.Skeleton.js';
73
+ export { default as PrimaryButton } from './components/PrimaryButton/PrimaryButton.js';
74
+ export { default as ProgressIndicatorSkeleton } from './components/ProgressIndicator/ProgressIndicator.Skeleton.js';
75
+ export { ProgressIndicator, ProgressStep } from './components/ProgressIndicator/ProgressIndicator.js';
70
76
  export { default as RadioButton } from './components/RadioButton/RadioButton.js';
71
77
  export { default as RadioButtonSkeleton } from './components/RadioButton/RadioButton.Skeleton.js';
72
78
  export { default as RadioButtonGroup } from './components/RadioButtonGroup/RadioButtonGroup.js';
73
79
  export { default as Search } from './components/Search/Search.js';
74
80
  export { default as SearchSkeleton } from './components/Search/Search.Skeleton.js';
81
+ export { default as SecondaryButton } from './components/SecondaryButton/SecondaryButton.js';
75
82
  export { default as Select } from './components/Select/Select.js';
76
83
  export { default as SelectSkeleton } from './components/Select/Select.Skeleton.js';
77
84
  export { default as SelectItem } from './components/SelectItem/SelectItem.js';
78
85
  export { default as SelectItemGroup } from './components/SelectItemGroup/SelectItemGroup.js';
86
+ export { default as SkeletonIcon } from './components/SkeletonIcon/SkeletonIcon.js';
79
87
  export { default as SkeletonPlaceholder } from './components/SkeletonPlaceholder/SkeletonPlaceholder.js';
80
88
  export { default as SkeletonText } from './components/SkeletonText/SkeletonText.js';
81
89
  export { default as Slider } from './components/Slider/index.js';
82
90
  export { StructuredListBody, StructuredListCell, StructuredListHead, StructuredListInput, StructuredListRow, StructuredListWrapper } from './components/StructuredList/StructuredList.js';
83
91
  export { default as StructuredListSkeleton } from './components/StructuredList/StructuredList.Skeleton.js';
92
+ export { default as Switch } from './components/Switch/Switch.js';
93
+ export { default as IconSwitch } from './components/Switch/IconSwitch.js';
84
94
  export { IconTab, Tab, TabList, TabPanel, TabPanels, Tabs } from './components/Tabs/Tabs.js';
85
95
  export { default as TabContent } from './components/TabContent/TabContent.js';
86
96
  export { default as TabsSkeleton } from './components/Tabs/Tabs.Skeleton.js';
@@ -134,6 +144,7 @@ export { Layer, useLayer } from './components/Layer/index.js';
134
144
  export { Layout as unstable_Layout } from './components/Layout/index.js';
135
145
  export { OverflowMenuV2 as unstable_OverflowMenuV2 } from './components/OverflowMenuV2/index.js';
136
146
  export { Popover, PopoverContent } from './components/Popover/index.js';
147
+ export { default as ProgressBar } from './components/ProgressBar/ProgressBar.js';
137
148
  export { Slug as unstable__Slug, SlugActions as unstable__SlugActions, SlugContent as unstable__SlugContent } from './components/Slug/index.js';
138
149
  export { HStack, VStack } from './components/Stack/index.js';
139
150
  export { DefinitionTooltip } from './components/Tooltip/DefinitionTooltip.js';
@@ -157,13 +168,10 @@ export { default as ContainedList } from './components/ContainedList/ContainedLi
157
168
  export { default as useContextMenu } from './components/ContextMenu/useContextMenu.js';
158
169
  export { default as Copy } from './components/Copy/Copy.js';
159
170
  export { default as CopyButton } from './components/CopyButton/CopyButton.js';
160
- export { default as ErrorBoundary } from './components/ErrorBoundary/ErrorBoundary.js';
161
- export { default as ModalWrapper } from './components/ModalWrapper/ModalWrapper.js';
162
- export { default as ProgressIndicatorSkeleton } from './components/ProgressIndicator/ProgressIndicator.Skeleton.js';
171
+ export { default as SliderSkeleton } from './components/Slider/Slider.Skeleton.js';
163
172
  export { default as TextInputSkeleton } from './components/TextInput/TextInput.Skeleton.js';
164
173
  export { default as TextInput } from './components/TextInput/TextInput.js';
165
174
  export { default as TreeView } from './components/TreeView/TreeView.js';
166
- export { default as ProgressBar } from './components/ProgressBar/ProgressBar.js';
167
175
  export { default as unstable__FluidComboBox } from './components/FluidComboBox/FluidComboBox.js';
168
176
  export { default as unstable__FluidComboBoxSkeleton } from './components/FluidComboBox/FluidComboBox.Skeleton.js';
169
177
  export { default as unstable__FluidDatePicker } from './components/FluidDatePicker/FluidDatePicker.js';
@@ -203,7 +211,6 @@ export { default as TableToolbarAction } from './components/DataTable/TableToolb
203
211
  export { default as TableToolbarContent } from './components/DataTable/TableToolbarContent.js';
204
212
  export { default as TableToolbarSearch } from './components/DataTable/TableToolbarSearch.js';
205
213
  export { default as TableToolbarMenu } from './components/DataTable/TableToolbarMenu.js';
206
- export { ErrorBoundaryContext } from './components/ErrorBoundary/ErrorBoundaryContext.js';
207
214
  export { default as FilterableMultiSelect } from './components/MultiSelect/FilterableMultiSelect.js';
208
215
  export { Menu } from './components/Menu/Menu.js';
209
216
  export { MenuItem, MenuItemDivider, MenuItemGroup, MenuItemRadioGroup, MenuItemSelectable } from './components/Menu/MenuItem.js';
@@ -212,13 +219,6 @@ export { default as Pagination } from './components/Pagination/Pagination.js';
212
219
  export { default as PaginationNav } from './components/PaginationNav/PaginationNav.js';
213
220
  export { default as ControlledPasswordInput } from './components/TextInput/ControlledPasswordInput.js';
214
221
  export { default as PasswordInput } from './components/TextInput/PasswordInput.js';
215
- export { default as PrimaryButton } from './components/PrimaryButton/PrimaryButton.js';
216
- export { ProgressIndicator, ProgressStep } from './components/ProgressIndicator/ProgressIndicator.js';
217
222
  export { default as RadioTile } from './components/RadioTile/RadioTile.js';
218
- export { default as SecondaryButton } from './components/SecondaryButton/SecondaryButton.js';
219
- export { default as SkeletonIcon } from './components/SkeletonIcon/SkeletonIcon.js';
220
- export { default as SliderSkeleton } from './components/Slider/Slider.Skeleton.js';
221
- export { default as Switch } from './components/Switch/Switch.js';
222
- export { default as IconSwitch } from './components/Switch/IconSwitch.js';
223
223
  export { default as TreeNode } from './components/TreeView/TreeNode.js';
224
224
  export { Stack } from './components/Stack/Stack.js';
@@ -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>;
@@ -10,9 +10,6 @@ import React__default from 'react';
10
10
  /**
11
11
  * Wrap a class component with a functional component. This prevents an end-user
12
12
  * from being able to pass `ref` and access the underlying class instance.
13
- *
14
- * @param {ReactNode} Component
15
- * @returns {ReactNode}
16
13
  */
17
14
  function createClassWrapper(Component) {
18
15
  function ClassWrapper(props) {
@@ -74,7 +74,9 @@ function AccordionItem(_ref) {
74
74
  content.current.style.maxBlockSize = '';
75
75
  } else {
76
76
  // accordion opens
77
- content.current.style.maxBlockSize = content.current.scrollHeight + 15 + 'px';
77
+ content.current.style.maxBlockSize =
78
+ // Scroll height plus top/bottom padding
79
+ content.current.scrollHeight + 32 + 'px';
78
80
  }
79
81
  const nextValue = !isOpen;
80
82
  setIsOpen(nextValue);
@@ -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
+ /// <reference types="react" />
8
+ import { ContentSwitcherProps } from './ContentSwitcher';
9
+ declare const ContentSwitcher: import("react").FunctionComponent<ContentSwitcherProps>;
10
+ export default ContentSwitcher;
11
+ export { ContentSwitcher };
@@ -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, { MouseEventHandler, PropsWithChildren } from 'react';
7
+ import React, { type MouseEventHandler, type PropsWithChildren } from 'react';
8
8
  import { TableRowProps } from './TableRow';
9
9
  interface TableExpandRowProps extends PropsWithChildren<TableRowProps> {
10
10
  /**
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import { ReactNodeLike } from 'prop-types';
8
- import React, { MouseEventHandler } from 'react';
8
+ import React, { type MouseEventHandler } from 'react';
9
9
  import { ReactAttr } from '../../types/common';
10
10
  interface TableHeaderProps extends ReactAttr<HTMLTableCellElement & HTMLButtonElement> {
11
11
  /**
@@ -0,0 +1,47 @@
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, { ErrorInfo, ReactNode } from 'react';
8
+ import PropTypes from 'prop-types';
9
+ import { ErrorBoundaryContext } from './ErrorBoundaryContext';
10
+ /**
11
+ * React introduced additional lifecycle methods in v16 for capturing errors
12
+ * that occur in a specific sub-tree of components. This component helps to
13
+ * consolidate some of the duplication that occurs when using these lifecycle
14
+ * methods across a codebase. In addition, it allows you to specify the fallback
15
+ * UI to display when an error occurs in the sub-tree through the `fallback`
16
+ * prop.
17
+ *
18
+ * This component roughly follows the React.js docs example code for these
19
+ * methods. In addition, it takes advantage of an `ErrorBoundaryContext` so that
20
+ * consumers can specify their own logic for logging errors. For example,
21
+ * reporting an error in the UI to an external service for every `ErrorBoundary`
22
+ * used.
23
+ *
24
+ * Reference:
25
+ * https://reactjs.org/docs/error-boundaries.html#introducing-error-boundaries
26
+ */
27
+ interface ErrorBoundaryProps {
28
+ children?: ReactNode;
29
+ fallback?: ReactNode;
30
+ }
31
+ interface ErrorBoundaryState {
32
+ hasError: boolean;
33
+ }
34
+ export default class ErrorBoundary extends React.Component<ErrorBoundaryProps> {
35
+ static propTypes: {
36
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
37
+ fallback: PropTypes.Requireable<PropTypes.ReactNodeLike>;
38
+ };
39
+ static contextType: React.Context<import("./ErrorBoundaryContext").ErrorBoundaryContextType>;
40
+ context: React.ContextType<typeof ErrorBoundaryContext>;
41
+ static getDerivedStateFromError(): ErrorBoundaryState;
42
+ state: ErrorBoundaryState;
43
+ componentDidCatch(error: Error, info: ErrorInfo): void;
44
+ componentDidUpdate(prevProps: ErrorBoundaryProps): void;
45
+ render(): React.ReactNode;
46
+ }
47
+ export {};
@@ -36,9 +36,11 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
36
36
  * Reference:
37
37
  * https://reactjs.org/docs/error-boundaries.html#introducing-error-boundaries
38
38
  */
39
+
39
40
  class ErrorBoundary extends React__default["default"].Component {
40
41
  constructor() {
41
42
  super(...arguments);
43
+ _rollupPluginBabelHelpers.defineProperty(this, "context", void 0);
42
44
  _rollupPluginBabelHelpers.defineProperty(this, "state", {
43
45
  hasError: false
44
46
  });
@@ -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 { ErrorInfo } from 'react';
8
+ export interface ErrorBoundaryContextType {
9
+ log: (error: Error, errorInfo: ErrorInfo) => void;
10
+ }
11
+ export declare const ErrorBoundaryContext: import("react").Context<ErrorBoundaryContextType>;
@@ -0,0 +1,8 @@
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
+ export { default as ErrorBoundary } from './ErrorBoundary';
8
+ export { ErrorBoundaryContext } from './ErrorBoundaryContext';
@@ -27,9 +27,10 @@ const FluidDropdownSkeleton = _ref => {
27
27
  ...rest
28
28
  } = _ref;
29
29
  const prefix = usePrefix.usePrefix();
30
- const wrapperClasses = cx__default["default"](className, `${prefix}--skeleton`, `${prefix}--list-box`);
30
+ const wrapperContainerClasses = cx__default["default"](className, `${prefix}--list-box__wrapper--fluid`);
31
+ const wrapperClasses = cx__default["default"](`${prefix}--skeleton`, `${prefix}--list-box`);
31
32
  return /*#__PURE__*/React__default["default"].createElement("div", {
32
- className: `${prefix}--list-box__wrapper--fluid`
33
+ className: wrapperContainerClasses
33
34
  }, /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
34
35
  className: wrapperClasses
35
36
  }, rest), /*#__PURE__*/React__default["default"].createElement("span", {
@@ -44,7 +44,7 @@ const InlineCheckbox = /*#__PURE__*/React__default["default"].forwardRef(functio
44
44
  disabled,
45
45
  id,
46
46
  name,
47
- onClick,
47
+ onClick: onClick ? onClickCheckBoxInput : onClick,
48
48
  onChange: evt => {
49
49
  onChange(evt.target.checked, id, evt);
50
50
  },
@@ -60,6 +60,13 @@ const InlineCheckbox = /*#__PURE__*/React__default["default"].forwardRef(functio
60
60
  inputRef.current.indeterminate = indeterminate;
61
61
  }
62
62
  }, [indeterminate]);
63
+ function onClickCheckBoxInput(evt) {
64
+ // If the previous "indeterminate" is true, change "checked" to false. If it is not undefined, we're working on `TableSelectAll`
65
+ if (indeterminate) {
66
+ evt.target.checked = false;
67
+ }
68
+ onClick(evt);
69
+ }
63
70
  return /*#__PURE__*/React__default["default"].createElement("div", {
64
71
  className: `${prefix}--checkbox--inline`
65
72
  }, /*#__PURE__*/React__default["default"].createElement("input", inputProps),
@@ -0,0 +1,75 @@
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, { ReactNode } from 'react';
9
+ import { ButtonKinds } from '../Button';
10
+ interface ModalWrapperProps {
11
+ buttonTriggerClassName?: string;
12
+ buttonTriggerText?: ReactNode;
13
+ children?: ReactNode;
14
+ disabled?: boolean;
15
+ handleOpen?: React.MouseEventHandler<HTMLButtonElement>;
16
+ handleSubmit?: React.ReactEventHandler<HTMLElement>;
17
+ id?: string;
18
+ modalBeforeContent?: boolean;
19
+ modalHeading?: string;
20
+ modalLabel?: string;
21
+ modalText?: string;
22
+ onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
23
+ passiveModal?: boolean;
24
+ preventCloseOnClickOutside?: boolean;
25
+ primaryButtonText?: string;
26
+ renderTriggerButtonIcon: React.ElementType;
27
+ secondaryButtonText?: string;
28
+ selectorPrimaryFocus?: string;
29
+ shouldCloseAfterSubmit?: boolean;
30
+ status?: string;
31
+ triggerButtonIconDescription?: string;
32
+ triggerButtonKind: (typeof ButtonKinds)[number];
33
+ withHeader?: boolean;
34
+ }
35
+ interface ModelWrapperState {
36
+ isOpen: boolean;
37
+ }
38
+ export default class ModalWrapper extends React.Component<ModalWrapperProps, ModelWrapperState> {
39
+ if(__DEV__: any): void;
40
+ static propTypes: {
41
+ buttonTriggerClassName: PropTypes.Requireable<string>;
42
+ buttonTriggerText: PropTypes.Requireable<PropTypes.ReactNodeLike>;
43
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
44
+ disabled: PropTypes.Requireable<boolean>;
45
+ handleOpen: PropTypes.Requireable<(...args: any[]) => any>;
46
+ handleSubmit: PropTypes.Requireable<(...args: any[]) => any>;
47
+ id: PropTypes.Requireable<string>;
48
+ modalBeforeContent: PropTypes.Requireable<boolean>;
49
+ modalHeading: PropTypes.Requireable<string>;
50
+ modalLabel: PropTypes.Requireable<string>;
51
+ modalText: PropTypes.Requireable<string>;
52
+ onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
53
+ passiveModal: PropTypes.Requireable<boolean>;
54
+ preventCloseOnClickOutside: PropTypes.Requireable<boolean>;
55
+ primaryButtonText: PropTypes.Requireable<string>;
56
+ renderTriggerButtonIcon: PropTypes.Requireable<object>;
57
+ secondaryButtonText: PropTypes.Requireable<string>;
58
+ selectorPrimaryFocus: PropTypes.Requireable<string>;
59
+ shouldCloseAfterSubmit: PropTypes.Requireable<boolean>;
60
+ status: PropTypes.Requireable<string>;
61
+ triggerButtonIconDescription: PropTypes.Requireable<string>;
62
+ triggerButtonKind: PropTypes.Requireable<"primary" | "secondary" | "ghost" | "tertiary" | "danger" | "danger--primary" | "danger--ghost" | "danger--tertiary">;
63
+ withHeader: PropTypes.Requireable<boolean>;
64
+ };
65
+ triggerButton: React.RefObject<HTMLButtonElement>;
66
+ modal: React.RefObject<HTMLDivElement>;
67
+ state: {
68
+ isOpen: boolean;
69
+ };
70
+ handleOpen: () => void;
71
+ handleClose: (evt: React.KeyboardEvent<HTMLDivElement>) => void;
72
+ handleOnRequestSubmit: (evt: React.KeyboardEvent<HTMLDivElement>) => void;
73
+ render(): JSX.Element;
74
+ }
75
+ export {};