@carbon/react 1.13.0 → 1.14.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.
Files changed (35) hide show
  1. package/es/components/Accordion/Accordion.Skeleton.js +12 -4
  2. package/es/components/Accordion/Accordion.js +9 -2
  3. package/es/components/FileUploader/Filename.js +3 -1
  4. package/es/components/FluidTextArea/FluidTextArea.js +130 -0
  5. package/es/components/FluidTextInput/FluidTextInput.js +13 -4
  6. package/es/components/Notification/Notification.js +6 -2
  7. package/es/components/NumberInput/NumberInput.js +2 -2
  8. package/es/components/ProgressIndicator/ProgressIndicator.js +128 -154
  9. package/es/components/RadioTile/RadioTile.js +2 -11
  10. package/es/components/TextArea/TextArea.js +14 -5
  11. package/es/components/TextInput/PasswordInput.js +7 -6
  12. package/es/components/TextInput/TextInput.js +42 -6
  13. package/es/index.js +2 -4
  14. package/lib/components/Accordion/Accordion.Skeleton.js +12 -4
  15. package/lib/components/Accordion/Accordion.js +9 -2
  16. package/lib/components/FileUploader/Filename.js +3 -1
  17. package/lib/components/FluidTextArea/FluidTextArea.js +140 -0
  18. package/lib/components/FluidTextInput/FluidTextInput.js +12 -3
  19. package/lib/components/Notification/Notification.js +6 -2
  20. package/lib/components/NumberInput/NumberInput.js +2 -2
  21. package/lib/components/ProgressIndicator/ProgressIndicator.js +126 -152
  22. package/lib/components/RadioTile/RadioTile.js +2 -11
  23. package/lib/components/TextArea/TextArea.js +13 -4
  24. package/lib/components/TextInput/PasswordInput.js +7 -6
  25. package/lib/components/TextInput/TextInput.js +40 -4
  26. package/lib/index.js +47 -50
  27. package/package.json +8 -7
  28. package/es/components/ProgressIndicator/index.js +0 -15
  29. package/es/components/ProgressIndicator/next/ProgressIndicator.js +0 -117
  30. package/es/components/SearchFilterButton/SearchFilterButton.js +0 -61
  31. package/es/components/SearchLayoutButton/SearchLayoutButton.js +0 -151
  32. package/lib/components/ProgressIndicator/index.js +0 -39
  33. package/lib/components/ProgressIndicator/next/ProgressIndicator.js +0 -127
  34. package/lib/components/SearchFilterButton/SearchFilterButton.js +0 -70
  35. package/lib/components/SearchLayoutButton/SearchLayoutButton.js +0 -160
