@carbon/react 1.25.0 → 1.26.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.
- package/es/components/Button/Button.js +2 -2
- package/es/components/DataTable/Table.d.ts +74 -0
- package/es/components/DataTable/Table.js +4 -2
- package/es/components/DataTable/TableCell.d.ts +10 -0
- package/es/components/DataTable/TableContext.d.ts +13 -0
- package/es/components/DataTable/TableContext.js +2 -2
- package/es/components/DataTable/TableExpandRow.d.ts +67 -0
- package/es/components/DataTable/TableExpandedRow.d.ts +32 -0
- package/es/components/DataTable/TableHead.d.ts +10 -0
- package/es/components/DataTable/TableHeader.d.ts +64 -0
- package/es/components/DataTable/TableHeader.js +23 -28
- package/es/components/DataTable/TableRow.d.ts +32 -0
- package/es/components/DataTable/TableSelectAll.js +1 -1
- package/es/components/DataTable/TableSelectRow.js +1 -3
- package/es/components/DataTable/TableToolbarContent.d.ts +4 -6
- package/es/components/DataTable/TableToolbarSearch.js +1 -0
- package/es/components/ExpandableSearch/ExpandableSearch.js +1 -0
- package/es/components/FileUploader/FileUploaderButton.js +2 -0
- package/es/components/InlineCheckbox/InlineCheckbox.js +7 -53
- package/es/components/MultiSelect/FilterableMultiSelect.js +15 -7
- package/es/components/MultiSelect/MultiSelect.js +0 -2
- package/es/components/NumberInput/NumberInput.js +9 -1
- package/es/components/RadioButton/RadioButton.Skeleton.d.ts +25 -0
- package/es/components/RadioButton/RadioButton.Skeleton.js +3 -3
- package/es/components/RadioButton/RadioButton.d.ts +64 -0
- package/es/components/RadioButton/RadioButton.js +19 -17
- package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +80 -0
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +84 -25
- package/es/components/Search/Search.Skeleton.d.ts +36 -0
- package/es/components/Search/Search.js +3 -2
- package/es/components/Search/index.js +1 -0
- package/es/components/StructuredList/StructuredList.js +1 -1
- package/es/components/Tabs/Tabs.js +26 -5
- package/es/components/TextInput/TextInput.Skeleton.d.ts +33 -0
- package/es/components/TextInput/index.js +1 -0
- package/es/components/Tile/Tile.js +15 -8
- package/es/components/UIShell/HeaderMenu.js +13 -4
- package/es/components/UIShell/HeaderMenuItem.js +17 -4
- package/es/tools/wrapComponent.js +9 -0
- package/lib/components/Button/Button.js +2 -2
- package/lib/components/DataTable/Table.d.ts +74 -0
- package/lib/components/DataTable/Table.js +4 -2
- package/lib/components/DataTable/TableCell.d.ts +10 -0
- package/lib/components/DataTable/TableContext.d.ts +13 -0
- package/lib/components/DataTable/TableContext.js +2 -2
- package/lib/components/DataTable/TableExpandRow.d.ts +67 -0
- package/lib/components/DataTable/TableExpandedRow.d.ts +32 -0
- package/lib/components/DataTable/TableHead.d.ts +10 -0
- package/lib/components/DataTable/TableHeader.d.ts +64 -0
- package/lib/components/DataTable/TableHeader.js +23 -28
- package/lib/components/DataTable/TableRow.d.ts +32 -0
- package/lib/components/DataTable/TableSelectAll.js +1 -1
- package/lib/components/DataTable/TableSelectRow.js +1 -3
- package/lib/components/DataTable/TableToolbarContent.d.ts +4 -6
- package/lib/components/DataTable/TableToolbarSearch.js +1 -0
- package/lib/components/ExpandableSearch/ExpandableSearch.js +1 -0
- package/lib/components/FileUploader/FileUploaderButton.js +2 -0
- package/lib/components/InlineCheckbox/InlineCheckbox.js +7 -53
- package/lib/components/MultiSelect/FilterableMultiSelect.js +14 -6
- package/lib/components/MultiSelect/MultiSelect.js +0 -2
- package/lib/components/NumberInput/NumberInput.js +9 -1
- package/lib/components/RadioButton/RadioButton.Skeleton.d.ts +25 -0
- package/lib/components/RadioButton/RadioButton.Skeleton.js +3 -3
- package/lib/components/RadioButton/RadioButton.d.ts +64 -0
- package/lib/components/RadioButton/RadioButton.js +18 -16
- package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +80 -0
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +83 -24
- package/lib/components/Search/Search.Skeleton.d.ts +36 -0
- package/lib/components/Search/Search.js +3 -2
- package/lib/components/Search/index.js +2 -0
- package/lib/components/StructuredList/StructuredList.js +1 -1
- package/lib/components/Tabs/Tabs.js +26 -5
- package/lib/components/TextInput/TextInput.Skeleton.d.ts +33 -0
- package/lib/components/TextInput/index.js +2 -0
- package/lib/components/Tile/Tile.js +15 -8
- package/lib/components/UIShell/HeaderMenu.js +13 -4
- package/lib/components/UIShell/HeaderMenuItem.js +17 -4
- package/lib/tools/wrapComponent.js +9 -0
- package/package.json +3 -3
|
@@ -0,0 +1,36 @@
|
|
|
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 SearchSkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Specify an optional className to add.
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Specify whether the Search should be a small variant.
|
|
16
|
+
*/
|
|
17
|
+
small?: boolean;
|
|
18
|
+
}
|
|
19
|
+
declare const SearchSkeleton: {
|
|
20
|
+
({ small, className, ...rest }: SearchSkeletonProps): JSX.Element;
|
|
21
|
+
propTypes: {
|
|
22
|
+
/**
|
|
23
|
+
* Specify an optional className to add.
|
|
24
|
+
*/
|
|
25
|
+
className: PropTypes.Requireable<string>;
|
|
26
|
+
/**
|
|
27
|
+
* Specify whether the Search should be a small variant
|
|
28
|
+
*/
|
|
29
|
+
small: PropTypes.Requireable<boolean>;
|
|
30
|
+
};
|
|
31
|
+
defaultProps: {
|
|
32
|
+
small: boolean;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export default SearchSkeleton;
|
|
36
|
+
export { SearchSkeleton };
|
|
@@ -54,7 +54,7 @@ var Search = /*#__PURE__*/React__default["default"].forwardRef(function Search(_
|
|
|
54
54
|
onKeyDown = _ref.onKeyDown,
|
|
55
55
|
onExpand = _ref.onExpand,
|
|
56
56
|
_ref$placeholder = _ref.placeholder,
|
|
57
|
-
placeholder = _ref$placeholder === void 0 ? '' : _ref$placeholder,
|
|
57
|
+
placeholder = _ref$placeholder === void 0 ? 'Search' : _ref$placeholder,
|
|
58
58
|
renderIcon = _ref.renderIcon,
|
|
59
59
|
_ref$role = _ref.role,
|
|
60
60
|
role = _ref$role === void 0 ? 'searchbox' : _ref$role,
|
|
@@ -125,9 +125,10 @@ var Search = /*#__PURE__*/React__default["default"].forwardRef(function Search(_
|
|
|
125
125
|
|
|
126
126
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
127
127
|
role: "search",
|
|
128
|
-
"aria-
|
|
128
|
+
"aria-label": placeholder,
|
|
129
129
|
className: searchClasses
|
|
130
130
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
131
|
+
"aria-labelledby": uniqueId,
|
|
131
132
|
role: onExpand ? 'button' : null,
|
|
132
133
|
className: "".concat(prefix, "--search-magnifier"),
|
|
133
134
|
onClick: onExpand
|
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
12
|
var Search = require('./Search.js');
|
|
13
|
+
var Search_Skeleton = require('./Search.Skeleton.js');
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
exports.Search = Search["default"];
|
|
17
18
|
exports["default"] = Search["default"];
|
|
19
|
+
exports.SearchSkeleton = Search_Skeleton["default"];
|
|
@@ -256,7 +256,7 @@ StructuredListInput.propTypes = {
|
|
|
256
256
|
/**
|
|
257
257
|
* Provide an optional hook that is called each time the input is updated
|
|
258
258
|
*/
|
|
259
|
-
onChange:
|
|
259
|
+
onChange: PropTypes__default["default"].func,
|
|
260
260
|
|
|
261
261
|
/**
|
|
262
262
|
* Provide a `title` for the input
|
|
@@ -39,7 +39,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
39
39
|
var _ChevronLeft, _ChevronRight;
|
|
40
40
|
|
|
41
41
|
var _excluded = ["activation", "aria-label", "children", "className", "contained", "iconSize", "leftOverflowButtonProps", "light", "rightOverflowButtonProps", "scrollDebounceWait", "scrollIntoView"],
|
|
42
|
-
_excluded2 = ["as", "children", "className", "disabled", "onClick", "onKeyDown"],
|
|
42
|
+
_excluded2 = ["as", "children", "className", "disabled", "onClick", "onKeyDown", "secondaryLabel", "hasSecondaryLabel"],
|
|
43
43
|
_excluded3 = ["children", "className", "defaultOpen", "enterDelayMs", "leaveDelayMs", "label"],
|
|
44
44
|
_excluded4 = ["children", "className"];
|
|
45
45
|
|
|
@@ -177,7 +177,10 @@ function TabList(_ref2) {
|
|
|
177
177
|
scrollLeft = _useState6[0],
|
|
178
178
|
setScrollLeft = _useState6[1];
|
|
179
179
|
|
|
180
|
-
var
|
|
180
|
+
var hasSecondaryLabelTabs = contained && !!React__default["default"].Children.toArray(children).filter(function (child) {
|
|
181
|
+
return child.props.secondaryLabel;
|
|
182
|
+
}).length;
|
|
183
|
+
var className = cx__default["default"]("".concat(prefix, "--tabs"), customClassName, (_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--tabs--contained"), contained), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--tabs--light"), light), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--tabs__icon--default"), iconSize === 'default'), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--tabs__icon--lg"), iconSize === 'lg'), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--tabs--tall"), hasSecondaryLabelTabs), _cx)); // Previous Button
|
|
181
184
|
// VISIBLE IF:
|
|
182
185
|
// SCROLLABLE
|
|
183
186
|
// AND SCROLL_LEFT > 0
|
|
@@ -337,7 +340,8 @@ function TabList(_ref2) {
|
|
|
337
340
|
}, /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
338
341
|
ref: function ref(node) {
|
|
339
342
|
tabs.current[index] = node;
|
|
340
|
-
}
|
|
343
|
+
},
|
|
344
|
+
hasSecondaryLabel: hasSecondaryLabelTabs
|
|
341
345
|
}));
|
|
342
346
|
})), /*#__PURE__*/React__default["default"].createElement("button", _rollupPluginBabelHelpers["extends"]({
|
|
343
347
|
"aria-hidden": "true",
|
|
@@ -462,6 +466,8 @@ var Tab = /*#__PURE__*/React__default["default"].forwardRef(function Tab(_ref5,
|
|
|
462
466
|
disabled = _ref5.disabled,
|
|
463
467
|
_onClick = _ref5.onClick,
|
|
464
468
|
onKeyDown = _ref5.onKeyDown,
|
|
469
|
+
secondaryLabel = _ref5.secondaryLabel,
|
|
470
|
+
hasSecondaryLabel = _ref5.hasSecondaryLabel,
|
|
465
471
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref5, _excluded2);
|
|
466
472
|
|
|
467
473
|
var prefix = usePrefix.usePrefix();
|
|
@@ -498,7 +504,11 @@ var Tab = /*#__PURE__*/React__default["default"].forwardRef(function Tab(_ref5,
|
|
|
498
504
|
onKeyDown: onKeyDown,
|
|
499
505
|
tabIndex: selectedIndex === index ? '0' : '-1',
|
|
500
506
|
type: "button"
|
|
501
|
-
}),
|
|
507
|
+
}), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
508
|
+
className: "".concat(prefix, "--tabs__nav-item-label")
|
|
509
|
+
}, children), hasSecondaryLabel && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
510
|
+
className: "".concat(prefix, "--tabs__nav-item-secondary-label")
|
|
511
|
+
}, secondaryLabel));
|
|
502
512
|
});
|
|
503
513
|
Tab.propTypes = {
|
|
504
514
|
/**
|
|
@@ -521,6 +531,11 @@ Tab.propTypes = {
|
|
|
521
531
|
*/
|
|
522
532
|
disabled: PropTypes__default["default"].bool,
|
|
523
533
|
|
|
534
|
+
/*
|
|
535
|
+
* Internal use only, determines wether a tab should render as a secondary label tab
|
|
536
|
+
**/
|
|
537
|
+
hasSecondaryLabel: PropTypes__default["default"].bool,
|
|
538
|
+
|
|
524
539
|
/**
|
|
525
540
|
* Provide a handler that is invoked when a user clicks on the control
|
|
526
541
|
*/
|
|
@@ -536,7 +551,13 @@ Tab.propTypes = {
|
|
|
536
551
|
* Useful for using Tab along with react-router or other client
|
|
537
552
|
* side router libraries.
|
|
538
553
|
**/
|
|
539
|
-
renderButton: PropTypes__default["default"].func
|
|
554
|
+
renderButton: PropTypes__default["default"].func,
|
|
555
|
+
|
|
556
|
+
/*
|
|
557
|
+
* An optional label to render under the primary tab label.
|
|
558
|
+
/* This prop is only useful for conained tabs
|
|
559
|
+
**/
|
|
560
|
+
secondaryLabel: PropTypes__default["default"].string
|
|
540
561
|
};
|
|
541
562
|
var IconTab = /*#__PURE__*/React__default["default"].forwardRef(function IconTab(_ref6, ref) {
|
|
542
563
|
var children = _ref6.children,
|
|
@@ -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(
|
|
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(
|
|
449
|
+
if (!useNoInteractiveChildren.getInteractiveContent(belowTheFold.current)) {
|
|
450
|
+
setInteractive(false);
|
|
444
451
|
return;
|
|
445
|
-
} else if (useNoInteractiveChildren.getInteractiveContent(aboveTheFold.current)) {
|
|
446
|
-
setInteractive(
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
4
|
+
"version": "1.26.0-rc.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.
|
|
49
|
+
"@carbon/styles": "^1.26.0-rc.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": "
|
|
136
|
+
"gitHead": "14c6f7442f8915d508a0bada49bb05e0cac8464c"
|
|
137
137
|
}
|