@carbon/react 1.31.3 → 1.32.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 (190) 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 +311 -0
  73. package/es/components/Tabs/Tabs.js +151 -97
  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/HeaderPanel.js +61 -5
  86. package/es/components/UIShell/SideNav.d.ts +1 -1
  87. package/es/components/UIShell/Switcher.js +45 -5
  88. package/es/components/UIShell/SwitcherItem.js +45 -6
  89. package/es/index.js +16 -16
  90. package/es/internal/keyboard/match.js +2 -2
  91. package/es/internal/useControllableState.js +2 -2
  92. package/es/internal/useMatchMedia.js +44 -0
  93. package/es/internal/wrapFocus.js +6 -6
  94. package/es/prop-types/requiredIfGivenPropIsTruthy.js +1 -1
  95. package/es/prop-types/types.js +3 -0
  96. package/lib/components/Accordion/Accordion.Skeleton.d.ts +64 -0
  97. package/lib/components/Accordion/Accordion.Skeleton.js +3 -3
  98. package/lib/components/Accordion/Accordion.d.ts +65 -0
  99. package/lib/components/Accordion/Accordion.js +5 -6
  100. package/lib/components/Accordion/AccordionItem.d.ts +105 -0
  101. package/lib/components/Accordion/AccordionItem.js +11 -8
  102. package/lib/components/Accordion/AccordionProvider.d.ts +20 -0
  103. package/lib/components/Accordion/AccordionProvider.js +34 -0
  104. package/lib/components/Accordion/index.d.ts +11 -0
  105. package/lib/components/Button/Button.Skeleton.d.ts +28 -0
  106. package/lib/components/Button/Button.Skeleton.js +5 -3
  107. package/lib/components/Button/Button.d.ts +72 -0
  108. package/lib/components/Button/Button.js +18 -11
  109. package/lib/components/Button/index.d.ts +11 -0
  110. package/lib/components/Button/index.js +6 -0
  111. package/lib/components/ButtonSet/ButtonSet.d.ts +17 -0
  112. package/lib/components/ButtonSet/ButtonSet.js +1 -2
  113. package/lib/components/ButtonSet/index.d.ts +9 -0
  114. package/lib/components/CodeSnippet/CodeSnippet.js +1 -0
  115. package/lib/components/ComboButton/index.js +1 -0
  116. package/lib/components/ComposedModal/ComposedModal.d.ts +70 -0
  117. package/lib/components/ComposedModal/ComposedModal.js +58 -67
  118. package/lib/components/ComposedModal/ModalFooter.d.ts +71 -0
  119. package/lib/components/ComposedModal/ModalFooter.js +22 -19
  120. package/lib/components/ComposedModal/ModalHeader.d.ts +58 -0
  121. package/lib/components/ComposedModal/ModalHeader.js +8 -25
  122. package/lib/components/ComposedModal/index.d.ts +9 -0
  123. package/lib/components/ContainedList/ContainedList.js +12 -1
  124. package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +109 -0
  125. package/lib/components/ContentSwitcher/ContentSwitcher.js +14 -6
  126. package/lib/components/DangerButton/DangerButton.d.ts +9 -0
  127. package/lib/components/DangerButton/DangerButton.js +2 -2
  128. package/lib/components/DangerButton/index.d.ts +9 -0
  129. package/lib/components/DataTable/TableBatchAction.js +1 -0
  130. package/lib/components/DataTable/TableBatchActions.js +1 -0
  131. package/lib/components/DataTable/TableBody.d.ts +29 -0
  132. package/lib/components/DataTable/TableBody.js +3 -4
  133. package/lib/components/DataTable/TableContainer.d.ts +51 -0
  134. package/lib/components/DataTable/TableContainer.js +3 -4
  135. package/lib/components/DataTable/TableExpandHeader.d.ts +86 -0
  136. package/lib/components/DataTable/TableExpandHeader.js +4 -5
  137. package/lib/components/DatePicker/plugins/fixEventsPlugin.js +12 -16
  138. package/lib/components/Dropdown/Dropdown.js +1 -0
  139. package/lib/components/FluidTextInput/FluidTextInput.js +1 -0
  140. package/lib/components/FormGroup/FormGroup.d.ts +80 -0
  141. package/lib/components/IconButton/index.js +3 -2
  142. package/lib/components/Layout/index.d.ts +74 -0
  143. package/lib/components/Layout/index.js +14 -5
  144. package/lib/components/Link/Link.d.ts +2 -2
  145. package/lib/components/Link/Link.js +2 -1
  146. package/lib/components/MenuButton/index.js +1 -0
  147. package/lib/components/Modal/Modal.js +1 -0
  148. package/lib/components/ModalWrapper/ModalWrapper.js +1 -0
  149. package/lib/components/Notification/Notification.d.ts +531 -0
  150. package/lib/components/Notification/Notification.js +40 -6
  151. package/lib/components/Notification/index.d.ts +7 -0
  152. package/lib/components/PrimaryButton/PrimaryButton.js +1 -0
  153. package/lib/components/SecondaryButton/SecondaryButton.js +1 -0
  154. package/lib/components/Select/Select.d.ts +1 -1
  155. package/lib/components/SkeletonText/SkeletonText.d.ts +61 -0
  156. package/lib/components/SkeletonText/SkeletonText.js +15 -17
  157. package/lib/components/SkeletonText/index.d.ts +9 -0
  158. package/lib/components/Switch/Switch.d.ts +56 -0
  159. package/lib/components/Switch/Switch.js +4 -4
  160. package/lib/components/Tab/index.d.ts +9 -0
  161. package/lib/components/TabContent/TabContent.d.ts +40 -0
  162. package/lib/components/TabContent/TabContent.js +6 -12
  163. package/lib/components/TabContent/index.d.ts +10 -0
  164. package/lib/components/Tabs/Tabs.Skeleton.d.ts +33 -0
  165. package/lib/components/Tabs/Tabs.Skeleton.js +2 -2
  166. package/lib/components/Tabs/Tabs.d.ts +311 -0
  167. package/lib/components/Tabs/Tabs.js +150 -96
  168. package/lib/components/Tabs/index.d.ts +10 -0
  169. package/lib/components/Tabs/usePressable.js +11 -0
  170. package/lib/components/TextInput/ControlledPasswordInput.d.ts +90 -0
  171. package/lib/components/TextInput/ControlledPasswordInput.js +5 -6
  172. package/lib/components/Tile/Tile.d.ts +153 -0
  173. package/lib/components/Tile/Tile.js +62 -74
  174. package/lib/components/Tile/index.d.ts +7 -0
  175. package/lib/components/Toggle/Toggle.Skeleton.d.ts +3 -47
  176. package/lib/components/Toggle/Toggle.Skeleton.js +22 -62
  177. package/lib/components/Toggle/Toggle.js +1 -1
  178. package/lib/components/UIShell/HeaderGlobalAction.js +1 -0
  179. package/lib/components/UIShell/HeaderPanel.js +60 -4
  180. package/lib/components/UIShell/SideNav.d.ts +1 -1
  181. package/lib/components/UIShell/Switcher.js +44 -4
  182. package/lib/components/UIShell/SwitcherItem.js +45 -6
  183. package/lib/index.js +51 -47
  184. package/lib/internal/keyboard/match.js +2 -2
  185. package/lib/internal/useControllableState.js +2 -2
  186. package/lib/internal/useMatchMedia.js +48 -0
  187. package/lib/internal/wrapFocus.js +6 -6
  188. package/lib/prop-types/requiredIfGivenPropIsTruthy.js +1 -1
  189. package/lib/prop-types/types.js +3 -0
  190. package/package.json +4 -3
