@carbon/react 1.25.0 → 1.26.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 (83) hide show
  1. package/es/components/Button/Button.js +2 -2
  2. package/es/components/DataTable/Table.d.ts +74 -0
  3. package/es/components/DataTable/Table.js +4 -2
  4. package/es/components/DataTable/TableCell.d.ts +10 -0
  5. package/es/components/DataTable/TableContext.d.ts +13 -0
  6. package/es/components/DataTable/TableContext.js +2 -2
  7. package/es/components/DataTable/TableExpandRow.d.ts +67 -0
  8. package/es/components/DataTable/TableExpandedRow.d.ts +32 -0
  9. package/es/components/DataTable/TableHead.d.ts +10 -0
  10. package/es/components/DataTable/TableHeader.d.ts +64 -0
  11. package/es/components/DataTable/TableHeader.js +23 -28
  12. package/es/components/DataTable/TableRow.d.ts +32 -0
  13. package/es/components/DataTable/TableSelectAll.js +1 -1
  14. package/es/components/DataTable/TableSelectRow.js +1 -3
  15. package/es/components/DataTable/TableToolbarContent.d.ts +4 -6
  16. package/es/components/DataTable/TableToolbarSearch.js +1 -0
  17. package/es/components/ExpandableSearch/ExpandableSearch.js +1 -0
  18. package/es/components/FileUploader/FileUploaderButton.js +2 -0
  19. package/es/components/InlineCheckbox/InlineCheckbox.js +7 -53
  20. package/es/components/MultiSelect/FilterableMultiSelect.js +15 -7
  21. package/es/components/MultiSelect/MultiSelect.js +0 -2
  22. package/es/components/NumberInput/NumberInput.js +9 -1
  23. package/es/components/RadioButton/RadioButton.Skeleton.d.ts +25 -0
  24. package/es/components/RadioButton/RadioButton.Skeleton.js +3 -3
  25. package/es/components/RadioButton/RadioButton.d.ts +64 -0
  26. package/es/components/RadioButton/RadioButton.js +19 -17
  27. package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +80 -0
  28. package/es/components/RadioButtonGroup/RadioButtonGroup.js +91 -25
  29. package/es/components/Search/Search.Skeleton.d.ts +36 -0
  30. package/es/components/Search/Search.js +3 -2
  31. package/es/components/Search/index.js +1 -0
  32. package/es/components/StructuredList/StructuredList.js +1 -1
  33. package/es/components/Tabs/Tabs.js +26 -5
  34. package/es/components/TextInput/PasswordInput.d.ts +125 -0
  35. package/es/components/TextInput/PasswordInput.js +10 -6
  36. package/es/components/TextInput/TextInput.Skeleton.d.ts +33 -0
  37. package/es/components/TextInput/index.js +1 -0
  38. package/es/components/Tile/Tile.js +15 -8
  39. package/es/components/UIShell/HeaderMenu.js +13 -4
  40. package/es/components/UIShell/HeaderMenuItem.js +17 -4
  41. package/es/tools/wrapComponent.js +9 -0
  42. package/lib/components/Button/Button.js +2 -2
  43. package/lib/components/DataTable/Table.d.ts +74 -0
  44. package/lib/components/DataTable/Table.js +4 -2
  45. package/lib/components/DataTable/TableCell.d.ts +10 -0
  46. package/lib/components/DataTable/TableContext.d.ts +13 -0
  47. package/lib/components/DataTable/TableContext.js +2 -2
  48. package/lib/components/DataTable/TableExpandRow.d.ts +67 -0
  49. package/lib/components/DataTable/TableExpandedRow.d.ts +32 -0
  50. package/lib/components/DataTable/TableHead.d.ts +10 -0
  51. package/lib/components/DataTable/TableHeader.d.ts +64 -0
  52. package/lib/components/DataTable/TableHeader.js +23 -28
  53. package/lib/components/DataTable/TableRow.d.ts +32 -0
  54. package/lib/components/DataTable/TableSelectAll.js +1 -1
  55. package/lib/components/DataTable/TableSelectRow.js +1 -3
  56. package/lib/components/DataTable/TableToolbarContent.d.ts +4 -6
  57. package/lib/components/DataTable/TableToolbarSearch.js +1 -0
  58. package/lib/components/ExpandableSearch/ExpandableSearch.js +1 -0
  59. package/lib/components/FileUploader/FileUploaderButton.js +2 -0
  60. package/lib/components/InlineCheckbox/InlineCheckbox.js +7 -53
  61. package/lib/components/MultiSelect/FilterableMultiSelect.js +14 -6
  62. package/lib/components/MultiSelect/MultiSelect.js +0 -2
  63. package/lib/components/NumberInput/NumberInput.js +9 -1
  64. package/lib/components/RadioButton/RadioButton.Skeleton.d.ts +25 -0
  65. package/lib/components/RadioButton/RadioButton.Skeleton.js +3 -3
  66. package/lib/components/RadioButton/RadioButton.d.ts +64 -0
  67. package/lib/components/RadioButton/RadioButton.js +18 -16
  68. package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +80 -0
  69. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +90 -24
  70. package/lib/components/Search/Search.Skeleton.d.ts +36 -0
  71. package/lib/components/Search/Search.js +3 -2
  72. package/lib/components/Search/index.js +2 -0
  73. package/lib/components/StructuredList/StructuredList.js +1 -1
  74. package/lib/components/Tabs/Tabs.js +26 -5
  75. package/lib/components/TextInput/PasswordInput.d.ts +125 -0
  76. package/lib/components/TextInput/PasswordInput.js +10 -25
  77. package/lib/components/TextInput/TextInput.Skeleton.d.ts +33 -0
  78. package/lib/components/TextInput/index.js +2 -0
  79. package/lib/components/Tile/Tile.js +15 -8
  80. package/lib/components/UIShell/HeaderMenu.js +13 -4
  81. package/lib/components/UIShell/HeaderMenuItem.js +17 -4
  82. package/lib/tools/wrapComponent.js +9 -0
  83. package/package.json +3 -3
