@carbon/ibm-products 1.6.0 → 1.6.1
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/css/index-full-carbon.css +110 -30
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +7 -1
- package/css/index-full-carbon.min.css.map +1 -0
- package/css/index-without-carbon-released-only.css +2 -0
- 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 -0
- package/css/index-without-carbon.css +110 -30
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +7 -1
- package/css/index-without-carbon.min.css.map +1 -0
- package/css/index.css +110 -30
- package/css/index.css.map +1 -1
- package/css/index.min.css +7 -1
- package/css/index.min.css.map +1 -0
- package/es/components/AddSelect/AddSelect.js +4 -3
- package/es/components/AddSelect/AddSelectList.js +2 -2
- package/es/components/AddSelect/AddSelectSidebar.js +41 -9
- package/es/components/EmptyStates/EmptyState.js +1 -1
- package/es/components/EmptyStates/EmptyStateContent.js +2 -2
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -1
- package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -1
- package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -1
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -1
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -1
- package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +1 -1
- package/es/components/InlineEdit/InlineEdit.js +51 -27
- package/es/components/PageHeader/PageHeader.js +2 -2
- package/lib/components/AddSelect/AddSelect.js +4 -3
- package/lib/components/AddSelect/AddSelectList.js +2 -2
- package/lib/components/AddSelect/AddSelectSidebar.js +40 -14
- package/lib/components/EmptyStates/EmptyState.js +1 -1
- package/lib/components/EmptyStates/EmptyStateContent.js +2 -2
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -1
- package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -1
- package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -1
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -1
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -1
- package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +1 -1
- package/lib/components/InlineEdit/InlineEdit.js +50 -26
- package/lib/components/PageHeader/PageHeader.js +2 -2
- package/package.json +12 -12
- package/scss/components/AddSelect/_add-select.scss +15 -5
- package/scss/components/CancelableTextEdit/_storybook-styles.scss +0 -7
- package/scss/components/CreateTearsheetNarrow/_storybook-styles.scss +0 -6
- package/scss/components/EditSidePanel/_storybook-styles.scss +0 -8
- package/scss/components/InlineEdit/_inline-edit.scss +104 -29
- package/scss/components/InlineEdit/_storybook-styles.scss +1 -8
- package/scss/components/LoadingBar/_storybook-styles.scss +0 -5
- package/scss/components/OptionsTile/_storybook-styles.scss +0 -7
- package/scss/components/PageHeader/_page-header.scss +3 -0
- package/scss/components/StatusIcon/_status-icon.scss +4 -4
- package/scss/components/UserProfileImage/_user-profile-image.scss +2 -2
@@ -770,7 +770,7 @@ PageHeader.propTypes = _objectSpread({
|
|
770
770
|
* - onChange: function to process the live value (React change === HTML Input)
|
771
771
|
* - onSave: function to process a confirmed change
|
772
772
|
* - editableLabel: label for edit required if onChange supplied
|
773
|
-
* -
|
773
|
+
* - cancelDescription: label for edit cancel button
|
774
774
|
* - saveDescription: label for edit save button
|
775
775
|
* - Object containing user defined contents. These must fit within the area defined for the title in both main part of the header and the breadcrumb.
|
776
776
|
* - content: title or name of current location shown in main part of page header
|
@@ -789,7 +789,7 @@ PageHeader.propTypes = _objectSpread({
|
|
789
789
|
// .isRequired.if(inlineEditRequired),
|
790
790
|
onChange: PropTypes.func,
|
791
791
|
onSave: PropTypes.func,
|
792
|
-
|
792
|
+
cancelDescription: PropTypes.string,
|
793
793
|
//.isRequired.if(inlineEditRequired),
|
794
794
|
saveDescription: PropTypes.string //.isRequired.if(inlineEditRequired),
|
795
795
|
// Update docgen if changed
|
@@ -179,6 +179,7 @@ var AddSelect = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
179
179
|
};
|
180
180
|
var sidebarProps = {
|
181
181
|
influencerTitle: influencerTitle,
|
182
|
+
items: items,
|
182
183
|
multiSelection: multiSelection,
|
183
184
|
noSelectionDescription: noSelectionDescription,
|
184
185
|
noSelectionTitle: noSelectionTitle
|
@@ -199,9 +200,9 @@ AddSelect.propTypes = {
|
|
199
200
|
influencerTitle: _propTypes.default.string,
|
200
201
|
inputPlaceholder: _propTypes.default.string,
|
201
202
|
items: _propTypes.default.arrayOf(_propTypes.default.shape({
|
202
|
-
id: _propTypes.default.
|
203
|
-
label: _propTypes.default.string,
|
204
|
-
value: _propTypes.default.string
|
203
|
+
id: _propTypes.default.string.isRequired,
|
204
|
+
label: _propTypes.default.string.isRequired,
|
205
|
+
value: _propTypes.default.string.isRequired
|
205
206
|
})),
|
206
207
|
itemsLabel: _propTypes.default.string,
|
207
208
|
multi: _propTypes.default.bool,
|
@@ -77,11 +77,11 @@ var AddSelectList = function AddSelectList(_ref) {
|
|
77
77
|
}, multi ? /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Checkbox, {
|
78
78
|
className: "".concat(blockClass, "-checkbox"),
|
79
79
|
onChange: function onChange(value) {
|
80
|
-
return handleMultiSelection(item.
|
80
|
+
return handleMultiSelection(item.id, value);
|
81
81
|
},
|
82
82
|
labelText: item.label,
|
83
83
|
id: item.id,
|
84
|
-
checked: multiSelection.includes(item.
|
84
|
+
checked: multiSelection.includes(item.id)
|
85
85
|
}) : /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.RadioButton, {
|
86
86
|
className: "".concat(blockClass, "-radio"),
|
87
87
|
name: "add-select-selections",
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
});
|
8
8
|
exports.AddSelectSidebar = void 0;
|
9
9
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
11
|
+
|
10
12
|
var _react = _interopRequireDefault(require("react"));
|
11
13
|
|
12
14
|
var _carbonComponentsReact = require("carbon-components-react");
|
@@ -17,22 +19,33 @@ var _NoDataEmptyState = require("../../components/EmptyStates/NoDataEmptyState")
|
|
17
19
|
|
18
20
|
var _settings = require("../../settings");
|
19
21
|
|
20
|
-
|
21
|
-
// Copyright IBM Corp. 2022
|
22
|
-
//
|
23
|
-
// This source code is licensed under the Apache-2.0 license found in the
|
24
|
-
// LICENSE file in the root directory of this source tree.
|
25
|
-
//
|
22
|
+
var _excluded = ["children"];
|
26
23
|
var componentName = 'AddSelectSidebar';
|
27
24
|
|
28
25
|
var AddSelectSidebar = function AddSelectSidebar(_ref) {
|
29
26
|
var influencerTitle = _ref.influencerTitle,
|
27
|
+
items = _ref.items,
|
30
28
|
multiSelection = _ref.multiSelection,
|
31
29
|
noSelectionDescription = _ref.noSelectionDescription,
|
32
30
|
noSelectionTitle = _ref.noSelectionTitle;
|
33
|
-
var blockClass = "".concat(_settings.pkg.prefix, "--add-
|
31
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--add-select__sidebar"); // utility to flatten the list of items and their children into a single searchable array
|
32
|
+
|
33
|
+
var flattenItems = function flattenItems(arr) {
|
34
|
+
return arr.reduce(function (prev, cur) {
|
35
|
+
var children = cur.children,
|
36
|
+
item = (0, _objectWithoutProperties2.default)(cur, _excluded);
|
37
|
+
return prev.concat(item).concat(children ? flattenItems(children) : []);
|
38
|
+
}, []);
|
39
|
+
};
|
40
|
+
|
41
|
+
var flattenedItems = flattenItems(items);
|
42
|
+
var sidebarItems = multiSelection.map(function (selectedId) {
|
43
|
+
return flattenedItems.find(function (item) {
|
44
|
+
return item.id === selectedId;
|
45
|
+
});
|
46
|
+
});
|
34
47
|
return /*#__PURE__*/_react.default.createElement("div", {
|
35
|
-
className:
|
48
|
+
className: blockClass
|
36
49
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
37
50
|
className: "".concat(blockClass, "-header")
|
38
51
|
}, /*#__PURE__*/_react.default.createElement("p", {
|
@@ -40,13 +53,25 @@ var AddSelectSidebar = function AddSelectSidebar(_ref) {
|
|
40
53
|
}, influencerTitle), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Tag, {
|
41
54
|
type: "gray",
|
42
55
|
size: "sm"
|
43
|
-
}, multiSelection.length)), /*#__PURE__*/_react.default.createElement(
|
56
|
+
}, multiSelection.length)), multiSelection.length > 0 ? /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Accordion, {
|
57
|
+
align: "start"
|
58
|
+
}, sidebarItems.map(function (item) {
|
59
|
+
return /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.AccordionItem, {
|
60
|
+
title: item.value,
|
61
|
+
key: item.id
|
62
|
+
}, Object.keys(item).map(function (key) {
|
63
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
64
|
+
className: "".concat(blockClass, "-item"),
|
65
|
+
key: key
|
66
|
+
}, /*#__PURE__*/_react.default.createElement("p", {
|
67
|
+
className: "".concat(blockClass, "-item-header")
|
68
|
+
}, key), /*#__PURE__*/_react.default.createElement("p", {
|
69
|
+
className: "".concat(blockClass, "-item-body")
|
70
|
+
}, item[key]));
|
71
|
+
}));
|
72
|
+
})) : /*#__PURE__*/_react.default.createElement("div", {
|
44
73
|
className: "".concat(blockClass, "-body")
|
45
|
-
},
|
46
|
-
return /*#__PURE__*/_react.default.createElement("p", {
|
47
|
-
key: item
|
48
|
-
}, item);
|
49
|
-
}) : /*#__PURE__*/_react.default.createElement(_NoDataEmptyState.NoDataEmptyState, {
|
74
|
+
}, /*#__PURE__*/_react.default.createElement(_NoDataEmptyState.NoDataEmptyState, {
|
50
75
|
subtitle: noSelectionDescription,
|
51
76
|
title: noSelectionTitle,
|
52
77
|
size: "sm"
|
@@ -56,6 +81,7 @@ var AddSelectSidebar = function AddSelectSidebar(_ref) {
|
|
56
81
|
exports.AddSelectSidebar = AddSelectSidebar;
|
57
82
|
AddSelectSidebar.propTypes = {
|
58
83
|
influencerTitle: _propTypes.default.string,
|
84
|
+
items: _propTypes.default.array,
|
59
85
|
multiSelection: _propTypes.default.array,
|
60
86
|
noSelectionDescription: _propTypes.default.string,
|
61
87
|
noSelectionTitle: _propTypes.default.string
|
@@ -123,7 +123,7 @@ EmptyState.propTypes = {
|
|
123
123
|
/**
|
124
124
|
* Empty state subtext
|
125
125
|
*/
|
126
|
-
subtitle: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node])
|
126
|
+
subtitle: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
127
127
|
|
128
128
|
/**
|
129
129
|
* Empty state heading
|
@@ -37,7 +37,7 @@ var EmptyStateContent = function EmptyStateContent(_ref) {
|
|
37
37
|
title = _ref.title;
|
38
38
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("h3", {
|
39
39
|
className: (0, _classnames.default)("".concat(blockClass, "__header"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__header--small"), size === 'sm'))
|
40
|
-
}, title), /*#__PURE__*/_react.default.createElement("p", {
|
40
|
+
}, title), subtitle && /*#__PURE__*/_react.default.createElement("p", {
|
41
41
|
className: (0, _classnames.default)("".concat(blockClass, "__subtitle"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__subtitle--small"), size === 'sm'))
|
42
42
|
}, subtitle), (action === null || action === void 0 ? void 0 : action.text) && (action === null || action === void 0 ? void 0 : action.onClick) && /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, (0, _extends2.default)({}, action, {
|
43
43
|
className: "".concat(blockClass, "__action-button"),
|
@@ -85,7 +85,7 @@ EmptyStateContent.propTypes = {
|
|
85
85
|
/**
|
86
86
|
* Empty state subtitle
|
87
87
|
*/
|
88
|
-
subtitle: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node])
|
88
|
+
subtitle: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
89
89
|
|
90
90
|
/**
|
91
91
|
* Empty state title
|
@@ -114,7 +114,7 @@ ErrorEmptyState.propTypes = {
|
|
114
114
|
/**
|
115
115
|
* Empty state subtitle
|
116
116
|
*/
|
117
|
-
subtitle: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node])
|
117
|
+
subtitle: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
118
118
|
|
119
119
|
/**
|
120
120
|
* Empty state title
|
@@ -114,7 +114,7 @@ NoDataEmptyState.propTypes = {
|
|
114
114
|
/**
|
115
115
|
* Empty state subtitle
|
116
116
|
*/
|
117
|
-
subtitle: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node])
|
117
|
+
subtitle: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
118
118
|
|
119
119
|
/**
|
120
120
|
* Empty state title
|
@@ -114,7 +114,7 @@ NoTagsEmptyState.propTypes = {
|
|
114
114
|
/**
|
115
115
|
* Empty state subtitle
|
116
116
|
*/
|
117
|
-
subtitle: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node])
|
117
|
+
subtitle: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
118
118
|
|
119
119
|
/**
|
120
120
|
* Empty state title
|
@@ -114,7 +114,7 @@ NotFoundEmptyState.propTypes = {
|
|
114
114
|
/**
|
115
115
|
* Empty state subtitle
|
116
116
|
*/
|
117
|
-
subtitle: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node])
|
117
|
+
subtitle: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
118
118
|
|
119
119
|
/**
|
120
120
|
* Empty state title
|
@@ -114,7 +114,7 @@ NotificationsEmptyState.propTypes = {
|
|
114
114
|
/**
|
115
115
|
* Empty state subtitle
|
116
116
|
*/
|
117
|
-
subtitle: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node])
|
117
|
+
subtitle: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
118
118
|
|
119
119
|
/**
|
120
120
|
* Empty state title
|
@@ -114,7 +114,7 @@ UnauthorizedEmptyState.propTypes = {
|
|
114
114
|
/**
|
115
115
|
* Empty state subtitle
|
116
116
|
*/
|
117
|
-
subtitle: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node])
|
117
|
+
subtitle: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
118
118
|
|
119
119
|
/**
|
120
120
|
* Empty state title
|
@@ -31,7 +31,7 @@ var _carbonComponentsReact = require("carbon-components-react");
|
|
31
31
|
|
32
32
|
var _iconsReact = require("@carbon/icons-react");
|
33
33
|
|
34
|
-
var _excluded = ["cancelDescription", "className", "disabled", "editDescription", "editVisibleOnHoverOnly", "id", "invalid", "invalidText", "labelText", "light", "onCancel", "onSave", "onChange", "saveDescription", "saveDisabled", "size", "value", "warn", "warnText"];
|
34
|
+
var _excluded = ["cancelDescription", "className", "disabled", "editDescription", "editVisibleOnHoverOnly", "id", "invalid", "invalidText", "labelText", "light", "onCancel", "onSave", "onChange", "placeholder", "saveDescription", "saveDisabled", "size", "value", "warn", "warnText"];
|
35
35
|
|
36
36
|
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); }
|
37
37
|
|
@@ -46,7 +46,7 @@ var componentName = 'InlineEdit'; // NOTE: the component SCSS is not imported he
|
|
46
46
|
*/
|
47
47
|
|
48
48
|
var InlineEdit = /*#__PURE__*/_react.default.forwardRef(function (_ref, refIn) {
|
49
|
-
var _cx,
|
49
|
+
var _cx, _cx3;
|
50
50
|
|
51
51
|
var cancelDescription = _ref.cancelDescription,
|
52
52
|
className = _ref.className,
|
@@ -61,6 +61,7 @@ var InlineEdit = /*#__PURE__*/_react.default.forwardRef(function (_ref, refIn) {
|
|
61
61
|
onCancel = _ref.onCancel,
|
62
62
|
onSave = _ref.onSave,
|
63
63
|
onChange = _ref.onChange,
|
64
|
+
placeholder = _ref.placeholder,
|
64
65
|
saveDescription = _ref.saveDescription,
|
65
66
|
saveDisabled = _ref.saveDisabled,
|
66
67
|
size = _ref.size,
|
@@ -86,13 +87,22 @@ var InlineEdit = /*#__PURE__*/_react.default.forwardRef(function (_ref, refIn) {
|
|
86
87
|
var validationText = invalidText || warnText;
|
87
88
|
var validationIcon = showValidationText ? invalid ? /*#__PURE__*/_react.default.createElement(_iconsReact.WarningFilled16, null) : /*#__PURE__*/_react.default.createElement(_iconsReact.WarningAltFilled16, null) : null;
|
88
89
|
|
90
|
+
var doSetEditing = function doSetEditing(value) {
|
91
|
+
if (value === false) {
|
92
|
+
// move scroll to start
|
93
|
+
refInput.current.scrollLeft = 0;
|
94
|
+
}
|
95
|
+
|
96
|
+
setEditing(!disabled && value);
|
97
|
+
};
|
98
|
+
|
89
99
|
var handleEdit = function handleEdit(ev) {
|
90
100
|
if (!disabled) {
|
91
|
-
var rightOfInput = ev.currentTarget.classList.contains("".concat(blockClass, "__edit")) || ev.target.classList.contains("".concat(blockClass, "
|
101
|
+
var rightOfInput = ev.currentTarget.classList.contains("".concat(blockClass, "__edit")) || ev.target.classList.contains("".concat(blockClass, "__after-input-elements"));
|
92
102
|
var leftOfInput = ev.currentTarget = ev.target.classList.contains("".concat(blockClass)); // clicking on the content editable element should not set either of these to true
|
93
103
|
|
94
104
|
if (rightOfInput || leftOfInput) {
|
95
|
-
|
105
|
+
doSetEditing(true);
|
96
106
|
setTimeout(function () {
|
97
107
|
refInput.current.focus(); // select all the content
|
98
108
|
|
@@ -111,14 +121,15 @@ var InlineEdit = /*#__PURE__*/_react.default.forwardRef(function (_ref, refIn) {
|
|
111
121
|
};
|
112
122
|
|
113
123
|
var handleFocus = function handleFocus(ev) {
|
124
|
+
ev.preventDefault();
|
125
|
+
|
114
126
|
if (!editing && ev.target.classList.contains("".concat(blockClass, "__input"))) {
|
115
|
-
|
116
|
-
setEditing(true);
|
127
|
+
doSetEditing(true);
|
117
128
|
}
|
118
129
|
};
|
119
130
|
|
120
131
|
var handleSave = function handleSave() {
|
121
|
-
|
132
|
+
doSetEditing(false);
|
122
133
|
document.getSelection().removeAllRanges();
|
123
134
|
|
124
135
|
if (onSave) {
|
@@ -164,7 +175,7 @@ var InlineEdit = /*#__PURE__*/_react.default.forwardRef(function (_ref, refIn) {
|
|
164
175
|
var handleCancel = function handleCancel() {
|
165
176
|
refInput.current.innerText = value;
|
166
177
|
handleInput(value);
|
167
|
-
|
178
|
+
doSetEditing(false);
|
168
179
|
document.getSelection().removeAllRanges();
|
169
180
|
|
170
181
|
if (onCancel) {
|
@@ -174,7 +185,7 @@ var InlineEdit = /*#__PURE__*/_react.default.forwardRef(function (_ref, refIn) {
|
|
174
185
|
|
175
186
|
var handleBlur = function handleBlur(ev) {
|
176
187
|
if (!ref.current.contains(ev.relatedTarget)) {
|
177
|
-
|
188
|
+
doSetEditing(false);
|
178
189
|
handleSave();
|
179
190
|
}
|
180
191
|
};
|
@@ -190,13 +201,13 @@ var InlineEdit = /*#__PURE__*/_react.default.forwardRef(function (_ref, refIn) {
|
|
190
201
|
<container>
|
191
202
|
<!-- margin left of input to match Carbon -->
|
192
203
|
<content-editable>
|
193
|
-
<-- margin right of input space for
|
194
|
-
<
|
204
|
+
<-- margin right of input space for after-input-elements -->
|
205
|
+
<after-input-elements>
|
195
206
|
</container>
|
196
207
|
NOTE:
|
197
208
|
- An input is not used as this would not permit a heading tag e.g. <h2>.
|
198
209
|
- Some padding is added to the left 16px standard for a Carbon text input
|
199
|
-
- The
|
210
|
+
- The after-input-elements are position absolute with a margin to on the input to reserve space. Using inline-flex
|
200
211
|
- does not measure space properly for the input otherwise.
|
201
212
|
- The content editable is not expected to change size when buttons are added, to ensure the text does not move space
|
202
213
|
is reserved up front for buttons and invalid icon. Mostly this is only noticed if the width of the component is not 100%.
|
@@ -209,14 +220,14 @@ var InlineEdit = /*#__PURE__*/_react.default.forwardRef(function (_ref, refIn) {
|
|
209
220
|
*/
|
210
221
|
|
211
222
|
|
212
|
-
var
|
223
|
+
var toolbarAnimation = true;
|
213
224
|
return (
|
214
225
|
/*#__PURE__*/
|
215
226
|
// eslint-disable-next-line
|
216
227
|
_react.default.createElement("div", {
|
217
228
|
className: (0, _classnames.default)(blockClass, // Apply the block class to the main HTML element
|
218
229
|
className, // Apply any supplied class names to the main HTML element.
|
219
|
-
"".concat(blockClass, "--").concat(size), (_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--editing"), editing), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--invalid"), invalid), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--light"), light), _cx)),
|
230
|
+
"".concat(blockClass, "--").concat(size), (_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--disabled"), disabled), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--editing"), editing), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--invalid"), invalid), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--warn"), warn), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--light"), light), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--overflows"), refInput.current && refInput.current.scrollWidth > refInput.current.offsetWidth), _cx)),
|
220
231
|
onClick: handleEdit // disabled eslint for click handler
|
221
232
|
,
|
222
233
|
onBlur: handleBlur,
|
@@ -224,26 +235,30 @@ var InlineEdit = /*#__PURE__*/_react.default.forwardRef(function (_ref, refIn) {
|
|
224
235
|
}, /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, (0, _devtools.getDevtoolsProps)(componentName), {
|
225
236
|
id: id,
|
226
237
|
size: size,
|
227
|
-
className: "".concat(blockClass, "__input"),
|
238
|
+
className: (0, _classnames.default)("".concat(blockClass, "__input"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__input--empty"), refInput.current && refInput.current.innerText.length === 0)),
|
228
239
|
contentEditable: true,
|
229
240
|
"aria-label": labelText,
|
230
241
|
role: "textbox",
|
231
|
-
tabIndex:
|
242
|
+
tabIndex: disabled ? -1 : 0,
|
232
243
|
onFocus: handleFocus,
|
233
244
|
onInput: handleInput,
|
234
245
|
onKeyDown: handleKeyDown,
|
235
246
|
onPaste: handlePaste,
|
236
247
|
suppressContentEditableWarning: true,
|
237
|
-
ref: refInput
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
248
|
+
ref: refInput,
|
249
|
+
"data-placeholder": placeholder !== null && placeholder !== void 0 ? placeholder : labelText
|
250
|
+
}), value), /*#__PURE__*/_react.default.createElement("div", {
|
251
|
+
className: (0, _classnames.default)("".concat(blockClass, "__after-input-elements")) // tabindex -1 fixes blur target test when clicking on after-input-elements background
|
252
|
+
,
|
253
|
+
tabIndex: "-1"
|
254
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
255
|
+
className: "".concat(blockClass, "__ellipsis"),
|
256
|
+
"aria-hidden": !editing
|
257
|
+
}, "\u2026"), /*#__PURE__*/_react.default.createElement("div", {
|
258
|
+
className: (0, _classnames.default)("".concat(blockClass, "__toolbar"), (_cx3 = {}, (0, _defineProperty2.default)(_cx3, "".concat(blockClass, "__toolbar--animation"), toolbarAnimation), (0, _defineProperty2.default)(_cx3, "".concat(blockClass, "__toolbar--saveable"), refInput.current && value !== internalValue), _cx3))
|
259
|
+
}, showValidationText && validationText.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
|
243
260
|
className: "".concat(blockClass, "__validation-icon")
|
244
|
-
}, validationIcon), /*#__PURE__*/_react.default.createElement(
|
245
|
-
className: (0, _classnames.default)("".concat(blockClass, "__controls"), (_cx2 = {}, (0, _defineProperty2.default)(_cx2, "".concat(blockClass, "__controls--animation"), controlsAnimation), (0, _defineProperty2.default)(_cx2, "".concat(blockClass, "__controls--saveable"), invalid || saveDisabled || refInput.current && value !== internalValue), _cx2))
|
246
|
-
}, editing ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
261
|
+
}, validationIcon), editing ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
247
262
|
className: "".concat(blockClass, "__cancel"),
|
248
263
|
kind: "ghost",
|
249
264
|
hasIconOnly: true,
|
@@ -268,7 +283,11 @@ var InlineEdit = /*#__PURE__*/_react.default.forwardRef(function (_ref, refIn) {
|
|
268
283
|
renderIcon: disabled ? _iconsReact.EditOff16 : _iconsReact.Edit16,
|
269
284
|
disabled: disabled,
|
270
285
|
tabIndex: -1
|
271
|
-
})))
|
286
|
+
}))), /*#__PURE__*/_react.default.createElement("div", {
|
287
|
+
className: (0, _classnames.default)("".concat(blockClass, "__disabled-cover"))
|
288
|
+
}), showValidationText && validationText.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
|
289
|
+
className: "".concat(blockClass, "__validation-text ").concat(_settings.carbon.prefix, "--form-requirement")
|
290
|
+
}, validationText))
|
272
291
|
);
|
273
292
|
}); // Return a placeholder if not released and not enabled by feature flag
|
274
293
|
|
@@ -348,6 +367,11 @@ InlineEdit.propTypes = {
|
|
348
367
|
*/
|
349
368
|
onSave: _propTypes.default.func,
|
350
369
|
|
370
|
+
/**
|
371
|
+
* placeholder for text input
|
372
|
+
*/
|
373
|
+
placeholder: _propTypes.default.string,
|
374
|
+
|
351
375
|
/**
|
352
376
|
* label for save button
|
353
377
|
*/
|
@@ -803,7 +803,7 @@ PageHeader.propTypes = _objectSpread({
|
|
803
803
|
* - onChange: function to process the live value (React change === HTML Input)
|
804
804
|
* - onSave: function to process a confirmed change
|
805
805
|
* - editableLabel: label for edit required if onChange supplied
|
806
|
-
* -
|
806
|
+
* - cancelDescription: label for edit cancel button
|
807
807
|
* - saveDescription: label for edit save button
|
808
808
|
* - Object containing user defined contents. These must fit within the area defined for the title in both main part of the header and the breadcrumb.
|
809
809
|
* - content: title or name of current location shown in main part of page header
|
@@ -822,7 +822,7 @@ PageHeader.propTypes = _objectSpread({
|
|
822
822
|
// .isRequired.if(inlineEditRequired),
|
823
823
|
onChange: _propTypes.default.func,
|
824
824
|
onSave: _propTypes.default.func,
|
825
|
-
|
825
|
+
cancelDescription: _propTypes.default.string,
|
826
826
|
//.isRequired.if(inlineEditRequired),
|
827
827
|
saveDescription: _propTypes.default.string //.isRequired.if(inlineEditRequired),
|
828
828
|
// Update docgen if changed
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@carbon/ibm-products",
|
3
3
|
"description": "Carbon for IBM Products",
|
4
|
-
"version": "1.6.
|
4
|
+
"version": "1.6.1",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "lib/index.js",
|
7
7
|
"module": "es/index.js",
|
@@ -33,14 +33,14 @@
|
|
33
33
|
"access": "public"
|
34
34
|
},
|
35
35
|
"scripts": {
|
36
|
-
"build": "run-s clean build-all",
|
36
|
+
"build": "run-s clean build-first build-all",
|
37
37
|
"build-all": "run-p build:*",
|
38
|
-
"build
|
39
|
-
"build:css-
|
38
|
+
"build-first": "copyfiles 'src/**/*.scss' scss -u 1",
|
39
|
+
"build:css-dev": "sass --style=expanded --load-path node_modules --load-path ../../node_modules scss:css",
|
40
|
+
"build:css-min": "sass --style=compressed --load-path node_modules --load-path ../../node_modules scss/index.scss:css/index.min.css scss/index-full-carbon.scss:css/index-full-carbon.min.css scss/index-without-carbon.scss:css/index-without-carbon.min.css scss/index-without-carbon-released-only.scss:css/index-without-carbon-released-only.min.css",
|
40
41
|
"build:js-esm": "cross-env BABEL_ENV=esm yarn build:js:modules -d es",
|
41
42
|
"build:js-cjs": "cross-env BABEL_ENV=cjs yarn build:js:modules -d lib",
|
42
43
|
"build:js:modules": "babel src --ignore '**/__tests__','**/*.test.js','**/*.stories.js','src/utils/**/*'",
|
43
|
-
"build:scss": "copyfiles 'src/**/*.scss' scss -u 1",
|
44
44
|
"ci-check": "node scripts/import",
|
45
45
|
"clean": "rimraf es lib css scss",
|
46
46
|
"generate": "cross-env FORCE_COLOR=1 node scripts/generate",
|
@@ -51,24 +51,24 @@
|
|
51
51
|
},
|
52
52
|
"devDependencies": {
|
53
53
|
"@babel/cli": "^7.17.0",
|
54
|
-
"@babel/core": "^7.17.
|
55
|
-
"babel-preset-ibm-cloud-cognitive": "^0.14.
|
54
|
+
"@babel/core": "^7.17.2",
|
55
|
+
"babel-preset-ibm-cloud-cognitive": "^0.14.7",
|
56
56
|
"chalk": "^4.1.2",
|
57
57
|
"change-case": "^4.1.2",
|
58
58
|
"copyfiles": "^2.4.1",
|
59
59
|
"cross-env": "^7.0.3",
|
60
60
|
"fs-extra": "^10.0.0",
|
61
61
|
"glob": "^7.2.0",
|
62
|
-
"jest": "^27.
|
63
|
-
"jest-config-ibm-cloud-cognitive": "^0.23.
|
64
|
-
"npm-check-updates": "^12.
|
62
|
+
"jest": "^27.5.1",
|
63
|
+
"jest-config-ibm-cloud-cognitive": "^0.23.8",
|
64
|
+
"npm-check-updates": "^12.3.0",
|
65
65
|
"npm-run-all": "^4.1.5",
|
66
66
|
"rimraf": "^3.0.2",
|
67
67
|
"sass": "^1.49.7",
|
68
68
|
"yargs": "^17.3.1"
|
69
69
|
},
|
70
70
|
"dependencies": {
|
71
|
-
"@babel/runtime": "^7.17.
|
71
|
+
"@babel/runtime": "^7.17.2",
|
72
72
|
"@carbon/telemetry": "^0.0.0-alpha.6",
|
73
73
|
"react-resize-detector": "^7.0.0"
|
74
74
|
},
|
@@ -86,5 +86,5 @@
|
|
86
86
|
"react": "^16.8.6 || ^17.0.1",
|
87
87
|
"react-dom": "^16.8.6 || ^17.0.1"
|
88
88
|
},
|
89
|
-
"gitHead": "
|
89
|
+
"gitHead": "86c37c0c58a654ada45a703c5524237e9abb2664"
|
90
90
|
}
|
@@ -49,26 +49,36 @@
|
|
49
49
|
}
|
50
50
|
}
|
51
51
|
|
52
|
-
//
|
52
|
+
// sidebar
|
53
53
|
|
54
|
-
.#{$block-class}
|
54
|
+
.#{$block-class}__sidebar-header {
|
55
55
|
display: flex;
|
56
56
|
padding: $spacing-06 $spacing-05 $spacing-03 $spacing-05;
|
57
57
|
border-bottom: 1px solid $ui-03;
|
58
58
|
|
59
|
-
.#{$block-class}
|
59
|
+
.#{$block-class}__sidebar-title {
|
60
60
|
@include carbon--type-style('productive-heading-02');
|
61
61
|
}
|
62
62
|
}
|
63
63
|
|
64
|
-
.#{$block-class}
|
64
|
+
.#{$block-class}__sidebar-title {
|
65
65
|
margin-right: $spacing-03;
|
66
66
|
}
|
67
67
|
|
68
|
-
.#{$block-class}
|
68
|
+
.#{$block-class}__sidebar-body {
|
69
69
|
padding: $spacing-05;
|
70
70
|
}
|
71
71
|
|
72
|
+
.#{$block-class} .#{$block-class}__sidebar-item-header {
|
73
|
+
@include carbon--type-style('label-01');
|
74
|
+
}
|
75
|
+
|
76
|
+
.#{$block-class} .#{$block-class}__sidebar-item-body {
|
77
|
+
@include carbon--type-style('body-long-01');
|
78
|
+
|
79
|
+
margin-bottom: $spacing-03;
|
80
|
+
}
|
81
|
+
|
72
82
|
// overrides
|
73
83
|
|
74
84
|
// the influencer sidebar needs to be even with the buttons
|
@@ -5,11 +5,4 @@
|
|
5
5
|
// LICENSE file in the root directory of this source tree.
|
6
6
|
//
|
7
7
|
|
8
|
-
@import './index';
|
9
|
-
|
10
8
|
// TODO: add any additional styles used by CancelableTextEdit.stories.js
|
11
|
-
|
12
|
-
// Uncomment next line (which must appear last) to test in storybook
|
13
|
-
// that the SCSS styles for this component are sufficiently specific
|
14
|
-
// to override Carbon whichever order the styles get loaded in.
|
15
|
-
//@import 'carbon-components/css/carbon-components.min';
|
@@ -5,14 +5,8 @@
|
|
5
5
|
// LICENSE file in the root directory of this source tree.
|
6
6
|
//
|
7
7
|
|
8
|
-
@import './index';
|
9
8
|
@import '../../global/styles/project-settings';
|
10
9
|
|
11
|
-
// Uncomment next line (which must appear last) to test in storybook
|
12
|
-
// that the SCSS styles for this component are sufficiently specific
|
13
|
-
// to override Carbon whichever order the styles get loaded in.
|
14
|
-
//@import 'carbon-components/css/carbon-components.min';
|
15
|
-
|
16
10
|
$story-class: #{$pkg-prefix}--create-tearsheet-narrow--story;
|
17
11
|
|
18
12
|
.#{$story-class}__flex-container {
|
@@ -5,9 +5,6 @@
|
|
5
5
|
// LICENSE file in the root directory of this source tree.
|
6
6
|
//
|
7
7
|
|
8
|
-
@import './index';
|
9
|
-
|
10
|
-
// TODO: add any additional styles used by EditSidePanel.stories.js
|
11
8
|
@import '../../global/styles/project-settings';
|
12
9
|
|
13
10
|
$block-class: #{$pkg-prefix}--edit-side-panel;
|
@@ -28,8 +25,3 @@ $story-prefix: edit-side-panel-stories__;
|
|
28
25
|
.#{$block-class} .#{$carbon-prefix}--number__control-btn::after {
|
29
26
|
background-color: $field-02;
|
30
27
|
}
|
31
|
-
|
32
|
-
// Uncomment next line (which must appear last) to test in storybook
|
33
|
-
// that the SCSS styles for this component are sufficiently specific
|
34
|
-
// to override Carbon whichever order the styles get loaded in.
|
35
|
-
//@import 'carbon-components/css/carbon-components.min';
|