@carbon/react 1.8.0 → 1.9.0-rc.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/ComposedModal/next/ComposedModal.js +1 -1
- package/es/components/Menu/Menu.js +1 -1
- package/es/components/NumberInput/NumberInput.Skeleton.js +3 -4
- package/es/components/NumberInput/NumberInput.js +308 -359
- package/es/index.js +2 -2
- package/lib/components/ComposedModal/next/ComposedModal.js +1 -1
- package/lib/components/Menu/Menu.js +1 -1
- package/lib/components/NumberInput/NumberInput.Skeleton.js +3 -4
- package/lib/components/NumberInput/NumberInput.js +305 -376
- package/lib/index.js +4 -4
- package/package.json +6 -6
- package/scss/utilities/_hide-at-breakpoint.scss +9 -0
- package/es/internal/FeatureFlags.js +0 -52
- package/es/prop-types/requiredIfValueExists.js +0 -32
- package/lib/internal/FeatureFlags.js +0 -56
- package/lib/prop-types/requiredIfValueExists.js +0 -36
package/lib/index.js
CHANGED
|
@@ -46,8 +46,6 @@ var Loading = require('./components/Loading/Loading.js');
|
|
|
46
46
|
var Modal = require('./components/Modal/Modal.js');
|
|
47
47
|
var ModalWrapper = require('./components/ModalWrapper/ModalWrapper.js');
|
|
48
48
|
require('./components/MultiSelect/index.js');
|
|
49
|
-
var NumberInput_Skeleton = require('./components/NumberInput/NumberInput.Skeleton.js');
|
|
50
|
-
var NumberInput = require('./components/NumberInput/NumberInput.js');
|
|
51
49
|
var OrderedList = require('./components/OrderedList/OrderedList.js');
|
|
52
50
|
var index$2 = require('./components/OverflowMenu/index.js');
|
|
53
51
|
var index$3 = require('./components/OverflowMenuItem/index.js');
|
|
@@ -120,6 +118,7 @@ var FileUploaderDropContainer = require('./components/FileUploader/FileUploaderD
|
|
|
120
118
|
var FileUploaderItem = require('./components/FileUploader/FileUploaderItem.js');
|
|
121
119
|
var Row = require('./components/Grid/Row.js');
|
|
122
120
|
var Column = require('./components/Grid/Column.js');
|
|
121
|
+
var NumberInput_Skeleton = require('./components/NumberInput/NumberInput.Skeleton.js');
|
|
123
122
|
var HeaderMenuButton = require('./components/UIShell/HeaderMenuButton.js');
|
|
124
123
|
var HeaderName = require('./components/UIShell/HeaderName.js');
|
|
125
124
|
var SkipToContent = require('./components/UIShell/SkipToContent.js');
|
|
@@ -172,6 +171,7 @@ var Grid = require('./components/Grid/Grid.js');
|
|
|
172
171
|
var ColumnHang = require('./components/Grid/ColumnHang.js');
|
|
173
172
|
var FlexGrid = require('./components/Grid/FlexGrid.js');
|
|
174
173
|
var Notification = require('./components/Notification/Notification.js');
|
|
174
|
+
var NumberInput = require('./components/NumberInput/NumberInput.js');
|
|
175
175
|
var ControlledPasswordInput = require('./components/TextInput/ControlledPasswordInput.js');
|
|
176
176
|
var PasswordInput = require('./components/TextInput/PasswordInput.js');
|
|
177
177
|
var ProgressIndicator = require('./components/ProgressIndicator/ProgressIndicator.js');
|
|
@@ -240,8 +240,6 @@ exports.ListItem = ListItem["default"];
|
|
|
240
240
|
exports.Loading = Loading["default"];
|
|
241
241
|
exports.Modal = Modal["default"];
|
|
242
242
|
exports.ModalWrapper = ModalWrapper["default"];
|
|
243
|
-
exports.NumberInputSkeleton = NumberInput_Skeleton["default"];
|
|
244
|
-
exports.NumberInput = NumberInput["default"];
|
|
245
243
|
exports.OrderedList = OrderedList["default"];
|
|
246
244
|
exports.OverflowMenu = index$2["default"];
|
|
247
245
|
exports.OverflowMenuItem = index$3["default"];
|
|
@@ -333,6 +331,7 @@ exports.FileUploaderDropContainer = FileUploaderDropContainer["default"];
|
|
|
333
331
|
exports.FileUploaderItem = FileUploaderItem["default"];
|
|
334
332
|
exports.Row = Row["default"];
|
|
335
333
|
exports.Column = Column["default"];
|
|
334
|
+
exports.NumberInputSkeleton = NumberInput_Skeleton["default"];
|
|
336
335
|
exports.HeaderMenuButton = HeaderMenuButton["default"];
|
|
337
336
|
exports.HeaderName = HeaderName["default"];
|
|
338
337
|
exports.SkipToContent = SkipToContent["default"];
|
|
@@ -389,6 +388,7 @@ exports.InlineNotification = Notification.InlineNotification;
|
|
|
389
388
|
exports.NotificationActionButton = Notification.NotificationActionButton;
|
|
390
389
|
exports.NotificationButton = Notification.NotificationButton;
|
|
391
390
|
exports.ToastNotification = Notification.ToastNotification;
|
|
391
|
+
exports.NumberInput = NumberInput.NumberInput;
|
|
392
392
|
exports.ControlledPasswordInput = ControlledPasswordInput["default"];
|
|
393
393
|
exports.PasswordInput = PasswordInput["default"];
|
|
394
394
|
exports.ProgressStep = ProgressIndicator.ProgressStep;
|
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.
|
|
4
|
+
"version": "1.9.0-rc.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "es/index.js",
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@babel/runtime": "^7.18.3",
|
|
46
46
|
"@carbon/feature-flags": "^0.8.0",
|
|
47
|
-
"@carbon/icons-react": "^11.
|
|
48
|
-
"@carbon/layout": "^11.
|
|
49
|
-
"@carbon/styles": "^1.
|
|
47
|
+
"@carbon/icons-react": "^11.7.0-rc.0",
|
|
48
|
+
"@carbon/layout": "^11.5.0-rc.0",
|
|
49
|
+
"@carbon/styles": "^1.9.0-rc.0",
|
|
50
50
|
"@carbon/telemetry": "0.1.0",
|
|
51
51
|
"classnames": "2.3.1",
|
|
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.25.0",
|
|
76
|
-
"@carbon/themes": "^11.
|
|
76
|
+
"@carbon/themes": "^11.6.0-rc.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",
|
|
@@ -129,5 +129,5 @@
|
|
|
129
129
|
"**/*.scss",
|
|
130
130
|
"**/*.css"
|
|
131
131
|
],
|
|
132
|
-
"gitHead": "
|
|
132
|
+
"gitHead": "5a23e3960d9bf5b652b96b6a051ae2b04cfa9a08"
|
|
133
133
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Code generated by @carbon/react. DO NOT EDIT.
|
|
2
|
+
//
|
|
3
|
+
// Copyright IBM Corp. 2018, 2018
|
|
4
|
+
//
|
|
5
|
+
// This source code is licensed under the Apache-2.0 license found in the
|
|
6
|
+
// LICENSE file in the root directory of this source tree.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
@forward '@carbon/styles/scss/utilities/hide-at-breakpoint';
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright IBM Corp. 2016, 2022
|
|
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 { enabled } from '@carbon/feature-flags';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* This file contains the list of the default values of compile-time feature flags.
|
|
12
|
-
*
|
|
13
|
-
* Build toolchain can replace variable here and/or the references
|
|
14
|
-
* in order to apply non-default values to those feature flags.
|
|
15
|
-
*
|
|
16
|
-
* @example Render `foo` if `aFeatureFlag` is `true`, render `bar` otherwise.
|
|
17
|
-
* import { aFeatureFlag } from '/path/to/FeatureFlags';
|
|
18
|
-
* ...
|
|
19
|
-
* const MyComponent = props => (<div {...props}>{aFeatureFlag ? 'foo' : 'bar'}</div>);
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* With this flag, certain components will be created in either a controlled or controlled
|
|
24
|
-
* mode based on the existence of a value prop.
|
|
25
|
-
*
|
|
26
|
-
* The following components will have the significance of their props slightly altered as outlined below.
|
|
27
|
-
*
|
|
28
|
-
* Components: `<NumberInput>`
|
|
29
|
-
*
|
|
30
|
-
* * `value` → when provided, enables controlled mode.
|
|
31
|
-
* For the rest of the component's lifecycle, it will be controlled by this prop as it's single source of truth.
|
|
32
|
-
* * `defaultValue` → Optional starting value, used for for uncontrolled mode only (no value prop).
|
|
33
|
-
* The value prop takes precedence over defaultValue.
|
|
34
|
-
* * `onChange` → Optional event handler.
|
|
35
|
-
* However, if value is provided and a handler is not, we'll throw a warning indicating the component is now read-only
|
|
36
|
-
* * `readOnly` → silences the above warning, acknowledging the read-only state of the component
|
|
37
|
-
*
|
|
38
|
-
* This flag also disables prop -> state sync in several components, notably `<NumberInput>`.
|
|
39
|
-
*
|
|
40
|
-
* This flag also updates event handlers to pass an up-to-date value in the second parameter,
|
|
41
|
-
* so applications can use it in both controlled and uncontrolled components.
|
|
42
|
-
*
|
|
43
|
-
* * _With_ this feature flag, the signature of the event handler will be altered to provide additional context in the second parameter: `onChange(event, { value, ...rest })` where:
|
|
44
|
-
* * `event` is the (React) raw event
|
|
45
|
-
* * `value` is the new value
|
|
46
|
-
* * `rest` tells you additional information based on the source component
|
|
47
|
-
* * _Without_ this feature flag the event handler has component-specific signature, e.g. `onChange(event, direction)`.
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
|
-
var useControlledStateWithValue = enabled('enable-use-controlled-state-with-value');
|
|
51
|
-
|
|
52
|
-
export { useControlledStateWithValue };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright IBM Corp. 2016, 2022
|
|
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
|
-
/**
|
|
9
|
-
* @param {Function} propType The original prop type checker.
|
|
10
|
-
* @returns {Function} The new prop type checker for `onChange` that makes it required if `value` exists and `readOnly` does not exist.
|
|
11
|
-
*/
|
|
12
|
-
function requiredIfValueExists(propType) {
|
|
13
|
-
return function check(props, propName, componentName) {
|
|
14
|
-
var onChange = props[propName],
|
|
15
|
-
value = props.value,
|
|
16
|
-
readOnly = props.readOnly;
|
|
17
|
-
var exists = onChange !== undefined;
|
|
18
|
-
var valueExists = value !== undefined;
|
|
19
|
-
|
|
20
|
-
if (process.env.NODE_ENV !== "production" && !exists && valueExists && !readOnly) {
|
|
21
|
-
return new Error("You provided a value prop to `".concat(componentName, "` without an `onChange` handler. ") + 'This will render a read-only field. ' + 'If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
25
|
-
rest[_key - 3] = arguments[_key];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return propType.apply(void 0, [props, propName, componentName].concat(rest));
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export { requiredIfValueExists as default };
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright IBM Corp. 2016, 2022
|
|
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
|
-
'use strict';
|
|
9
|
-
|
|
10
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
-
|
|
12
|
-
var FeatureFlags = require('@carbon/feature-flags');
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* This file contains the list of the default values of compile-time feature flags.
|
|
16
|
-
*
|
|
17
|
-
* Build toolchain can replace variable here and/or the references
|
|
18
|
-
* in order to apply non-default values to those feature flags.
|
|
19
|
-
*
|
|
20
|
-
* @example Render `foo` if `aFeatureFlag` is `true`, render `bar` otherwise.
|
|
21
|
-
* import { aFeatureFlag } from '/path/to/FeatureFlags';
|
|
22
|
-
* ...
|
|
23
|
-
* const MyComponent = props => (<div {...props}>{aFeatureFlag ? 'foo' : 'bar'}</div>);
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* With this flag, certain components will be created in either a controlled or controlled
|
|
28
|
-
* mode based on the existence of a value prop.
|
|
29
|
-
*
|
|
30
|
-
* The following components will have the significance of their props slightly altered as outlined below.
|
|
31
|
-
*
|
|
32
|
-
* Components: `<NumberInput>`
|
|
33
|
-
*
|
|
34
|
-
* * `value` → when provided, enables controlled mode.
|
|
35
|
-
* For the rest of the component's lifecycle, it will be controlled by this prop as it's single source of truth.
|
|
36
|
-
* * `defaultValue` → Optional starting value, used for for uncontrolled mode only (no value prop).
|
|
37
|
-
* The value prop takes precedence over defaultValue.
|
|
38
|
-
* * `onChange` → Optional event handler.
|
|
39
|
-
* However, if value is provided and a handler is not, we'll throw a warning indicating the component is now read-only
|
|
40
|
-
* * `readOnly` → silences the above warning, acknowledging the read-only state of the component
|
|
41
|
-
*
|
|
42
|
-
* This flag also disables prop -> state sync in several components, notably `<NumberInput>`.
|
|
43
|
-
*
|
|
44
|
-
* This flag also updates event handlers to pass an up-to-date value in the second parameter,
|
|
45
|
-
* so applications can use it in both controlled and uncontrolled components.
|
|
46
|
-
*
|
|
47
|
-
* * _With_ this feature flag, the signature of the event handler will be altered to provide additional context in the second parameter: `onChange(event, { value, ...rest })` where:
|
|
48
|
-
* * `event` is the (React) raw event
|
|
49
|
-
* * `value` is the new value
|
|
50
|
-
* * `rest` tells you additional information based on the source component
|
|
51
|
-
* * _Without_ this feature flag the event handler has component-specific signature, e.g. `onChange(event, direction)`.
|
|
52
|
-
*/
|
|
53
|
-
|
|
54
|
-
var useControlledStateWithValue = FeatureFlags.enabled('enable-use-controlled-state-with-value');
|
|
55
|
-
|
|
56
|
-
exports.useControlledStateWithValue = useControlledStateWithValue;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright IBM Corp. 2016, 2022
|
|
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
|
-
'use strict';
|
|
9
|
-
|
|
10
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @param {Function} propType The original prop type checker.
|
|
14
|
-
* @returns {Function} The new prop type checker for `onChange` that makes it required if `value` exists and `readOnly` does not exist.
|
|
15
|
-
*/
|
|
16
|
-
function requiredIfValueExists(propType) {
|
|
17
|
-
return function check(props, propName, componentName) {
|
|
18
|
-
var onChange = props[propName],
|
|
19
|
-
value = props.value,
|
|
20
|
-
readOnly = props.readOnly;
|
|
21
|
-
var exists = onChange !== undefined;
|
|
22
|
-
var valueExists = value !== undefined;
|
|
23
|
-
|
|
24
|
-
if (process.env.NODE_ENV !== "production" && !exists && valueExists && !readOnly) {
|
|
25
|
-
return new Error("You provided a value prop to `".concat(componentName, "` without an `onChange` handler. ") + 'This will render a read-only field. ' + 'If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.');
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
29
|
-
rest[_key - 3] = arguments[_key];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return propType.apply(void 0, [props, propName, componentName].concat(rest));
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
exports["default"] = requiredIfValueExists;
|