@carbon/react 1.27.0-rc.0 → 1.27.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.
|
@@ -49,7 +49,7 @@ var RadioTile = /*#__PURE__*/React__default.forwardRef(function RadioTile(_ref,
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
return /*#__PURE__*/React__default.createElement(
|
|
52
|
+
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("input", {
|
|
53
53
|
checked: checked,
|
|
54
54
|
className: "".concat(prefix, "--tile-input"),
|
|
55
55
|
disabled: disabled,
|
|
@@ -28,7 +28,7 @@ import { ArrowRight, ArrowLeft, Home, End } from '../../internal/keyboard/keys.j
|
|
|
28
28
|
var _ChevronLeft, _ChevronRight;
|
|
29
29
|
|
|
30
30
|
var _excluded = ["activation", "aria-label", "children", "className", "contained", "iconSize", "leftOverflowButtonProps", "light", "rightOverflowButtonProps", "scrollDebounceWait", "scrollIntoView"],
|
|
31
|
-
_excluded2 = ["as", "children", "className", "disabled", "onClick", "onKeyDown", "secondaryLabel", "
|
|
31
|
+
_excluded2 = ["as", "children", "className", "disabled", "onClick", "onKeyDown", "secondaryLabel", "renderIcon"],
|
|
32
32
|
_excluded3 = ["children", "className", "defaultOpen", "enterDelayMs", "leaveDelayMs", "label"],
|
|
33
33
|
_excluded4 = ["children", "className"];
|
|
34
34
|
|
|
@@ -325,12 +325,14 @@ function TabList(_ref2) {
|
|
|
325
325
|
onKeyDown: onKeyDown
|
|
326
326
|
}), React__default.Children.map(children, function (child, index) {
|
|
327
327
|
return /*#__PURE__*/React__default.createElement(TabContext.Provider, {
|
|
328
|
-
value:
|
|
328
|
+
value: {
|
|
329
|
+
index: index,
|
|
330
|
+
hasSecondaryLabel: hasSecondaryLabelTabs
|
|
331
|
+
}
|
|
329
332
|
}, /*#__PURE__*/React__default.cloneElement(child, {
|
|
330
333
|
ref: function ref(node) {
|
|
331
334
|
tabs.current[index] = node;
|
|
332
|
-
}
|
|
333
|
-
hasSecondaryLabel: hasSecondaryLabelTabs
|
|
335
|
+
}
|
|
334
336
|
}));
|
|
335
337
|
})), /*#__PURE__*/React__default.createElement("button", _extends({
|
|
336
338
|
"aria-hidden": "true",
|
|
@@ -456,7 +458,7 @@ var Tab = /*#__PURE__*/React__default.forwardRef(function Tab(_ref5, ref) {
|
|
|
456
458
|
_onClick = _ref5.onClick,
|
|
457
459
|
onKeyDown = _ref5.onKeyDown,
|
|
458
460
|
secondaryLabel = _ref5.secondaryLabel,
|
|
459
|
-
|
|
461
|
+
Icon = _ref5.renderIcon,
|
|
460
462
|
rest = _objectWithoutProperties(_ref5, _excluded2);
|
|
461
463
|
|
|
462
464
|
var prefix = usePrefix();
|
|
@@ -466,7 +468,10 @@ var Tab = /*#__PURE__*/React__default.forwardRef(function Tab(_ref5, ref) {
|
|
|
466
468
|
setSelectedIndex = _React$useContext2.setSelectedIndex,
|
|
467
469
|
baseId = _React$useContext2.baseId;
|
|
468
470
|
|
|
469
|
-
var
|
|
471
|
+
var _React$useContext3 = React__default.useContext(TabContext),
|
|
472
|
+
index = _React$useContext3.index,
|
|
473
|
+
hasSecondaryLabel = _React$useContext3.hasSecondaryLabel;
|
|
474
|
+
|
|
470
475
|
var id = "".concat(baseId, "-tab-").concat(index);
|
|
471
476
|
var panelId = "".concat(baseId, "-tabpanel-").concat(index);
|
|
472
477
|
var className = cx("".concat(prefix, "--tabs__nav-item"), "".concat(prefix, "--tabs__nav-link"), customClassName, (_cx4 = {}, _defineProperty(_cx4, "".concat(prefix, "--tabs__nav-item--selected"), selectedIndex === index), _defineProperty(_cx4, "".concat(prefix, "--tabs__nav-item--disabled"), disabled), _cx4));
|
|
@@ -493,9 +498,15 @@ var Tab = /*#__PURE__*/React__default.forwardRef(function Tab(_ref5, ref) {
|
|
|
493
498
|
onKeyDown: onKeyDown,
|
|
494
499
|
tabIndex: selectedIndex === index ? '0' : '-1',
|
|
495
500
|
type: "button"
|
|
496
|
-
}), /*#__PURE__*/React__default.createElement("
|
|
501
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
502
|
+
className: "".concat(prefix, "--tabs__nav-item-label-wrapper")
|
|
503
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
497
504
|
className: "".concat(prefix, "--tabs__nav-item-label")
|
|
498
|
-
}, children),
|
|
505
|
+
}, children), Icon && /*#__PURE__*/React__default.createElement("div", {
|
|
506
|
+
className: "".concat(prefix, "--tabs__nav-item--icon")
|
|
507
|
+
}, /*#__PURE__*/React__default.createElement(Icon, {
|
|
508
|
+
size: 16
|
|
509
|
+
}))), hasSecondaryLabel && /*#__PURE__*/React__default.createElement("div", {
|
|
499
510
|
className: "".concat(prefix, "--tabs__nav-item-secondary-label")
|
|
500
511
|
}, secondaryLabel));
|
|
501
512
|
});
|
|
@@ -520,11 +531,6 @@ Tab.propTypes = {
|
|
|
520
531
|
*/
|
|
521
532
|
disabled: PropTypes.bool,
|
|
522
533
|
|
|
523
|
-
/*
|
|
524
|
-
* Internal use only, determines wether a tab should render as a secondary label tab
|
|
525
|
-
**/
|
|
526
|
-
hasSecondaryLabel: PropTypes.bool,
|
|
527
|
-
|
|
528
534
|
/**
|
|
529
535
|
* Provide a handler that is invoked when a user clicks on the control
|
|
530
536
|
*/
|
|
@@ -542,6 +548,12 @@ Tab.propTypes = {
|
|
|
542
548
|
**/
|
|
543
549
|
renderButton: PropTypes.func,
|
|
544
550
|
|
|
551
|
+
/**
|
|
552
|
+
* Optional prop to render an icon next to the label.
|
|
553
|
+
* Can be a React component class
|
|
554
|
+
*/
|
|
555
|
+
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
556
|
+
|
|
545
557
|
/*
|
|
546
558
|
* An optional label to render under the primary tab label.
|
|
547
559
|
/* This prop is only useful for conained tabs
|
|
@@ -559,7 +571,7 @@ var IconTab = /*#__PURE__*/React__default.forwardRef(function IconTab(_ref6, ref
|
|
|
559
571
|
rest = _objectWithoutProperties(_ref6, _excluded3);
|
|
560
572
|
|
|
561
573
|
var prefix = usePrefix();
|
|
562
|
-
var classNames = cx("".concat(prefix, "--tabs__nav-item--icon"), customClassName);
|
|
574
|
+
var classNames = cx("".concat(prefix, "--tabs__nav-item--icon-only"), customClassName);
|
|
563
575
|
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
564
576
|
align: "bottom",
|
|
565
577
|
defaultOpen: defaultOpen,
|
|
@@ -625,9 +637,9 @@ var TabPanel = /*#__PURE__*/React__default.forwardRef(function TabPanel(_ref7, f
|
|
|
625
637
|
interactiveContent = _useState10[0],
|
|
626
638
|
setInteractiveContent = _useState10[1];
|
|
627
639
|
|
|
628
|
-
var _React$
|
|
629
|
-
selectedIndex = _React$
|
|
630
|
-
baseId = _React$
|
|
640
|
+
var _React$useContext4 = React__default.useContext(TabsContext),
|
|
641
|
+
selectedIndex = _React$useContext4.selectedIndex,
|
|
642
|
+
baseId = _React$useContext4.baseId;
|
|
631
643
|
|
|
632
644
|
var index = React__default.useContext(TabPanelContext);
|
|
633
645
|
var id = "".concat(baseId, "-tabpanel-").concat(index);
|
|
@@ -59,7 +59,7 @@ var RadioTile = /*#__PURE__*/React__default["default"].forwardRef(function Radio
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
return /*#__PURE__*/React__default["default"].createElement(
|
|
62
|
+
return /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("input", {
|
|
63
63
|
checked: checked,
|
|
64
64
|
className: "".concat(prefix, "--tile-input"),
|
|
65
65
|
disabled: disabled,
|
|
@@ -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", "secondaryLabel", "
|
|
42
|
+
_excluded2 = ["as", "children", "className", "disabled", "onClick", "onKeyDown", "secondaryLabel", "renderIcon"],
|
|
43
43
|
_excluded3 = ["children", "className", "defaultOpen", "enterDelayMs", "leaveDelayMs", "label"],
|
|
44
44
|
_excluded4 = ["children", "className"];
|
|
45
45
|
|
|
@@ -336,12 +336,14 @@ function TabList(_ref2) {
|
|
|
336
336
|
onKeyDown: onKeyDown
|
|
337
337
|
}), React__default["default"].Children.map(children, function (child, index) {
|
|
338
338
|
return /*#__PURE__*/React__default["default"].createElement(TabContext.Provider, {
|
|
339
|
-
value:
|
|
339
|
+
value: {
|
|
340
|
+
index: index,
|
|
341
|
+
hasSecondaryLabel: hasSecondaryLabelTabs
|
|
342
|
+
}
|
|
340
343
|
}, /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
341
344
|
ref: function ref(node) {
|
|
342
345
|
tabs.current[index] = node;
|
|
343
|
-
}
|
|
344
|
-
hasSecondaryLabel: hasSecondaryLabelTabs
|
|
346
|
+
}
|
|
345
347
|
}));
|
|
346
348
|
})), /*#__PURE__*/React__default["default"].createElement("button", _rollupPluginBabelHelpers["extends"]({
|
|
347
349
|
"aria-hidden": "true",
|
|
@@ -467,7 +469,7 @@ var Tab = /*#__PURE__*/React__default["default"].forwardRef(function Tab(_ref5,
|
|
|
467
469
|
_onClick = _ref5.onClick,
|
|
468
470
|
onKeyDown = _ref5.onKeyDown,
|
|
469
471
|
secondaryLabel = _ref5.secondaryLabel,
|
|
470
|
-
|
|
472
|
+
Icon = _ref5.renderIcon,
|
|
471
473
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref5, _excluded2);
|
|
472
474
|
|
|
473
475
|
var prefix = usePrefix.usePrefix();
|
|
@@ -477,7 +479,10 @@ var Tab = /*#__PURE__*/React__default["default"].forwardRef(function Tab(_ref5,
|
|
|
477
479
|
setSelectedIndex = _React$useContext2.setSelectedIndex,
|
|
478
480
|
baseId = _React$useContext2.baseId;
|
|
479
481
|
|
|
480
|
-
var
|
|
482
|
+
var _React$useContext3 = React__default["default"].useContext(TabContext),
|
|
483
|
+
index = _React$useContext3.index,
|
|
484
|
+
hasSecondaryLabel = _React$useContext3.hasSecondaryLabel;
|
|
485
|
+
|
|
481
486
|
var id = "".concat(baseId, "-tab-").concat(index);
|
|
482
487
|
var panelId = "".concat(baseId, "-tabpanel-").concat(index);
|
|
483
488
|
var className = cx__default["default"]("".concat(prefix, "--tabs__nav-item"), "".concat(prefix, "--tabs__nav-link"), customClassName, (_cx4 = {}, _rollupPluginBabelHelpers.defineProperty(_cx4, "".concat(prefix, "--tabs__nav-item--selected"), selectedIndex === index), _rollupPluginBabelHelpers.defineProperty(_cx4, "".concat(prefix, "--tabs__nav-item--disabled"), disabled), _cx4));
|
|
@@ -504,9 +509,15 @@ var Tab = /*#__PURE__*/React__default["default"].forwardRef(function Tab(_ref5,
|
|
|
504
509
|
onKeyDown: onKeyDown,
|
|
505
510
|
tabIndex: selectedIndex === index ? '0' : '-1',
|
|
506
511
|
type: "button"
|
|
507
|
-
}), /*#__PURE__*/React__default["default"].createElement("
|
|
512
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
513
|
+
className: "".concat(prefix, "--tabs__nav-item-label-wrapper")
|
|
514
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
508
515
|
className: "".concat(prefix, "--tabs__nav-item-label")
|
|
509
|
-
}, children),
|
|
516
|
+
}, children), Icon && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
517
|
+
className: "".concat(prefix, "--tabs__nav-item--icon")
|
|
518
|
+
}, /*#__PURE__*/React__default["default"].createElement(Icon, {
|
|
519
|
+
size: 16
|
|
520
|
+
}))), hasSecondaryLabel && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
510
521
|
className: "".concat(prefix, "--tabs__nav-item-secondary-label")
|
|
511
522
|
}, secondaryLabel));
|
|
512
523
|
});
|
|
@@ -531,11 +542,6 @@ Tab.propTypes = {
|
|
|
531
542
|
*/
|
|
532
543
|
disabled: PropTypes__default["default"].bool,
|
|
533
544
|
|
|
534
|
-
/*
|
|
535
|
-
* Internal use only, determines wether a tab should render as a secondary label tab
|
|
536
|
-
**/
|
|
537
|
-
hasSecondaryLabel: PropTypes__default["default"].bool,
|
|
538
|
-
|
|
539
545
|
/**
|
|
540
546
|
* Provide a handler that is invoked when a user clicks on the control
|
|
541
547
|
*/
|
|
@@ -553,6 +559,12 @@ Tab.propTypes = {
|
|
|
553
559
|
**/
|
|
554
560
|
renderButton: PropTypes__default["default"].func,
|
|
555
561
|
|
|
562
|
+
/**
|
|
563
|
+
* Optional prop to render an icon next to the label.
|
|
564
|
+
* Can be a React component class
|
|
565
|
+
*/
|
|
566
|
+
renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object]),
|
|
567
|
+
|
|
556
568
|
/*
|
|
557
569
|
* An optional label to render under the primary tab label.
|
|
558
570
|
/* This prop is only useful for conained tabs
|
|
@@ -570,7 +582,7 @@ var IconTab = /*#__PURE__*/React__default["default"].forwardRef(function IconTab
|
|
|
570
582
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref6, _excluded3);
|
|
571
583
|
|
|
572
584
|
var prefix = usePrefix.usePrefix();
|
|
573
|
-
var classNames = cx__default["default"]("".concat(prefix, "--tabs__nav-item--icon"), customClassName);
|
|
585
|
+
var classNames = cx__default["default"]("".concat(prefix, "--tabs__nav-item--icon-only"), customClassName);
|
|
574
586
|
return /*#__PURE__*/React__default["default"].createElement(Tooltip.Tooltip, {
|
|
575
587
|
align: "bottom",
|
|
576
588
|
defaultOpen: defaultOpen,
|
|
@@ -636,9 +648,9 @@ var TabPanel = /*#__PURE__*/React__default["default"].forwardRef(function TabPan
|
|
|
636
648
|
interactiveContent = _useState10[0],
|
|
637
649
|
setInteractiveContent = _useState10[1];
|
|
638
650
|
|
|
639
|
-
var _React$
|
|
640
|
-
selectedIndex = _React$
|
|
641
|
-
baseId = _React$
|
|
651
|
+
var _React$useContext4 = React__default["default"].useContext(TabsContext),
|
|
652
|
+
selectedIndex = _React$useContext4.selectedIndex,
|
|
653
|
+
baseId = _React$useContext4.baseId;
|
|
642
654
|
|
|
643
655
|
var index = React__default["default"].useContext(TabPanelContext);
|
|
644
656
|
var id = "".concat(baseId, "-tabpanel-").concat(index);
|
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.27.0
|
|
4
|
+
"version": "1.27.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "es/index.js",
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@babel/runtime": "^7.18.3",
|
|
46
46
|
"@carbon/feature-flags": "^0.13.0",
|
|
47
|
-
"@carbon/icons-react": "^11.18.0
|
|
48
|
-
"@carbon/layout": "^11.13.0
|
|
49
|
-
"@carbon/styles": "^1.27.0
|
|
47
|
+
"@carbon/icons-react": "^11.18.0",
|
|
48
|
+
"@carbon/layout": "^11.13.0",
|
|
49
|
+
"@carbon/styles": "^1.27.0",
|
|
50
50
|
"@carbon/telemetry": "0.1.0",
|
|
51
51
|
"classnames": "2.3.2",
|
|
52
52
|
"copy-to-clipboard": "^3.3.1",
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"@babel/plugin-transform-react-constant-elements": "^7.17.12",
|
|
73
73
|
"@babel/preset-env": "^7.18.2",
|
|
74
74
|
"@babel/preset-react": "^7.17.12",
|
|
75
|
-
"@carbon/test-utils": "^10.28.0
|
|
76
|
-
"@carbon/themes": "^11.18.0
|
|
75
|
+
"@carbon/test-utils": "^10.28.0",
|
|
76
|
+
"@carbon/themes": "^11.18.0",
|
|
77
77
|
"@rollup/plugin-babel": "^6.0.0",
|
|
78
78
|
"@rollup/plugin-commonjs": "^24.0.0",
|
|
79
79
|
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
@@ -133,5 +133,5 @@
|
|
|
133
133
|
"**/*.scss",
|
|
134
134
|
"**/*.css"
|
|
135
135
|
],
|
|
136
|
-
"gitHead": "
|
|
136
|
+
"gitHead": "9d9c35494255b0ad0996bad46ffaf093cdd20012"
|
|
137
137
|
}
|