@carbon/react 1.16.0-rc.0 → 1.16.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/es/components/CodeSnippet/CodeSnippet.js +0 -1
- package/es/components/NumberInput/NumberInput.js +45 -1
- package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.js +10 -4
- package/es/components/TextInput/TextInput.js +1 -1
- package/es/internal/useNormalizedInputProps.js +13 -17
- package/lib/components/CodeSnippet/CodeSnippet.js +0 -1
- package/lib/components/NumberInput/NumberInput.js +45 -1
- package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.js +9 -3
- package/lib/components/TextInput/TextInput.js +1 -1
- package/lib/internal/useNormalizedInputProps.js +12 -16
- package/package.json +4 -4
|
@@ -245,7 +245,6 @@ function CodeSnippet(_ref) {
|
|
|
245
245
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
246
246
|
className: "".concat(prefix, "--snippet-btn--text")
|
|
247
247
|
}, expandCodeBtnText), /*#__PURE__*/React__default.createElement(ChevronDown, {
|
|
248
|
-
"aria-label": expandCodeBtnText,
|
|
249
248
|
className: "".concat(prefix, "--icon-chevron--down ").concat(prefix, "--snippet__icon"),
|
|
250
249
|
name: "chevron--down",
|
|
251
250
|
role: "img"
|
|
@@ -16,7 +16,7 @@ import { useNormalizedInputProps } from '../../internal/useNormalizedInputProps.
|
|
|
16
16
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
17
17
|
import deprecate from '../../prop-types/deprecate.js';
|
|
18
18
|
|
|
19
|
-
var _excluded = ["allowEmpty", "className", "disabled", "defaultValue", "helperText", "hideLabel", "hideSteppers", "iconDescription", "id", "label", "invalid", "invalidText", "light", "max", "min", "onChange", "onClick", "onKeyUp", "readOnly", "size", "step", "translateWithId", "warn", "warnText", "value"];
|
|
19
|
+
var _excluded = ["allowEmpty", "className", "disabled", "disableWheel", "defaultValue", "helperText", "hideLabel", "hideSteppers", "iconDescription", "id", "label", "invalid", "invalidText", "light", "max", "min", "onChange", "onClick", "onKeyUp", "readOnly", "size", "step", "translateWithId", "warn", "warnText", "value"];
|
|
20
20
|
|
|
21
21
|
var _defaultTranslations, _Subtract, _Add;
|
|
22
22
|
var translationIds = {
|
|
@@ -34,6 +34,8 @@ var NumberInput = /*#__PURE__*/React__default.forwardRef(function NumberInput(pr
|
|
|
34
34
|
customClassName = props.className,
|
|
35
35
|
_props$disabled = props.disabled,
|
|
36
36
|
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
37
|
+
_props$disableWheel = props.disableWheel,
|
|
38
|
+
disableWheelProp = _props$disableWheel === void 0 ? false : _props$disableWheel,
|
|
37
39
|
defaultValue = props.defaultValue,
|
|
38
40
|
_props$helperText = props.helperText,
|
|
39
41
|
helperText = _props$helperText === void 0 ? '' : _props$helperText,
|
|
@@ -172,6 +174,24 @@ var NumberInput = /*#__PURE__*/React__default.forwardRef(function NumberInput(pr
|
|
|
172
174
|
onClick: _onClick,
|
|
173
175
|
onChange: handleOnChange,
|
|
174
176
|
onKeyUp: onKeyUp,
|
|
177
|
+
onFocus: function onFocus(e) {
|
|
178
|
+
if (disableWheelProp) {
|
|
179
|
+
e.target.addEventListener('wheel', disableWheel);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (rest.onFocus) {
|
|
183
|
+
rest.onFocus(e);
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
onBlur: function onBlur(e) {
|
|
187
|
+
if (disableWheelProp) {
|
|
188
|
+
e.target.removeEventListener('wheel', disableWheel);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (rest.onBlur) {
|
|
192
|
+
rest.onBlur(e);
|
|
193
|
+
}
|
|
194
|
+
},
|
|
175
195
|
pattern: "[0-9]*",
|
|
176
196
|
readOnly: readOnly,
|
|
177
197
|
step: step,
|
|
@@ -254,6 +274,11 @@ NumberInput.propTypes = {
|
|
|
254
274
|
*/
|
|
255
275
|
defaultValue: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
256
276
|
|
|
277
|
+
/**
|
|
278
|
+
* Specify if the wheel functionality for the input should be disabled, or not
|
|
279
|
+
*/
|
|
280
|
+
disableWheel: PropTypes.bool,
|
|
281
|
+
|
|
257
282
|
/**
|
|
258
283
|
* Specify if the control should be disabled, or not
|
|
259
284
|
*/
|
|
@@ -449,6 +474,25 @@ function getInputValidity(_ref4) {
|
|
|
449
474
|
|
|
450
475
|
return true;
|
|
451
476
|
}
|
|
477
|
+
/**
|
|
478
|
+
* It prevents any wheel event from emitting.
|
|
479
|
+
*
|
|
480
|
+
* We want to prevent this input field from changing by the user accidentally
|
|
481
|
+
* when the user scrolling up or down in a long form. So we prevent the default
|
|
482
|
+
* behavior of wheel events when it is focused.
|
|
483
|
+
*
|
|
484
|
+
* Because React uses passive event handler by default, we can't just call
|
|
485
|
+
* `preventDefault` in the `onWheel` event handler. So we have to get the input
|
|
486
|
+
* ref and add our event handler manually.
|
|
487
|
+
*
|
|
488
|
+
* @see https://github.com/facebook/react/pull/19654
|
|
489
|
+
* @param {WheelEvent} e A wheel event.
|
|
490
|
+
*/
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
function disableWheel(e) {
|
|
494
|
+
e.preventDefault();
|
|
495
|
+
}
|
|
452
496
|
/**
|
|
453
497
|
* Clamp the given value between the upper bound `max` and the lower bound `min`
|
|
454
498
|
* @param {number} max
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
8
|
+
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import React__default from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
import { CircleDash } from '@carbon/icons-react';
|
|
14
14
|
|
|
15
|
-
var _excluded = ["className"];
|
|
15
|
+
var _excluded = ["className", "vertical"];
|
|
16
16
|
|
|
17
17
|
var _CircleDash, _Step, _Step2, _Step3, _Step4;
|
|
18
18
|
|
|
@@ -31,11 +31,12 @@ function Step() {
|
|
|
31
31
|
|
|
32
32
|
function ProgressIndicatorSkeleton(_ref) {
|
|
33
33
|
var className = _ref.className,
|
|
34
|
+
vertical = _ref.vertical,
|
|
34
35
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
35
36
|
|
|
36
37
|
var prefix = usePrefix();
|
|
37
38
|
return /*#__PURE__*/React__default.createElement("ul", _extends({
|
|
38
|
-
className: cx("".concat(prefix, "--progress"), "".concat(prefix, "--skeleton"), className)
|
|
39
|
+
className: cx("".concat(prefix, "--progress"), "".concat(prefix, "--skeleton"), _defineProperty({}, "".concat(prefix, "--progress--vertical"), vertical), className)
|
|
39
40
|
}, rest), _Step || (_Step = /*#__PURE__*/React__default.createElement(Step, null)), _Step2 || (_Step2 = /*#__PURE__*/React__default.createElement(Step, null)), _Step3 || (_Step3 = /*#__PURE__*/React__default.createElement(Step, null)), _Step4 || (_Step4 = /*#__PURE__*/React__default.createElement(Step, null)));
|
|
40
41
|
}
|
|
41
42
|
|
|
@@ -43,7 +44,12 @@ ProgressIndicatorSkeleton.propTypes = {
|
|
|
43
44
|
/**
|
|
44
45
|
* Specify an optional className to add.
|
|
45
46
|
*/
|
|
46
|
-
className: PropTypes.string
|
|
47
|
+
className: PropTypes.string,
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Determines whether or not the ProgressIndicator should be rendered vertically.
|
|
51
|
+
*/
|
|
52
|
+
vertical: PropTypes.bool
|
|
47
53
|
};
|
|
48
54
|
|
|
49
55
|
export { ProgressIndicatorSkeleton as default };
|
|
@@ -109,7 +109,7 @@ var TextInput = /*#__PURE__*/React__default.forwardRef(function TextInput(_ref,
|
|
|
109
109
|
var helperTextClasses = cx("".concat(prefix, "--form__helper-text"), (_classNames4 = {}, _defineProperty(_classNames4, "".concat(prefix, "--form__helper-text--disabled"), normalizedProps.disabled), _defineProperty(_classNames4, "".concat(prefix, "--form__helper-text--inline"), inline), _classNames4));
|
|
110
110
|
var fieldOuterWrapperClasses = cx("".concat(prefix, "--text-input__field-outer-wrapper"), _defineProperty({}, "".concat(prefix, "--text-input__field-outer-wrapper--inline"), inline));
|
|
111
111
|
var fieldWrapperClasses = cx("".concat(prefix, "--text-input__field-wrapper"), _defineProperty({}, "".concat(prefix, "--text-input__field-wrapper--warning"), normalizedProps.warn));
|
|
112
|
-
var iconClasses = cx((_classNames7 = {}, _defineProperty(_classNames7, "".concat(prefix, "--text-input__invalid-icon"), normalizedProps.invalid || normalizedProps.warn), _defineProperty(_classNames7, "".concat(prefix, "--text-input__invalid-icon--warning"), normalizedProps.warn),
|
|
112
|
+
var iconClasses = cx((_classNames7 = {}, _defineProperty(_classNames7, "".concat(prefix, "--text-input__invalid-icon"), normalizedProps.invalid || normalizedProps.warn), _defineProperty(_classNames7, "".concat(prefix, "--text-input__invalid-icon--warning"), normalizedProps.warn), _classNames7));
|
|
113
113
|
var counterClasses = cx("".concat(prefix, "--label"), (_classNames8 = {}, _defineProperty(_classNames8, "".concat(prefix, "--label--disabled"), disabled), _defineProperty(_classNames8, "".concat(prefix, "--text-input__label-counter"), true), _classNames8));
|
|
114
114
|
var counter = enableCounter && maxCount ? /*#__PURE__*/React__default.createElement("div", {
|
|
115
115
|
className: counterClasses
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React__default from 'react';
|
|
9
|
-
import {
|
|
9
|
+
import { WarningFilled, WarningAltFilled } from '@carbon/icons-react';
|
|
10
10
|
import { usePrefix } from './usePrefix.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -65,22 +65,18 @@ function useNormalizedInputProps(_ref) {
|
|
|
65
65
|
helperId: "".concat(id, "-helper-text")
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
if (
|
|
69
|
-
normalizedProps.icon =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
normalizedProps.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
normalizedProps.
|
|
79
|
-
|
|
80
|
-
className: "".concat(prefix, "--form-requirement"),
|
|
81
|
-
id: normalizedProps.warnId
|
|
82
|
-
}, warnText);
|
|
83
|
-
}
|
|
68
|
+
if (normalizedProps.invalid) {
|
|
69
|
+
normalizedProps.icon = WarningFilled;
|
|
70
|
+
normalizedProps.validation = /*#__PURE__*/React__default.createElement("div", {
|
|
71
|
+
className: "".concat(prefix, "--form-requirement"),
|
|
72
|
+
id: normalizedProps.invalidId
|
|
73
|
+
}, invalidText);
|
|
74
|
+
} else if (normalizedProps.warn) {
|
|
75
|
+
normalizedProps.icon = WarningAltFilled;
|
|
76
|
+
normalizedProps.validation = /*#__PURE__*/React__default.createElement("div", {
|
|
77
|
+
className: "".concat(prefix, "--form-requirement"),
|
|
78
|
+
id: normalizedProps.warnId
|
|
79
|
+
}, warnText);
|
|
84
80
|
}
|
|
85
81
|
|
|
86
82
|
return normalizedProps;
|
|
@@ -256,7 +256,6 @@ function CodeSnippet(_ref) {
|
|
|
256
256
|
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
257
257
|
className: "".concat(prefix, "--snippet-btn--text")
|
|
258
258
|
}, expandCodeBtnText), /*#__PURE__*/React__default["default"].createElement(iconsReact.ChevronDown, {
|
|
259
|
-
"aria-label": expandCodeBtnText,
|
|
260
259
|
className: "".concat(prefix, "--icon-chevron--down ").concat(prefix, "--snippet__icon"),
|
|
261
260
|
name: "chevron--down",
|
|
262
261
|
role: "img"
|
|
@@ -26,7 +26,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
26
26
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
27
27
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
28
28
|
|
|
29
|
-
var _excluded = ["allowEmpty", "className", "disabled", "defaultValue", "helperText", "hideLabel", "hideSteppers", "iconDescription", "id", "label", "invalid", "invalidText", "light", "max", "min", "onChange", "onClick", "onKeyUp", "readOnly", "size", "step", "translateWithId", "warn", "warnText", "value"];
|
|
29
|
+
var _excluded = ["allowEmpty", "className", "disabled", "disableWheel", "defaultValue", "helperText", "hideLabel", "hideSteppers", "iconDescription", "id", "label", "invalid", "invalidText", "light", "max", "min", "onChange", "onClick", "onKeyUp", "readOnly", "size", "step", "translateWithId", "warn", "warnText", "value"];
|
|
30
30
|
|
|
31
31
|
var _defaultTranslations, _Subtract, _Add;
|
|
32
32
|
var translationIds = {
|
|
@@ -44,6 +44,8 @@ var NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function Num
|
|
|
44
44
|
customClassName = props.className,
|
|
45
45
|
_props$disabled = props.disabled,
|
|
46
46
|
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
47
|
+
_props$disableWheel = props.disableWheel,
|
|
48
|
+
disableWheelProp = _props$disableWheel === void 0 ? false : _props$disableWheel,
|
|
47
49
|
defaultValue = props.defaultValue,
|
|
48
50
|
_props$helperText = props.helperText,
|
|
49
51
|
helperText = _props$helperText === void 0 ? '' : _props$helperText,
|
|
@@ -182,6 +184,24 @@ var NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function Num
|
|
|
182
184
|
onClick: _onClick,
|
|
183
185
|
onChange: handleOnChange,
|
|
184
186
|
onKeyUp: onKeyUp,
|
|
187
|
+
onFocus: function onFocus(e) {
|
|
188
|
+
if (disableWheelProp) {
|
|
189
|
+
e.target.addEventListener('wheel', disableWheel);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (rest.onFocus) {
|
|
193
|
+
rest.onFocus(e);
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
onBlur: function onBlur(e) {
|
|
197
|
+
if (disableWheelProp) {
|
|
198
|
+
e.target.removeEventListener('wheel', disableWheel);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (rest.onBlur) {
|
|
202
|
+
rest.onBlur(e);
|
|
203
|
+
}
|
|
204
|
+
},
|
|
185
205
|
pattern: "[0-9]*",
|
|
186
206
|
readOnly: readOnly,
|
|
187
207
|
step: step,
|
|
@@ -264,6 +284,11 @@ NumberInput.propTypes = {
|
|
|
264
284
|
*/
|
|
265
285
|
defaultValue: PropTypes__default["default"].oneOfType([PropTypes__default["default"].number, PropTypes__default["default"].string]),
|
|
266
286
|
|
|
287
|
+
/**
|
|
288
|
+
* Specify if the wheel functionality for the input should be disabled, or not
|
|
289
|
+
*/
|
|
290
|
+
disableWheel: PropTypes__default["default"].bool,
|
|
291
|
+
|
|
267
292
|
/**
|
|
268
293
|
* Specify if the control should be disabled, or not
|
|
269
294
|
*/
|
|
@@ -459,6 +484,25 @@ function getInputValidity(_ref4) {
|
|
|
459
484
|
|
|
460
485
|
return true;
|
|
461
486
|
}
|
|
487
|
+
/**
|
|
488
|
+
* It prevents any wheel event from emitting.
|
|
489
|
+
*
|
|
490
|
+
* We want to prevent this input field from changing by the user accidentally
|
|
491
|
+
* when the user scrolling up or down in a long form. So we prevent the default
|
|
492
|
+
* behavior of wheel events when it is focused.
|
|
493
|
+
*
|
|
494
|
+
* Because React uses passive event handler by default, we can't just call
|
|
495
|
+
* `preventDefault` in the `onWheel` event handler. So we have to get the input
|
|
496
|
+
* ref and add our event handler manually.
|
|
497
|
+
*
|
|
498
|
+
* @see https://github.com/facebook/react/pull/19654
|
|
499
|
+
* @param {WheelEvent} e A wheel event.
|
|
500
|
+
*/
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
function disableWheel(e) {
|
|
504
|
+
e.preventDefault();
|
|
505
|
+
}
|
|
462
506
|
/**
|
|
463
507
|
* Clamp the given value between the upper bound `max` and the lower bound `min`
|
|
464
508
|
* @param {number} max
|
|
@@ -22,7 +22,7 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
22
22
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
23
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
24
24
|
|
|
25
|
-
var _excluded = ["className"];
|
|
25
|
+
var _excluded = ["className", "vertical"];
|
|
26
26
|
|
|
27
27
|
var _CircleDash, _Step, _Step2, _Step3, _Step4;
|
|
28
28
|
|
|
@@ -41,11 +41,12 @@ function Step() {
|
|
|
41
41
|
|
|
42
42
|
function ProgressIndicatorSkeleton(_ref) {
|
|
43
43
|
var className = _ref.className,
|
|
44
|
+
vertical = _ref.vertical,
|
|
44
45
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
45
46
|
|
|
46
47
|
var prefix = usePrefix.usePrefix();
|
|
47
48
|
return /*#__PURE__*/React__default["default"].createElement("ul", _rollupPluginBabelHelpers["extends"]({
|
|
48
|
-
className: cx__default["default"]("".concat(prefix, "--progress"), "".concat(prefix, "--skeleton"), className)
|
|
49
|
+
className: cx__default["default"]("".concat(prefix, "--progress"), "".concat(prefix, "--skeleton"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--progress--vertical"), vertical), className)
|
|
49
50
|
}, rest), _Step || (_Step = /*#__PURE__*/React__default["default"].createElement(Step, null)), _Step2 || (_Step2 = /*#__PURE__*/React__default["default"].createElement(Step, null)), _Step3 || (_Step3 = /*#__PURE__*/React__default["default"].createElement(Step, null)), _Step4 || (_Step4 = /*#__PURE__*/React__default["default"].createElement(Step, null)));
|
|
50
51
|
}
|
|
51
52
|
|
|
@@ -53,7 +54,12 @@ ProgressIndicatorSkeleton.propTypes = {
|
|
|
53
54
|
/**
|
|
54
55
|
* Specify an optional className to add.
|
|
55
56
|
*/
|
|
56
|
-
className: PropTypes__default["default"].string
|
|
57
|
+
className: PropTypes__default["default"].string,
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Determines whether or not the ProgressIndicator should be rendered vertically.
|
|
61
|
+
*/
|
|
62
|
+
vertical: PropTypes__default["default"].bool
|
|
57
63
|
};
|
|
58
64
|
|
|
59
65
|
exports["default"] = ProgressIndicatorSkeleton;
|
|
@@ -138,7 +138,7 @@ var TextInput = /*#__PURE__*/React__default["default"].forwardRef(function TextI
|
|
|
138
138
|
var helperTextClasses = cx__default["default"]("".concat(prefix, "--form__helper-text"), (_classNames4 = {}, _rollupPluginBabelHelpers.defineProperty(_classNames4, "".concat(prefix, "--form__helper-text--disabled"), normalizedProps.disabled), _rollupPluginBabelHelpers.defineProperty(_classNames4, "".concat(prefix, "--form__helper-text--inline"), inline), _classNames4));
|
|
139
139
|
var fieldOuterWrapperClasses = cx__default["default"]("".concat(prefix, "--text-input__field-outer-wrapper"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--text-input__field-outer-wrapper--inline"), inline));
|
|
140
140
|
var fieldWrapperClasses = cx__default["default"]("".concat(prefix, "--text-input__field-wrapper"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--text-input__field-wrapper--warning"), normalizedProps.warn));
|
|
141
|
-
var iconClasses = cx__default["default"]((_classNames7 = {}, _rollupPluginBabelHelpers.defineProperty(_classNames7, "".concat(prefix, "--text-input__invalid-icon"), normalizedProps.invalid || normalizedProps.warn), _rollupPluginBabelHelpers.defineProperty(_classNames7, "".concat(prefix, "--text-input__invalid-icon--warning"), normalizedProps.warn),
|
|
141
|
+
var iconClasses = cx__default["default"]((_classNames7 = {}, _rollupPluginBabelHelpers.defineProperty(_classNames7, "".concat(prefix, "--text-input__invalid-icon"), normalizedProps.invalid || normalizedProps.warn), _rollupPluginBabelHelpers.defineProperty(_classNames7, "".concat(prefix, "--text-input__invalid-icon--warning"), normalizedProps.warn), _classNames7));
|
|
142
142
|
var counterClasses = cx__default["default"]("".concat(prefix, "--label"), (_classNames8 = {}, _rollupPluginBabelHelpers.defineProperty(_classNames8, "".concat(prefix, "--label--disabled"), disabled), _rollupPluginBabelHelpers.defineProperty(_classNames8, "".concat(prefix, "--text-input__label-counter"), true), _classNames8));
|
|
143
143
|
var counter = enableCounter && maxCount ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
144
144
|
className: counterClasses
|
|
@@ -73,22 +73,18 @@ function useNormalizedInputProps(_ref) {
|
|
|
73
73
|
helperId: "".concat(id, "-helper-text")
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
if (
|
|
77
|
-
normalizedProps.icon = iconsReact.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
normalizedProps.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
normalizedProps.
|
|
87
|
-
|
|
88
|
-
className: "".concat(prefix, "--form-requirement"),
|
|
89
|
-
id: normalizedProps.warnId
|
|
90
|
-
}, warnText);
|
|
91
|
-
}
|
|
76
|
+
if (normalizedProps.invalid) {
|
|
77
|
+
normalizedProps.icon = iconsReact.WarningFilled;
|
|
78
|
+
normalizedProps.validation = /*#__PURE__*/React__default["default"].createElement("div", {
|
|
79
|
+
className: "".concat(prefix, "--form-requirement"),
|
|
80
|
+
id: normalizedProps.invalidId
|
|
81
|
+
}, invalidText);
|
|
82
|
+
} else if (normalizedProps.warn) {
|
|
83
|
+
normalizedProps.icon = iconsReact.WarningAltFilled;
|
|
84
|
+
normalizedProps.validation = /*#__PURE__*/React__default["default"].createElement("div", {
|
|
85
|
+
className: "".concat(prefix, "--form-requirement"),
|
|
86
|
+
id: normalizedProps.warnId
|
|
87
|
+
}, warnText);
|
|
92
88
|
}
|
|
93
89
|
|
|
94
90
|
return normalizedProps;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/react",
|
|
3
3
|
"description": "React components for the Carbon Design System",
|
|
4
|
-
"version": "1.16.0
|
|
4
|
+
"version": "1.16.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "es/index.js",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@carbon/feature-flags": "^0.9.0",
|
|
47
47
|
"@carbon/icons-react": "^11.10.0",
|
|
48
48
|
"@carbon/layout": "^11.7.0",
|
|
49
|
-
"@carbon/styles": "^1.16.0
|
|
49
|
+
"@carbon/styles": "^1.16.0",
|
|
50
50
|
"@carbon/telemetry": "0.1.0",
|
|
51
51
|
"classnames": "2.3.2",
|
|
52
52
|
"copy-to-clipboard": "^3.3.1",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"@babel/preset-env": "^7.18.2",
|
|
74
74
|
"@babel/preset-react": "^7.17.12",
|
|
75
75
|
"@carbon/test-utils": "^10.26.0",
|
|
76
|
-
"@carbon/themes": "^11.11.0
|
|
76
|
+
"@carbon/themes": "^11.11.0",
|
|
77
77
|
"@rollup/plugin-babel": "^5.3.0",
|
|
78
78
|
"@rollup/plugin-commonjs": "^21.0.0",
|
|
79
79
|
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
@@ -131,5 +131,5 @@
|
|
|
131
131
|
"**/*.scss",
|
|
132
132
|
"**/*.css"
|
|
133
133
|
],
|
|
134
|
-
"gitHead": "
|
|
134
|
+
"gitHead": "c77cccfd9ee14e87f60daefbc518d63204606e2b"
|
|
135
135
|
}
|