@carbon/react 1.31.3 → 1.32.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 (182) hide show
  1. package/README.md +1 -1
  2. package/es/components/Accordion/Accordion.Skeleton.d.ts +64 -0
  3. package/es/components/Accordion/Accordion.Skeleton.js +3 -3
  4. package/es/components/Accordion/Accordion.d.ts +65 -0
  5. package/es/components/Accordion/Accordion.js +5 -6
  6. package/es/components/Accordion/AccordionItem.d.ts +105 -0
  7. package/es/components/Accordion/AccordionItem.js +12 -9
  8. package/es/components/Accordion/AccordionProvider.d.ts +20 -0
  9. package/es/components/Accordion/AccordionProvider.js +25 -0
  10. package/es/components/Accordion/index.d.ts +11 -0
  11. package/es/components/Button/Button.Skeleton.d.ts +28 -0
  12. package/es/components/Button/Button.Skeleton.js +5 -3
  13. package/es/components/Button/Button.d.ts +72 -0
  14. package/es/components/Button/Button.js +13 -10
  15. package/es/components/Button/index.d.ts +11 -0
  16. package/es/components/Button/index.js +2 -1
  17. package/es/components/ButtonSet/ButtonSet.d.ts +17 -0
  18. package/es/components/ButtonSet/ButtonSet.js +1 -2
  19. package/es/components/ButtonSet/index.d.ts +9 -0
  20. package/es/components/CodeSnippet/CodeSnippet.js +1 -0
  21. package/es/components/ComboButton/index.js +1 -0
  22. package/es/components/ComposedModal/ComposedModal.d.ts +70 -0
  23. package/es/components/ComposedModal/ComposedModal.js +58 -67
  24. package/es/components/ComposedModal/ModalFooter.d.ts +71 -0
  25. package/es/components/ComposedModal/ModalFooter.js +22 -19
  26. package/es/components/ComposedModal/ModalHeader.d.ts +58 -0
  27. package/es/components/ComposedModal/ModalHeader.js +8 -25
  28. package/es/components/ComposedModal/index.d.ts +9 -0
  29. package/es/components/ContainedList/ContainedList.js +12 -1
  30. package/es/components/ContentSwitcher/ContentSwitcher.d.ts +109 -0
  31. package/es/components/ContentSwitcher/ContentSwitcher.js +14 -6
  32. package/es/components/DangerButton/DangerButton.d.ts +9 -0
  33. package/es/components/DangerButton/DangerButton.js +2 -2
  34. package/es/components/DangerButton/index.d.ts +9 -0
  35. package/es/components/DataTable/TableBatchAction.js +1 -0
  36. package/es/components/DataTable/TableBatchActions.js +1 -0
  37. package/es/components/DataTable/TableBody.d.ts +29 -0
  38. package/es/components/DataTable/TableBody.js +2 -3
  39. package/es/components/DataTable/TableContainer.d.ts +51 -0
  40. package/es/components/DataTable/TableContainer.js +3 -4
  41. package/es/components/DataTable/TableExpandHeader.d.ts +86 -0
  42. package/es/components/DataTable/TableExpandHeader.js +4 -5
  43. package/es/components/DatePicker/plugins/fixEventsPlugin.js +12 -16
  44. package/es/components/Dropdown/Dropdown.js +1 -0
  45. package/es/components/FluidTextInput/FluidTextInput.js +1 -0
  46. package/es/components/FormGroup/FormGroup.d.ts +80 -0
  47. package/es/components/IconButton/index.js +3 -2
  48. package/es/components/Layout/index.d.ts +74 -0
  49. package/es/components/Layout/index.js +14 -5
  50. package/es/components/Link/Link.d.ts +2 -2
  51. package/es/components/Link/Link.js +2 -1
  52. package/es/components/MenuButton/index.js +1 -0
  53. package/es/components/Modal/Modal.js +1 -0
  54. package/es/components/ModalWrapper/ModalWrapper.js +1 -0
  55. package/es/components/Notification/Notification.d.ts +531 -0
  56. package/es/components/Notification/Notification.js +40 -6
  57. package/es/components/Notification/index.d.ts +7 -0
  58. package/es/components/PrimaryButton/PrimaryButton.js +1 -0
  59. package/es/components/SecondaryButton/SecondaryButton.js +1 -0
  60. package/es/components/Select/Select.d.ts +1 -1
  61. package/es/components/SkeletonText/SkeletonText.d.ts +61 -0
  62. package/es/components/SkeletonText/SkeletonText.js +15 -17
  63. package/es/components/SkeletonText/index.d.ts +9 -0
  64. package/es/components/Switch/Switch.d.ts +56 -0
  65. package/es/components/Switch/Switch.js +4 -4
  66. package/es/components/Tab/index.d.ts +9 -0
  67. package/es/components/TabContent/TabContent.d.ts +40 -0
  68. package/es/components/TabContent/TabContent.js +6 -12
  69. package/es/components/TabContent/index.d.ts +10 -0
  70. package/es/components/Tabs/Tabs.Skeleton.d.ts +33 -0
  71. package/es/components/Tabs/Tabs.Skeleton.js +2 -2
  72. package/es/components/Tabs/Tabs.d.ts +303 -0
  73. package/es/components/Tabs/Tabs.js +136 -95
  74. package/es/components/Tabs/index.d.ts +10 -0
  75. package/es/components/Tabs/usePressable.js +11 -0
  76. package/es/components/TextInput/ControlledPasswordInput.d.ts +90 -0
  77. package/es/components/TextInput/ControlledPasswordInput.js +5 -6
  78. package/es/components/Tile/Tile.d.ts +153 -0
  79. package/es/components/Tile/Tile.js +62 -74
  80. package/es/components/Tile/index.d.ts +7 -0
  81. package/es/components/Toggle/Toggle.Skeleton.d.ts +3 -47
  82. package/es/components/Toggle/Toggle.Skeleton.js +24 -64
  83. package/es/components/Toggle/Toggle.js +1 -1
  84. package/es/components/UIShell/HeaderGlobalAction.js +1 -0
  85. package/es/components/UIShell/SideNav.d.ts +1 -1
  86. package/es/index.js +16 -16
  87. package/es/internal/keyboard/match.js +2 -2
  88. package/es/internal/useControllableState.js +2 -2
  89. package/es/internal/wrapFocus.js +6 -6
  90. package/es/prop-types/requiredIfGivenPropIsTruthy.js +1 -1
  91. package/es/prop-types/types.js +3 -0
  92. package/lib/components/Accordion/Accordion.Skeleton.d.ts +64 -0
  93. package/lib/components/Accordion/Accordion.Skeleton.js +3 -3
  94. package/lib/components/Accordion/Accordion.d.ts +65 -0
  95. package/lib/components/Accordion/Accordion.js +5 -6
  96. package/lib/components/Accordion/AccordionItem.d.ts +105 -0
  97. package/lib/components/Accordion/AccordionItem.js +11 -8
  98. package/lib/components/Accordion/AccordionProvider.d.ts +20 -0
  99. package/lib/components/Accordion/AccordionProvider.js +34 -0
  100. package/lib/components/Accordion/index.d.ts +11 -0
  101. package/lib/components/Button/Button.Skeleton.d.ts +28 -0
  102. package/lib/components/Button/Button.Skeleton.js +5 -3
  103. package/lib/components/Button/Button.d.ts +72 -0
  104. package/lib/components/Button/Button.js +18 -11
  105. package/lib/components/Button/index.d.ts +11 -0
  106. package/lib/components/Button/index.js +6 -0
  107. package/lib/components/ButtonSet/ButtonSet.d.ts +17 -0
  108. package/lib/components/ButtonSet/ButtonSet.js +1 -2
  109. package/lib/components/ButtonSet/index.d.ts +9 -0
  110. package/lib/components/CodeSnippet/CodeSnippet.js +1 -0
  111. package/lib/components/ComboButton/index.js +1 -0
  112. package/lib/components/ComposedModal/ComposedModal.d.ts +70 -0
  113. package/lib/components/ComposedModal/ComposedModal.js +58 -67
  114. package/lib/components/ComposedModal/ModalFooter.d.ts +71 -0
  115. package/lib/components/ComposedModal/ModalFooter.js +22 -19
  116. package/lib/components/ComposedModal/ModalHeader.d.ts +58 -0
  117. package/lib/components/ComposedModal/ModalHeader.js +8 -25
  118. package/lib/components/ComposedModal/index.d.ts +9 -0
  119. package/lib/components/ContainedList/ContainedList.js +12 -1
  120. package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +109 -0
  121. package/lib/components/ContentSwitcher/ContentSwitcher.js +14 -6
  122. package/lib/components/DangerButton/DangerButton.d.ts +9 -0
  123. package/lib/components/DangerButton/DangerButton.js +2 -2
  124. package/lib/components/DangerButton/index.d.ts +9 -0
  125. package/lib/components/DataTable/TableBatchAction.js +1 -0
  126. package/lib/components/DataTable/TableBatchActions.js +1 -0
  127. package/lib/components/DataTable/TableBody.d.ts +29 -0
  128. package/lib/components/DataTable/TableBody.js +3 -4
  129. package/lib/components/DataTable/TableContainer.d.ts +51 -0
  130. package/lib/components/DataTable/TableContainer.js +3 -4
  131. package/lib/components/DataTable/TableExpandHeader.d.ts +86 -0
  132. package/lib/components/DataTable/TableExpandHeader.js +4 -5
  133. package/lib/components/DatePicker/plugins/fixEventsPlugin.js +12 -16
  134. package/lib/components/Dropdown/Dropdown.js +1 -0
  135. package/lib/components/FluidTextInput/FluidTextInput.js +1 -0
  136. package/lib/components/FormGroup/FormGroup.d.ts +80 -0
  137. package/lib/components/IconButton/index.js +3 -2
  138. package/lib/components/Layout/index.d.ts +74 -0
  139. package/lib/components/Layout/index.js +14 -5
  140. package/lib/components/Link/Link.d.ts +2 -2
  141. package/lib/components/Link/Link.js +2 -1
  142. package/lib/components/MenuButton/index.js +1 -0
  143. package/lib/components/Modal/Modal.js +1 -0
  144. package/lib/components/ModalWrapper/ModalWrapper.js +1 -0
  145. package/lib/components/Notification/Notification.d.ts +531 -0
  146. package/lib/components/Notification/Notification.js +40 -6
  147. package/lib/components/Notification/index.d.ts +7 -0
  148. package/lib/components/PrimaryButton/PrimaryButton.js +1 -0
  149. package/lib/components/SecondaryButton/SecondaryButton.js +1 -0
  150. package/lib/components/Select/Select.d.ts +1 -1
  151. package/lib/components/SkeletonText/SkeletonText.d.ts +61 -0
  152. package/lib/components/SkeletonText/SkeletonText.js +15 -17
  153. package/lib/components/SkeletonText/index.d.ts +9 -0
  154. package/lib/components/Switch/Switch.d.ts +56 -0
  155. package/lib/components/Switch/Switch.js +4 -4
  156. package/lib/components/Tab/index.d.ts +9 -0
  157. package/lib/components/TabContent/TabContent.d.ts +40 -0
  158. package/lib/components/TabContent/TabContent.js +6 -12
  159. package/lib/components/TabContent/index.d.ts +10 -0
  160. package/lib/components/Tabs/Tabs.Skeleton.d.ts +33 -0
  161. package/lib/components/Tabs/Tabs.Skeleton.js +2 -2
  162. package/lib/components/Tabs/Tabs.d.ts +303 -0
  163. package/lib/components/Tabs/Tabs.js +135 -94
  164. package/lib/components/Tabs/index.d.ts +10 -0
  165. package/lib/components/Tabs/usePressable.js +11 -0
  166. package/lib/components/TextInput/ControlledPasswordInput.d.ts +90 -0
  167. package/lib/components/TextInput/ControlledPasswordInput.js +5 -6
  168. package/lib/components/Tile/Tile.d.ts +153 -0
  169. package/lib/components/Tile/Tile.js +62 -74
  170. package/lib/components/Tile/index.d.ts +7 -0
  171. package/lib/components/Toggle/Toggle.Skeleton.d.ts +3 -47
  172. package/lib/components/Toggle/Toggle.Skeleton.js +22 -62
  173. package/lib/components/Toggle/Toggle.js +1 -1
  174. package/lib/components/UIShell/HeaderGlobalAction.js +1 -0
  175. package/lib/components/UIShell/SideNav.d.ts +1 -1
  176. package/lib/index.js +51 -47
  177. package/lib/internal/keyboard/match.js +2 -2
  178. package/lib/internal/useControllableState.js +2 -2
  179. package/lib/internal/wrapFocus.js +6 -6
  180. package/lib/prop-types/requiredIfGivenPropIsTruthy.js +1 -1
  181. package/lib/prop-types/types.js +3 -0
  182. package/package.json +4 -3
