@carbon/ibm-products 1.2.5 → 1.3.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/css/index-full-carbon.css +386 -186
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +2 -2
- package/css/index-without-carbon.css +163 -0
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +2 -2
- package/css/index.css +385 -0
- package/css/index.css.map +1 -1
- package/css/index.min.css +2 -2
- package/es/components/AddSelect/AddSelect.js +111 -0
- package/es/components/AddSelect/index.js +7 -0
- package/es/components/CancelableTextEdit/CancelableTextEdit.js +207 -0
- package/es/components/CancelableTextEdit/index.js +7 -0
- package/es/components/index.js +3 -1
- package/es/global/js/package-settings.js +3 -1
- package/lib/components/AddSelect/AddSelect.js +133 -0
- package/lib/components/AddSelect/index.js +13 -0
- package/lib/components/CancelableTextEdit/CancelableTextEdit.js +226 -0
- package/lib/components/CancelableTextEdit/index.js +13 -0
- package/lib/components/index.js +17 -1
- package/lib/global/js/package-settings.js +3 -1
- package/package.json +2 -2
- package/scss/components/AddSelect/_add-select.scss +73 -0
- package/scss/components/AddSelect/_index.scss +10 -0
- package/scss/components/AddSelect/_storybook-styles.scss +6 -0
- package/scss/components/CancelableTextEdit/_cancelable-text-edit.scss +140 -0
- package/scss/components/CancelableTextEdit/_index.scss +8 -0
- package/scss/components/CancelableTextEdit/_storybook-styles.scss +15 -0
- package/scss/components/_index.scss +2 -0
@@ -0,0 +1,226 @@
|
|
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.CancelableTextEdit = 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 _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
17
|
+
|
18
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
19
|
+
|
20
|
+
var _react = _interopRequireWildcard(require("react"));
|
21
|
+
|
22
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
23
|
+
|
24
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
25
|
+
|
26
|
+
var _carbonComponentsReact = require("carbon-components-react");
|
27
|
+
|
28
|
+
var _propsHelper = require("../../global/js/utils/props-helper");
|
29
|
+
|
30
|
+
var _settings = require("../../settings");
|
31
|
+
|
32
|
+
var _iconsReact = require("@carbon/icons-react");
|
33
|
+
|
34
|
+
var _excluded = ["className", "inline", "invalid", "invalidText", "labelText", "onChange", "onInput", "revertLabel", "saveLabel", "value", "warn", "warnText"];
|
35
|
+
|
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
|
+
|
38
|
+
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; }
|
39
|
+
|
40
|
+
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; }
|
41
|
+
|
42
|
+
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; }
|
43
|
+
|
44
|
+
// Carbon and package components we use.
|
45
|
+
|
46
|
+
/* TODO: @import(s) of carbon components and other package components. */
|
47
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
48
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--cancelable-text-edit");
|
49
|
+
var componentName = 'CancelableTextEdit'; // NOTE: the component SCSS is not imported here: it is rolled up separately.
|
50
|
+
|
51
|
+
/**
|
52
|
+
* TODO: A description of the component.
|
53
|
+
*/
|
54
|
+
|
55
|
+
var CancelableTextEdit = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
56
|
+
var _cx;
|
57
|
+
|
58
|
+
var className = _ref.className,
|
59
|
+
inline = _ref.inline,
|
60
|
+
invalid = _ref.invalid,
|
61
|
+
invalidText = _ref.invalidText,
|
62
|
+
labelText = _ref.labelText,
|
63
|
+
onChange = _ref.onChange,
|
64
|
+
onInput = _ref.onInput,
|
65
|
+
revertLabel = _ref.revertLabel,
|
66
|
+
saveLabel = _ref.saveLabel,
|
67
|
+
value = _ref.value,
|
68
|
+
warn = _ref.warn,
|
69
|
+
warnText = _ref.warnText,
|
70
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
71
|
+
// remove these props later
|
72
|
+
var removeProps = ['children', 'onInput', 'onChange', 'value'];
|
73
|
+
var showWarn = inline && warn && !invalid;
|
74
|
+
var showInvalid = inline && invalid;
|
75
|
+
|
76
|
+
var _useState = (0, _react.useState)(value !== null && value !== void 0 ? value : ''),
|
77
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
78
|
+
liveValue = _useState2[0],
|
79
|
+
setLiveValue = _useState2[1];
|
80
|
+
|
81
|
+
(0, _react.useEffect)(function () {
|
82
|
+
if (value !== liveValue) {
|
83
|
+
setLiveValue(value);
|
84
|
+
} // Do not care if liveValue changes here
|
85
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
86
|
+
|
87
|
+
}, [value]);
|
88
|
+
|
89
|
+
var doInput = function doInput(newValue) {
|
90
|
+
setLiveValue(newValue);
|
91
|
+
|
92
|
+
if (onInput) {
|
93
|
+
onInput(newValue);
|
94
|
+
}
|
95
|
+
};
|
96
|
+
|
97
|
+
var handleInput = function handleInput(ev) {
|
98
|
+
doInput(ev.target.value);
|
99
|
+
};
|
100
|
+
|
101
|
+
var handleRevert = function handleRevert() {
|
102
|
+
doInput(value);
|
103
|
+
};
|
104
|
+
|
105
|
+
var handleSave = function handleSave() {
|
106
|
+
if (onChange && !invalid) {
|
107
|
+
onChange(liveValue);
|
108
|
+
}
|
109
|
+
};
|
110
|
+
|
111
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
112
|
+
className: (0, _classnames.default)(className, "".concat(blockClass), (_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--invalid"), invalid), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--warn"), warn), _cx))
|
113
|
+
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.TextInput, (0, _extends2.default)({}, (0, _propsHelper.prepareProps)(rest, removeProps), {
|
114
|
+
// it is not permitted to pass children down to TextInput guard against this
|
115
|
+
className: "".concat(blockClass, "__input"),
|
116
|
+
ref: ref,
|
117
|
+
onInput: handleInput,
|
118
|
+
value: liveValue !== null && liveValue !== void 0 ? liveValue : '' // ?? '' prevents controlled components test failure https://reactjs.org/docs/forms.html#controlled-components
|
119
|
+
,
|
120
|
+
inline: inline,
|
121
|
+
invalid: invalid,
|
122
|
+
invalidText: invalidText,
|
123
|
+
labelText: labelText,
|
124
|
+
warn: warn,
|
125
|
+
warnText: warnText
|
126
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
127
|
+
className: "".concat(blockClass, "__buttons")
|
128
|
+
}, !inline && labelText && /*#__PURE__*/_react.default.createElement("div", {
|
129
|
+
className: "".concat(blockClass, "__label-spacer ").concat(_settings.carbon.prefix, "--label")
|
130
|
+
}, "\xA0"), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
131
|
+
className: "".concat(blockClass, "__revert ").concat(_settings.carbon.prefix, "--search-close"),
|
132
|
+
kind: "ghost",
|
133
|
+
hasIconOnly: true,
|
134
|
+
iconDescription: revertLabel,
|
135
|
+
onClick: handleRevert,
|
136
|
+
renderIcon: _iconsReact.Reset16
|
137
|
+
}), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
138
|
+
className: "".concat(blockClass, "__save ").concat(_settings.carbon.prefix, "--search-close"),
|
139
|
+
kind: "ghost",
|
140
|
+
hasIconOnly: true,
|
141
|
+
iconDescription: saveLabel,
|
142
|
+
onClick: handleSave,
|
143
|
+
renderIcon: _iconsReact.Checkmark16,
|
144
|
+
disabled: invalid
|
145
|
+
}))), inline && (showInvalid || showWarn) && /*#__PURE__*/_react.default.createElement("div", {
|
146
|
+
className: "".concat(_settings.carbon.prefix, "--form-requirement")
|
147
|
+
}, showInvalid ? invalidText : warnText));
|
148
|
+
}); // Return a placeholder if not released and not enabled by feature flag
|
149
|
+
|
150
|
+
|
151
|
+
exports.CancelableTextEdit = CancelableTextEdit;
|
152
|
+
exports.CancelableTextEdit = CancelableTextEdit = _settings.pkg.checkComponentEnabled(CancelableTextEdit, componentName); // The display name of the component, used by React. Note that displayName
|
153
|
+
// is used in preference to relying on function.name.
|
154
|
+
|
155
|
+
CancelableTextEdit.displayName = componentName; // The types and DocGen commentary for the component props,
|
156
|
+
// in alphabetical order (for consistency).
|
157
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
158
|
+
|
159
|
+
CancelableTextEdit.propTypes = _objectSpread(_objectSpread({}, (0, _propsHelper.prepareProps)(_carbonComponentsReact.TextInput.propTypes, ['inline', 'invalid', 'invalidText', 'labelText', 'onChange', 'onInput', 'value', 'warn', 'warnText'])), {}, {
|
160
|
+
/**
|
161
|
+
* Provide an optional class to be applied to the containing node.
|
162
|
+
*/
|
163
|
+
className: _propTypes.default.string,
|
164
|
+
|
165
|
+
/**
|
166
|
+
* inline variant
|
167
|
+
*/
|
168
|
+
inline: _propTypes.default.bool,
|
169
|
+
|
170
|
+
/**
|
171
|
+
* show invalid for current value
|
172
|
+
*/
|
173
|
+
invalid: _propTypes.default.bool,
|
174
|
+
|
175
|
+
/**
|
176
|
+
* invalid text
|
177
|
+
*/
|
178
|
+
invalidText: _propTypes.default.string,
|
179
|
+
|
180
|
+
/**
|
181
|
+
* labelText for text input
|
182
|
+
*/
|
183
|
+
labelText: _propTypes.default.string,
|
184
|
+
|
185
|
+
/**
|
186
|
+
* method called on change event
|
187
|
+
*/
|
188
|
+
onChange: _propTypes.default.func,
|
189
|
+
|
190
|
+
/**
|
191
|
+
* method called on input event
|
192
|
+
*/
|
193
|
+
onInput: _propTypes.default.func,
|
194
|
+
|
195
|
+
/**
|
196
|
+
* label for revert button
|
197
|
+
*/
|
198
|
+
revertLabel: _propTypes.default.string.isRequired,
|
199
|
+
|
200
|
+
/**
|
201
|
+
* label for save button
|
202
|
+
*/
|
203
|
+
saveLabel: _propTypes.default.string.isRequired,
|
204
|
+
|
205
|
+
/**
|
206
|
+
* unedited value
|
207
|
+
*/
|
208
|
+
value: _propTypes.default.string,
|
209
|
+
|
210
|
+
/**
|
211
|
+
* show warning for current value
|
212
|
+
*/
|
213
|
+
warn: _propTypes.default.bool,
|
214
|
+
|
215
|
+
/**
|
216
|
+
* warn text
|
217
|
+
*/
|
218
|
+
warnText: _propTypes.default.string
|
219
|
+
}); // Default values for component props. Default values are not required for
|
220
|
+
// props that are required, nor for props where the component can apply
|
221
|
+
// 'undefined' values reasonably. Default values should be provided when the
|
222
|
+
// component needs to make a choice or assumption when a prop is not supplied.
|
223
|
+
|
224
|
+
CancelableTextEdit.defaultProps = {
|
225
|
+
/* TODO: add defaults for relevant props. */
|
226
|
+
};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
Object.defineProperty(exports, "CancelableTextEdit", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function get() {
|
9
|
+
return _CancelableTextEdit.CancelableTextEdit;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
|
13
|
+
var _CancelableTextEdit = require("./CancelableTextEdit");
|
package/lib/components/index.js
CHANGED
@@ -15,6 +15,18 @@ Object.defineProperty(exports, "AboutModal", {
|
|
15
15
|
return _AboutModal.AboutModal;
|
16
16
|
}
|
17
17
|
});
|
18
|
+
Object.defineProperty(exports, "AddSelect", {
|
19
|
+
enumerable: true,
|
20
|
+
get: function get() {
|
21
|
+
return _AddSelect.AddSelect;
|
22
|
+
}
|
23
|
+
});
|
24
|
+
Object.defineProperty(exports, "CancelableTextEdit", {
|
25
|
+
enumerable: true,
|
26
|
+
get: function get() {
|
27
|
+
return _CancelableTextEdit.CancelableTextEdit;
|
28
|
+
}
|
29
|
+
});
|
18
30
|
Object.defineProperty(exports, "Cascade", {
|
19
31
|
enumerable: true,
|
20
32
|
get: function get() {
|
@@ -276,6 +288,8 @@ Object.defineProperty(exports, "WebTerminal", {
|
|
276
288
|
|
277
289
|
var _AboutModal = require("./AboutModal");
|
278
290
|
|
291
|
+
var _AddSelect = require("./AddSelect");
|
292
|
+
|
279
293
|
var _APIKeyModal = require("./APIKeyModal");
|
280
294
|
|
281
295
|
var _Cascade = require("./Cascade");
|
@@ -332,4 +346,6 @@ var _WebTerminal = require("./WebTerminal");
|
|
332
346
|
|
333
347
|
var _EditSidePanel = require("./EditSidePanel");
|
334
348
|
|
335
|
-
var _OptionsTile = require("./OptionsTile");
|
349
|
+
var _OptionsTile = require("./OptionsTile");
|
350
|
+
|
351
|
+
var _CancelableTextEdit = require("./CancelableTextEdit");
|
@@ -56,6 +56,7 @@ var defaults = {
|
|
56
56
|
UnauthorizedEmptyState: true,
|
57
57
|
UserProfileImage: true,
|
58
58
|
// other public components not yet reviewed and released:
|
59
|
+
AddSelect: false,
|
59
60
|
LoadingBar: false,
|
60
61
|
ModifiedTabs: false,
|
61
62
|
Toolbar: false,
|
@@ -63,7 +64,8 @@ var defaults = {
|
|
63
64
|
ToolbarGroup: false,
|
64
65
|
WebTerminal: false,
|
65
66
|
EditSidePanel: false,
|
66
|
-
OptionsTile: false
|
67
|
+
OptionsTile: false,
|
68
|
+
CancelableTextEdit: false
|
67
69
|
/* new component flags here - comment used by generate CLI */
|
68
70
|
|
69
71
|
},
|
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.
|
4
|
+
"version": "1.3.0",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "lib/index.js",
|
7
7
|
"module": "es/index.js",
|
@@ -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": "569d76f7fd293e929288516959f03a3eea777251"
|
90
90
|
}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
//
|
2
|
+
// Copyright IBM Corp. 2021
|
3
|
+
//
|
4
|
+
// This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
// LICENSE file in the root directory of this source tree.
|
6
|
+
//
|
7
|
+
|
8
|
+
// Standard imports.
|
9
|
+
@import '../../global/styles/project-settings';
|
10
|
+
|
11
|
+
@import 'carbon-components/scss/components/structured-list/structured-list';
|
12
|
+
|
13
|
+
@mixin add-select {
|
14
|
+
$block-class: #{$pkg-prefix}--add-select;
|
15
|
+
$tearsheet-class: #{$pkg-prefix}--tearsheet;
|
16
|
+
|
17
|
+
.#{$block-class}__header {
|
18
|
+
padding: $spacing-05;
|
19
|
+
padding-bottom: 0;
|
20
|
+
border-top: 1px solid $ui-03;
|
21
|
+
|
22
|
+
.#{$block-class}__items-label {
|
23
|
+
@include carbon--type-style('productive-heading-01');
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
.#{$block-class}__items-label {
|
28
|
+
margin-right: $spacing-03;
|
29
|
+
|
30
|
+
&-container {
|
31
|
+
display: flex;
|
32
|
+
align-items: center;
|
33
|
+
margin-top: $spacing-05;
|
34
|
+
margin-bottom: $spacing-03;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
.#{$block-class}__selections {
|
39
|
+
border-top: 1px solid $ui-03;
|
40
|
+
}
|
41
|
+
|
42
|
+
// multi select specific
|
43
|
+
|
44
|
+
.#{$block-class}__influencer-header {
|
45
|
+
display: flex;
|
46
|
+
padding: $spacing-06 $spacing-05 $spacing-03 $spacing-05;
|
47
|
+
border-bottom: 1px solid $ui-03;
|
48
|
+
|
49
|
+
.#{$block-class}__influencer-title {
|
50
|
+
@include carbon--type-style('productive-heading-02');
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
.#{$block-class}__influencer-title {
|
55
|
+
margin-right: $spacing-03;
|
56
|
+
}
|
57
|
+
|
58
|
+
.#{$block-class}__influencer-body {
|
59
|
+
padding: $spacing-05;
|
60
|
+
}
|
61
|
+
|
62
|
+
// overrides
|
63
|
+
|
64
|
+
// the influencer sidebar needs to be even with the buttons
|
65
|
+
.#{$block-class} .#{$tearsheet-class} .#{$tearsheet-class}__influencer {
|
66
|
+
max-width: 29rem;
|
67
|
+
flex: 0 0 50%;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
@include exports('add-select') {
|
72
|
+
@include add-select;
|
73
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
//
|
2
|
+
// Copyright IBM Corp. 2021
|
3
|
+
//
|
4
|
+
// This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
// LICENSE file in the root directory of this source tree.
|
6
|
+
//
|
7
|
+
|
8
|
+
// An index file is most useful when you have multiple components
|
9
|
+
|
10
|
+
@import './add-select';
|
@@ -0,0 +1,140 @@
|
|
1
|
+
//
|
2
|
+
// Copyright IBM Corp. 2021, 2021
|
3
|
+
//
|
4
|
+
// This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
// LICENSE file in the root directory of this source tree.
|
6
|
+
//
|
7
|
+
|
8
|
+
// Standard imports.
|
9
|
+
@import '../../global/styles/project-settings';
|
10
|
+
@import '../../global/styles/mixins';
|
11
|
+
|
12
|
+
// Other Carbon settings.
|
13
|
+
// TODO: @import 'carbon-components/scss/globals/grid/grid'; if needed
|
14
|
+
|
15
|
+
// CancelableTextEdit uses the following Carbon components:
|
16
|
+
// TODO: @import(s) of Carbon component styles used by CancelableTextEdit
|
17
|
+
|
18
|
+
// CancelableTextEdit uses the following Carbon for IBM Products components:
|
19
|
+
// TODO: @import(s) of IBM Products component styles used by CancelableTextEdit
|
20
|
+
|
21
|
+
// Define all component styles in a mixin which is then exported using
|
22
|
+
// the Carbon import-once mechanism.
|
23
|
+
@mixin cancelable-text-edit {
|
24
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
25
|
+
$block-class: #{$pkg-prefix}--cancelable-text-edit;
|
26
|
+
|
27
|
+
.#{$block-class}.#{$block-class} {
|
28
|
+
--size: #{$spacing-08};
|
29
|
+
|
30
|
+
position: relative;
|
31
|
+
width: 100%;
|
32
|
+
min-height: var(--size);
|
33
|
+
}
|
34
|
+
|
35
|
+
.#{$block-class}.#{$block-class}--xl {
|
36
|
+
--size: $spacing-09;
|
37
|
+
}
|
38
|
+
|
39
|
+
.#{$block-class}.#{$block-class} .#{$block-class}__input {
|
40
|
+
height: var(--size);
|
41
|
+
// stylelint-disable-next-line carbon/layout-token-use
|
42
|
+
padding-right: calc(2 * var(--size));
|
43
|
+
}
|
44
|
+
|
45
|
+
.#{$block-class}__buttons {
|
46
|
+
position: absolute;
|
47
|
+
top: 0;
|
48
|
+
right: 0;
|
49
|
+
}
|
50
|
+
.#{$block-class}.#{$block-class} .#{$block-class}__revert,
|
51
|
+
.#{$block-class}.#{$block-class} .#{$block-class}__save {
|
52
|
+
width: var(--size);
|
53
|
+
height: var(--size);
|
54
|
+
min-height: var(--size);
|
55
|
+
|
56
|
+
&:hover {
|
57
|
+
// border hover input does NOT have focus
|
58
|
+
border-color: $hover-field;
|
59
|
+
border-bottom: 1px solid transparent;
|
60
|
+
background-clip: content-box;
|
61
|
+
box-shadow: initial;
|
62
|
+
}
|
63
|
+
|
64
|
+
&:focus:active,
|
65
|
+
&:focus {
|
66
|
+
// border focus input does NOT have focus
|
67
|
+
border-width: 2px;
|
68
|
+
border-color: $focus;
|
69
|
+
box-shadow: initial;
|
70
|
+
}
|
71
|
+
|
72
|
+
&:focus:active:hover {
|
73
|
+
// stylelint-disable-next-line carbon/layout-token-use
|
74
|
+
padding: 1px;
|
75
|
+
}
|
76
|
+
|
77
|
+
&::before {
|
78
|
+
background-color: transparent;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
// border hover input has focus
|
83
|
+
// and/or is invalid
|
84
|
+
.#{$block-class}.#{$block-class}--invalid
|
85
|
+
.#{$carbon-prefix}--text-input-wrapper
|
86
|
+
~ .#{$block-class}__buttons,
|
87
|
+
.#{$block-class}.#{$block-class}
|
88
|
+
.#{$carbon-prefix}--text-input-wrapper:focus-within
|
89
|
+
~ .#{$block-class}__buttons {
|
90
|
+
.#{$block-class}__revert,
|
91
|
+
.#{$block-class}__save {
|
92
|
+
border: 2px solid transparent;
|
93
|
+
// transition-property: initial; // turn off seems to cause a bit of a visual glitch
|
94
|
+
}
|
95
|
+
|
96
|
+
// button hover state
|
97
|
+
.#{$block-class}__revert:hover,
|
98
|
+
.#{$block-class}__save:hover {
|
99
|
+
border-top: 2px solid transparent;
|
100
|
+
border-bottom: 2px solid transparent;
|
101
|
+
background-clip: content-box;
|
102
|
+
}
|
103
|
+
.#{$block-class}__save {
|
104
|
+
// border hover input has focus or is in error
|
105
|
+
border-right: 2px solid transparent;
|
106
|
+
}
|
107
|
+
}
|
108
|
+
|
109
|
+
// > only wish to affect version added for inline
|
110
|
+
.#{$block-class}--invalid > .#{$carbon-prefix}--form-requirement,
|
111
|
+
.#{$block-class}--warn > .#{$carbon-prefix}--form-requirement {
|
112
|
+
display: block;
|
113
|
+
max-height: initial;
|
114
|
+
// stylelint-disable-next-line carbon/layout-token-use
|
115
|
+
margin-left: calc(20% + 1.25rem); // needs to match inline input layout
|
116
|
+
}
|
117
|
+
|
118
|
+
// > only wish to affect version added for inline
|
119
|
+
.#{$block-class}--invalid > .#{$carbon-prefix}--form-requirement {
|
120
|
+
color: $text-error;
|
121
|
+
}
|
122
|
+
|
123
|
+
.#{$block-class} .#{$carbon-prefix}--text-input {
|
124
|
+
// stylelint-disable-next-line carbon/layout-token-use
|
125
|
+
padding-right: calc(2 * var(--size)); // to take account of save and revert
|
126
|
+
}
|
127
|
+
|
128
|
+
.#{$block-class} .#{$carbon-prefix}--text-input--invalid {
|
129
|
+
// stylelint-disable-next-line carbon/layout-token-use
|
130
|
+
padding-right: calc(3 * var(--size)); // to take account of save and revert
|
131
|
+
}
|
132
|
+
|
133
|
+
.#{$block-class} .#{$carbon-prefix}--text-input__invalid-icon {
|
134
|
+
margin-right: $spacing-11;
|
135
|
+
}
|
136
|
+
}
|
137
|
+
|
138
|
+
@include exports('cancelable-text-edit') {
|
139
|
+
@include cancelable-text-edit;
|
140
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
//
|
2
|
+
// Copyright IBM Corp. 2021, 2021
|
3
|
+
//
|
4
|
+
// This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
// LICENSE file in the root directory of this source tree.
|
6
|
+
//
|
7
|
+
|
8
|
+
@import './index';
|
9
|
+
|
10
|
+
// 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';
|
@@ -9,6 +9,7 @@
|
|
9
9
|
|
10
10
|
@import './_Canary/canary';
|
11
11
|
|
12
|
+
@import './AddSelect/index';
|
12
13
|
@import './APIKeyModal/index';
|
13
14
|
@import './AboutModal/index';
|
14
15
|
@import './ActionSet/index';
|
@@ -41,3 +42,4 @@
|
|
41
42
|
@import './UserProfileImage/index';
|
42
43
|
@import './EditSidePanel/index';
|
43
44
|
@import './OptionsTile/index';
|
45
|
+
@import './CancelableTextEdit/index';
|