@@ -0,0 +1,125 @@
1
+ import React, { InputHTMLAttributes } from 'react';
2
+ import { ReactNodeLike } from 'prop-types';
3
+ type ExcludedAttributes = 'size';
4
+ export interface PasswordInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes> {
5
+ /**
6
+ * Provide a custom className that is applied directly to the underlyling `<input>` node
7
+ */
8
+ className?: string;
9
+ /**
10
+ * Optionally provide the default value of the `<input>`
11
+ */
12
+ defaultValue?: string | number;
13
+ /**
14
+ * Specify whether the control is disabled
15
+ */
16
+ disabled?: boolean;
17
+ /**
18
+ * Specify whether to display the character counter
19
+ */
20
+ enableCounter?: boolean;
21
+ /**
22
+ * Provide text that is used alongside the control label for additional help
23
+ */
24
+ helperText?: ReactNodeLike;
25
+ /**
26
+ * Specify whether or not the underlying label is visually hidden
27
+ */
28
+ hideLabel?: boolean;
29
+ /**
30
+ * "Hide password" tooltip text on password visibility toggle
31
+ */
32
+ hidePasswordLabel?: string;
33
+ /**
34
+ * Provide a unique identifier for the input field
35
+ */
36
+ id: string;
37
+ /**
38
+ * `true` to use the inline version
39
+ */
40
+ inline?: boolean;
41
+ /**
42
+ * Specify whether the control is currently invalid
43
+ */
44
+ invalid?: boolean;
45
+ /**
46
+ * Provide the text that is displayed when the control is in an invalid state
47
+ */
48
+ invalidText?: ReactNodeLike;
49
+ /**
50
+ * Provide the text that will be read by a screen reader when visiting this control
51
+ */
52
+ labelText: ReactNodeLike;
53
+ /**
54
+ * @deprecated The `light` prop for `PasswordInput` has been deprecated in favor of the new `Layer` component. It will be removed in the next major release.
55
+ * `true` to use the light version. For use on $ui-01 backgrounds only.
56
+ * Don't use this to make tile background color same as container background color.
57
+ */
58
+ light?: boolean;
59
+ /**
60
+ * Max character count allowed for the input. This is needed in order for enableCounter to display
61
+ */
62
+ maxCount?: number;
63
+ /**
64
+ * Optionally provide an `onChange` handler that is called whenever `<input>` is updated
65
+ * @param evt Change event triggered by `<input>`
66
+ * @returns {void}
67
+ */
68
+ onChange?: (evt: React.ChangeEvent<HTMLInputElement>) => void;
69
+ /**
70
+ * Optionally provide an `onClick` handler that is called whenever the `<input>` is returned
71
+ * @param evt Mouse event triggered by `<input>`
72
+ * @returns {void}
73
+ */
74
+ onClick?: (evt: React.MouseEvent<HTMLInputElement>) => void;
75
+ /**
76
+ * Callback function that is called whenever the toggle password visibility button is clicked
77
+ * @param evt Mouse event triggered by the password visibility `<button>`
78
+ * @returns {void}
79
+ */
80
+ onTogglePasswordVisibility?: (evt: React.MouseEvent<HTMLButtonElement>) => void;
81
+ /**
82
+ * Specify the placeholder attribute for the `<input>`
83
+ */
84
+ placeholder?: string;
85
+ /**
86
+ * Whether the input should be read-only
87
+ */
88
+ readOnly?: boolean;
89
+ /**
90
+ * "Show password" tooltip text on password visibility toggle
91
+ */
92
+ showPasswordLabel?: string;
93
+ /**
94
+ * Specify the size of the Text Input. Supports `sm`, `md`, or `lg`.
95
+ */
96
+ size?: 'sm' | 'md' | 'lg';
97
+ /**
98
+ * Specify the alignment of the tooltip to the icon-only button.
99
+ * Can be one of: `start`, `center`, or `end`.
100
+ */
101
+ tooltipAlignment?: 'start' | 'center' | 'end';
102
+ /**
103
+ * Specify the direction of the tooltip for the icon-only button.
104
+ * Can be either `top`, `right`, `bottom`, or `left`
105
+ */
106
+ tooltipPosition?: 'top' | 'right' | 'bottom' | 'left';
107
+ /**
108
+ * The input type, either `password` or `text`
109
+ */
110
+ type?: 'password' | 'text';
111
+ /**
112
+ * Provide the current value of the `<input>`
113
+ */
114
+ value?: string | number;
115
+ /**
116
+ * Specify whether the control is currently in warning state
117
+ */
118
+ warn?: boolean;
119
+ /**
120
+ * Provide the text that is displayed when the control is in warning state
121
+ */
122
+ warnText?: ReactNodeLike;
123
+ }
124
+ declare const PasswordInput: React.ForwardRefExoticComponent<PasswordInputProps & React.RefAttributes<unknown>>;
125
+ export default PasswordInput;
@@ -14,11 +14,10 @@ import { useNormalizedInputProps } from '../../internal/useNormalizedInputProps.
14
14
  import { textInputProps } from './util.js';