@@ -0,0 +1,109 @@
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, { HTMLAttributes, ReactElement } from 'react';
9
+ interface SwitchEventHandlersParams {
10
+ index?: number;
11
+ name?: string | number;
12
+ text?: string;
13
+ key?: string | number;
14
+ }
15
+ export interface ContentSwitcherProps extends Omit<HTMLAttributes<HTMLElement>, 'onChange'> {
16
+ /**
17
+ * Pass in Switch components to be rendered in the ContentSwitcher
18
+ */
19
+ children?: ReactElement[];
20
+ /**
21
+ * Specify an optional className to be added to the container node
22
+ */
23
+ className?: string;
24
+ /**
25
+ * `true` to use the light version.
26
+ *
27
+ * @deprecated The `light` prop for `ContentSwitcher` has
28
+ * been deprecated in favor of the new `Layer` component. It will be removed in the next major release.
29
+ */
30
+ light?: boolean;
31
+ /**
32
+ * Specify an `onChange` handler that is called whenever the ContentSwitcher
33
+ * changes which item is selected
34
+ */
35
+ onChange: (params: SwitchEventHandlersParams) => void;
36
+ /**
37
+ * Specify a selected index for the initially selected content
38
+ */
39
+ selectedIndex: number;
40
+ /**
41
+ * Choose whether or not to automatically change selection on focus
42
+ */
43
+ selectionMode: 'automatic' | 'manual';
44
+ /**
45
+ * Specify the size of the Content Switcher. Currently supports either `sm`, 'md' (default) or 'lg` as an option.
46
+ */
47
+ size: 'sm' | 'md' | 'lg';
48
+ }
49
+ interface ContentSwitcherState {
50
+ selectedIndex?: number;
51
+ }
52
+ export default class ContentSwitcher extends React.Component<ContentSwitcherProps, ContentSwitcherState> {
53
+ /**
54
+ * The DOM references of child `<Switch>`.
55
+ * @type {Array<Element>}
56
+ * @private
57
+ */
58
+ _switchRefs: HTMLButtonElement[];
59
+ state: {
60
+ selectedIndex: undefined;
61
+ };
62
+ static propTypes: {
63
+ /**
64
+ * Pass in Switch components to be rendered in the ContentSwitcher
65
+ */
66
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
67
+ /**
68
+ * Specify an optional className to be added to the container node
69
+ */
70
+ className: PropTypes.Requireable<string>;
71
+ /**
72
+ * `true` to use the light variant.
73
+ */
74
+ light: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
75
+ /**
76
+ * Specify an `onChange` handler that is called whenever the ContentSwitcher
77
+ * changes which item is selected
78
+ */
79
+ onChange: PropTypes.Validator<(...args: any[]) => any>;
80
+ /**
81
+ * Specify a selected index for the initially selected content
82
+ */
83
+ selectedIndex: PropTypes.Requireable<number>;
84
+ /**
85
+ * Choose whether or not to automatically change selection on focus
86
+ */
87
+ selectionMode: PropTypes.Requireable<string>;
88
+ /**
89
+ * Specify the size of the Content Switcher. Currently supports either `sm`, 'md' (default) or 'lg` as an option.
90
+ */
91
+ size: PropTypes.Requireable<string>;
92
+ };
93
+ static contextType: React.Context<string>;
94
+ static defaultProps: {
95
+ selectedIndex: number;
96
+ selectionMode: string;
97
+ onChange: () => void;
98
+ };
99
+ static getDerivedStateFromProps({ selectedIndex }: {
100
+ selectedIndex: any;
101
+ }, state: any): {
102
+ selectedIndex: any;
103
+ prevSelectedIndex: any;
104
+ } | null;
105
+ handleItemRef: (index: any) => (ref: any) => void;
106
+ handleChildChange: (data: any) => void;
107
+ render(): JSX.Element;
108
+ }
109
+ export {};
@@ -21,7 +21,9 @@ class ContentSwitcher extends React__default.Component {
21
21
  constructor() {
22
22
  super(...arguments);
23
23
  _defineProperty(this, "_switchRefs", []);
24
- _defineProperty(this, "state", {});
24
+ _defineProperty(this, "state", {
25
+ selectedIndex: undefined
26
+ });
25
27
  _defineProperty(this, "handleItemRef", index => ref => {
26
28
  this._switchRefs[index] = ref;
27
29
  });
@@ -41,7 +43,7 @@ class ContentSwitcher extends React__default.Component {
41
43
  key
42
44
  } = data;
43
45
  if (matches(data, [ArrowRight, ArrowLeft])) {
44
- const nextIndex = getNextIndex(key, index, this.props.children.length);
46
+ const nextIndex = getNextIndex(key, index, this.props.children?.length);
45
47
  const children = React__default.Children.toArray(this.props.children);
46
48
  if (selectionMode === 'manual') {
47
49
  const switchRef = this._switchRefs[nextIndex];
@@ -50,6 +52,9 @@ class ContentSwitcher extends React__default.Component {
50
52
  this.setState({
51
53
  selectedIndex: nextIndex
52
54
  }, () => {
55
+ if (typeof this.state.selectedIndex !== 'number') {
56
+ return;
57
+ }
53
58
  const child = children[this.state.selectedIndex];
54
59
  const switchRef = this._switchRefs[this.state.selectedIndex];
55
60
  switchRef && switchRef.focus();
@@ -95,16 +100,18 @@ class ContentSwitcher extends React__default.Component {
95
100
  children,
96
101
  className,
97
102
  light,
103
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
98
104
  selectedIndex,
99
105
  // eslint-disable-line no-unused-vars
106
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
100
107
  selectionMode,
101
108
  // eslint-disable-line no-unused-vars
102
109
  size,
103
110
  ...other
104
111
  } = this.props;
105
- const isIconOnly = React__default.Children.map(children, child => {
112
+ const isIconOnly = React__default.Children?.map(children, child => {
106
113
  return child.type.displayName === 'IconSwitch';
107
- }).every(val => val === true);
114
+ })?.every(val => val === true);
108
115
  const classes = cx(`${prefix}--content-switcher`, className, {
109
116
  [`${prefix}--content-switcher--light`]: light,
110
117
  [`${prefix}--content-switcher--${size}`]: size,
@@ -120,8 +127,9 @@ class ContentSwitcher extends React__default.Component {
120
127
  }
121
128
  }, other, {
122
129
  className: classes,
123
- role: "tablist"
124
- }), React__default.Children.map(children, (child, index) => /*#__PURE__*/React__default.cloneElement(child, {
130
+ role: "tablist",
131
+ onChange: undefined
132
+ }), children && React__default.Children.map(children, (child, index) => /*#__PURE__*/React__default.cloneElement(child, {
125
133
  index,
126
134
  onClick: composeEventHandlers([this.handleChildChange, child.props.onClick]),
127
135
  onKeyDown: this.handleChildChange,
@@ -0,0 +1,9 @@
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 { ButtonComponent } from '../Button';
8
+ declare const DangerButton: ButtonComponent;
9
+ export default DangerButton;
@@ -8,10 +8,10 @@
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import React__default from 'react';
10
10
  import Button from '../Button/Button.js';
11
+ import '../Button/Button.Skeleton.js';
11
12
 
12
13
  const DangerButton = props => /*#__PURE__*/React__default.createElement(Button, _extends({
13
14
  kind: "danger"
14
15
  }, props));
15
- var DangerButton$1 = DangerButton;
16
16
 
17
- export { DangerButton$1 as default };
17
+ export { DangerButton as default };
@@ -0,0 +1,9 @@
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 DangerButton from './DangerButton';
8
+ export default DangerButton;
9
+ export { DangerButton };
@@ -9,6 +9,7 @@ import PropTypes from 'prop-types';
9
9
  import React__default from 'react';
10
10
  import { AddFilled } from '@carbon/icons-react';
11
11
  import Button from '../Button/Button.js';
12
+ import '../Button/Button.Skeleton.js';
12
13
 
13
14
  const TableBatchAction = props => /*#__PURE__*/React__default.createElement(Button, props);
14
15
  TableBatchAction.propTypes = {
@@ -10,6 +10,7 @@ import cx from 'classnames';
10
10
  import PropTypes from 'prop-types';
11
11
  import React__default from 'react';
12
12
  import Button from '../Button/Button.js';
13
+ import '../Button/Button.Skeleton.js';
13
14
  import TableActionList from './TableActionList.js';
14
15
  import '../Text/index.js';
15
16
  import { usePrefix } from '../../internal/usePrefix.js';
@@ -0,0 +1,29 @@
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 { ReactAttr } from '../../types/common';
9
+ export interface TableBodyProps extends ReactAttr<HTMLTableSectionElement> {
10
+ /**
11
+ * `polite` Adjust the notification behavior of screen readers
12
+ */
13
+ 'aria-live'?: 'polite' | 'assertive' | 'off';
14
+ }
15
+ declare const TableBody: {
16
+ ({ children, className, ...rest }: TableBodyProps): JSX.Element;
17
+ propTypes: {
18
+ /**
19
+ * `polite` Adjust the notification behavior of screen readers
20
+ */
21
+ 'aria-live': PropTypes.Requireable<string>;
22
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
23
+ className: PropTypes.Requireable<string>;
24
+ };
25
+ defaultProps: {
26
+ 'aria-live': string;
27
+ };
28
+ };
29
+ export default TableBody;
@@ -6,8 +6,8 @@
6
6
  */
7
7
 
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
- import React__default from 'react';
10
9
  import PropTypes from 'prop-types';
10
+ import React__default from 'react';
11
11
 
12
12
  const TableBody = _ref => {
13
13
  let {
@@ -30,6 +30,5 @@ TableBody.propTypes = {
30
30
  TableBody.defaultProps = {
31
31
  'aria-live': 'polite'
32
32
  };
33
- var TableBody$1 = TableBody;
34
33
 
35
- export { TableBody$1 as default };
34
+ export { TableBody as default };
@@ -0,0 +1,51 @@
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
+ import { ReactAttr } from '../../types/common';
10
+ export interface TableContainerProps extends Omit<ReactAttr<HTMLDivElement>, 'title'> {
11
+ /**
12
+ * Optional description text for the Table
13
+ */
14
+ description?: React.ReactNode;
15
+ /**
16
+ * Specify whether the table should have a sticky header
17
+ */
18
+ stickyHeader?: boolean;
19
+ /**
20
+ * If true, will use a width of 'fit-content' to match the inner table width
21
+ */
22
+ useStaticWidth?: boolean;
23
+ /**
24
+ * Provide a title for the Table
25
+ */
26
+ title?: React.ReactNode;
27
+ }
28
+ declare const TableContainer: {
29
+ ({ className, children, title, description, stickyHeader, useStaticWidth, ...rest }: TableContainerProps): JSX.Element;
30
+ propTypes: {
31
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
32
+ className: PropTypes.Requireable<string>;
33
+ /**
34
+ * Optional description text for the Table
35
+ */
36
+ description: PropTypes.Requireable<PropTypes.ReactNodeLike>;
37
+ /**
38
+ * Specify whether the table should have a sticky header
39
+ */
40
+ stickyHeader: PropTypes.Requireable<boolean>;
41
+ /**
42
+ * Provide a title for the Table
43
+ */
44
+ title: PropTypes.Requireable<PropTypes.ReactNodeLike>;
45
+ /**
46
+ * If true, will use a width of 'fit-content' to match the inner table width
47
+ */
48
+ useStaticWidth: PropTypes.Requireable<boolean>;
49
+ };
50
+ };
51
+ export default TableContainer;
@@ -33,8 +33,8 @@ const TableContainer = _ref => {
33
33
  });
34
34
  const value = useMemo(() => {
35
35
  return {
36
- titleId: title ? titleId : null,
37
- descriptionId: description ? descriptionId : null
36
+ titleId: title ? titleId : undefined,
37
+ descriptionId: description ? descriptionId : undefined
38
38
  };
39
39
  }, [title, description, titleId, descriptionId]);
40
40
  return /*#__PURE__*/React__default.createElement(TableContext.Provider, {
@@ -71,6 +71,5 @@ TableContainer.propTypes = {
71
71
  */
72
72
  useStaticWidth: PropTypes.bool
73
73
  };
74
- var TableContainer$1 = TableContainer;
75
74
 
76
- export { TableContainer$1 as default };
75
+ export { TableContainer as default };
@@ -0,0 +1,86 @@
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
+ import { ReactAttr } from '../../types/common';
10
+ type TableExpandHeaderPropsBase = {
11
+ /**
12
+ * Specify the string read by a voice reader when the expand trigger is
13
+ * focused
14
+ */
15
+ ariaLabel?: string;
16
+ /**
17
+ * @deprecated The enableExpando prop is being replaced by `enableToggle`
18
+ */
19
+ enableExpando?: false | undefined;
20
+ /**
21
+ * Specify whether an expand all button should be displayed
22
+ */
23
+ enableToggle?: false | undefined;
24
+ /**
25
+ * The description of the chevron right icon, to be put in its SVG `<title>` element.
26
+ */
27
+ expandIconDescription?: string;
28
+ /**
29
+ * Specify whether this row is expanded or not. This helps coordinate data
30
+ * attributes so that `TableExpandRow` and `TableExpandedRow` work together
31
+ */
32
+ isExpanded?: boolean;
33
+ /**
34
+ * Hook for when a listener initiates a request to expand the given row
35
+ */
36
+ onExpand?(event: React.MouseEvent<HTMLButtonElement>): void;
37
+ } & ReactAttr<HTMLTableCellElement>;
38
+ type TableExpandHeaderPropsWithToggle = Omit<TableExpandHeaderPropsBase, 'ariaLabel' | 'enableToggle' | 'onExpand'> & {
39
+ enableToggle: true;
40
+ ariaLabel: string;
41
+ onExpand(event: React.MouseEvent<HTMLButtonElement>): void;
42
+ };
43
+ type TableExpandHeaderPropsWithExpando = Omit<TableExpandHeaderPropsBase, 'ariaLabel' | 'enableExpando' | 'onExpand'> & {
44
+ enableExpando: true;
45
+ ariaLabel: string;
46
+ onExpand(event: React.MouseEvent<HTMLButtonElement>): void;
47
+ };
48
+ export type TableExpandHeaderProps = TableExpandHeaderPropsWithToggle | TableExpandHeaderPropsWithExpando | TableExpandHeaderPropsBase;
49
+ declare const TableExpandHeader: {
50
+ ({ ariaLabel, className: headerClassName, enableExpando, enableToggle, id, isExpanded, onExpand, expandIconDescription, children, ...rest }: TableExpandHeaderProps): JSX.Element;
51
+ propTypes: {
52
+ /**
53
+ * Specify the string read by a voice reader when the expand trigger is
54
+ * focused
55
+ */
56
+ ariaLabel: PropTypes.Requireable<any>;
57
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
58
+ className: PropTypes.Requireable<string>;
59
+ /**
60
+ * The enableExpando prop is being replaced by enableToggle
61
+ */
62
+ enableExpando: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
63
+ /**
64
+ * Specify whether an expand all button should be displayed
65
+ */
66
+ enableToggle: PropTypes.Requireable<boolean>;
67
+ /**
68
+ * The description of the chevron right icon, to be put in its SVG `<title>` element.
69
+ */
70
+ expandIconDescription: PropTypes.Requireable<string>;
71
+ /**
72
+ * Supply an id to the th element.
73
+ */
74
+ id: PropTypes.Requireable<string>;
75
+ /**
76
+ * Specify whether this row is expanded or not. This helps coordinate data
77
+ * attributes so that `TableExpandRow` and `TableExpandedRow` work together
78
+ */
79
+ isExpanded: Function;
80
+ /**
81
+ * Hook for when a listener initiates a request to expand the given row
82
+ */
83
+ onExpand: PropTypes.Requireable<any>;
84
+ };
85
+ };
86
+ export default TableExpandHeader;
@@ -6,13 +6,13 @@
6
6
  */
7
7
 
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import { ChevronRight } from '@carbon/icons-react';
9
10
  import cx from 'classnames';
10
11
  import PropTypes from 'prop-types';
11
- import requiredIfGivenPropIsTruthy from '../../prop-types/requiredIfGivenPropIsTruthy.js';
12
- import deprecate from '../../prop-types/deprecate.js';
13
12
  import React__default from 'react';
14
- import { ChevronRight } from '@carbon/icons-react';
15
13
  import { usePrefix } from '../../internal/usePrefix.js';
14
+ import deprecate from '../../prop-types/deprecate.js';
15
+ import requiredIfGivenPropIsTruthy from '../../prop-types/requiredIfGivenPropIsTruthy.js';
16
16
 
17
17
  const TableExpandHeader = _ref => {
18
18
  let {
@@ -80,6 +80,5 @@ TableExpandHeader.propTypes = {
80
80
  */
81
81
  onExpand: PropTypes.oneOfType([requiredIfGivenPropIsTruthy('enableExpando', PropTypes.func), requiredIfGivenPropIsTruthy('enableToggle', PropTypes.func)])
82
82
  };
83
- var TableExpandHeader$1 = TableExpandHeader;
84
83
 
85
- export { TableExpandHeader$1 as default };
84
+ export { TableExpandHeader as default };
@@ -13,14 +13,15 @@ import { Enter, ArrowLeft, ArrowRight, ArrowDown } from '../../../internal/keybo
13
13
  * @returns {Plugin} A Flatpickr plugin to fix Flatpickr's behavior of certain events.
14
14
  */
15
15
  var carbonFlatpickrFixEventsPlugin = (config => fp => {
16
+ const {
17
+ inputFrom,
18
+ inputTo,
19
+ lastStartValue
20
+ } = config;
16
21
  /**
17
22
  * Handles `keydown` event.
18
23
  */
19
24
  const handleKeydown = event => {
20
- const {
21
- inputFrom,
22
- inputTo
23
- } = config;
24
25
  const {
25
26
  target
26
27
  } = event;
@@ -41,6 +42,7 @@ var carbonFlatpickrFixEventsPlugin = (config => fp => {
41
42
  }
42
43
  }
43
44
  };
45
+ const parseDateWithFormat = dateStr => fp.parseDate(dateStr, fp.config.dateFormat);
44
46
 
45
47
  /**
46
48
  * Handles `blur` event.
@@ -50,11 +52,6 @@ var carbonFlatpickrFixEventsPlugin = (config => fp => {
50
52
  * set the date again, triggering the calendar to update.
51
53
  */
52
54
  const handleBlur = event => {
53
- const {
54
- inputFrom,
55
- inputTo,
56
- lastStartValue
57
- } = config;
58
55
  const {
59
56
  target
60
57
  } = event;
@@ -64,8 +61,9 @@ var carbonFlatpickrFixEventsPlugin = (config => fp => {
64
61
  if (inputTo === target && fp.selectedDates[1]) {
65
62
  // Using getTime() enables the ability to more readily compare the date currently
66
63
  // selected in the calendar and the date currently in the value of the input
67
- const selectedToDate = new Date(fp.selectedDates[1]).setHours(0, 0, 0, 0);
68
- const currentValueToDate = new Date(inputTo.value).setHours(0, 0, 0, 0);
64
+ const withoutTime = date => date.setHours(0, 0, 0, 0);
65
+ const selectedToDate = withoutTime(new Date(fp.selectedDates[1]));
66
+ const currentValueToDate = withoutTime(parseDateWithFormat(inputTo.value));
69
67
 
70
68
  // The date should only be set if both dates are valid dates, and they don't match.
71
69
  // When they don't match, this indiciates that the date selected in the calendar is stale,
@@ -75,19 +73,17 @@ var carbonFlatpickrFixEventsPlugin = (config => fp => {
75
73
  fp.setDate([inputFrom.value, inputTo && inputTo.value], true, fp.config.dateFormat);
76
74
  }
77
75
  }
78
-
76
+ const isValidDate = date => date.toString() !== 'Invalid Date';
79
77
  // save end date in calendar inmediately after it's been written down
80
78
  if (inputTo === target && fp.selectedDates.length === 1 && inputTo.value) {
81
- let currentEndDate = new Date(inputTo.value);
82
- if (currentEndDate.toString() !== 'Invalid Date') {
79
+ if (isValidDate(parseDateWithFormat(inputTo.value))) {
83
80
  fp.setDate([inputFrom.value, inputTo.value], true, fp.config.dateFormat);
84
81
  }
85
82
  }
86
83
 
87
84
  // overriding the flatpickr bug where the startDate gets deleted on blur
88
85
  if (inputTo === target && !inputFrom.value && lastStartValue.current) {
89
- let currentStartDate = new Date(lastStartValue.current);
90
- if (currentStartDate.toString() !== 'Invalid Date') {
86
+ if (isValidDate(parseDateWithFormat(lastStartValue.current))) {
91
87
  inputFrom.value = lastStartValue.current;
92
88
  if (inputTo.value) {
93
89
  fp.setDate([inputFrom.value, inputTo.value], true, fp.config.dateFormat);
@@ -217,6 +217,7 @@ const Dropdown = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
217
217
  ,
218
218
  role: "combobox" // eslint-disable-line jsx-a11y/role-has-required-aria-props
219
219
  ,
220
+ "aria-owns": getMenuProps().id,
220
221
  "aria-controls": getMenuProps().id,
221
222
  className: `${prefix}--list-box__field`,
222
223
  disabled: disabled,
@@ -10,6 +10,7 @@ import PropTypes from 'prop-types';
10
10
  import React__default from 'react';
11
11
  import cx from 'classnames';
12
12
  import '../TextInput/index.js';
13
+ import '../TextInput/ControlledPasswordInput.js';
13
14
  import PasswordInput from '../TextInput/PasswordInput.js';
14
15
  import { usePrefix } from '../../internal/usePrefix.js';
15
16
  import { FormContext } from '../FluidForm/FormContext.js';
@@ -0,0 +1,80 @@
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
+ import { ReactAttr } from '../../types/common';
10
+ export interface FormGroupProps extends ReactAttr<HTMLFieldSetElement> {
11
+ /**
12
+ * Provide the children form elements to be rendered inside of the <fieldset>
13
+ */
14
+ children: React.ReactNode;
15
+ /**
16
+ * Provide a custom className to be applied to the containing <fieldset> node
17
+ */
18
+ className?: string;
19
+ /**
20
+ * Specify whether the <FormGroup> is invalid
21
+ */
22
+ invalid?: boolean;
23
+ /**
24
+ * Provide id for the fieldset <legend> which corresponds to the fieldset
25
+ * `aria-labelledby`
26
+ */
27
+ legendId?: string;
28
+ /**
29
+ * Provide the text to be rendered inside of the fieldset <legend>
30
+ */
31
+ legendText: React.ReactNode;
32
+ /**
33
+ * Specify whether the message should be displayed in the <FormGroup>
34
+ */
35
+ message?: boolean;
36
+ /**
37
+ * Provide the text for the message in the <FormGroup>
38
+ */
39
+ messageText?: string;
40
+ }
41
+ declare const FormGroup: {
42
+ ({ legendId, legendText, invalid, children, className, message, messageText, ...rest }: FormGroupProps): JSX.Element;
43
+ propTypes: {
44
+ /**
45
+ * Provide the children form elements to be rendered inside of the <fieldset>
46
+ */
47
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
48
+ /**
49
+ * Provide a custom className to be applied to the containing <fieldset> node
50
+ */
51
+ className: PropTypes.Requireable<string>;
52
+ /**
53
+ * Specify whether the <FormGroup> is invalid
54
+ */
55
+ invalid: PropTypes.Requireable<boolean>;
56
+ /**
57
+ * Provide id for the fieldset <legend> which corresponds to the fieldset
58
+ * `aria-labelledby`
59
+ */
60
+ legendId: PropTypes.Requireable<PropTypes.ReactNodeLike>;
61
+ /**
62
+ * Provide the text to be rendered inside of the fieldset <legend>
63
+ */
64
+ legendText: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
65
+ /**
66
+ * Specify whether the message should be displayed in the <FormGroup>
67
+ */
68
+ message: PropTypes.Requireable<boolean>;
69
+ /**
70
+ * Provide the text for the message in the <FormGroup>
71
+ */
72
+ messageText: PropTypes.Requireable<string>;
73
+ };
74
+ defaultProps: {
75
+ invalid: boolean;
76
+ message: boolean;
77
+ messageText: string;
78
+ };
79
+ };
80
+ export default FormGroup;
@@ -9,6 +9,7 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
9
9
  import PropTypes from 'prop-types';
10
10
  import React__default from 'react';
11
11
  import Button from '../Button/Button.js';
12
+ import '../Button/Button.Skeleton.js';
12
13
  import cx from 'classnames';
13
14
  import '../Tooltip/DefinitionTooltip.js';
14
15
  import { Tooltip } from '../Tooltip/Tooltip.js';
@@ -22,10 +23,10 @@ const IconButton = /*#__PURE__*/React__default.forwardRef(function IconButton(pr
22
23
  closeOnActivation = true,
23
24
  defaultOpen = false,
24
25
  disabled,
25
- enterDelayMs,
26
+ enterDelayMs = 100,
26
27
  kind,
27
28
  label,
28
- leaveDelayMs,
29
+ leaveDelayMs = 100,
29
30
  wrapperClasses,
30
31
  size,
31
32
  ...rest