@@ -1,127 +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 _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
13
- var cx = require('classnames');
14
- var PropTypes = require('prop-types');
15
- var React = require('react');
16
- var usePrefix = require('../../../internal/usePrefix.js');
17
-
18
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
19
-
20
- var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
21
- var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
22
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
23
-
24
- var _excluded = ["children", "className", "currentIndex", "onChange", "spaceEqually", "vertical"];
25
-
26
- function ProgressIndicator(_ref) {
27
- var _cx;
28
-
29
- var children = _ref.children,
30
- customClassName = _ref.className,
31
- _ref$currentIndex = _ref.currentIndex,
32
- controlledIndex = _ref$currentIndex === void 0 ? 0 : _ref$currentIndex,
33
- onChange = _ref.onChange,
34
- spaceEqually = _ref.spaceEqually,
35
- vertical = _ref.vertical,
36
- rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
37
-
38
- var prefix = usePrefix.usePrefix();
39
-
40
- var _useState = React.useState(controlledIndex),
41
- _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
42
- currentIndex = _useState2[0],
43
- setCurrentIndex = _useState2[1];
44
-
45
- var _useState3 = React.useState(controlledIndex),
46
- _useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
47
- prevControlledIndex = _useState4[0],
48
- setPrevControlledIndex = _useState4[1];
49
-
50
- var className = cx__default["default"]((_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--progress"), true), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--progress--vertical"), vertical), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--progress--space-equal"), spaceEqually && !vertical), _rollupPluginBabelHelpers.defineProperty(_cx, customClassName, customClassName), _cx));
51
-
52
- if (controlledIndex !== prevControlledIndex) {
53
- setCurrentIndex(controlledIndex);
54
- setPrevControlledIndex(controlledIndex);
55
- }
56
-
57
- return /*#__PURE__*/React__default["default"].createElement("ul", _rollupPluginBabelHelpers["extends"]({
58
- className: className
59
- }, rest), React__default["default"].Children.map(children, function (child, index) {
60
- // only setup click handlers if onChange event is passed
61
- var onClick = onChange ? function () {
62
- return onChange(index);
63
- } : undefined;
64
-
65
- if (index === currentIndex) {
66
- return /*#__PURE__*/React__default["default"].cloneElement(child, {
67
- complete: child.props.complete,
68
- current: child.props.complete ? false : true,
69
- index: index,
70
- onClick: onClick
71
- });
72
- }
73
-
74
- if (index < currentIndex) {
75
- return /*#__PURE__*/React__default["default"].cloneElement(child, {
76
- complete: true,
77
- index: index,
78
- onClick: onClick
79
- });
80
- }
81
-
82
- if (index > currentIndex) {
83
- return /*#__PURE__*/React__default["default"].cloneElement(child, {
84
- complete: child.props.complete || false,
85
- index: index,
86
- onClick: onClick
87
- });
88
- }
89
-
90
- return null;
91
- }));
92
- }
93
-
94
- ProgressIndicator.propTypes = {
95
- /**
96
- * Provide `<ProgressStep>` components to be rendered in the
97
- * `<ProgressIndicator>`
98
- */
99
- children: PropTypes__default["default"].node,
100
-
101
- /**
102
- * Provide an optional className to be applied to the containing node
103
- */
104
- className: PropTypes__default["default"].string,
105
-
106
- /**
107
- * Optionally specify the current step array index
108
- */
109
- currentIndex: PropTypes__default["default"].number,
110
-
111
- /**
112
- * Optional callback called if a ProgressStep is clicked on. Returns the index of the step.
113
- */
114
- onChange: PropTypes__default["default"].func,
115
-
116
- /**
117
- * Specify whether the progress steps should be split equally in size in the div
118
- */
119
- spaceEqually: PropTypes__default["default"].bool,
120
-
121
- /**
122
- * Determines whether or not the ProgressIndicator should be rendered vertically.
123
- */
124
- vertical: PropTypes__default["default"].bool
125
- };
126
-
127
- exports.ProgressIndicator = ProgressIndicator;
@@ -1,70 +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 _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
13
- var iconsReact = require('@carbon/icons-react');
14
- var PropTypes = require('prop-types');
15
- var React = require('react');
16
- var warning = require('../../internal/warning.js');
17
- var usePrefix = require('../../internal/usePrefix.js');
18
-
19
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
20
-
21
- var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
22
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
23
-
24
- var _excluded = ["labelText", "iconDescription"];
25
- var didWarnAboutDeprecation = false;
26
- /**
27
- * The filter button for `<Search>`.
28
- */
29
-
30
- var SearchFilterButton = function SearchFilterButton(_ref) {
31
- var labelText = _ref.labelText,
32
- iconDescription = _ref.iconDescription,
33
- other = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
34
-
35
- var prefix = usePrefix.usePrefix();
36
-
37
- if (process.env.NODE_ENV !== "production") {
38
- process.env.NODE_ENV !== "production" ? warning.warning(didWarnAboutDeprecation, 'The SearchFilterButton component has been deprecated and will be removed in the next major release of `carbon-components-react`') : void 0;
39
- didWarnAboutDeprecation = true;
40
- }
41
-
42
- return /*#__PURE__*/React__default["default"].createElement("button", _rollupPluginBabelHelpers["extends"]({
43
- className: "".concat(prefix, "--search-button"),
44
- type: "button",
45
- "aria-label": labelText,
46
- title: labelText
47
- }, other), /*#__PURE__*/React__default["default"].createElement(iconsReact.Filter, {
48
- className: "".concat(prefix, "--search-filter"),
49
- "aria-label": iconDescription
50
- }));
51
- };
52
-
53
- SearchFilterButton.propTypes = {
54
- /**
55
- * The icon description.
56
- */
57
- iconDescription: PropTypes__default["default"].string,
58
-
59
- /**
60
- * The a11y label text.
61
- */
62
- labelText: PropTypes__default["default"].string
63
- };
64
- SearchFilterButton.defaultProps = {
65
- labelText: 'Search',
66
- iconDescription: 'filter'
67
- };
68
- var SearchFilterButton$1 = SearchFilterButton;
69
-
70
- exports["default"] = SearchFilterButton$1;
@@ -1,160 +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 _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
13
- var iconsReact = require('@carbon/icons-react');
14
- var PropTypes = require('prop-types');
15
- var React = require('react');
16
- var warning = require('../../internal/warning.js');
17
- var usePrefix = require('../../internal/usePrefix.js');
18
-
19
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
20
-
21
- var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
22
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
23
-
24
- var didWarnAboutDeprecation = false;
25
- /**
26
- * The layout button for `<Search>`.
27
- */
28
-
29
- var SearchLayoutButton = /*#__PURE__*/function (_Component) {
30
- _rollupPluginBabelHelpers.inherits(SearchLayoutButton, _Component);
31
-
32
- var _super = _rollupPluginBabelHelpers.createSuper(SearchLayoutButton);
33
-
34
- function SearchLayoutButton(props) {
35
- var _this;
36
-
37
- _rollupPluginBabelHelpers.classCallCheck(this, SearchLayoutButton);
38
-
39
- _this = _super.call(this, props);
40
-
41
- _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.assertThisInitialized(_this), "state", {
42
- format: 'list'
43
- });
44
-
45
- _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.assertThisInitialized(_this), "toggleLayout", function () {
46
- var format = _this.state.format === 'list' ? 'grid' : 'list';
47
-
48
- _this.setState({
49
- format: format
50
- }, function () {
51
- var onChangeFormat = _this.props.onChangeFormat;
52
-
53
- if (typeof onChangeFormat === 'function') {
54
- onChangeFormat({
55
- format: format
56
- });
57
- }
58
- });
59
- });
60
-
61
- if (process.env.NODE_ENV !== "production") {
62
- process.env.NODE_ENV !== "production" ? warning.warning(didWarnAboutDeprecation, 'The SearchLayoutButton component has been deprecated and will be removed in the next major release of `carbon-components-react`') : void 0;
63
- didWarnAboutDeprecation = true;
64
- }
65
-
66
- return _this;
67
- }
68
- /**
69
- * Toggles the button state upon user-initiated event.
70
- */
71
-
72
-
73
- _rollupPluginBabelHelpers.createClass(SearchLayoutButton, [{
74
- key: "render",
75
- value: function render() {
76
- var _this2 = this;
77
-
78
- var prefix = this.context;
79
- var _this$props = this.props,
80
- labelText = _this$props.labelText,
81
- iconDescriptionList = _this$props.iconDescriptionList,
82
- iconDescriptionGrid = _this$props.iconDescriptionGrid;
83
-
84
- var SearchLayoutButtonIcon = function SearchLayoutButtonIcon() {
85
- if (_this2.state.format === 'list') {
86
- return /*#__PURE__*/React__default["default"].createElement(iconsReact.ListBulleted, {
87
- className: "".concat(prefix, "--search-view"),
88
- "aria-label": iconDescriptionList
89
- });
90
- }
91
-
92
- return /*#__PURE__*/React__default["default"].createElement(iconsReact.Grid, {
93
- className: "".concat(prefix, "--search-view"),
94
- "aria-label": iconDescriptionGrid
95
- });
96
- };
97
-
98
- return /*#__PURE__*/React__default["default"].createElement("button", {
99
- className: "".concat(prefix, "--search-button"),
100
- type: "button",
101
- onClick: this.toggleLayout,
102
- "aria-label": labelText,
103
- title: labelText
104
- }, /*#__PURE__*/React__default["default"].createElement("div", {
105
- className: "".concat(prefix, "--search__toggle-layout__container")
106
- }, /*#__PURE__*/React__default["default"].createElement(SearchLayoutButtonIcon, null)));
107
- }
108
- }], [{
109
- key: "getDerivedStateFromProps",
110
- value: function getDerivedStateFromProps(_ref, state) {
111
- var format = _ref.format;
112
- var prevFormat = state.prevFormat;
113
- return prevFormat === format ? null : {
114
- format: format || 'list',
115
- prevFormat: format
116
- };
117
- }
118
- }]);
119
-
120
- return SearchLayoutButton;
121
- }(React.Component);
122
-
123
- _rollupPluginBabelHelpers.defineProperty(SearchLayoutButton, "contextType", usePrefix.PrefixContext);
124
-
125
- _rollupPluginBabelHelpers.defineProperty(SearchLayoutButton, "propTypes", {
126
- /**
127
- * The layout.
128
- */
129
- format: PropTypes__default["default"].oneOf(['list', 'grid']),
130
-
131
- /**
132
- * The description for the "grid" icon.
133
- */
134
- iconDescriptionGrid: PropTypes__default["default"].string,
135
-
136
- /**
137
- * The description for the "list" icon.
138
- */
139
- iconDescriptionList: PropTypes__default["default"].string,
140
-
141
- /**
142
- * The a11y label text.
143
- */
144
- labelText: PropTypes__default["default"].string,
145
-
146
- /**
147
- * The callback called when layout switches.
148
- */
149
- onChangeFormat: PropTypes__default["default"].func
150
- });
151
-
152
- _rollupPluginBabelHelpers.defineProperty(SearchLayoutButton, "defaultProps", {
153
- labelText: 'Filter',
154
- iconDescriptionList: 'list',
155
- iconDescriptionGrid: 'grid'
156
- });
157
-
158
- var SearchLayoutButton$1 = SearchLayoutButton;
159
-
160
- exports["default"] = SearchLayoutButton$1;