15
15
  import '../FluidForm/FluidForm.js';
16
16
  import { FormContext } from '../FluidForm/FormContext.js';
17
- import * as FeatureFlags from '@carbon/feature-flags';
18
17
  import deprecate from '../../prop-types/deprecate.js';
19
18
  import { usePrefix } from '../../internal/usePrefix.js';
20
19
 
21
- var _excluded = ["className", "disabled", "helperText", "hideLabel", "hidePasswordLabel", "id", "inline", "invalid", "invalidText", "labelText", "light", "onChange", "onClick", "onTogglePasswordVisibility", "placeholder", "size", "showPasswordLabel", "tooltipPosition", "tooltipAlignment", "type", "warn", "warnText"];
20
+ var _excluded = ["className", "disabled", "helperText", "hideLabel", "hidePasswordLabel", "id", "inline", "invalid", "invalidText", "labelText", "light", "onChange", "onClick", "onTogglePasswordVisibility", "placeholder", "readOnly", "size", "showPasswordLabel", "tooltipPosition", "tooltipAlignment", "type", "warn", "warnText"];
22
21
  var PasswordInput = /*#__PURE__*/React__default.forwardRef(function PasswordInput(_ref, ref) {
23
22
  var _classNames, _classNames2, _classNames3, _classNames4, _classNames7, _classNames8;
24
23
 
@@ -42,6 +41,7 @@ var PasswordInput = /*#__PURE__*/React__default.forwardRef(function PasswordInpu
42
41
  _onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
43
42
  onTogglePasswordVisibility = _ref.onTogglePasswordVisibility,
44
43
  placeholder = _ref.placeholder,
44
+ readOnly = _ref.readOnly,
45
45
  _ref$size = _ref.size,
46
46
  size = _ref$size === void 0 ? 'md' : _ref$size,
47
47
  _ref$showPasswordLabe = _ref.showPasswordLabel,
@@ -52,7 +52,8 @@ var PasswordInput = /*#__PURE__*/React__default.forwardRef(function PasswordInpu
52
52
  tooltipAlignment = _ref$tooltipAlignment === void 0 ? 'center' : _ref$tooltipAlignment,
53
53
  _ref$type = _ref.type,
54
54
  type = _ref$type === void 0 ? 'password' : _ref$type,
55
- warn = _ref.warn,
55
+ _ref$warn = _ref.warn,
56
+ warn = _ref$warn === void 0 ? false : _ref$warn,
56
57
  warnText = _ref.warnText,
57
58
  rest = _objectWithoutProperties(_ref, _excluded);
58
59
 
@@ -67,7 +68,9 @@ var PasswordInput = /*#__PURE__*/React__default.forwardRef(function PasswordInpu
67
68
  invalid: invalid,
68
69
  invalidText: invalidText,
69
70
  warn: warn,
70
- warnText: warnText
71
+ warnText: warnText,
72
+ readOnly: readOnly,
73
+ disabled: disabled
71
74
  });
72
75
 
73
76
  var _useContext = useContext(FormContext),
@@ -140,6 +143,7 @@ var PasswordInput = /*#__PURE__*/React__default.forwardRef(function PasswordInpu
140
143
  useEffect(function () {
141
144
  setInputType(type);
142
145
  }, [type]);
146
+ var Icon = normalizedProps.icon;
143
147
  return /*#__PURE__*/React__default.createElement("div", {
144
148
  className: inputWrapperClasses
145
149
  }, !inline ? label : /*#__PURE__*/React__default.createElement("div", {
@@ -149,7 +153,7 @@ var PasswordInput = /*#__PURE__*/React__default.forwardRef(function PasswordInpu
149
153
  }, /*#__PURE__*/React__default.createElement("div", {
150
154
  className: fieldWrapperClasses,
151
155
  "data-invalid": normalizedProps.invalid || null
152
- }, normalizedProps.icon && /*#__PURE__*/React__default.createElement(normalizedProps.icon, {
156
+ }, Icon && /*#__PURE__*/React__default.createElement(Icon, {
153
157
  className: iconClasses
154
158
  }), input, isFluid && !inline && normalizedProps.validation), !isFluid && !inline && (normalizedProps.validation || helper)));
155
159
  });
@@ -249,7 +253,7 @@ PasswordInput.propTypes = {
249
253
  /**
250
254
  * Specify the size of the Text Input. Supports `sm`, `md`, or `lg`.
251
255
  */
252
- size: FeatureFlags.enabled('enable-v11-release') ? PropTypes.oneOf(['sm', 'md', 'lg']) : PropTypes.string,
256
+ size: PropTypes.oneOf(['sm', 'md', 'lg']),
253
257
 
254
258
  /**
255
259
  * Specify the alignment of the tooltip to the icon-only button.
@@ -0,0 +1,33 @@
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
+ export interface TextInputSkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
10
+ /**
11
+ * Specify an optional className to add to the form item wrapper.
12
+ */
13
+ className?: string;
14
+ /**
15
+ * Specify whether the label should be hidden or not.
16
+ */
17
+ hideLabel?: boolean;
18
+ }
19
+ declare const TextInputSkeleton: {
20
+ ({ hideLabel, className, ...rest }: TextInputSkeletonProps): JSX.Element;
21
+ propTypes: {
22
+ /**
23
+ * Specify an optional className to add to the form item wrapper.
24
+ */
25
+ className: PropTypes.Requireable<string>;
26
+ /**
27
+ * Specify whether the label should be hidden, or not
28
+ */
29
+ hideLabel: PropTypes.Requireable<boolean>;
30
+ };
31
+ };
32
+ export default TextInputSkeleton;
33
+ export { TextInputSkeleton };
@@ -10,6 +10,7 @@ import ControlledPasswordInput from './ControlledPasswordInput.js';
10
10
  import PasswordInput from './PasswordInput.js';
11
11
  import TextInput from './TextInput.js';
12
12
  export { default as TextInput, default } from './TextInput.js';
13
+ export { default as TextInputSkeleton } from './TextInput.Skeleton.js';
13
14
 
14
15
  TextInput.ControlledPasswordInput = ControlledPasswordInput;
15
16
  TextInput.PasswordInput = PasswordInput;
@@ -22,7 +22,7 @@ import { Enter, Space } from '../../internal/keyboard/keys.js';
22
22
  var _CheckboxCheckedFille, _Checkbox, _ChevronDown, _ChevronDown2;
23
23
 
24
24
  var _excluded = ["children", "className", "light"],
25
- _excluded2 = ["children", "className", "clicked", "href", "light", "onClick", "onKeyDown"],
25
+ _excluded2 = ["children", "className", "clicked", "disabled", "href", "light", "onClick", "onKeyDown"],
26
26
  _excluded3 = ["children", "className", "disabled", "id", "light", "name", "onClick", "onChange", "onKeyDown", "selected", "tabIndex", "title", "value"],
27
27
  _excluded4 = ["tabIndex", "className", "children", "expanded", "tileMaxHeight", "tilePadding", "onClick", "onKeyUp", "tileCollapsedIconText", "tileExpandedIconText", "tileCollapsedLabel", "tileExpandedLabel", "light"];
28
28
  var Tile = /*#__PURE__*/React__default.forwardRef(function Tile(_ref, ref) {
@@ -64,6 +64,7 @@ var ClickableTile = /*#__PURE__*/React__default.forwardRef(function ClickableTil
64
64
  className = _ref2.className,
65
65
  _ref2$clicked = _ref2.clicked,
66
66
  clicked = _ref2$clicked === void 0 ? false : _ref2$clicked,
67
+ disabled = _ref2.disabled,
67
68
  href = _ref2.href,
68
69
  light = _ref2.light,
69
70
  _ref2$onClick = _ref2.onClick,
@@ -101,9 +102,10 @@ var ClickableTile = /*#__PURE__*/React__default.forwardRef(function ClickableTil
101
102
  return /*#__PURE__*/React__default.createElement(Link, _extends({
102
103
  className: classes,
103
104
  href: href,
104
- onClick: handleOnClick,
105
+ onClick: !disabled ? handleOnClick : null,
105
106
  onKeyDown: handleOnKeyDown,
106
- ref: ref
107
+ ref: ref,
108
+ disabled: disabled
107
109
  }, rest), children);
108
110
  });
109
111
  ClickableTile.displayName = 'ClickableTile';
@@ -123,6 +125,11 @@ ClickableTile.propTypes = {
123
125
  */
124
126
  clicked: PropTypes.bool,
125
127
 
128
+ /**
129
+ * Specify whether the ClickableTile should be disabled
130
+ */
131
+ disabled: PropTypes.bool,
132
+
126
133
  /**
127
134
  * The href for the link.
128
135
  */
@@ -359,7 +366,7 @@ function ExpandableTile(_ref4) {
359
366
  isExpanded = _useState18[0],
360
367
  setIsExpanded = _useState18[1];
361
368
 
362
- var _useState19 = useState(false),
369
+ var _useState19 = useState(true),
363
370
  _useState20 = _slicedToArray(_useState19, 2),
364
371
  interactive = _useState20[0],
365
372
  setInteractive = _useState20[1];
@@ -429,11 +436,11 @@ function ExpandableTile(_ref4) {
429
436
  setIsTilePadding(paddingTop + paddingBottom);
430
437
  }, [isTileMaxHeight]);
431
438
  useIsomorphicEffect(function () {
432
- if (getInteractiveContent(belowTheFold.current)) {
433
- setInteractive(true);
439
+ if (!getInteractiveContent(belowTheFold.current)) {
440
+ setInteractive(false);
434
441
  return;
435
- } else if (getInteractiveContent(aboveTheFold.current)) {
436
- setInteractive(true);
442
+ } else if (!getInteractiveContent(aboveTheFold.current)) {
443
+ setInteractive(false);
437
444
  }
438
445
  }, []);
439
446
  useIsomorphicEffect(function () {
@@ -12,10 +12,11 @@ import React__default from 'react';
12
12
  import PropTypes from 'prop-types';
13
13
  import { AriaLabelPropType } from '../../prop-types/AriaPropTypes.js';
14
14
  import { PrefixContext } from '../../internal/usePrefix.js';
15
+ import deprecate from '../../prop-types/deprecate.js';
15
16
  import { matches } from '../../internal/keyboard/match.js';
16
17
  import { Enter, Space, Escape } from '../../internal/keyboard/keys.js';
17
18
 
18
- var _excluded = ["isCurrentPage", "aria-label", "aria-labelledby", "className", "children", "renderMenuContent", "menuLinkName", "focusRef"];
19
+ var _excluded = ["isActive", "isCurrentPage", "aria-label", "aria-labelledby", "className", "children", "renderMenuContent", "menuLinkName", "focusRef"];
19
20
  /**
20
21
  * `HeaderMenu` is used to render submenu's in the `Header`. Most often children
21
22
  * will be a `HeaderMenuItem`. It handles certain keyboard events to help
@@ -149,6 +150,7 @@ var HeaderMenu = /*#__PURE__*/function (_React$Component) {
149
150
  var prefix = this.context;
150
151
 
151
152
  var _this$props = this.props,
153
+ isActive = _this$props.isActive,
152
154
  isCurrentPage = _this$props.isCurrentPage,
153
155
  ariaLabel = _this$props['aria-label'],
154
156
  ariaLabelledBy = _this$props['aria-labelledby'],
@@ -164,7 +166,8 @@ var HeaderMenu = /*#__PURE__*/function (_React$Component) {
164
166
  'aria-labelledby': ariaLabelledBy
165
167
  };
166
168
  var itemClassName = cx((_cx = {}, _defineProperty(_cx, "".concat(prefix, "--header__submenu"), true), _defineProperty(_cx, customClassName, !!customClassName), _cx));
167
- var linkClassName = cx((_cx2 = {}, _defineProperty(_cx2, "".concat(prefix, "--header__menu-item"), true), _defineProperty(_cx2, "".concat(prefix, "--header__menu-title"), true), _defineProperty(_cx2, "".concat(prefix, "--header__menu-item--current"), isCurrentPage), _cx2)); // Notes on eslint comments and based on the examples in:
169
+ var isActivePage = isActive ? isActive : isCurrentPage;
170
+ var linkClassName = cx((_cx2 = {}, _defineProperty(_cx2, "".concat(prefix, "--header__menu-item"), true), _defineProperty(_cx2, "".concat(prefix, "--header__menu-title"), true), _defineProperty(_cx2, "".concat(prefix, "--header__menu-item--current"), isActivePage), _cx2)); // Notes on eslint comments and based on the examples in:
168
171
  // https://www.w3.org/TR/wai-aria-practices/examples/menubar/menubar-1/menubar-1.html#
169
172
  // - The focus is handled by the <a> menuitem, onMouseOver is for mouse
170
173
  // users
@@ -218,9 +221,15 @@ _defineProperty(HeaderMenu, "propTypes", _objectSpread2(_objectSpread2({}, AriaL
218
221
  focusRef: PropTypes.func,
219
222
 
220
223
  /**
221
- * Applies selected styles to the item if a user sets this to true and aria-current !== 'page'.
224
+ * Applies selected styles to the item if a user sets this to true and `aria-current !== 'page'`.
222
225
  */
223
- isCurrentPage: PropTypes.bool,
226
+ isActive: PropTypes.bool,
227
+
228
+ /**
229
+ * Applies selected styles to the item if a user sets this to true and `aria-current !== 'page'`.
230
+ * @deprecated Please use `isActive` instead. This will be removed in the next major release.
231
+ */
232
+ isCurrentPage: deprecate(PropTypes.bool, 'The `isCurrentPage` prop for `HeaderMenu` has ' + 'been deprecated. Please use `isActive` instead. This will be removed in the next major release.'),
224
233
 
225
234
  /**
226
235
  * Provide a label for the link text
@@ -11,12 +11,14 @@ import React__default from 'react';
11
11
  import cx from 'classnames';
12
12
  import Link, { LinkPropTypes } from './Link.js';
13
13
  import { usePrefix } from '../../internal/usePrefix.js';
14
+ import deprecate from '../../prop-types/deprecate.js';
14
15
 
15
- var _excluded = ["className", "isCurrentPage", "aria-current", "children", "role", "tabIndex"];
16
+ var _excluded = ["className", "isActive", "isCurrentPage", "aria-current", "children", "role", "tabIndex"];
16
17
  var HeaderMenuItem = /*#__PURE__*/React__default.forwardRef(function HeaderMenuItem(_ref, ref) {
17
18
  var _cx;
18
19
 
19
20
  var className = _ref.className,
21
+ isActive = _ref.isActive,
20
22
  isCurrentPage = _ref.isCurrentPage,
21
23
  ariaCurrent = _ref['aria-current'],
22
24
  children = _ref.children,
@@ -26,7 +28,12 @@ var HeaderMenuItem = /*#__PURE__*/React__default.forwardRef(function HeaderMenuI
26
28
  rest = _objectWithoutProperties(_ref, _excluded);
27
29
 
28
30
  var prefix = usePrefix();
29
- var linkClassName = cx((_cx = {}, _defineProperty(_cx, "".concat(prefix, "--header__menu-item"), true), _defineProperty(_cx, "".concat(prefix, "--header__menu-item--current"), isCurrentPage && ariaCurrent !== 'page'), _cx));
31
+
32
+ if (isCurrentPage) {
33
+ isActive = isCurrentPage;
34
+ }
35
+
36
+ var linkClassName = cx((_cx = {}, _defineProperty(_cx, "".concat(prefix, "--header__menu-item"), true), _defineProperty(_cx, "".concat(prefix, "--header__menu-item--current"), isActive && ariaCurrent !== 'page'), _cx));
30
37
  return /*#__PURE__*/React__default.createElement("li", {
31
38
  className: className,
32
39
  role: role
@@ -53,9 +60,15 @@ HeaderMenuItem.propTypes = _objectSpread2(_objectSpread2({}, LinkPropTypes), {},
53
60
  className: PropTypes.string,
54
61
 
55
62
  /**
56
- * Applies selected styles to the item if a user sets this to true and aria-current !== 'page'.
63
+ * Applies selected styles to the item if a user sets this to true and `aria-current !== 'page'`.
64
+ */
65
+ isActive: PropTypes.bool,
66
+
67
+ /**
68
+ * Applies selected styles to the item if a user sets this to true and `aria-current !== 'page'`.
69
+ * @deprecated Please use `isActive` instead. This will be removed in the next major release.
57
70
  */
58
- isCurrentPage: PropTypes.bool,
71
+ isCurrentPage: deprecate(PropTypes.bool, 'The `isCurrentPage` prop for `HeaderMenuItem` has ' + 'been deprecated. Please use `isActive` instead. This will be removed in the next major release.'),
59
72
 
60
73
  /**
61
74
  * Optionally supply a role for the underlying `<li>` node. Useful for resetting
@@ -12,12 +12,21 @@ import cx from 'classnames';
12
12
  import { usePrefix } from '../internal/usePrefix.js';
13
13
 
14
14
  var _excluded = ["className"];
15
+ /**
16
+ * @param {{ name: string, type: string, className?: string | (prefix: string) => string }} props
17
+ * @returns
18
+ */
15
19
 
16
20
  var wrapComponent = function wrapComponent(_ref) {
17
21
  var name = _ref.name,
18
22
  getClassName = _ref.className,
19
23
  type = _ref.type;
20
24
 
25
+ /**
26
+ *
27
+ * @param {{ className?: string, [x: string]: any}} param0
28
+ * @returns
29
+ */
21
30
  function Component(_ref2) {
22
31
  var baseClassName = _ref2.className,
23
32
  other = _objectWithoutProperties(_ref2, _excluded);
@@ -27,7 +27,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
27
27
 
28
28
  var _excluded = ["as", "children", "className", "dangerDescription", "disabled", "hasIconOnly", "href", "iconDescription", "isExpressive", "isSelected", "kind", "onBlur", "onClick", "onFocus", "onMouseEnter", "onMouseLeave", "renderIcon", "size", "tabIndex", "tooltipAlignment", "tooltipPosition", "type"];
29
29
  var Button = /*#__PURE__*/React__default["default"].forwardRef(function Button(_ref, ref) {
30
- var _classNames;
30
+ var _classNames, _rest$ariaPressed;
31
31
 
32
32
  var as = _ref.as,
33
33
  children = _ref.children,
@@ -92,7 +92,7 @@ var Button = /*#__PURE__*/React__default["default"].forwardRef(function Button(_
92
92
  disabled: disabled,
93
93
  type: type,
94
94
  'aria-describedby': dangerButtonVariants.includes(kind) ? assistiveId : null,
95
- 'aria-pressed': hasIconOnly && kind === 'ghost' ? isSelected : null
95
+ 'aria-pressed': (_rest$ariaPressed = rest['aria-pressed']) !== null && _rest$ariaPressed !== void 0 ? _rest$ariaPressed : hasIconOnly && kind === 'ghost' ? isSelected : null
96
96
  };
97
97
  var anchorProps = {
98
98
  href: href
@@ -0,0 +1,74 @@
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 { PropsWithChildren } from 'react';
8
+ import PropTypes from 'prop-types';
9
+ interface TableProps {
10
+ className?: string;
11
+ /**
12
+ * `false` If true, will apply sorting styles
13
+ */
14
+ isSortable?: boolean;
15
+ /**
16
+ * Specify whether the overflow menu (if it exists) should be shown always, or only on hover
17
+ */
18
+ overflowMenuOnHover?: boolean;
19
+ /**
20
+ * Change the row height of table. Currently supports `xs`, `sm`, `md`, `lg`, and `xl`.
21
+ */
22
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
23
+ /**
24
+ * `false` If true, will keep the header sticky (only data rows will scroll)
25
+ */
26
+ stickyHeader?: boolean;
27
+ /**
28
+ * `false` If true, will use a width of 'auto' instead of 100%
29
+ */
30
+ useStaticWidth?: boolean;
31
+ /**
32
+ * `true` to add useZebraStyles striping.
33
+ */
34
+ useZebraStyles?: boolean;
35
+ }
36
+ export declare const Table: {
37
+ ({ className, children, useZebraStyles, size, isSortable, useStaticWidth, stickyHeader, overflowMenuOnHover, ...other }: PropsWithChildren<TableProps>): JSX.Element;
38
+ propTypes: {
39
+ /**
40
+ * Pass in the children that will be rendered within the Table
41
+ */
42
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
43
+ className: PropTypes.Requireable<string>;
44
+ /**
45
+ * `false` If true, will apply sorting styles
46
+ */
47
+ isSortable: PropTypes.Requireable<boolean>;
48
+ /**
49
+ * Specify whether the overflow menu (if it exists) should be shown always, or only on hover
50
+ */
51
+ overflowMenuOnHover: PropTypes.Requireable<boolean>;
52
+ /**
53
+ * Change the row height of table. Currently supports `xs`, `sm`, `md`, `lg`, and `xl`.
54
+ */
55
+ size: PropTypes.Requireable<string>;
56
+ /**
57
+ * `false` If true, will keep the header sticky (only data rows will scroll)
58
+ */
59
+ stickyHeader: PropTypes.Requireable<boolean>;
60
+ /**
61
+ * `false` If true, will use a width of 'auto' instead of 100%
62
+ */
63
+ useStaticWidth: PropTypes.Requireable<boolean>;
64
+ /**
65
+ * `true` to add useZebraStyles striping.
66
+ */
67
+ useZebraStyles: PropTypes.Requireable<boolean>;
68
+ };
69
+ defaultProps: {
70
+ isSortable: boolean;
71
+ overflowMenuOnHover: boolean;
72
+ };
73
+ };
74
+ export default Table;
@@ -30,10 +30,12 @@ var Table = function Table(_ref) {
30
30
  children = _ref.children,
31
31
  useZebraStyles = _ref.useZebraStyles,
32
32
  size = _ref.size,
33
- isSortable = _ref.isSortable,
33
+ _ref$isSortable = _ref.isSortable,
34
+ isSortable = _ref$isSortable === void 0 ? false : _ref$isSortable,
34
35
  useStaticWidth = _ref.useStaticWidth,
35
36
  stickyHeader = _ref.stickyHeader,
36
- overflowMenuOnHover = _ref.overflowMenuOnHover,
37
+ _ref$overflowMenuOnHo = _ref.overflowMenuOnHover,
38
+ overflowMenuOnHover = _ref$overflowMenuOnHo === void 0 ? true : _ref$overflowMenuOnHo,
37
39
  other = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
38
40
 
39
41
  var _useContext = React.useContext(TableContext.TableContext),
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { TdHTMLAttributes } from 'react';
8
+ export type TableCellProps = TdHTMLAttributes<HTMLTableCellElement>;
9
+ declare const TableCell: React.FC<TableCellProps>;
10
+ export default TableCell;
@@ -0,0 +1,13 @@
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
+ interface TableContextType {
9
+ titleId?: string;
10
+ descriptionId?: string;
11
+ }
12
+ export declare const TableContext: import("react").Context<TableContextType>;
13
+ export {};
@@ -12,8 +12,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
12
12
  var React = require('react');
13
13
 
14
14
  var TableContext = /*#__PURE__*/React.createContext({
15
- titleId: null,
16
- descriptionId: null
15
+ titleId: undefined,
16
+ descriptionId: undefined
17
17
  });
18
18
 
19
19
  exports.TableContext = TableContext;
@@ -0,0 +1,67 @@
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 { MouseEventHandler, PropsWithChildren } from 'react';
9
+ import { TableRowProps } from './TableRow';
10
+ interface TableExpandRowProps extends PropsWithChildren<TableRowProps> {
11
+ /**
12
+ * Specify the string read by a voice reader when the expand trigger is
13
+ * focused
14
+ */
15
+ ariaLabel: string;
16
+ /**
17
+ * The id of the matching th node in the table head. Addresses a11y concerns outlined here: https://www.ibm.com/able/guidelines/ci162/info_and_relationships.html and https://www.w3.org/TR/WCAG20-TECHS/H43
18
+ */
19
+ expandHeader?: string;
20
+ /**
21
+ * The description of the chevron right icon, to be put in its SVG `<title>` element.
22
+ */
23
+ expandIconDescription?: string;
24
+ /**
25
+ * Specify whether this row is expanded or not. This helps coordinate data
26
+ * attributes so that `TableExpandRow` and `TableExpandedRow` work together
27
+ */
28
+ isExpanded: boolean;
29
+ /**
30
+ * Hook for when a listener initiates a request to expand the given row
31
+ */
32
+ onExpand: MouseEventHandler<HTMLButtonElement>;
33
+ }
34
+ declare const TableExpandRow: {
35
+ ({ ariaLabel, className: rowClassName, children, isExpanded, onExpand, expandIconDescription, isSelected, expandHeader, ...rest }: TableExpandRowProps): JSX.Element;
36
+ propTypes: {
37
+ /**
38
+ * Specify the string read by a voice reader when the expand trigger is
39
+ * focused
40
+ */
41
+ ariaLabel: PropTypes.Validator<string>;
42
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
43
+ className: PropTypes.Requireable<string>;
44
+ /**
45
+ * The id of the matching th node in the table head. Addresses a11y concerns outlined here: https://www.ibm.com/able/guidelines/ci162/info_and_relationships.html and https://www.w3.org/TR/WCAG20-TECHS/H43
46
+ */
47
+ expandHeader: PropTypes.Requireable<string>;
48
+ /**
49
+ * The description of the chevron right icon, to be put in its SVG `<title>` element.
50
+ */
51
+ expandIconDescription: PropTypes.Requireable<string>;
52
+ /**
53
+ * Specify whether this row is expanded or not. This helps coordinate data
54
+ * attributes so that `TableExpandRow` and `TableExpandedRow` work together
55
+ */
56
+ isExpanded: PropTypes.Validator<boolean>;
57
+ /**
58
+ * Specify if the row is selected
59
+ */
60
+ isSelected: PropTypes.Requireable<boolean>;
61
+ /**
62
+ * Hook for when a listener initiates a request to expand the given row
63
+ */
64
+ onExpand: PropTypes.Validator<(...args: any[]) => any>;
65
+ };
66
+ };
67
+ export default TableExpandRow;