@carbon/ibm-products 1.50.0 → 1.52.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/README.md +10 -5
- package/css/index-full-carbon.css +131 -82
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +2 -2
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +38 -11
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +131 -82
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +2 -2
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +131 -82
- package/css/index.css.map +1 -1
- package/css/index.min.css +2 -2
- package/css/index.min.css.map +1 -1
- package/es/components/AboutModal/AboutModal.js +3 -4
- package/es/components/ActionBar/ActionBar.js +9 -18
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +8 -13
- package/es/components/ButtonSetWithOverflow/ButtonSetWithOverflow.js +7 -11
- package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +8 -8
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +5 -5
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +3 -4
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +17 -3
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +17 -2
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +8 -4
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useInitialStateFromFilters.js +2 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/utils.js +14 -0
- package/es/components/Datagrid/index.js +1 -0
- package/es/components/Datagrid/useActionsColumn.js +10 -7
- package/es/components/Datagrid/useCustomizeColumns.js +5 -1
- package/es/components/Datagrid/useEditableCell.js +12 -0
- package/es/components/Datagrid/useExpandedRow.js +11 -7
- package/es/components/Datagrid/useFiltering.js +15 -10
- package/es/components/Datagrid/useInlineEdit.js +17 -8
- package/es/components/Datagrid/useNestedRows.js +10 -6
- package/es/components/Datagrid/useOnRowClick.js +9 -1
- package/es/components/Datagrid/useSelectRows.js +2 -0
- package/es/components/EditInPlace/EditInPlace.js +43 -0
- package/es/components/EditInPlace/index.js +8 -0
- package/es/components/ExampleComponent/ExampleComponent.js +32 -4
- package/es/components/ExampleComponent/useExample.js +49 -0
- package/es/components/InlineEdit/InlineEdit.js +5 -1
- package/es/components/InlineEditV1/InlineEditV1.js +7 -2
- package/es/components/InlineEditV2/InlineEditV2.js +51 -15
- package/es/components/NonLinearReading/NonLinearReading.js +7 -7
- package/es/components/PageHeader/PageHeader.js +28 -31
- package/es/components/SidePanel/SidePanel.js +25 -26
- package/es/components/TagSet/TagSet.js +5 -7
- package/es/components/Tearsheet/TearsheetShell.js +4 -6
- package/es/components/index.js +2 -1
- package/es/global/js/hooks/useResizeObserver.js +74 -0
- package/es/global/js/package-settings.js +35 -4
- package/es/global/js/utils/test-helper.js +34 -3
- package/es/settings.js +40 -29
- package/lib/components/AboutModal/AboutModal.js +3 -4
- package/lib/components/ActionBar/ActionBar.js +9 -18
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +8 -13
- package/lib/components/ButtonSetWithOverflow/ButtonSetWithOverflow.js +7 -11
- package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +4 -4
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +3 -4
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +17 -3
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +17 -2
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +8 -4
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useInitialStateFromFilters.js +2 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/utils.js +15 -0
- package/lib/components/Datagrid/index.js +7 -0
- package/lib/components/Datagrid/useActionsColumn.js +7 -1
- package/lib/components/Datagrid/useCustomizeColumns.js +4 -0
- package/lib/components/Datagrid/useEditableCell.js +20 -0
- package/lib/components/Datagrid/useExpandedRow.js +4 -0
- package/lib/components/Datagrid/useFiltering.js +8 -2
- package/lib/components/Datagrid/useInlineEdit.js +19 -8
- package/lib/components/Datagrid/useNestedRows.js +9 -6
- package/lib/components/Datagrid/useOnRowClick.js +9 -1
- package/lib/components/Datagrid/useSelectRows.js +2 -0
- package/lib/components/EditInPlace/EditInPlace.js +46 -0
- package/lib/components/EditInPlace/index.js +12 -0
- package/lib/components/ExampleComponent/ExampleComponent.js +35 -4
- package/lib/components/ExampleComponent/useExample.js +58 -0
- package/lib/components/InlineEdit/InlineEdit.js +5 -1
- package/lib/components/InlineEditV1/InlineEditV1.js +7 -2
- package/lib/components/InlineEditV2/InlineEditV2.js +53 -16
- package/lib/components/NonLinearReading/NonLinearReading.js +6 -6
- package/lib/components/PageHeader/PageHeader.js +28 -31
- package/lib/components/SidePanel/SidePanel.js +25 -26
- package/lib/components/TagSet/TagSet.js +5 -7
- package/lib/components/Tearsheet/TearsheetShell.js +4 -6
- package/lib/components/index.js +13 -0
- package/lib/global/js/hooks/useResizeObserver.js +83 -0
- package/lib/global/js/package-settings.js +34 -3
- package/lib/global/js/utils/test-helper.js +37 -5
- package/lib/settings.js +41 -30
- package/package.json +2 -3
- package/scss/components/Datagrid/styles/_useSelectAllToggle.scss +10 -7
- package/scss/components/InlineEditV2/_inline-edit-v2.scss +52 -11
- package/scss/components/InlineEditV2/_storybook-styles.scss +9 -2
- package/scss/components/NonLinearReading/_non-linear-reading.scss +76 -67
- package/scss/components/NonLinearReading/_storybook-styles.scss +16 -0
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.ExampleComponent = void 0;
|
|
8
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
12
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
-
var _react =
|
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
15
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
16
|
var _settings = require("../../settings");
|
|
17
|
+
var _useExample3 = _interopRequireDefault(require("./useExample"));
|
|
15
18
|
var _carbonComponentsReact = require("carbon-components-react");
|
|
16
|
-
var _excluded = ["borderColor", "boxedBorder", "className", "disabled", "onPrimaryClick", "onSecondaryClick", "primaryButtonLabel", "primaryKind", "secondaryButtonLabel", "secondaryKind", "size", "style"];
|
|
19
|
+
var _excluded = ["borderColor", "boxedBorder", "className", "disabled", "usesExampleHook", "onPrimaryClick", "onSecondaryClick", "primaryButtonLabel", "primaryKind", "secondaryButtonLabel", "secondaryKind", "secondaryIcon", "size", "style"];
|
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
22
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
18
23
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19
24
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
|
@@ -37,6 +42,7 @@ var ExampleComponent = /*#__PURE__*/_react.default.forwardRef(function (_ref, re
|
|
|
37
42
|
boxedBorder = _ref.boxedBorder,
|
|
38
43
|
className = _ref.className,
|
|
39
44
|
disabled = _ref.disabled,
|
|
45
|
+
usesExampleHook = _ref.usesExampleHook,
|
|
40
46
|
onPrimaryClick = _ref.onPrimaryClick,
|
|
41
47
|
onSecondaryClick = _ref.onSecondaryClick,
|
|
42
48
|
primaryButtonLabel = _ref.primaryButtonLabel,
|
|
@@ -45,10 +51,18 @@ var ExampleComponent = /*#__PURE__*/_react.default.forwardRef(function (_ref, re
|
|
|
45
51
|
secondaryButtonLabel = _ref.secondaryButtonLabel,
|
|
46
52
|
_ref$secondaryKind = _ref.secondaryKind,
|
|
47
53
|
secondaryKind = _ref$secondaryKind === void 0 ? defaults.secondaryKind : _ref$secondaryKind,
|
|
54
|
+
secondaryIcon = _ref.secondaryIcon,
|
|
48
55
|
_ref$size = _ref.size,
|
|
49
56
|
size = _ref$size === void 0 ? defaults.size : _ref$size,
|
|
50
57
|
style = _ref.style,
|
|
51
58
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
59
|
+
var _useState = (0, _react.useState)(primaryButtonLabel),
|
|
60
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
61
|
+
thePrimaryButtonLabel = _useState2[0],
|
|
62
|
+
setThePrimaryButtonLabel = _useState2[1];
|
|
63
|
+
var _useExample = (0, _useExample3.default)(usesExampleHook),
|
|
64
|
+
_useExample2 = (0, _slicedToArray2.default)(_useExample, 1),
|
|
65
|
+
exampleUse = _useExample2[0];
|
|
52
66
|
var modeClass = boxedBorder ? "".concat(blockClass, "--boxed-set") : "".concat(blockClass, "--shadow-set");
|
|
53
67
|
var handlePrimaryClick = function handlePrimaryClick(e) {
|
|
54
68
|
if (onPrimaryClick) {
|
|
@@ -60,6 +74,14 @@ var ExampleComponent = /*#__PURE__*/_react.default.forwardRef(function (_ref, re
|
|
|
60
74
|
onSecondaryClick(e);
|
|
61
75
|
}
|
|
62
76
|
};
|
|
77
|
+
var theSecondaryIcon = (0, _react.useRef)(secondaryIcon && _settings.pkg.checkReportFeatureEnabled('ExampleComponent.secondaryIcon') ? secondaryIcon : null);
|
|
78
|
+
(0, _react.useEffect)(function () {
|
|
79
|
+
if (usesExampleHook !== undefined && _settings.pkg.checkReportFeatureEnabled('ExampleComponent.useExample')) {
|
|
80
|
+
setThePrimaryButtonLabel("".concat(primaryButtonLabel, " ").concat(exampleUse.toFixed(1), "s"));
|
|
81
|
+
} else {
|
|
82
|
+
setThePrimaryButtonLabel(primaryButtonLabel);
|
|
83
|
+
}
|
|
84
|
+
}, [primaryButtonLabel, usesExampleHook, exampleUse]);
|
|
63
85
|
return /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.ButtonSet, (0, _extends2.default)({}, rest, {
|
|
64
86
|
className: (0, _classnames.default)(blockClass,
|
|
65
87
|
// Apply the block class to the main HTML element
|
|
@@ -72,6 +94,7 @@ var ExampleComponent = /*#__PURE__*/_react.default.forwardRef(function (_ref, re
|
|
|
72
94
|
className: "".concat(blockClass, "__secondary-button"),
|
|
73
95
|
kind: secondaryKind,
|
|
74
96
|
onClick: handleSecondaryClick,
|
|
97
|
+
renderIcon: theSecondaryIcon.current,
|
|
75
98
|
disabled: disabled,
|
|
76
99
|
size: size
|
|
77
100
|
}, secondaryButtonLabel), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
|
@@ -80,7 +103,7 @@ var ExampleComponent = /*#__PURE__*/_react.default.forwardRef(function (_ref, re
|
|
|
80
103
|
onClick: handlePrimaryClick,
|
|
81
104
|
disabled: disabled,
|
|
82
105
|
size: size
|
|
83
|
-
},
|
|
106
|
+
}, thePrimaryButtonLabel));
|
|
84
107
|
});
|
|
85
108
|
|
|
86
109
|
// Return a placeholder if not released and not enabled by feature flag.
|
|
@@ -131,6 +154,10 @@ ExampleComponent.propTypes = {
|
|
|
131
154
|
* The secondary button label.
|
|
132
155
|
*/
|
|
133
156
|
secondaryButtonLabel: _propTypes.default.string.isRequired,
|
|
157
|
+
/**
|
|
158
|
+
* The icon to use for the secondary button.
|
|
159
|
+
*/
|
|
160
|
+
secondaryIcon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
134
161
|
/**
|
|
135
162
|
* The kind of button for the secondary button ('secondary' or 'tertiary').
|
|
136
163
|
*/
|
|
@@ -142,5 +169,9 @@ ExampleComponent.propTypes = {
|
|
|
142
169
|
/**
|
|
143
170
|
* Optional style settings for the containing node.
|
|
144
171
|
*/
|
|
145
|
-
style: _propTypes.default.object
|
|
172
|
+
style: _propTypes.default.object,
|
|
173
|
+
/**
|
|
174
|
+
* Hook example timeout (in seconds) or undefined
|
|
175
|
+
*/
|
|
176
|
+
usesExampleHook: _propTypes.default.number
|
|
146
177
|
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _settings = require("../../settings");
|
|
11
|
+
/**
|
|
12
|
+
* Copyright IBM Corp. 2020, 2021
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
15
|
+
* LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
var useExample = function useExample(initialTime) {
|
|
19
|
+
// NOTE: hooks cannot be called conditionally.
|
|
20
|
+
//
|
|
21
|
+
// ** If the hook uses other hooks then they must be called,
|
|
22
|
+
// ** this could lead to unexpected behavior.
|
|
23
|
+
// ** As some hooks may still be called even if the condition is false.
|
|
24
|
+
|
|
25
|
+
var _useState = (0, _react.useState)(
|
|
26
|
+
// Disable hook in a safe way if possible, else use despite feature disabled.
|
|
27
|
+
// Either a console error or warning will be logged.
|
|
28
|
+
initialTime),
|
|
29
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
30
|
+
time = _useState2[0],
|
|
31
|
+
setTime = _useState2[1];
|
|
32
|
+
|
|
33
|
+
// Use of the feature flag to
|
|
34
|
+
var feature = 'ExampleComponent.useExample';
|
|
35
|
+
var tryFeature = initialTime !== undefined;
|
|
36
|
+
var featureEnabled = tryFeature && _settings.pkg.checkReportFeatureEnabled(feature);
|
|
37
|
+
if (tryFeature && !featureEnabled) {
|
|
38
|
+
// Output a useful message if the feature is disabled.
|
|
39
|
+
console.warn("Disabled feature \"".concat(feature, "\" does not change the initialTime."));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Actual hook is code is below
|
|
43
|
+
(0, _react.useEffect)(function () {
|
|
44
|
+
if (!featureEnabled) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// turn off all or part of the feature
|
|
49
|
+
if (time > 0) {
|
|
50
|
+
setTimeout(function () {
|
|
51
|
+
setTime(Math.max(0, time - 0.1));
|
|
52
|
+
}, 100);
|
|
53
|
+
}
|
|
54
|
+
}, [featureEnabled, time]);
|
|
55
|
+
return [time];
|
|
56
|
+
};
|
|
57
|
+
var _default = useExample;
|
|
58
|
+
exports.default = _default;
|
|
@@ -38,8 +38,12 @@ var InlineEdit = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
38
38
|
return /*#__PURE__*/_react.default.createElement(_InlineEditV.InlineEditV1, props);
|
|
39
39
|
});
|
|
40
40
|
exports.InlineEdit = InlineEdit;
|
|
41
|
-
|
|
41
|
+
InlineEdit.deprecated = {
|
|
42
|
+
details: "The InlineEdit component is being renamed to EditInPlace in the next major version of @carbon/ibm-products. You can prepare by updating your usage of InlineEdit to EditInPlace.",
|
|
43
|
+
level: 'warn'
|
|
44
|
+
};
|
|
42
45
|
InlineEdit.displayName = componentName;
|
|
46
|
+
exports.InlineEdit = InlineEdit = _settings.pkg.checkComponentEnabled(InlineEdit, componentName);
|
|
43
47
|
InlineEdit.propTypes = {
|
|
44
48
|
v2: _propTypes.default.bool
|
|
45
49
|
};
|
|
@@ -15,7 +15,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
15
15
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
16
16
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
17
|
var _devtools = require("../../global/js/utils/devtools");
|
|
18
|
-
var _pconsole = _interopRequireDefault(require("../../global/js/utils/pconsole"));
|
|
19
18
|
var _settings = require("../../settings");
|
|
20
19
|
var _carbonComponentsReact = require("carbon-components-react");
|
|
21
20
|
var _iconsReact = require("@carbon/icons-react");
|
|
@@ -79,7 +78,6 @@ var InlineEditV1 = /*#__PURE__*/_react.default.forwardRef(function (_ref, refIn)
|
|
|
79
78
|
var showValidation = invalid; // || warn;
|
|
80
79
|
var validationText = invalidText; // || warnText;
|
|
81
80
|
var validationIcon = showValidation ? /*#__PURE__*/_react.default.createElement(_iconsReact.WarningFilled16, null) : null;
|
|
82
|
-
_pconsole.default.warn("".concat(componentName, ": the v1 version of this component is being deprecated. please switch to the v2 component as soon as possible."));
|
|
83
81
|
|
|
84
82
|
// sanitize the tooltip values
|
|
85
83
|
var alignIsObject = (0, _typeof2.default)(buttonTooltipAlignment) === 'object';
|
|
@@ -301,6 +299,13 @@ var InlineEditV1 = /*#__PURE__*/_react.default.forwardRef(function (_ref, refIn)
|
|
|
301
299
|
// is used in preference to relying on function.name.
|
|
302
300
|
exports.InlineEditV1 = InlineEditV1;
|
|
303
301
|
InlineEditV1.displayName = componentName;
|
|
302
|
+
InlineEditV1.deprecated = {
|
|
303
|
+
level: 'warn',
|
|
304
|
+
details: "The v1 version of this component is being deprecated. please switch to the v2 component as soon as possible."
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
// needed to show deprecation message but based on host component name
|
|
308
|
+
exports.InlineEditV1 = InlineEditV1 = _settings.pkg.checkComponentEnabled(InlineEditV1, 'InlineEdit');
|
|
304
309
|
|
|
305
310
|
// The types and DocGen commentary for the component props,
|
|
306
311
|
// in alphabetical order (for consistency).
|
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.InlineEditV2 = void 0;
|
|
8
|
+
exports.deprecatedProps = exports.InlineEditV2 = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
@@ -17,22 +17,32 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
17
17
|
var _iconsReact = require("@carbon/icons-react");
|
|
18
18
|
var _settings = require("../../settings");
|
|
19
19
|
var _devtools = require("../../global/js/utils/devtools");
|
|
20
|
-
var _excluded = ["cancelLabel", "editLabel", "id", "invalid", "invalidLabel", "labelText", "onCancel", "onChange", "onSave", "saveLabel", "value"];
|
|
20
|
+
var _excluded = ["cancelLabel", "editAlwaysVisible", "editLabel", "id", "inheritTypography", "invalid", "invalidLabel", "invalidText", "labelText", "onCancel", "onChange", "onSave", "size", "saveLabel", "value"];
|
|
21
21
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
22
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
24
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
25
|
var componentName = 'InlineEditV2';
|
|
24
26
|
var blockClass = "".concat(_settings.pkg.prefix, "--inline-edit-v2");
|
|
27
|
+
var defaults = {
|
|
28
|
+
size: 'sm'
|
|
29
|
+
};
|
|
25
30
|
var InlineEditV2 = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
26
31
|
var _cx;
|
|
27
32
|
var cancelLabel = _ref.cancelLabel,
|
|
33
|
+
editAlwaysVisible = _ref.editAlwaysVisible,
|
|
28
34
|
editLabel = _ref.editLabel,
|
|
29
35
|
id = _ref.id,
|
|
36
|
+
inheritTypography = _ref.inheritTypography,
|
|
30
37
|
invalid = _ref.invalid,
|
|
31
|
-
|
|
38
|
+
deprecated_invalidLabel = _ref.invalidLabel,
|
|
39
|
+
invalidText = _ref.invalidText,
|
|
32
40
|
labelText = _ref.labelText,
|
|
33
41
|
onCancel = _ref.onCancel,
|
|
34
42
|
onChange = _ref.onChange,
|
|
35
43
|
onSave = _ref.onSave,
|
|
44
|
+
_ref$size = _ref.size,
|
|
45
|
+
size = _ref$size === void 0 ? defaults.size : _ref$size,
|
|
36
46
|
saveLabel = _ref.saveLabel,
|
|
37
47
|
value = _ref.value,
|
|
38
48
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
@@ -130,7 +140,7 @@ var InlineEditV2 = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
130
140
|
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
|
|
131
141
|
ref: ref
|
|
132
142
|
}, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement("div", {
|
|
133
|
-
className: (0, _classnames.default)(blockClass, (_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--focused"), focused), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--invalid"), invalid), _cx)),
|
|
143
|
+
className: (0, _classnames.default)(blockClass, "".concat(blockClass, "--").concat(size), (_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--focused"), focused), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--invalid"), invalid), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--inherit-type"), inheritTypography), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--overflows"), inputRef.current && inputRef.current.scrollWidth > inputRef.current.offsetWidth), _cx)),
|
|
134
144
|
onFocus: onFocusHandler,
|
|
135
145
|
onBlur: onBlurHandler
|
|
136
146
|
}, /*#__PURE__*/_react.default.createElement("label", {
|
|
@@ -138,7 +148,7 @@ var InlineEditV2 = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
138
148
|
htmlFor: id
|
|
139
149
|
}, labelText), /*#__PURE__*/_react.default.createElement("input", {
|
|
140
150
|
id: id,
|
|
141
|
-
className: (0, _classnames.default)("".concat(blockClass, "__text-input"), "".concat(_settings.carbon.prefix, "--text-input"), "".concat(_settings.carbon.prefix, "--text-input--
|
|
151
|
+
className: (0, _classnames.default)("".concat(blockClass, "__text-input"), "".concat(_settings.carbon.prefix, "--text-input"), "".concat(_settings.carbon.prefix, "--text-input--").concat(size)),
|
|
142
152
|
type: "text",
|
|
143
153
|
value: value,
|
|
144
154
|
onChange: onChangeHandler,
|
|
@@ -147,13 +157,16 @@ var InlineEditV2 = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
147
157
|
,
|
|
148
158
|
onKeyDown: onKeyHandler
|
|
149
159
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
160
|
+
className: "".concat(blockClass, "__ellipsis"),
|
|
161
|
+
"aria-hidden": !focused
|
|
162
|
+
}, "\u2026"), /*#__PURE__*/_react.default.createElement("div", {
|
|
150
163
|
className: "".concat(blockClass, "__toolbar")
|
|
151
|
-
},
|
|
164
|
+
}, invalid && /*#__PURE__*/_react.default.createElement(_iconsReact.WarningFilled16, {
|
|
152
165
|
className: "".concat(blockClass, "__warning-icon")
|
|
153
|
-
}), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
|
166
|
+
}), focused ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
|
154
167
|
hasIconOnly: true,
|
|
155
168
|
renderIcon: _iconsReact.Close24,
|
|
156
|
-
size:
|
|
169
|
+
size: size,
|
|
157
170
|
iconDescription: cancelLabel,
|
|
158
171
|
onClick: onCancelHandler,
|
|
159
172
|
kind: "ghost",
|
|
@@ -163,7 +176,7 @@ var InlineEditV2 = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
163
176
|
}), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
|
164
177
|
hasIconOnly: true,
|
|
165
178
|
renderIcon: _iconsReact.Checkmark24,
|
|
166
|
-
size:
|
|
179
|
+
size: size,
|
|
167
180
|
iconDescription: saveLabel,
|
|
168
181
|
onClick: onSaveHandler,
|
|
169
182
|
kind: "ghost",
|
|
@@ -172,12 +185,12 @@ var InlineEditV2 = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
172
185
|
className: "".concat(blockClass, "__btn ").concat(blockClass, "__btn-save"),
|
|
173
186
|
disabled: !canSave
|
|
174
187
|
})) : /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
|
175
|
-
className: "".concat(blockClass, "__btn ").concat(blockClass, "__btn-edit"),
|
|
188
|
+
className: (0, _classnames.default)("".concat(blockClass, "__btn"), "".concat(blockClass, "__btn-edit"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__btn-edit--always-visible"), editAlwaysVisible)),
|
|
176
189
|
hasIconOnly: true
|
|
177
190
|
// renderIcon={readOnly ? EditOff24 : Edit24}
|
|
178
191
|
,
|
|
179
192
|
renderIcon: _iconsReact.Edit24,
|
|
180
|
-
size:
|
|
193
|
+
size: size
|
|
181
194
|
// iconDescription={readOnly ? readOnlyLabel : editLabel}
|
|
182
195
|
,
|
|
183
196
|
iconDescription: editLabel,
|
|
@@ -185,17 +198,29 @@ var InlineEditV2 = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
185
198
|
kind: "ghost",
|
|
186
199
|
tabIndex: 0,
|
|
187
200
|
key: "edit"
|
|
188
|
-
}))),
|
|
201
|
+
}))), invalid && /*#__PURE__*/_react.default.createElement("p", {
|
|
189
202
|
className: "".concat(blockClass, "__warning-text")
|
|
190
|
-
},
|
|
203
|
+
}, invalidText !== null && invalidText !== void 0 ? invalidText : deprecated_invalidLabel));
|
|
191
204
|
});
|
|
192
205
|
exports.InlineEditV2 = InlineEditV2;
|
|
193
206
|
InlineEditV2.displayName = componentName;
|
|
194
|
-
|
|
207
|
+
var deprecatedProps = {
|
|
208
|
+
/**
|
|
209
|
+
* **Deprecated**
|
|
210
|
+
* invalidLabel was misnamed, using invalidText to match Carbon
|
|
211
|
+
*/
|
|
212
|
+
invalidText: _propTypes.default.string
|
|
213
|
+
};
|
|
214
|
+
exports.deprecatedProps = deprecatedProps;
|
|
215
|
+
InlineEditV2.propTypes = _objectSpread({
|
|
195
216
|
/**
|
|
196
217
|
* label for cancel button
|
|
197
218
|
*/
|
|
198
219
|
cancelLabel: _propTypes.default.string.isRequired,
|
|
220
|
+
/**
|
|
221
|
+
* By default the edit icon is shown on hover only.
|
|
222
|
+
*/
|
|
223
|
+
editAlwaysVisible: _propTypes.default.bool,
|
|
199
224
|
/**
|
|
200
225
|
* label for edit button
|
|
201
226
|
*/
|
|
@@ -204,6 +229,14 @@ InlineEditV2.propTypes = {
|
|
|
204
229
|
* Specify a custom id for the input
|
|
205
230
|
*/
|
|
206
231
|
id: _propTypes.default.string.isRequired,
|
|
232
|
+
/**
|
|
233
|
+
* inheritTypography - causes the text entry field to inherit typography settings
|
|
234
|
+
* assigned to the container. This is useful when editing titles for instance.
|
|
235
|
+
*
|
|
236
|
+
* NOTE: The size property limits the vertical size of the input element.
|
|
237
|
+
* Inherited font's should be selected to fit within the size selected.
|
|
238
|
+
*/
|
|
239
|
+
inheritTypography: _propTypes.default.bool,
|
|
207
240
|
/**
|
|
208
241
|
* determines if the input is invalid
|
|
209
242
|
*/
|
|
@@ -211,7 +244,7 @@ InlineEditV2.propTypes = {
|
|
|
211
244
|
/**
|
|
212
245
|
* text that is displayed if the input is invalid
|
|
213
246
|
*/
|
|
214
|
-
|
|
247
|
+
invalidText: _propTypes.default.string,
|
|
215
248
|
/**
|
|
216
249
|
* Provide the text that will be read by a screen reader when visiting this control
|
|
217
250
|
*/
|
|
@@ -240,11 +273,15 @@ InlineEditV2.propTypes = {
|
|
|
240
273
|
* label for save button
|
|
241
274
|
*/
|
|
242
275
|
saveLabel: _propTypes.default.string.isRequired,
|
|
276
|
+
/**
|
|
277
|
+
* vertical size of control
|
|
278
|
+
*/
|
|
279
|
+
size: _propTypes.default.oneOf(['sm', 'md', 'lg']),
|
|
243
280
|
/**
|
|
244
281
|
* current value of the input
|
|
245
282
|
*/
|
|
246
283
|
value: _propTypes.default.string.isRequired
|
|
247
|
-
};
|
|
284
|
+
}, deprecatedProps);
|
|
248
285
|
InlineEditV2.defaultProps = {
|
|
249
286
|
invalid: false,
|
|
250
287
|
invalidLabel: ''
|
|
@@ -49,16 +49,16 @@ var NonLinearReading = /*#__PURE__*/_react.default.forwardRef(function (_ref, re
|
|
|
49
49
|
});
|
|
50
50
|
};
|
|
51
51
|
return /*#__PURE__*/_react.default.createElement("span", (0, _extends2.default)({}, rest, {
|
|
52
|
-
className: (0, _classnames.default)(blockClass, className),
|
|
52
|
+
className: (0, _classnames.default)(blockClass, "".concat(blockClass, "__").concat(theme), className),
|
|
53
53
|
ref: ref,
|
|
54
54
|
role: "main"
|
|
55
55
|
}, (0, _devtools.getDevtoolsProps)(componentName)), ' ', /*#__PURE__*/_react.default.createElement("button", {
|
|
56
56
|
type: "button",
|
|
57
57
|
"aria-expanded": isOpen,
|
|
58
|
-
className: (0, _classnames.default)("".concat(blockClass, "
|
|
58
|
+
className: (0, _classnames.default)("".concat(blockClass, "__keyword"), [isOpen ? ["".concat(blockClass, "__keyword-open")] : ["".concat(blockClass, "__keyword-closed")]]),
|
|
59
59
|
onClick: handleToggle
|
|
60
|
-
}, children,
|
|
61
|
-
className: "".concat(blockClass, "
|
|
60
|
+
}, children, /*#__PURE__*/_react.default.createElement(_iconsReact.ChevronDown16, null)), ' ', isOpen && /*#__PURE__*/_react.default.createElement("span", {
|
|
61
|
+
className: "".concat(blockClass, "__body")
|
|
62
62
|
}, definition), ' ');
|
|
63
63
|
});
|
|
64
64
|
|
|
@@ -72,7 +72,7 @@ NonLinearReading.displayName = componentName;
|
|
|
72
72
|
// See https://www.npmjs.com/package/prop-types#usage.
|
|
73
73
|
NonLinearReading.propTypes = {
|
|
74
74
|
/**
|
|
75
|
-
* The
|
|
75
|
+
* The keyword of the component appears as a pill.
|
|
76
76
|
*/
|
|
77
77
|
children: _propTypes.default.node.isRequired,
|
|
78
78
|
/**
|
|
@@ -80,7 +80,7 @@ NonLinearReading.propTypes = {
|
|
|
80
80
|
*/
|
|
81
81
|
className: _propTypes.default.string,
|
|
82
82
|
/**
|
|
83
|
-
* The content that appears when the
|
|
83
|
+
* The content that appears when the keyword is toggled open.
|
|
84
84
|
*/
|
|
85
85
|
definition: _propTypes.default.node.isRequired,
|
|
86
86
|
/**
|
|
@@ -14,7 +14,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
14
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
15
|
var _layout = require("@carbon/layout");
|
|
16
16
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
-
var
|
|
17
|
+
var _useResizeObserver = require("../../global/js/hooks/useResizeObserver");
|
|
18
18
|
var _carbonComponentsReact = require("carbon-components-react");
|
|
19
19
|
var _hooks = require("../../global/js/hooks");
|
|
20
20
|
var _devtools = require("../../global/js/utils/devtools");
|
|
@@ -39,7 +39,7 @@ var defaults = {
|
|
|
39
39
|
narrowGrid: false
|
|
40
40
|
};
|
|
41
41
|
var PageHeader = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
42
|
-
var _withoutBackground, _enableBreadcrumbScro,
|
|
42
|
+
var _withoutBackground, _enableBreadcrumbScro, _ref7, _cx2, _ref8, _cx4, _cx7;
|
|
43
43
|
var actionBarItems = _ref.actionBarItems,
|
|
44
44
|
actionBarMenuOptionsClass = _ref.actionBarMenuOptionsClass,
|
|
45
45
|
actionBarOverflowAriaLabel = _ref.actionBarOverflowAriaLabel,
|
|
@@ -176,7 +176,8 @@ var PageHeader = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
176
176
|
};
|
|
177
177
|
|
|
178
178
|
/* istanbul ignore next */
|
|
179
|
-
var handleResizeActionBarColumn = function handleResizeActionBarColumn(
|
|
179
|
+
var handleResizeActionBarColumn = function handleResizeActionBarColumn(_ref4) {
|
|
180
|
+
var width = _ref4.width;
|
|
180
181
|
/* don't know how to test resize */
|
|
181
182
|
/* istanbul ignore next */
|
|
182
183
|
setActionBarColumnWidth(width);
|
|
@@ -250,8 +251,8 @@ var PageHeader = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
250
251
|
(0, _hooks.useNearestScroll)(headerRef,
|
|
251
252
|
// on scroll or various layout changes check updates if needed
|
|
252
253
|
// istanbul ignore next
|
|
253
|
-
function (
|
|
254
|
-
var current =
|
|
254
|
+
function (_ref5) {
|
|
255
|
+
var current = _ref5.current;
|
|
255
256
|
setPageHeaderStyles(function (prev) {
|
|
256
257
|
return _objectSpread(_objectSpread({}, prev), {}, (0, _defineProperty2.default)({}, "--".concat(_PageHeaderUtils.blockClass, "--breadcrumb-top"), "".concat(metrics.headerOffset, "px")));
|
|
257
258
|
});
|
|
@@ -267,8 +268,8 @@ var PageHeader = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
267
268
|
document.documentElement.style.setProperty("--".concat(_PageHeaderUtils.blockClass, "--tagset-tooltip-offset"), "".concat(tagsetTooltipOffset, "px"));
|
|
268
269
|
setScrollYValue(current.scrollY);
|
|
269
270
|
}, [metrics.headerHeight, metrics.headerTopValue, metrics.headerOffset, enableBreadcrumbScroll]);
|
|
270
|
-
(0, _hooks.useWindowResize)(function (
|
|
271
|
-
var current =
|
|
271
|
+
(0, _hooks.useWindowResize)(function (_ref6) {
|
|
272
|
+
var current = _ref6.current;
|
|
272
273
|
// on window resize and other updates some values may have changed
|
|
273
274
|
checkUpdateVerticalSpace();
|
|
274
275
|
setWidthIsNarrow(current.innerWidth / 16 < parseInt(_layout.breakpoints.md.width)); // small (below medium) media query
|
|
@@ -314,15 +315,11 @@ var PageHeader = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
314
315
|
(0, _PageHeaderUtils.utilSetCollapsed)(collapseHeader, metrics.headerOffset, metrics.headerTopValue);
|
|
315
316
|
}
|
|
316
317
|
}, [collapseHeader, metrics.headerOffset, metrics.headerTopValue]);
|
|
317
|
-
(0,
|
|
318
|
-
|
|
319
|
-
targetRef: sizingContainerRef,
|
|
320
|
-
handleWidth: true
|
|
318
|
+
(0, _useResizeObserver.useResizeObserver)(sizingContainerRef, {
|
|
319
|
+
callback: handleResizeActionBarColumn
|
|
321
320
|
});
|
|
322
|
-
(0,
|
|
323
|
-
|
|
324
|
-
targetRef: headerRef,
|
|
325
|
-
handleHeight: true
|
|
321
|
+
(0, _useResizeObserver.useResizeObserver)(headerRef, {
|
|
322
|
+
callback: handleResize
|
|
326
323
|
});
|
|
327
324
|
|
|
328
325
|
// Determine what form of title to display in the breadcrumb
|
|
@@ -331,7 +328,7 @@ var PageHeader = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
331
328
|
className: "".concat(_PageHeaderUtils.blockClass, "--offset-top-measuring-element"),
|
|
332
329
|
ref: offsetTopMeasuringRef
|
|
333
330
|
}), /*#__PURE__*/_react.default.createElement("section", (0, _extends2.default)({}, rest, {
|
|
334
|
-
className: (0, _classnames.default)([_PageHeaderUtils.blockClass, "".concat(_PageHeaderUtils.blockClass, "--no-margins-below-row"), className, (
|
|
331
|
+
className: (0, _classnames.default)([_PageHeaderUtils.blockClass, "".concat(_PageHeaderUtils.blockClass, "--no-margins-below-row"), className, (_ref7 = {}, (0, _defineProperty2.default)(_ref7, "".concat(_PageHeaderUtils.blockClass, "--has-navigation"), navigation || tags), (0, _defineProperty2.default)(_ref7, "".concat(_PageHeaderUtils.blockClass, "--has-navigation-tags-only"), !navigation && tags), _ref7)]),
|
|
335
332
|
style: pageHeaderStyles,
|
|
336
333
|
ref: headerRef
|
|
337
334
|
}, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Grid, {
|
|
@@ -352,7 +349,7 @@ var PageHeader = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
352
349
|
overflowAriaLabel: breadcrumbOverflowAriaLabel,
|
|
353
350
|
breadcrumbs: breadcrumbs && breadcrumbItemForTitle ? breadcrumbs.concat(breadcrumbItemForTitle) : breadcrumbItemForTitle ? [breadcrumbItemForTitle] : breadcrumbs // breadcrumbs may be null or undefined
|
|
354
351
|
}) : null), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Column, {
|
|
355
|
-
className: (0, _classnames.default)(["".concat(_PageHeaderUtils.blockClass, "__action-bar-column ").concat(_PageHeaderUtils.blockClass, "__action-bar-column--background"), (
|
|
352
|
+
className: (0, _classnames.default)(["".concat(_PageHeaderUtils.blockClass, "__action-bar-column ").concat(_PageHeaderUtils.blockClass, "__action-bar-column--background"), (_ref8 = {}, (0, _defineProperty2.default)(_ref8, "".concat(_PageHeaderUtils.blockClass, "__action-bar-column--has-page-actions"), pageActions), (0, _defineProperty2.default)(_ref8, "".concat(_PageHeaderUtils.blockClass, "__action-bar-column--influenced-by-collapse-button"), spaceForCollapseButton), _ref8)])
|
|
356
353
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
357
354
|
className: "".concat(_PageHeaderUtils.blockClass, "__action-bar-column-content"),
|
|
358
355
|
ref: sizingContainerRef
|
|
@@ -503,8 +500,8 @@ PageHeader.propTypes = _objectSpread({
|
|
|
503
500
|
*
|
|
504
501
|
* NOTE: This prop is required if actionBarItems are supplied
|
|
505
502
|
*/
|
|
506
|
-
actionBarOverflowAriaLabel: _propTypes.default.string.isRequired.if(function (
|
|
507
|
-
var actionBarItems =
|
|
503
|
+
actionBarOverflowAriaLabel: _propTypes.default.string.isRequired.if(function (_ref10) {
|
|
504
|
+
var actionBarItems = _ref10.actionBarItems;
|
|
508
505
|
return actionBarItems && actionBarItems.length > 0;
|
|
509
506
|
}),
|
|
510
507
|
/**
|
|
@@ -535,8 +532,8 @@ PageHeader.propTypes = _objectSpread({
|
|
|
535
532
|
* If the user supplies breadcrumbs then this property is required.
|
|
536
533
|
* It is used in an overflow menu when there is insufficient space to display all breadcrumbs inline.
|
|
537
534
|
*/
|
|
538
|
-
breadcrumbOverflowAriaLabel: _propTypes.default.string.isRequired.if(function (
|
|
539
|
-
var breadcrumbs =
|
|
535
|
+
breadcrumbOverflowAriaLabel: _propTypes.default.string.isRequired.if(function (_ref11) {
|
|
536
|
+
var breadcrumbs = _ref11.breadcrumbs;
|
|
540
537
|
return breadcrumbs && breadcrumbs.length > 0;
|
|
541
538
|
}),
|
|
542
539
|
/**
|
|
@@ -570,8 +567,8 @@ PageHeader.propTypes = _objectSpread({
|
|
|
570
567
|
/**
|
|
571
568
|
* A text version of the `label` for display, required if `label` is not a string.
|
|
572
569
|
*/
|
|
573
|
-
title: _propTypes.default.string.isRequired.if(function (
|
|
574
|
-
var label =
|
|
570
|
+
title: _propTypes.default.string.isRequired.if(function (_ref12) {
|
|
571
|
+
var label = _ref12.label;
|
|
575
572
|
return typeof label !== 'string';
|
|
576
573
|
})
|
|
577
574
|
})),
|
|
@@ -597,9 +594,9 @@ PageHeader.propTypes = _objectSpread({
|
|
|
597
594
|
* If `hasCollapseHeaderToggle` is set and `withoutBackground` is unset/falsy then assistive text is
|
|
598
595
|
* required for both the expend and collapse states of the button component used.
|
|
599
596
|
*/
|
|
600
|
-
collapseHeaderIconDescription: _propTypes.default.string.isRequired.if(function (
|
|
601
|
-
var withoutBackground =
|
|
602
|
-
hasCollapseHeaderToggle =
|
|
597
|
+
collapseHeaderIconDescription: _propTypes.default.string.isRequired.if(function (_ref13) {
|
|
598
|
+
var withoutBackground = _ref13.withoutBackground,
|
|
599
|
+
hasCollapseHeaderToggle = _ref13.hasCollapseHeaderToggle;
|
|
603
600
|
return !withoutBackground && hasCollapseHeaderToggle;
|
|
604
601
|
}),
|
|
605
602
|
/**
|
|
@@ -616,9 +613,9 @@ PageHeader.propTypes = _objectSpread({
|
|
|
616
613
|
* If `hasCollapseHeaderToggle` is set and `withoutBackground` is unset/falsy then assistive text is
|
|
617
614
|
* required for both the expend and collapse states of the button component used.
|
|
618
615
|
*/
|
|
619
|
-
expandHeaderIconDescription: _propTypes.default.string.isRequired.if(function (
|
|
620
|
-
var withoutBackground =
|
|
621
|
-
hasCollapseHeaderToggle =
|
|
616
|
+
expandHeaderIconDescription: _propTypes.default.string.isRequired.if(function (_ref14) {
|
|
617
|
+
var withoutBackground = _ref14.withoutBackground,
|
|
618
|
+
hasCollapseHeaderToggle = _ref14.hasCollapseHeaderToggle;
|
|
622
619
|
return !withoutBackground && hasCollapseHeaderToggle;
|
|
623
620
|
}),
|
|
624
621
|
/**
|
|
@@ -682,8 +679,8 @@ PageHeader.propTypes = _objectSpread({
|
|
|
682
679
|
*
|
|
683
680
|
* NOTE: This prop is required if pageActions are supplied
|
|
684
681
|
*/
|
|
685
|
-
pageActionsOverflowLabel: _propTypes.default.node.isRequired.if(function (
|
|
686
|
-
var pageActions =
|
|
682
|
+
pageActionsOverflowLabel: _propTypes.default.node.isRequired.if(function (_ref15) {
|
|
683
|
+
var pageActions = _ref15.pageActions;
|
|
687
684
|
return pageActions && pageActions.length > 0 && !pageActions.content;
|
|
688
685
|
}),
|
|
689
686
|
/**
|