@carbon/ibm-products 1.22.0 → 1.24.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/components/Datagrid/styles/datagrid.css +87 -11
- package/css/components/Datagrid/styles/datagrid.css.map +1 -1
- package/css/components/Datagrid/styles/index.css +94 -11
- package/css/components/Datagrid/styles/index.css.map +1 -1
- package/css/components/Datagrid/styles/useExpandedRow.css +9 -0
- package/css/components/Datagrid/styles/useExpandedRow.css.map +1 -0
- package/css/index-full-carbon.css +276 -181
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +2 -8
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +37 -41
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -7
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +271 -54
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +1 -7
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +274 -177
- package/css/index.css.map +1 -1
- package/css/index.min.css +2 -8
- package/css/index.min.css.map +1 -1
- package/es/components/AddSelect/AddSelect.js +56 -423
- package/es/components/AddSelect/AddSelectBody.js +345 -0
- package/es/components/AddSelect/AddSelectBreadcrumbs.js +11 -31
- package/es/components/AddSelect/AddSelectColumn.js +95 -42
- package/es/components/AddSelect/AddSelectFilter.js +2 -3
- package/es/components/AddSelect/AddSelectList.js +11 -62
- package/es/components/AddSelect/AddSelectMetaPanel.js +9 -8
- package/es/components/AddSelect/AddSelectSidebar.js +24 -39
- package/es/components/AddSelect/AddSelectSort.js +4 -2
- package/es/components/AddSelect/add-select-utils.js +85 -59
- package/es/components/AddSelect/hooks/useParentSelect.js +16 -0
- package/es/components/AddSelect/hooks/usePath.js +66 -0
- package/es/components/Card/Card.js +1 -1
- package/es/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +1 -5
- package/es/components/CreateTearsheet/preview-components/MultiStepWithIntro.js +1 -5
- package/es/components/Datagrid/Datagrid/Datagrid.js +17 -12
- package/es/components/Datagrid/Datagrid/DatagridRow.js +4 -2
- package/es/components/Datagrid/useExpandedRow.js +1 -0
- package/es/components/Datagrid/useOnRowClick.js +10 -3
- package/es/components/EditFullPage/EditFullPage.js +79 -0
- package/es/components/EditFullPage/index.js +7 -0
- package/es/components/EditTearsheet/EditTearsheet.js +205 -0
- package/es/components/EditTearsheet/EditTearsheetForm.js +103 -0
- package/es/components/EditTearsheet/index.js +8 -0
- package/es/components/EditTearsheet/preview-components/MultiFormEditTearsheet.js +230 -0
- package/es/components/EditTearsheetNarrow/EditTearsheetNarrow.js +79 -0
- package/es/components/EditTearsheetNarrow/index.js +7 -0
- package/es/components/PageHeader/PageHeaderUtils.js +5 -0
- package/es/components/TagSet/TagSet.js +15 -5
- package/es/components/WebTerminal/WebTerminal.js +5 -3
- package/es/components/index.js +4 -1
- package/es/global/js/package-settings.js +4 -1
- package/lib/components/AddSelect/AddSelect.js +53 -431
- package/lib/components/AddSelect/AddSelectBody.js +380 -0
- package/lib/components/AddSelect/AddSelectBreadcrumbs.js +11 -30
- package/lib/components/AddSelect/AddSelectColumn.js +93 -40
- package/lib/components/AddSelect/AddSelectFilter.js +2 -3
- package/lib/components/AddSelect/AddSelectList.js +12 -61
- package/lib/components/AddSelect/AddSelectMetaPanel.js +9 -8
- package/lib/components/AddSelect/AddSelectSidebar.js +22 -38
- package/lib/components/AddSelect/AddSelectSort.js +4 -2
- package/lib/components/AddSelect/add-select-utils.js +88 -64
- package/lib/components/AddSelect/hooks/useParentSelect.js +27 -0
- package/lib/components/AddSelect/hooks/usePath.js +75 -0
- package/lib/components/Card/Card.js +1 -1
- package/lib/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +1 -5
- package/lib/components/CreateTearsheet/preview-components/MultiStepWithIntro.js +1 -5
- package/lib/components/Datagrid/Datagrid/Datagrid.js +17 -12
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +3 -1
- package/lib/components/Datagrid/useExpandedRow.js +1 -0
- package/lib/components/Datagrid/useOnRowClick.js +10 -3
- package/lib/components/EditFullPage/EditFullPage.js +85 -0
- package/lib/components/EditFullPage/index.js +13 -0
- package/lib/components/EditTearsheet/EditTearsheet.js +229 -0
- package/lib/components/EditTearsheet/EditTearsheetForm.js +122 -0
- package/lib/components/EditTearsheet/index.js +21 -0
- package/lib/components/EditTearsheet/preview-components/MultiFormEditTearsheet.js +254 -0
- package/lib/components/EditTearsheetNarrow/EditTearsheetNarrow.js +85 -0
- package/lib/components/EditTearsheetNarrow/index.js +13 -0
- package/lib/components/PageHeader/PageHeaderUtils.js +5 -0
- package/lib/components/TagSet/TagSet.js +15 -5
- package/lib/components/WebTerminal/WebTerminal.js +5 -2
- package/lib/components/index.js +25 -1
- package/lib/global/js/package-settings.js +4 -1
- package/package.json +16 -16
- package/scss/components/Cascade/_cascade.scss +2 -1
- package/scss/components/CreateInfluencer/_create-influencer.scss +2 -2
- package/scss/components/CreateTearsheet/_create-tearsheet.scss +1 -1
- package/scss/components/Datagrid/_datagrid.scss +0 -1
- package/scss/components/Datagrid/_storybook-styles.scss +57 -0
- package/scss/components/Datagrid/styles/datagrid.scss +97 -12
- package/scss/components/Datagrid/styles/index.scss +1 -0
- package/scss/components/Datagrid/styles/useExpandedRow.scss +7 -0
- package/scss/components/EditFullPage/_edit-full-page.scss +34 -0
- package/scss/components/EditFullPage/_index.scss +8 -0
- package/scss/components/EditFullPage/_storybook-styles.scss +10 -0
- package/scss/components/EditTearsheet/_edit-tearsheet.scss +132 -0
- package/scss/components/EditTearsheet/_index.scss +8 -0
- package/scss/components/EditTearsheet/_storybook-styles.scss +55 -0
- package/scss/components/EditTearsheetNarrow/_edit-tearsheet-narrow.scss +34 -0
- package/scss/components/EditTearsheetNarrow/_index.scss +8 -0
- package/scss/components/EditTearsheetNarrow/_storybook-styles.scss +10 -0
- package/scss/components/InlineEdit/_inline-edit.scss +10 -21
- package/scss/components/NotificationsPanel/_notifications-panel.scss +1 -0
- package/scss/components/OptionsTile/_options-tile.scss +1 -0
- package/scss/components/PageHeader/_page-header.scss +11 -4
- package/scss/components/SidePanel/_side-panel.scss +1 -2
- package/scss/components/StatusIcon/_status-icon.scss +1 -1
- package/scss/components/TagSet/_tag-set.scss +4 -0
- package/scss/components/Tearsheet/_tearsheet.scss +2 -2
- package/scss/components/WebTerminal/_web-terminal.scss +2 -1
- package/scss/components/_index.scss +3 -0
@@ -204,11 +204,7 @@ var MultiStepTearsheet = function MultiStepTearsheet(_ref2) {
|
|
204
204
|
},
|
205
205
|
invalid: isInvalid,
|
206
206
|
invalidText: "This is a required field",
|
207
|
-
onBlur: function onBlur() {
|
208
|
-
if (!stepOneTextInputValue.length) {
|
209
|
-
setIsInvalid(true);
|
210
|
-
}
|
211
|
-
}
|
207
|
+
onBlur: function onBlur() {}
|
212
208
|
}), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.TextInput, {
|
213
209
|
labelText: "Topic description (optional)",
|
214
210
|
id: "tearsheet-multi-step-story-text-input-multi-step-1-input-2",
|
@@ -226,11 +226,7 @@ var MultiStepWithIntro = function MultiStepWithIntro(_ref) {
|
|
226
226
|
},
|
227
227
|
invalid: isInvalid,
|
228
228
|
invalidText: "This is a required field",
|
229
|
-
onBlur: function onBlur() {
|
230
|
-
if (!stepOneTextInputValue.length) {
|
231
|
-
setIsInvalid(true);
|
232
|
-
}
|
233
|
-
}
|
229
|
+
onBlur: function onBlur() {}
|
234
230
|
}), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.TextInput, {
|
235
231
|
labelText: "Topic description (optional)",
|
236
232
|
id: "tearsheet-multi-step-story-text-input-multi-step-1-input-2",
|
@@ -63,16 +63,25 @@ var Datagrid = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
63
63
|
_datagridState$vertic = datagridState.verticalAlign,
|
64
64
|
verticalAlign = _datagridState$vertic === void 0 ? 'center' : _datagridState$vertic,
|
65
65
|
variableRowHeight = datagridState.variableRowHeight,
|
66
|
-
className = datagridState.className
|
66
|
+
className = datagridState.className,
|
67
|
+
gridTitle = datagridState.gridTitle,
|
68
|
+
gridDescription = datagridState.gridDescription,
|
69
|
+
useDenseHeader = datagridState.useDenseHeader;
|
67
70
|
var rows = DatagridPagination && datagridState.page || datagridState.rows;
|
68
71
|
|
69
72
|
var dataGrid = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(TableContainer, {
|
70
|
-
className: (0, _classnames.default)("".concat(blockClass, "__grid-container"), withVirtualScroll || fullHeightDatagrid ? "".concat(blockClass, "__full-height") : '')
|
71
|
-
|
72
|
-
|
73
|
+
className: (0, _classnames.default)("".concat(blockClass, "__grid-container"), withVirtualScroll || fullHeightDatagrid ? "".concat(blockClass, "__full-height") : '', DatagridPagination ? "".concat(blockClass, "__with-pagination") : '', useDenseHeader ? "".concat(blockClass, "__dense-header") : ''),
|
74
|
+
title: gridTitle,
|
75
|
+
description: gridDescription
|
76
|
+
}, /*#__PURE__*/_react.default.createElement(_DatagridToolbar.default, datagridState), /*#__PURE__*/_react.default.createElement("div", {
|
77
|
+
className: "".concat(blockClass, "__table-container")
|
78
|
+
}, leftPanel && leftPanel.isOpen && /*#__PURE__*/_react.default.createElement("div", {
|
79
|
+
className: "".concat(blockClass, "__datagridLeftPanel")
|
80
|
+
}, leftPanel.panelContent), /*#__PURE__*/_react.default.createElement(Table, (0, _extends2.default)({}, getTableProps(), {
|
81
|
+
className: (0, _classnames.default)(withVirtualScroll ? '' : "".concat(blockClass, "__table-simple"), "".concat(blockClass, "__vertical-align-").concat(verticalAlign), (0, _defineProperty2.default)({}, "".concat(blockClass, "__variable-row-height"), variableRowHeight), (_getTableProps = getTableProps()) === null || _getTableProps === void 0 ? void 0 : _getTableProps.className)
|
73
82
|
}), /*#__PURE__*/_react.default.createElement(_DatagridHead.default, datagridState), /*#__PURE__*/_react.default.createElement(_DatagridBody.default, (0, _extends2.default)({}, datagridState, {
|
74
83
|
rows: rows
|
75
|
-
})))), (rows === null || rows === void 0 ? void 0 : rows.length) > 0 && !isFetching && DatagridPagination && DatagridPagination(datagridState), CustomizeColumnsModal && /*#__PURE__*/_react.default.createElement(CustomizeColumnsModal, {
|
84
|
+
}))))), (rows === null || rows === void 0 ? void 0 : rows.length) > 0 && !isFetching && DatagridPagination && DatagridPagination(datagridState), CustomizeColumnsModal && /*#__PURE__*/_react.default.createElement(CustomizeColumnsModal, {
|
76
85
|
instance: datagridState
|
77
86
|
}));
|
78
87
|
|
@@ -80,13 +89,9 @@ var Datagrid = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
80
89
|
id: tableId,
|
81
90
|
ref: ref,
|
82
91
|
className: (0, _classnames.default)(className, blockClass, withVirtualScroll ? "".concat(blockClass, "__datagridWrap") : "".concat(blockClass, "__datagridWrap-simple"), !isFetching && rows.length === 0 ? "".concat(blockClass, "__empty-state") : '')
|
83
|
-
}, (0, _devtools.getDevtoolsProps)(componentName)),
|
84
|
-
className: "".concat(blockClass, "
|
85
|
-
}, leftPanel
|
86
|
-
className: "".concat(blockClass, "__datagridLeftPanel")
|
87
|
-
}, leftPanel.panelContent), /*#__PURE__*/_react.default.createElement("div", {
|
88
|
-
className: "".concat(blockClass, "__datagridWithPanel")
|
89
|
-
}, dataGrid)), leftPanel === undefined && dataGrid);
|
92
|
+
}, (0, _devtools.getDevtoolsProps)(componentName)), leftPanel && /*#__PURE__*/_react.default.createElement("div", {
|
93
|
+
className: "".concat(blockClass, "__datagridWithPanel ").concat(blockClass, "__displayFlex ").concat(blockClass, "__leftPanel-position")
|
94
|
+
}, dataGrid), leftPanel === undefined && dataGrid);
|
90
95
|
}); // Return a placeholder if not released and not enabled by feature flag
|
91
96
|
|
92
97
|
|
@@ -29,9 +29,11 @@ var TableRow = _carbonComponentsReact.DataTable.TableRow,
|
|
29
29
|
TableCell = _carbonComponentsReact.DataTable.TableCell; // eslint-disable-next-line react/prop-types
|
30
30
|
|
31
31
|
var DatagridRow = function DatagridRow(datagridState) {
|
32
|
+
var _cx;
|
33
|
+
|
32
34
|
var row = datagridState.row;
|
33
35
|
return /*#__PURE__*/_react.default.createElement(TableRow, (0, _extends2.default)({
|
34
|
-
className: (0, _classnames.default)("".concat(blockClass, "__carbon-row"), (0, _defineProperty2.default)(
|
36
|
+
className: (0, _classnames.default)("".concat(blockClass, "__carbon-row"), (_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__carbon-row-expanded"), row.isExpanded), (0, _defineProperty2.default)(_cx, "".concat(_settings.carbon.prefix, "--data-table--selected"), row.isSelected), _cx))
|
35
37
|
}, row.getRowProps(), {
|
36
38
|
key: row.id,
|
37
39
|
onMouseEnter: function onMouseEnter(event) {
|
@@ -42,6 +42,7 @@ var useExpandedRow = function useExpandedRow(hooks) {
|
|
42
42
|
return _objectSpread(_objectSpread({}, row), {}, {
|
43
43
|
canExpand: row.original && !row.original.notExpandable,
|
44
44
|
expandedContentHeight: expandedRowsHeight[row.index] || expandedContentHeight,
|
45
|
+
// RowRenderer: DatagridExpandedRow(row.RowRenderer, expansionRenderer),
|
45
46
|
RowRenderer: (0, _DatagridExpandedRow.default)(row.RowRenderer, ExpandedRowContentComponent)
|
46
47
|
});
|
47
48
|
});
|
@@ -13,16 +13,23 @@ exports.default = void 0;
|
|
13
13
|
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
14
14
|
*/
|
15
15
|
var useOnRowClick = function useOnRowClick(hooks) {
|
16
|
-
var useInstance = function useInstance(
|
17
|
-
var onRowClick =
|
16
|
+
var useInstance = function useInstance(rowInstance) {
|
17
|
+
var onRowClick = rowInstance.onRowClick;
|
18
18
|
|
19
19
|
var getRowProps = function getRowProps(props, datagridState) {
|
20
20
|
var isFetching = datagridState.isFetching,
|
21
|
-
row = datagridState.row
|
21
|
+
row = datagridState.row,
|
22
|
+
instance = datagridState.instance;
|
23
|
+
var id = row.id,
|
24
|
+
toggleRowSelected = row.toggleRowSelected;
|
22
25
|
|
23
26
|
var onClick = function onClick() {
|
24
27
|
if (!isFetching && onRowClick) {
|
25
28
|
onRowClick(row);
|
29
|
+
instance.selectedFlatRows && instance.selectedFlatRows.map(function (toggleRow) {
|
30
|
+
return toggleRow.toggleRowSelected(false);
|
31
|
+
});
|
32
|
+
toggleRowSelected(id, true);
|
26
33
|
}
|
27
34
|
};
|
28
35
|
|
@@ -0,0 +1,85 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.EditFullPage = void 0;
|
9
|
+
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
11
|
+
|
12
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
13
|
+
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
15
|
+
|
16
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
17
|
+
|
18
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
19
|
+
|
20
|
+
var _devtools = require("../../global/js/utils/devtools");
|
21
|
+
|
22
|
+
var _settings = require("../../settings");
|
23
|
+
|
24
|
+
var _excluded = ["children", "className"];
|
25
|
+
// Carbon and package components we use.
|
26
|
+
|
27
|
+
/* TODO: @import(s) of carbon components and other package components. */
|
28
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
29
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--edit-full-page");
|
30
|
+
var componentName = 'EditFullPage'; // NOTE: the component SCSS is not imported here: it is rolled up separately.
|
31
|
+
// Default values can be included here and then assigned to the prop params,
|
32
|
+
// e.g. prop = defaults.prop,
|
33
|
+
// This gathers default values together neatly and ensures non-primitive
|
34
|
+
// values are initialized early to avoid react making unnecessary re-renders.
|
35
|
+
// Note that default values are not required for props that are 'required',
|
36
|
+
// nor for props where the component can apply undefined values reasonably.
|
37
|
+
// Default values should be provided when the component needs to make a choice
|
38
|
+
// or assumption when a prop is not supplied.
|
39
|
+
// Default values for props
|
40
|
+
// const defaults = {
|
41
|
+
// /* TODO: add defaults for relevant props if needed */
|
42
|
+
// };
|
43
|
+
|
44
|
+
/**
|
45
|
+
* TODO: A description of the component.
|
46
|
+
*/
|
47
|
+
|
48
|
+
var EditFullPage = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
49
|
+
var children = _ref.children,
|
50
|
+
className = _ref.className,
|
51
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
52
|
+
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
|
53
|
+
className: (0, _classnames.default)(blockClass, // Apply the block class to the main HTML element
|
54
|
+
className, // Apply any supplied class names to the main HTML element.
|
55
|
+
// example: `${blockClass}__template-string-class-${kind}-n-${size}`,
|
56
|
+
{// switched classes dependant on props or state
|
57
|
+
// example: [`${blockClass}__here-if-small`]: size === 'sm',
|
58
|
+
}),
|
59
|
+
ref: ref,
|
60
|
+
role: "main"
|
61
|
+
}, (0, _devtools.getDevtoolsProps)(componentName)), children);
|
62
|
+
}); // Return a placeholder if not released and not enabled by feature flag
|
63
|
+
|
64
|
+
|
65
|
+
exports.EditFullPage = EditFullPage;
|
66
|
+
exports.EditFullPage = EditFullPage = _settings.pkg.checkComponentEnabled(EditFullPage, componentName); // The display name of the component, used by React. Note that displayName
|
67
|
+
// is used in preference to relying on function.name.
|
68
|
+
|
69
|
+
EditFullPage.displayName = componentName; // The types and DocGen commentary for the component props,
|
70
|
+
// in alphabetical order (for consistency).
|
71
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
72
|
+
|
73
|
+
EditFullPage.propTypes = {
|
74
|
+
/**
|
75
|
+
* Provide the contents of the EditFullPage.
|
76
|
+
*/
|
77
|
+
children: _propTypes.default.node.isRequired,
|
78
|
+
|
79
|
+
/**
|
80
|
+
* Provide an optional class to be applied to the containing node.
|
81
|
+
*/
|
82
|
+
className: _propTypes.default.string
|
83
|
+
/* TODO: add types and DocGen for all props. */
|
84
|
+
|
85
|
+
};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
Object.defineProperty(exports, "EditFullPage", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function get() {
|
9
|
+
return _EditFullPage.EditFullPage;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
|
13
|
+
var _EditFullPage = require("./EditFullPage");
|
@@ -0,0 +1,229 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
6
|
+
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
8
|
+
value: true
|
9
|
+
});
|
10
|
+
exports.FormNumberContext = exports.FormContext = exports.EditTearsheet = void 0;
|
11
|
+
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
13
|
+
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
15
|
+
|
16
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
17
|
+
|
18
|
+
var _react = _interopRequireWildcard(require("react"));
|
19
|
+
|
20
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
21
|
+
|
22
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
23
|
+
|
24
|
+
var _carbonComponentsReact = require("carbon-components-react");
|
25
|
+
|
26
|
+
var _settings = require("../../settings");
|
27
|
+
|
28
|
+
var _devtools = require("../../global/js/utils/devtools");
|
29
|
+
|
30
|
+
var _TearsheetShell = require("../Tearsheet/TearsheetShell");
|
31
|
+
|
32
|
+
var _excluded = ["cancelButtonText", "children", "className", "description", "influencerWidth", "label", "onClose", "open", "submitButtonText", "title", "verticalPosition", "onHandleModalClick"];
|
33
|
+
|
34
|
+
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); }
|
35
|
+
|
36
|
+
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; }
|
37
|
+
|
38
|
+
var componentName = 'EditTearsheet';
|
39
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--tearsheet-edit"); // This is a general context for the forms container
|
40
|
+
// containing information about the state of the container
|
41
|
+
// and providing some callback methods for forms to use
|
42
|
+
|
43
|
+
var FormContext = /*#__PURE__*/(0, _react.createContext)(null); // This is a context supplied separately to each form in the container
|
44
|
+
// to let it know what number it is in the sequence of forms
|
45
|
+
|
46
|
+
exports.FormContext = FormContext;
|
47
|
+
var FormNumberContext = /*#__PURE__*/(0, _react.createContext)(0); // Default values for props
|
48
|
+
|
49
|
+
exports.FormNumberContext = FormNumberContext;
|
50
|
+
var defaults = {
|
51
|
+
verticalPosition: 'normal',
|
52
|
+
influencerWidth: 'narrow'
|
53
|
+
};
|
54
|
+
var EditTearsheet = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
55
|
+
var cancelButtonText = _ref.cancelButtonText,
|
56
|
+
children = _ref.children,
|
57
|
+
className = _ref.className,
|
58
|
+
description = _ref.description,
|
59
|
+
_ref$influencerWidth = _ref.influencerWidth,
|
60
|
+
influencerWidth = _ref$influencerWidth === void 0 ? defaults.influencerWidth : _ref$influencerWidth,
|
61
|
+
label = _ref.label,
|
62
|
+
onClose = _ref.onClose,
|
63
|
+
open = _ref.open,
|
64
|
+
submitButtonText = _ref.submitButtonText,
|
65
|
+
title = _ref.title,
|
66
|
+
_ref$verticalPosition = _ref.verticalPosition,
|
67
|
+
verticalPosition = _ref$verticalPosition === void 0 ? defaults.verticalPosition : _ref$verticalPosition,
|
68
|
+
onHandleModalClick = _ref.onHandleModalClick,
|
69
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
70
|
+
|
71
|
+
var _useState = (0, _react.useState)(0),
|
72
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
73
|
+
currentForm = _useState2[0],
|
74
|
+
setCurrentForm = _useState2[1];
|
75
|
+
|
76
|
+
var contentRef = (0, _react.useRef)();
|
77
|
+
|
78
|
+
var handleCurrentForm = function handleCurrentForm(form) {
|
79
|
+
setCurrentForm(form);
|
80
|
+
};
|
81
|
+
|
82
|
+
var sideNavItems = [{
|
83
|
+
label: 'Topic Name'
|
84
|
+
}, {
|
85
|
+
label: 'Location'
|
86
|
+
}, {
|
87
|
+
label: 'Partitions'
|
88
|
+
}, {
|
89
|
+
label: 'Message retention'
|
90
|
+
}];
|
91
|
+
|
92
|
+
var influencer = /*#__PURE__*/_react.default.createElement("div", {
|
93
|
+
className: "tearsheet-stories__dummy-influencer-block"
|
94
|
+
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.SideNav, {
|
95
|
+
"aria-label": "Side navigation",
|
96
|
+
className: "".concat(blockClass, "__side-nav"),
|
97
|
+
expanded: true,
|
98
|
+
isFixedNav: false
|
99
|
+
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.SideNavItems, null, sideNavItems.map(function (item, index) {
|
100
|
+
return /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.SideNavMenuItem, {
|
101
|
+
key: index,
|
102
|
+
onClick: function onClick() {
|
103
|
+
return handleCurrentForm(index);
|
104
|
+
},
|
105
|
+
isActive: currentForm === index
|
106
|
+
}, item.label);
|
107
|
+
}))));
|
108
|
+
|
109
|
+
return /*#__PURE__*/_react.default.createElement(_TearsheetShell.TearsheetShell, (0, _extends2.default)({}, rest, (0, _devtools.getDevtoolsProps)(componentName), {
|
110
|
+
actions: [{
|
111
|
+
label: submitButtonText,
|
112
|
+
onClick: onHandleModalClick,
|
113
|
+
kind: 'primary'
|
114
|
+
}, {
|
115
|
+
label: cancelButtonText,
|
116
|
+
onClick: onHandleModalClick,
|
117
|
+
kind: 'secondary'
|
118
|
+
}],
|
119
|
+
className: (0, _classnames.default)(blockClass, className),
|
120
|
+
description: description,
|
121
|
+
hasCloseIcon: false,
|
122
|
+
influencer: influencer,
|
123
|
+
influencerPosition: "left",
|
124
|
+
influencerWidth: influencerWidth,
|
125
|
+
label: label,
|
126
|
+
onClose: onClose,
|
127
|
+
open: open,
|
128
|
+
size: "wide",
|
129
|
+
title: title,
|
130
|
+
verticalPosition: verticalPosition,
|
131
|
+
ref: ref
|
132
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
133
|
+
className: "".concat(blockClass, "__content"),
|
134
|
+
ref: contentRef,
|
135
|
+
role: "main"
|
136
|
+
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Grid, null, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Form, null, /*#__PURE__*/_react.default.createElement(FormContext.Provider, {
|
137
|
+
value: {
|
138
|
+
currentForm: currentForm
|
139
|
+
}
|
140
|
+
}, _react.default.Children.map(children, function (child, index) {
|
141
|
+
return /*#__PURE__*/_react.default.createElement(FormNumberContext.Provider, {
|
142
|
+
value: index
|
143
|
+
}, child);
|
144
|
+
}))))));
|
145
|
+
}); // Return a placeholder if not released and not enabled by feature flag
|
146
|
+
|
147
|
+
exports.EditTearsheet = EditTearsheet;
|
148
|
+
exports.EditTearsheet = EditTearsheet = _settings.pkg.checkComponentEnabled(EditTearsheet, componentName); // The display name of the component, used by React. Note that displayName
|
149
|
+
// is used in preference to relying on function.name.
|
150
|
+
|
151
|
+
EditTearsheet.displayName = componentName; // Note that the descriptions here should be kept in sync with those for the
|
152
|
+
// corresponding props for TearsheetNarrow and TearsheetShell components.
|
153
|
+
|
154
|
+
EditTearsheet.propTypes = {
|
155
|
+
/**
|
156
|
+
* The cancel button text
|
157
|
+
*/
|
158
|
+
cancelButtonText: _propTypes.default.string,
|
159
|
+
|
160
|
+
/**
|
161
|
+
* The main content of the tearsheet
|
162
|
+
*/
|
163
|
+
children: _propTypes.default.node,
|
164
|
+
|
165
|
+
/**
|
166
|
+
* An optional class or classes to be added to the outermost element.
|
167
|
+
*/
|
168
|
+
className: _propTypes.default.string,
|
169
|
+
|
170
|
+
/**
|
171
|
+
* A description of the flow, displayed in the header area of the tearsheet.
|
172
|
+
*/
|
173
|
+
description: _propTypes.default.node,
|
174
|
+
|
175
|
+
/**
|
176
|
+
* The content for the influencer section of the tearsheet, displayed
|
177
|
+
* alongside the main content. This is typically a menu, or filter, or
|
178
|
+
* progress indicator, or similar.
|
179
|
+
*/
|
180
|
+
influencer: _propTypes.default.element,
|
181
|
+
|
182
|
+
/**
|
183
|
+
* Used to set the size of the influencer
|
184
|
+
*/
|
185
|
+
influencerWidth: _propTypes.default.oneOf(['narrow', 'wide']),
|
186
|
+
|
187
|
+
/**
|
188
|
+
* A label for the tearsheet, displayed in the header area of the tearsheet
|
189
|
+
* to maintain context for the tearsheet (e.g. as the title changes from page
|
190
|
+
* to page of a multi-page task).
|
191
|
+
*/
|
192
|
+
label: _propTypes.default.node,
|
193
|
+
|
194
|
+
/**
|
195
|
+
* An optional handler that is called when the user closes the tearsheet (by
|
196
|
+
* clicking the close button, if enabled, or clicking outside, if enabled).
|
197
|
+
* Returning `false` here prevents the modal from closing.
|
198
|
+
*/
|
199
|
+
onClose: _propTypes.default.func,
|
200
|
+
|
201
|
+
/**
|
202
|
+
* Specifies whether the tearsheet is currently open.
|
203
|
+
*/
|
204
|
+
onHandleModalClick: _propTypes.default.func,
|
205
|
+
|
206
|
+
/**
|
207
|
+
* Specifies whether the tearsheet is currently open.
|
208
|
+
*/
|
209
|
+
open: _propTypes.default.bool,
|
210
|
+
|
211
|
+
/**
|
212
|
+
* The submit button text
|
213
|
+
*/
|
214
|
+
submitButtonText: _propTypes.default.string,
|
215
|
+
|
216
|
+
/**
|
217
|
+
* The main title of the tearsheet, displayed in the header area.
|
218
|
+
*/
|
219
|
+
title: _propTypes.default.node,
|
220
|
+
|
221
|
+
/**
|
222
|
+
* The position of the top of tearsheet in the viewport. The 'normal'
|
223
|
+
* position (the default) is a short distance down from the top of the
|
224
|
+
* viewport, leaving room at the top for a global header bar to show through
|
225
|
+
* from below. The 'lower' position provides a little extra room at the top
|
226
|
+
* to allow an action bar navigation or breadcrumbs to also show through.
|
227
|
+
*/
|
228
|
+
verticalPosition: _propTypes.default.oneOf(['normal', 'lower'])
|
229
|
+
};
|
@@ -0,0 +1,122 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
6
|
+
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
8
|
+
value: true
|
9
|
+
});
|
10
|
+
exports.EditTearsheetForm = void 0;
|
11
|
+
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
13
|
+
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
15
|
+
|
16
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
17
|
+
|
18
|
+
var _react = _interopRequireWildcard(require("react"));
|
19
|
+
|
20
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
21
|
+
|
22
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
23
|
+
|
24
|
+
var _carbonComponentsReact = require("carbon-components-react");
|
25
|
+
|
26
|
+
var _EditTearsheet = require("./EditTearsheet");
|
27
|
+
|
28
|
+
var _settings = require("../../settings");
|
29
|
+
|
30
|
+
var _pconsole = _interopRequireDefault(require("../../global/js/utils/pconsole"));
|
31
|
+
|
32
|
+
var _excluded = ["children", "className", "description", "fieldsetLegendText", "hasFieldset", "subtitle", "title"];
|
33
|
+
|
34
|
+
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); }
|
35
|
+
|
36
|
+
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; }
|
37
|
+
|
38
|
+
var componentName = 'EditTearsheetForm';
|
39
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--tearsheet-edit__form"); // Default values for props
|
40
|
+
|
41
|
+
var defaults = {
|
42
|
+
hasFieldset: true
|
43
|
+
};
|
44
|
+
var EditTearsheetForm = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
45
|
+
var _cx;
|
46
|
+
|
47
|
+
var children = _ref.children,
|
48
|
+
className = _ref.className,
|
49
|
+
description = _ref.description,
|
50
|
+
fieldsetLegendText = _ref.fieldsetLegendText,
|
51
|
+
_ref$hasFieldset = _ref.hasFieldset,
|
52
|
+
hasFieldset = _ref$hasFieldset === void 0 ? defaults.hasFieldset : _ref$hasFieldset,
|
53
|
+
subtitle = _ref.subtitle,
|
54
|
+
title = _ref.title,
|
55
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
56
|
+
var formContext = (0, _react.useContext)(_EditTearsheet.FormContext);
|
57
|
+
var formNumber = (0, _react.useContext)(_EditTearsheet.FormNumberContext);
|
58
|
+
return formContext ? /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
|
59
|
+
className: (0, _classnames.default)(blockClass, className, (_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__form--hidden-form"), formNumber !== (formContext === null || formContext === void 0 ? void 0 : formContext.currentForm)), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__form--visible-form"), formNumber === (formContext === null || formContext === void 0 ? void 0 : formContext.currentForm)), _cx)),
|
60
|
+
ref: ref
|
61
|
+
}), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Row, null, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Column, {
|
62
|
+
xlg: 12,
|
63
|
+
lg: 12,
|
64
|
+
md: 8,
|
65
|
+
sm: 8
|
66
|
+
}, /*#__PURE__*/_react.default.createElement("h4", {
|
67
|
+
className: "".concat(blockClass, "--title")
|
68
|
+
}, title), subtitle && /*#__PURE__*/_react.default.createElement("h6", {
|
69
|
+
className: "".concat(blockClass, "--subtitle")
|
70
|
+
}, subtitle), description && /*#__PURE__*/_react.default.createElement("p", {
|
71
|
+
className: "".concat(blockClass, "--description")
|
72
|
+
}, description))), hasFieldset ? /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.FormGroup, {
|
73
|
+
legendText: fieldsetLegendText,
|
74
|
+
className: "".concat(blockClass, "--fieldset")
|
75
|
+
}, children) : children) : _pconsole.default.warn("You have tried using a ".concat(componentName, " component outside of a EditTearsheet. This is not allowed. ").concat(componentName, "s should always be children of the EditTearsheet"));
|
76
|
+
}); // Return a placeholder if not released and not enabled by feature flag
|
77
|
+
|
78
|
+
exports.EditTearsheetForm = EditTearsheetForm;
|
79
|
+
exports.EditTearsheetForm = EditTearsheetForm = _settings.pkg.checkComponentEnabled(EditTearsheetForm, componentName);
|
80
|
+
EditTearsheetForm.propTypes = {
|
81
|
+
/**
|
82
|
+
* Content that shows in the tearsheet form
|
83
|
+
*/
|
84
|
+
children: _propTypes.default.node,
|
85
|
+
|
86
|
+
/**
|
87
|
+
* Sets an optional className to be added to the tearsheet form
|
88
|
+
*/
|
89
|
+
className: _propTypes.default.string,
|
90
|
+
|
91
|
+
/**
|
92
|
+
* Sets an optional description on the form component
|
93
|
+
*/
|
94
|
+
description: _propTypes.default.string,
|
95
|
+
|
96
|
+
/**
|
97
|
+
* This is the required legend text that appears above a fieldset html element for accessibility purposes.
|
98
|
+
* You can set the `hasFieldset` prop to false if you have multiple fieldset elements or want to control the children of your Full Page's form content.
|
99
|
+
* Otherwise, use CSS to hide/remove this label text.
|
100
|
+
*/
|
101
|
+
fieldsetLegendText: _propTypes.default.string.isRequired.if(function (_ref2) {
|
102
|
+
var hasFieldset = _ref2.hasFieldset;
|
103
|
+
return !!hasFieldset;
|
104
|
+
}),
|
105
|
+
|
106
|
+
/**
|
107
|
+
* This optional prop will render your form content inside of a fieldset html element
|
108
|
+
* and is defaulted to true.
|
109
|
+
* You can set this prop to `false` if you have multiple fieldset elements or want to control the children of your Full Page's form content.
|
110
|
+
*/
|
111
|
+
hasFieldset: _propTypes.default.bool,
|
112
|
+
|
113
|
+
/**
|
114
|
+
* Sets an optional subtitle on the form component
|
115
|
+
*/
|
116
|
+
subtitle: _propTypes.default.string,
|
117
|
+
|
118
|
+
/**
|
119
|
+
* Sets the title text for a tearsheet form
|
120
|
+
*/
|
121
|
+
title: _propTypes.default.node.isRequired
|
122
|
+
};
|
@@ -0,0 +1,21 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
Object.defineProperty(exports, "EditTearsheet", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function get() {
|
9
|
+
return _EditTearsheet.EditTearsheet;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
Object.defineProperty(exports, "EditTearsheetForm", {
|
13
|
+
enumerable: true,
|
14
|
+
get: function get() {
|
15
|
+
return _EditTearsheetForm.EditTearsheetForm;
|
16
|
+
}
|
17
|
+
});
|
18
|
+
|
19
|
+
var _EditTearsheet = require("./EditTearsheet");
|
20
|
+
|
21
|
+
var _EditTearsheetForm = require("./EditTearsheetForm");
|