@@ -31,7 +31,9 @@ class ContentSwitcher extends React__default["default"].Component {
31
31
  constructor() {
32
32
  super(...arguments);
33
33
  _rollupPluginBabelHelpers.defineProperty(this, "_switchRefs", []);
34
- _rollupPluginBabelHelpers.defineProperty(this, "state", {});
34
+ _rollupPluginBabelHelpers.defineProperty(this, "state", {
35
+ selectedIndex: undefined
36
+ });
35
37
  _rollupPluginBabelHelpers.defineProperty(this, "handleItemRef", index => ref => {
36
38
  this._switchRefs[index] = ref;
37
39
  });
@@ -51,7 +53,7 @@ class ContentSwitcher extends React__default["default"].Component {
51
53
  key
52
54
  } = data;
53
55
  if (match.matches(data, [keys.ArrowRight, keys.ArrowLeft])) {
54
- const nextIndex = navigation.getNextIndex(key, index, this.props.children.length);
56
+ const nextIndex = navigation.getNextIndex(key, index, this.props.children?.length);
55
57
  const children = React__default["default"].Children.toArray(this.props.children);
56
58
  if (selectionMode === 'manual') {
57
59
  const switchRef = this._switchRefs[nextIndex];
@@ -60,6 +62,9 @@ class ContentSwitcher extends React__default["default"].Component {
60
62
  this.setState({
61
63
  selectedIndex: nextIndex
62
64
  }, () => {
65
+ if (typeof this.state.selectedIndex !== 'number') {
66
+ return;
67
+ }
63
68
  const child = children[this.state.selectedIndex];
64
69
  const switchRef = this._switchRefs[this.state.selectedIndex];
65
70
  switchRef && switchRef.focus();
@@ -105,16 +110,18 @@ class ContentSwitcher extends React__default["default"].Component {
105
110
  children,
106
111
  className,
107
112
  light,
113
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
108
114
  selectedIndex,
109
115
  // eslint-disable-line no-unused-vars
116
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
110
117
  selectionMode,
111
118
  // eslint-disable-line no-unused-vars
112
119
  size,
113
120
  ...other
114
121
  } = this.props;
115
- const isIconOnly = React__default["default"].Children.map(children, child => {
122
+ const isIconOnly = React__default["default"].Children?.map(children, child => {
116
123
  return child.type.displayName === 'IconSwitch';
117
- }).every(val => val === true);
124
+ })?.every(val => val === true);
118
125
  const classes = cx__default["default"](`${prefix}--content-switcher`, className, {
119
126
  [`${prefix}--content-switcher--light`]: light,
120
127
  [`${prefix}--content-switcher--${size}`]: size,
@@ -130,8 +137,9 @@ class ContentSwitcher extends React__default["default"].Component {
130
137
  }
131
138
  }, other, {
132
139
  className: classes,
133
- role: "tablist"
134
- }), React__default["default"].Children.map(children, (child, index) => /*#__PURE__*/React__default["default"].cloneElement(child, {
140
+ role: "tablist",
141
+ onChange: undefined
142
+ }), children && React__default["default"].Children.map(children, (child, index) => /*#__PURE__*/React__default["default"].cloneElement(child, {
135
143
  index,
136
144
  onClick: events.composeEventHandlers([this.handleChildChange, child.props.onClick]),
137
145
  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;
@@ -12,6 +12,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
12
12
  var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
13
13
  var React = require('react');
14
14
  var Button = require('../Button/Button.js');
15
+ require('../Button/Button.Skeleton.js');
15
16
 
16
17
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
17
18
 
@@ -20,6 +21,5 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
20
21
  const DangerButton = props => /*#__PURE__*/React__default["default"].createElement(Button["default"], _rollupPluginBabelHelpers["extends"]({
21
22
  kind: "danger"
22
23
  }, props));
23
- var DangerButton$1 = DangerButton;
24
24
 
25
- exports["default"] = DangerButton$1;
25
+ exports["default"] = DangerButton;
@@ -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 };
@@ -13,6 +13,7 @@ var PropTypes = require('prop-types');
13
13
  var React = require('react');
14
14
  var iconsReact = require('@carbon/icons-react');
15
15
  var Button = require('../Button/Button.js');
16
+ require('../Button/Button.Skeleton.js');
16
17
 
17
18
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
18
19
 
@@ -14,6 +14,7 @@ var cx = require('classnames');
14
14
  var PropTypes = require('prop-types');
15
15
  var React = require('react');
16
16
  var Button = require('../Button/Button.js');
17
+ require('../Button/Button.Skeleton.js');
17
18
  var TableActionList = require('./TableActionList.js');
18
19
  require('../Text/index.js');
19
20
  var usePrefix = require('../../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;
@@ -10,13 +10,13 @@
10
10
  Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
12
  var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
13
- var React = require('react');
14
13
  var PropTypes = require('prop-types');
14
+ var React = require('react');
15
15
 
16
16
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
17
17
 
18
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
19
18
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
19
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
20
20
 
21
21
  const TableBody = _ref => {
22
22
  let {
@@ -39,6 +39,5 @@ TableBody.propTypes = {
39
39
  TableBody.defaultProps = {
40
40
  'aria-live': 'polite'
41
41
  };
42
- var TableBody$1 = TableBody;
43
42
 
44
- exports["default"] = TableBody$1;
43
+ exports["default"] = TableBody;
@@ -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;
@@ -43,8 +43,8 @@ const TableContainer = _ref => {
43
43
  });
44
44
  const value = React.useMemo(() => {
45
45
  return {
46
- titleId: title ? titleId : null,
47
- descriptionId: description ? descriptionId : null
46
+ titleId: title ? titleId : undefined,
47
+ descriptionId: description ? descriptionId : undefined
48
48
  };
49
49
  }, [title, description, titleId, descriptionId]);
50
50
  return /*#__PURE__*/React__default["default"].createElement(TableContext.TableContext.Provider, {
@@ -81,6 +81,5 @@ TableContainer.propTypes = {
81
81
  */
82
82
  useStaticWidth: PropTypes__default["default"].bool
83
83
  };
84
- var TableContainer$1 = TableContainer;
85
84
 
86
- exports["default"] = TableContainer$1;
85
+ exports["default"] = TableContainer;
@@ -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;
@@ -10,13 +10,13 @@
10
10
  Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
12
  var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
13
+ var iconsReact = require('@carbon/icons-react');
13
14
  var cx = require('classnames');
14
15
  var PropTypes = require('prop-types');
15
- var requiredIfGivenPropIsTruthy = require('../../prop-types/requiredIfGivenPropIsTruthy.js');
16
- var deprecate = require('../../prop-types/deprecate.js');
17
16
  var React = require('react');
18
- var iconsReact = require('@carbon/icons-react');
19
17
  var usePrefix = require('../../internal/usePrefix.js');
18
+ var deprecate = require('../../prop-types/deprecate.js');
19
+ var requiredIfGivenPropIsTruthy = require('../../prop-types/requiredIfGivenPropIsTruthy.js');
20
20
 
21
21
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
22
22
 
@@ -90,6 +90,5 @@ TableExpandHeader.propTypes = {
90
90
  */
91
91
  onExpand: PropTypes__default["default"].oneOfType([requiredIfGivenPropIsTruthy["default"]('enableExpando', PropTypes__default["default"].func), requiredIfGivenPropIsTruthy["default"]('enableToggle', PropTypes__default["default"].func)])
92
92
  };
93
- var TableExpandHeader$1 = TableExpandHeader;
94
93
 
95
- exports["default"] = TableExpandHeader$1;
94
+ exports["default"] = TableExpandHeader;
@@ -17,14 +17,15 @@ var keys = require('../../../internal/keyboard/keys.js');
17
17
  * @returns {Plugin} A Flatpickr plugin to fix Flatpickr's behavior of certain events.
18
18
  */
19
19
  var carbonFlatpickrFixEventsPlugin = (config => fp => {
20
+ const {
21
+ inputFrom,
22
+ inputTo,
23
+ lastStartValue
24
+ } = config;
20
25
  /**
21
26
  * Handles `keydown` event.
22
27
  */
23
28
  const handleKeydown = event => {
24
- const {
25
- inputFrom,
26
- inputTo
27
- } = config;
28
29
  const {
29
30
  target
30
31
  } = event;
@@ -45,6 +46,7 @@ var carbonFlatpickrFixEventsPlugin = (config => fp => {
45
46
  }
46
47
  }
47
48
  };
49
+ const parseDateWithFormat = dateStr => fp.parseDate(dateStr, fp.config.dateFormat);
48
50
 
49
51
  /**
50
52
  * Handles `blur` event.
@@ -54,11 +56,6 @@ var carbonFlatpickrFixEventsPlugin = (config => fp => {
54
56
  * set the date again, triggering the calendar to update.
55
57
  */
56
58
  const handleBlur = event => {
57
- const {
58
- inputFrom,
59
- inputTo,
60
- lastStartValue
61
- } = config;
62
59
  const {
63
60
  target
64
61
  } = event;
@@ -68,8 +65,9 @@ var carbonFlatpickrFixEventsPlugin = (config => fp => {
68
65
  if (inputTo === target && fp.selectedDates[1]) {
69
66
  // Using getTime() enables the ability to more readily compare the date currently
70
67
  // selected in the calendar and the date currently in the value of the input
71
- const selectedToDate = new Date(fp.selectedDates[1]).setHours(0, 0, 0, 0);
72
- const currentValueToDate = new Date(inputTo.value).setHours(0, 0, 0, 0);
68
+ const withoutTime = date => date.setHours(0, 0, 0, 0);
69
+ const selectedToDate = withoutTime(new Date(fp.selectedDates[1]));
70
+ const currentValueToDate = withoutTime(parseDateWithFormat(inputTo.value));
73
71
 
74
72
  // The date should only be set if both dates are valid dates, and they don't match.
75
73
  // When they don't match, this indiciates that the date selected in the calendar is stale,
@@ -79,19 +77,17 @@ var carbonFlatpickrFixEventsPlugin = (config => fp => {
79
77
  fp.setDate([inputFrom.value, inputTo && inputTo.value], true, fp.config.dateFormat);
80
78
  }
81
79
  }
82
-
80
+ const isValidDate = date => date.toString() !== 'Invalid Date';
83
81
  // save end date in calendar inmediately after it's been written down
84
82
  if (inputTo === target && fp.selectedDates.length === 1 && inputTo.value) {
85
- let currentEndDate = new Date(inputTo.value);
86
- if (currentEndDate.toString() !== 'Invalid Date') {
83
+ if (isValidDate(parseDateWithFormat(inputTo.value))) {
87
84
  fp.setDate([inputFrom.value, inputTo.value], true, fp.config.dateFormat);
88
85
  }
89
86
  }
90
87
 
91
88
  // overriding the flatpickr bug where the startDate gets deleted on blur
92
89
  if (inputTo === target && !inputFrom.value && lastStartValue.current) {
93
- let currentStartDate = new Date(lastStartValue.current);
94
- if (currentStartDate.toString() !== 'Invalid Date') {
90
+ if (isValidDate(parseDateWithFormat(lastStartValue.current))) {
95
91
  inputFrom.value = lastStartValue.current;
96
92
  if (inputTo.value) {
97
93
  fp.setDate([inputFrom.value, inputTo.value], true, fp.config.dateFormat);
@@ -227,6 +227,7 @@ const Dropdown = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
227
227
  ,
228
228
  role: "combobox" // eslint-disable-line jsx-a11y/role-has-required-aria-props
229
229
  ,
230
+ "aria-owns": getMenuProps().id,
230
231
  "aria-controls": getMenuProps().id,
231
232
  className: `${prefix}--list-box__field`,
232
233
  disabled: disabled,
@@ -14,6 +14,7 @@ var PropTypes = require('prop-types');
14
14
  var React = require('react');
15
15
  var cx = require('classnames');
16
16
  require('../TextInput/index.js');
17
+ require('../TextInput/ControlledPasswordInput.js');
17
18
  var PasswordInput = require('../TextInput/PasswordInput.js');
18
19
  var usePrefix = require('../../internal/usePrefix.js');
19
20
  var FormContext = require('../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;
@@ -13,6 +13,7 @@ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelper
13
13
  var PropTypes = require('prop-types');
14
14
  var React = require('react');
15
15
  var Button = require('../Button/Button.js');
16
+ require('../Button/Button.Skeleton.js');
16
17
  var cx = require('classnames');
17
18
  require('../Tooltip/DefinitionTooltip.js');
18
19
  var Tooltip = require('../Tooltip/Tooltip.js');
@@ -32,10 +33,10 @@ const IconButton = /*#__PURE__*/React__default["default"].forwardRef(function Ic
32
33
  closeOnActivation = true,
33
34
  defaultOpen = false,
34
35
  disabled,
35
- enterDelayMs,
36
+ enterDelayMs = 100,
36
37
  kind,
37
38
  label,
38
- leaveDelayMs,
39
+ leaveDelayMs = 100,
39
40
  wrapperClasses,
40
41
  size,
41
42
  ...rest
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Copyright IBM Corp. 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, { ElementType, HTMLAttributes, ReactNode } from 'react';
8
+ /**
9
+ * Density of components within this layout
10
+ */
11
+ type Density = 'condensed' | 'normal';
12
+ /**
13
+ * Size of components within this layout
14
+ */
15
+ type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
16
+ export interface LayoutProps extends HTMLAttributes<HTMLElement> {
17
+ /**
18
+ * Specify a custom component or element to be rendered as the top-level
19
+ * element in the component
20
+ */
21
+ as?: (() => ReactNode) | string | ElementType;
22
+ /**
23
+ * Provide child elements to be rendered inside of `Layout`
24
+ */
25
+ children?: ReactNode;
26
+ /**
27
+ * Provide a custom class name to be used on the outermost element rendered by
28
+ * the component
29
+ */
30
+ className?: string;
31
+ /**
32
+ * Specify the desired density of components within this layout
33
+ */
34
+ density?: Density;
35
+ /**
36
+ * Specify the desired size of components within this layout
37
+ */
38
+ size?: Size;
39
+ }
40
+ declare const Layout: React.ForwardRefExoticComponent<LayoutProps & React.RefAttributes<React.ReactNode>>;
41
+ export interface LayoutConstraintProps extends HTMLAttributes<HTMLElement> {
42
+ /**
43
+ * Specify a custom component or element to be rendered as the top-level
44
+ * element in the component
45
+ */
46
+ as?: (() => ReactNode) | string | ElementType;
47
+ /**
48
+ * Provide child elements to be rendered inside of `LayoutConstraint`
49
+ */
50
+ children?: ReactNode;
51
+ /**
52
+ * Provide a custom class name to be used on the outermost element rendered by
53
+ * the component
54
+ */
55
+ className?: string;
56
+ /**
57
+ * Specify the desired layout density constraints of this element's children
58
+ */
59
+ density?: {
60
+ min?: Density | null;
61
+ default?: Density | null;
62
+ max?: Density | null;
63
+ } | null;
64
+ /**
65
+ * Specify the desired layout size constraints of this element's children
66
+ */
67
+ size?: {
68
+ min?: Size | null;
69
+ default?: Size | null;
70
+ max?: Size | null;
71
+ } | null;
72
+ }
73
+ declare const LayoutConstraint: React.ForwardRefExoticComponent<LayoutConstraintProps & React.RefAttributes<React.ReactNode>>;
74
+ export { Layout, LayoutConstraint };
@@ -23,6 +23,15 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
23
23
 
24
24
  const sizes = ['xs', 'sm', 'md', 'lg', 'xl', '2xl'];
25
25
  const densities = ['condensed', 'normal'];
26
+
27
+ /**
28
+ * Density of components within this layout
29
+ */
30
+
31
+ /**
32
+ * Size of components within this layout
33
+ */
34
+
26
35
  const Layout = /*#__PURE__*/React__default["default"].forwardRef(function Layout(_ref, forwardRef) {
27
36
  let {
28
37
  as: BaseComponent = 'div',
@@ -34,8 +43,8 @@ const Layout = /*#__PURE__*/React__default["default"].forwardRef(function Layout
34
43
  } = _ref;
35
44
  const prefix = usePrefix.usePrefix();
36
45
  const classes = cx__default["default"](className, `${prefix}--layout`, {
37
- [`${prefix}--layout--size-${size}`]: sizes.includes(size),
38
- [`${prefix}--layout--density-${density}`]: densities.includes(density)
46
+ [`${prefix}--layout--size-${size}`]: size && sizes.includes(size),
47
+ [`${prefix}--layout--density-${density}`]: density && densities.includes(density)
39
48
  });
40
49
  return /*#__PURE__*/React__default["default"].createElement(BaseComponent, _rollupPluginBabelHelpers["extends"]({}, rest, {
41
50
  ref: forwardRef,
@@ -82,9 +91,9 @@ const LayoutConstraint = /*#__PURE__*/React__default["default"].forwardRef(funct
82
91
  }).map(_ref3 => {
83
92
  let [group, constraints] = _ref3;
84
93
  return {
85
- [`${prefix}--layout-constraint--${group}:default-${constraints?.default}`]: constraints?.default,
86
- [`${prefix}--layout-constraint--${group}:min-${constraints?.min}`]: constraints?.min,
87
- [`${prefix}--layout-constraint--${group}:max-${constraints?.max}`]: constraints?.max
94
+ [`${prefix}--layout-constraint--${group}__default-${constraints?.default}`]: constraints?.default,
95
+ [`${prefix}--layout-constraint--${group}__min-${constraints?.min}`]: constraints?.min,
96
+ [`${prefix}--layout-constraint--${group}__max-${constraints?.max}`]: constraints?.max
88
97
  };
89
98
  }));
90
99
  return /*#__PURE__*/React__default["default"].createElement(BaseComponent, _rollupPluginBabelHelpers["extends"]({}, rest, {