@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,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 };
@@ -13,6 +13,7 @@ var deprecateFieldOnObject = require('../../internal/deprecateFieldOnObject.js')
13
13
  var ControlledPasswordInput = require('./ControlledPasswordInput.js');
14
14
  var PasswordInput = require('./PasswordInput.js');
15
15
  var TextInput = require('./TextInput.js');
16
+ var TextInput_Skeleton = require('./TextInput.Skeleton.js');
16
17
 
17
18
  TextInput["default"].ControlledPasswordInput = ControlledPasswordInput["default"];
18
19
  TextInput["default"].PasswordInput = PasswordInput["default"];
@@ -24,3 +25,4 @@ if (process.env.NODE_ENV !== "production") {
24
25
 
25
26
  exports.TextInput = TextInput["default"];
26
27
  exports["default"] = TextInput["default"];
28
+ exports.TextInputSkeleton = TextInput_Skeleton["default"];
@@ -32,7 +32,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
32
32
  var _CheckboxCheckedFille, _Checkbox, _ChevronDown, _ChevronDown2;
33
33
 
34
34
  var _excluded = ["children", "className", "light"],
35
- _excluded2 = ["children", "className", "clicked", "href", "light", "onClick", "onKeyDown"],
35
+ _excluded2 = ["children", "className", "clicked", "disabled", "href", "light", "onClick", "onKeyDown"],
36
36
  _excluded3 = ["children", "className", "disabled", "id", "light", "name", "onClick", "onChange", "onKeyDown", "selected", "tabIndex", "title", "value"],
37
37
  _excluded4 = ["tabIndex", "className", "children", "expanded", "tileMaxHeight", "tilePadding", "onClick", "onKeyUp", "tileCollapsedIconText", "tileExpandedIconText", "tileCollapsedLabel", "tileExpandedLabel", "light"];
38
38
  var Tile = /*#__PURE__*/React__default["default"].forwardRef(function Tile(_ref, ref) {
@@ -74,6 +74,7 @@ var ClickableTile = /*#__PURE__*/React__default["default"].forwardRef(function C
74
74
  className = _ref2.className,
75
75
  _ref2$clicked = _ref2.clicked,
76
76
  clicked = _ref2$clicked === void 0 ? false : _ref2$clicked,
77
+ disabled = _ref2.disabled,
77
78
  href = _ref2.href,
78
79
  light = _ref2.light,
79
80
  _ref2$onClick = _ref2.onClick,
@@ -111,9 +112,10 @@ var ClickableTile = /*#__PURE__*/React__default["default"].forwardRef(function C
111
112
  return /*#__PURE__*/React__default["default"].createElement(Link["default"], _rollupPluginBabelHelpers["extends"]({
112
113
  className: classes,
113
114
  href: href,
114
- onClick: handleOnClick,
115
+ onClick: !disabled ? handleOnClick : null,
115
116
  onKeyDown: handleOnKeyDown,
116
- ref: ref
117
+ ref: ref,
118
+ disabled: disabled
117
119
  }, rest), children);
118
120
  });
119
121
  ClickableTile.displayName = 'ClickableTile';
@@ -133,6 +135,11 @@ ClickableTile.propTypes = {
133
135
  */
134
136
  clicked: PropTypes__default["default"].bool,
135
137
 
138
+ /**
139
+ * Specify whether the ClickableTile should be disabled
140
+ */
141
+ disabled: PropTypes__default["default"].bool,
142
+
136
143
  /**
137
144
  * The href for the link.
138
145
  */
@@ -369,7 +376,7 @@ function ExpandableTile(_ref4) {
369
376
  isExpanded = _useState18[0],
370
377
  setIsExpanded = _useState18[1];
371
378
 
372
- var _useState19 = React.useState(false),
379
+ var _useState19 = React.useState(true),
373
380
  _useState20 = _rollupPluginBabelHelpers.slicedToArray(_useState19, 2),
374
381
  interactive = _useState20[0],
375
382
  setInteractive = _useState20[1];
@@ -439,11 +446,11 @@ function ExpandableTile(_ref4) {
439
446
  setIsTilePadding(paddingTop + paddingBottom);
440
447
  }, [isTileMaxHeight]);
441
448
  useIsomorphicEffect["default"](function () {
442
- if (useNoInteractiveChildren.getInteractiveContent(belowTheFold.current)) {
443
- setInteractive(true);
449
+ if (!useNoInteractiveChildren.getInteractiveContent(belowTheFold.current)) {
450
+ setInteractive(false);
444
451
  return;
445
- } else if (useNoInteractiveChildren.getInteractiveContent(aboveTheFold.current)) {
446
- setInteractive(true);
452
+ } else if (!useNoInteractiveChildren.getInteractiveContent(aboveTheFold.current)) {
453
+ setInteractive(false);
447
454
  }
448
455
  }, []);
449
456
  useIsomorphicEffect["default"](function () {
@@ -16,6 +16,7 @@ var React = require('react');
16
16
  var PropTypes = require('prop-types');
17
17
  var AriaPropTypes = require('../../prop-types/AriaPropTypes.js');
18
18
  var usePrefix = require('../../internal/usePrefix.js');
19
+ var deprecate = require('../../prop-types/deprecate.js');
19
20
  var match = require('../../internal/keyboard/match.js');
20
21
  var keys = require('../../internal/keyboard/keys.js');
21
22
 
@@ -25,7 +26,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
25
26
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
26
27
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
27
28
 
28
- var _excluded = ["isCurrentPage", "aria-label", "aria-labelledby", "className", "children", "renderMenuContent", "menuLinkName", "focusRef"];
29
+ var _excluded = ["isActive", "isCurrentPage", "aria-label", "aria-labelledby", "className", "children", "renderMenuContent", "menuLinkName", "focusRef"];
29
30
  /**
30
31
  * `HeaderMenu` is used to render submenu's in the `Header`. Most often children
31
32
  * will be a `HeaderMenuItem`. It handles certain keyboard events to help
@@ -159,6 +160,7 @@ var HeaderMenu = /*#__PURE__*/function (_React$Component) {
159
160
  var prefix = this.context;
160
161
 
161
162
  var _this$props = this.props,
163
+ isActive = _this$props.isActive,
162
164
  isCurrentPage = _this$props.isCurrentPage,
163
165
  ariaLabel = _this$props['aria-label'],
164
166
  ariaLabelledBy = _this$props['aria-labelledby'],
@@ -174,7 +176,8 @@ var HeaderMenu = /*#__PURE__*/function (_React$Component) {
174
176
  'aria-labelledby': ariaLabelledBy
175
177
  };
176
178
  var itemClassName = cx__default["default"]((_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--header__submenu"), true), _rollupPluginBabelHelpers.defineProperty(_cx, customClassName, !!customClassName), _cx));
177
- var linkClassName = cx__default["default"]((_cx2 = {}, _rollupPluginBabelHelpers.defineProperty(_cx2, "".concat(prefix, "--header__menu-item"), true), _rollupPluginBabelHelpers.defineProperty(_cx2, "".concat(prefix, "--header__menu-title"), true), _rollupPluginBabelHelpers.defineProperty(_cx2, "".concat(prefix, "--header__menu-item--current"), isCurrentPage), _cx2)); // Notes on eslint comments and based on the examples in:
179
+ var isActivePage = isActive ? isActive : isCurrentPage;
180
+ var linkClassName = cx__default["default"]((_cx2 = {}, _rollupPluginBabelHelpers.defineProperty(_cx2, "".concat(prefix, "--header__menu-item"), true), _rollupPluginBabelHelpers.defineProperty(_cx2, "".concat(prefix, "--header__menu-title"), true), _rollupPluginBabelHelpers.defineProperty(_cx2, "".concat(prefix, "--header__menu-item--current"), isActivePage), _cx2)); // Notes on eslint comments and based on the examples in:
178
181
  // https://www.w3.org/TR/wai-aria-practices/examples/menubar/menubar-1/menubar-1.html#
179
182
  // - The focus is handled by the <a> menuitem, onMouseOver is for mouse
180
183
  // users
@@ -228,9 +231,15 @@ _rollupPluginBabelHelpers.defineProperty(HeaderMenu, "propTypes", _rollupPluginB
228
231
  focusRef: PropTypes__default["default"].func,
229
232
 
230
233
  /**
231
- * Applies selected styles to the item if a user sets this to true and aria-current !== 'page'.
234
+ * Applies selected styles to the item if a user sets this to true and `aria-current !== 'page'`.
232
235
  */
233
- isCurrentPage: PropTypes__default["default"].bool,
236
+ isActive: PropTypes__default["default"].bool,
237
+
238
+ /**
239
+ * Applies selected styles to the item if a user sets this to true and `aria-current !== 'page'`.
240
+ * @deprecated Please use `isActive` instead. This will be removed in the next major release.
241
+ */
242
+ isCurrentPage: deprecate["default"](PropTypes__default["default"].bool, 'The `isCurrentPage` prop for `HeaderMenu` has ' + 'been deprecated. Please use `isActive` instead. This will be removed in the next major release.'),
234
243
 
235
244
  /**
236
245
  * Provide a label for the link text
@@ -15,6 +15,7 @@ var React = require('react');
15
15
  var cx = require('classnames');
16
16
  var Link = require('./Link.js');
17
17
  var usePrefix = require('../../internal/usePrefix.js');
18
+ var deprecate = require('../../prop-types/deprecate.js');
18
19
 
19
20
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
20
21
 
@@ -22,11 +23,12 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
22
23
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
23
24
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
24
25
 
25
- var _excluded = ["className", "isCurrentPage", "aria-current", "children", "role", "tabIndex"];
26
+ var _excluded = ["className", "isActive", "isCurrentPage", "aria-current", "children", "role", "tabIndex"];
26
27
  var HeaderMenuItem = /*#__PURE__*/React__default["default"].forwardRef(function HeaderMenuItem(_ref, ref) {
27
28
  var _cx;
28
29
 
29
30
  var className = _ref.className,
31
+ isActive = _ref.isActive,
30
32
  isCurrentPage = _ref.isCurrentPage,
31
33
  ariaCurrent = _ref['aria-current'],
32
34
  children = _ref.children,
@@ -36,7 +38,12 @@ var HeaderMenuItem = /*#__PURE__*/React__default["default"].forwardRef(function
36
38
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
37
39
 
38
40
  var prefix = usePrefix.usePrefix();
39
- var linkClassName = cx__default["default"]((_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--header__menu-item"), true), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--header__menu-item--current"), isCurrentPage && ariaCurrent !== 'page'), _cx));
41
+
42
+ if (isCurrentPage) {
43
+ isActive = isCurrentPage;
44
+ }
45
+
46
+ var linkClassName = cx__default["default"]((_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--header__menu-item"), true), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--header__menu-item--current"), isActive && ariaCurrent !== 'page'), _cx));
40
47
  return /*#__PURE__*/React__default["default"].createElement("li", {
41
48
  className: className,
42
49
  role: role
@@ -63,9 +70,15 @@ HeaderMenuItem.propTypes = _rollupPluginBabelHelpers.objectSpread2(_rollupPlugin
63
70
  className: PropTypes__default["default"].string,
64
71
 
65
72
  /**
66
- * Applies selected styles to the item if a user sets this to true and aria-current !== 'page'.
73
+ * Applies selected styles to the item if a user sets this to true and `aria-current !== 'page'`.
74
+ */
75
+ isActive: PropTypes__default["default"].bool,
76
+
77
+ /**
78
+ * Applies selected styles to the item if a user sets this to true and `aria-current !== 'page'`.
79
+ * @deprecated Please use `isActive` instead. This will be removed in the next major release.
67
80
  */
68
- isCurrentPage: PropTypes__default["default"].bool,
81
+ isCurrentPage: deprecate["default"](PropTypes__default["default"].bool, 'The `isCurrentPage` prop for `HeaderMenuItem` has ' + 'been deprecated. Please use `isActive` instead. This will be removed in the next major release.'),
69
82
 
70
83
  /**
71
84
  * Optionally supply a role for the underlying `<li>` node. Useful for resetting
@@ -22,12 +22,21 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
22
22
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
23
23
 
24
24
  var _excluded = ["className"];
25
+ /**
26
+ * @param {{ name: string, type: string, className?: string | (prefix: string) => string }} props
27
+ * @returns
28
+ */
25
29
 
26
30
  var wrapComponent = function wrapComponent(_ref) {
27
31
  var name = _ref.name,
28
32
  getClassName = _ref.className,
29
33
  type = _ref.type;
30
34
 
35
+ /**
36
+ *
37
+ * @param {{ className?: string, [x: string]: any}} param0
38
+ * @returns
39
+ */
31
40
  function Component(_ref2) {
32
41
  var baseClassName = _ref2.className,
33
42
  other = _rollupPluginBabelHelpers.objectWithoutProperties(_ref2, _excluded);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/react",
3
3
  "description": "React components for the Carbon Design System",
4
- "version": "1.25.0",
4
+ "version": "1.26.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -46,7 +46,7 @@
46
46
  "@carbon/feature-flags": "^0.13.0",
47
47
  "@carbon/icons-react": "^11.17.0",
48
48
  "@carbon/layout": "^11.12.0",
49
- "@carbon/styles": "^1.25.0",
49
+ "@carbon/styles": "^1.26.0",
50
50
  "@carbon/telemetry": "0.1.0",
51
51
  "classnames": "2.3.2",
52
52
  "copy-to-clipboard": "^3.3.1",
@@ -133,5 +133,5 @@
133
133
  "**/*.scss",
134
134
  "**/*.css"
135
135
  ],
136
- "gitHead": "47966b102beb1310c23bb0fc914a22f639dc08d6"
136
+ "gitHead": "a95ac1dfed8959765c963e5dbec340694cb60b57"
137
137
  }