@carbon/react 1.15.0-rc.0 → 1.16.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/CodeSnippet/CodeSnippet.js +2 -1
- package/es/components/ComboBox/ComboBox.js +45 -24
- package/es/components/DataTable/TableExpandHeader.js +10 -2
- package/es/components/DataTable/TableExpandRow.js +2 -4
- package/es/components/DataTable/TableHeader.js +1 -1
- package/es/components/DatePicker/DatePicker.js +10 -8
- package/es/components/Dropdown/Dropdown.js +2 -2
- package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +41 -0
- package/es/components/FluidComboBox/FluidComboBox.js +140 -0
- package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +41 -0
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +151 -0
- package/es/components/FluidSelect/FluidSelect.Skeleton.js +41 -0
- package/es/components/FluidSelect/FluidSelect.js +93 -0
- package/es/components/FluidTextArea/FluidTextArea.js +2 -1
- package/es/components/InlineLoading/InlineLoading.js +2 -4
- package/es/components/ListBox/ListBox.js +2 -1
- package/es/components/ModalWrapper/ModalWrapper.js +8 -0
- package/es/components/MultiSelect/FilterableMultiSelect.js +41 -21
- package/es/components/MultiSelect/MultiSelect.js +28 -12
- package/es/components/OverflowMenu/OverflowMenu.js +2 -2
- package/es/components/Pagination/Pagination.js +271 -270
- package/es/components/Pagination/index.js +1 -6
- package/es/components/Select/Select.js +23 -5
- package/es/components/TextArea/TextArea.js +2 -2
- package/es/components/TextInput/ControlledPasswordInput.js +2 -3
- package/es/components/TextInput/PasswordInput.js +3 -3
- package/es/components/TextInput/TextInput.js +6 -7
- package/es/components/Tile/next/Tile.js +18 -22
- package/es/components/Tooltip/next/DefinitionTooltip.js +11 -2
- package/es/components/UIShell/HeaderMenu.js +15 -4
- package/es/components/UIShell/SideNavMenu.js +2 -1
- package/es/index.js +14 -8
- package/es/internal/useNormalizedInputProps.js +2 -1
- package/lib/components/CodeSnippet/CodeSnippet.js +2 -1
- package/lib/components/ComboBox/ComboBox.js +44 -23
- package/lib/components/DataTable/TableExpandHeader.js +10 -2
- package/lib/components/DataTable/TableExpandRow.js +2 -4
- package/lib/components/DataTable/TableHeader.js +1 -1
- package/lib/components/DatePicker/DatePicker.js +10 -8
- package/lib/components/Dropdown/Dropdown.js +2 -2
- package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +51 -0
- package/lib/components/FluidComboBox/FluidComboBox.js +150 -0
- package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +51 -0
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +161 -0
- package/lib/components/FluidSelect/FluidSelect.Skeleton.js +51 -0
- package/lib/components/FluidSelect/FluidSelect.js +103 -0
- package/lib/components/FluidTextArea/FluidTextArea.js +2 -1
- package/lib/components/InlineLoading/InlineLoading.js +2 -4
- package/lib/components/ListBox/ListBox.js +2 -1
- package/lib/components/ModalWrapper/ModalWrapper.js +8 -0
- package/lib/components/MultiSelect/FilterableMultiSelect.js +40 -20
- package/lib/components/MultiSelect/MultiSelect.js +27 -11
- package/lib/components/OverflowMenu/OverflowMenu.js +2 -2
- package/lib/components/Pagination/Pagination.js +269 -268
- package/lib/components/Pagination/index.js +2 -24
- package/lib/components/Select/Select.js +21 -3
- package/lib/components/TextArea/TextArea.js +2 -2
- package/lib/components/TextInput/ControlledPasswordInput.js +2 -3
- package/lib/components/TextInput/PasswordInput.js +3 -3
- package/lib/components/TextInput/TextInput.js +6 -7
- package/lib/components/Tile/next/Tile.js +18 -22
- package/lib/components/Tooltip/next/DefinitionTooltip.js +11 -2
- package/lib/components/UIShell/HeaderMenu.js +15 -4
- package/lib/components/UIShell/SideNavMenu.js +2 -1
- package/lib/index.js +98 -86
- package/lib/internal/useNormalizedInputProps.js +2 -1
- package/package.json +5 -5
- package/scss/components/fluid-select/_fluid-select.scss +9 -0
- package/scss/components/fluid-select/_index.scss +9 -0
- package/es/components/FileUploader/index.js +0 -15
- package/es/components/Pagination/next/Pagination.js +0 -421
- package/lib/components/FileUploader/index.js +0 -39
- package/lib/components/Pagination/next/Pagination.js +0 -431
|
@@ -0,0 +1,161 @@
|
|
|
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 PropTypes = require('prop-types');
|
|
14
|
+
var React = require('react');
|
|
15
|
+
var cx = require('classnames');
|
|
16
|
+
require('../MultiSelect/index.js');
|
|
17
|
+
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
|
+
var FormContext = require('../FluidForm/FormContext.js');
|
|
19
|
+
var FilterableMultiSelect = require('../MultiSelect/FilterableMultiSelect.js');
|
|
20
|
+
var MultiSelect = require('../MultiSelect/MultiSelect.js');
|
|
21
|
+
|
|
22
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
23
|
+
|
|
24
|
+
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
25
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
26
|
+
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
27
|
+
|
|
28
|
+
var _excluded = ["className", "isCondensed", "isFilterable"];
|
|
29
|
+
var FluidMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(function FluidMultiSelect(_ref, ref) {
|
|
30
|
+
var className = _ref.className,
|
|
31
|
+
isCondensed = _ref.isCondensed,
|
|
32
|
+
isFilterable = _ref.isFilterable,
|
|
33
|
+
other = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
34
|
+
|
|
35
|
+
var prefix = usePrefix.usePrefix();
|
|
36
|
+
var classNames = cx__default["default"]("".concat(prefix, "--list-box__wrapper--fluid"), className, _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--list-box__wrapper--fluid--condensed"), isCondensed));
|
|
37
|
+
return /*#__PURE__*/React__default["default"].createElement(FormContext.FormContext.Provider, {
|
|
38
|
+
value: {
|
|
39
|
+
isFluid: true
|
|
40
|
+
}
|
|
41
|
+
}, isFilterable ? /*#__PURE__*/React__default["default"].createElement(FilterableMultiSelect["default"], _rollupPluginBabelHelpers["extends"]({
|
|
42
|
+
ref: ref,
|
|
43
|
+
className: classNames
|
|
44
|
+
}, other)) : /*#__PURE__*/React__default["default"].createElement(MultiSelect["default"], _rollupPluginBabelHelpers["extends"]({
|
|
45
|
+
ref: ref,
|
|
46
|
+
className: classNames
|
|
47
|
+
}, other)));
|
|
48
|
+
});
|
|
49
|
+
FluidMultiSelect.propTypes = {
|
|
50
|
+
/**
|
|
51
|
+
* Specify an optional className to be applied to the outer FluidForm wrapper
|
|
52
|
+
*/
|
|
53
|
+
className: PropTypes__default["default"].string,
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Specify the direction of the dropdown. Can be either top or bottom.
|
|
57
|
+
*/
|
|
58
|
+
direction: PropTypes__default["default"].oneOf(['top', 'bottom']),
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Specify whether the `<input>` should be disabled
|
|
62
|
+
*/
|
|
63
|
+
disabled: PropTypes__default["default"].bool,
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Specify a custom `id` for the `<input>`
|
|
67
|
+
*/
|
|
68
|
+
id: PropTypes__default["default"].string.isRequired,
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Allow users to pass in an arbitrary item or a string (in case their items are an array of strings)
|
|
72
|
+
* from their collection that are pre-selected
|
|
73
|
+
*/
|
|
74
|
+
initialSelectedItem: PropTypes__default["default"].oneOfType([PropTypes__default["default"].object, PropTypes__default["default"].string, PropTypes__default["default"].number]),
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Specify if the currently selected value is invalid.
|
|
78
|
+
*/
|
|
79
|
+
invalid: PropTypes__default["default"].bool,
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Provide the text that is displayed when the control is in an invalid state
|
|
83
|
+
*/
|
|
84
|
+
invalidText: PropTypes__default["default"].node,
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Specify if the `FluidMultiSelect` should render its menu items in condensed mode
|
|
88
|
+
*/
|
|
89
|
+
isCondensed: PropTypes__default["default"].bool,
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Specify if the `FluidMultiSelect` should render the `filterable` variant of `FluidMultiSelect`
|
|
93
|
+
*/
|
|
94
|
+
isFilterable: PropTypes__default["default"].bool,
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Function to render items as custom components instead of strings.
|
|
98
|
+
* Defaults to null and is overridden by a getter
|
|
99
|
+
*/
|
|
100
|
+
itemToElement: PropTypes__default["default"].func,
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Helper function passed to downshift that allows the library to render a
|
|
104
|
+
* given item to a string label. By default, it extracts the `label` field
|
|
105
|
+
* from a given item to serve as the item label in the list.
|
|
106
|
+
*/
|
|
107
|
+
itemToString: PropTypes__default["default"].func,
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* We try to stay as generic as possible here to allow individuals to pass
|
|
111
|
+
* in a collection of whatever kind of data structure they prefer
|
|
112
|
+
*/
|
|
113
|
+
items: PropTypes__default["default"].array.isRequired,
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Generic `label` that will be used as the textual representation of what
|
|
117
|
+
* this field is for
|
|
118
|
+
*/
|
|
119
|
+
label: PropTypes__default["default"].node.isRequired,
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* `onChange` is a utility for this controlled component to communicate to a
|
|
123
|
+
* consuming component what kind of internal state changes are occurring.
|
|
124
|
+
*/
|
|
125
|
+
onChange: PropTypes__default["default"].func,
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* An optional callback to render the currently selected item as a react element instead of only
|
|
129
|
+
* as a string.
|
|
130
|
+
*/
|
|
131
|
+
renderSelectedItem: PropTypes__default["default"].func,
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* In the case you want to control the dropdown selection entirely.
|
|
135
|
+
*/
|
|
136
|
+
selectedItem: PropTypes__default["default"].oneOfType([PropTypes__default["default"].object, PropTypes__default["default"].string, PropTypes__default["default"].number]),
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Provide the title text that will be read by a screen reader when
|
|
140
|
+
* visiting this control
|
|
141
|
+
*/
|
|
142
|
+
titleText: PropTypes__default["default"].node,
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Callback function for translating ListBoxMenuIcon SVG title
|
|
146
|
+
*/
|
|
147
|
+
translateWithId: PropTypes__default["default"].func,
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Specify whether the control is currently in warning state
|
|
151
|
+
*/
|
|
152
|
+
warn: PropTypes__default["default"].bool,
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Provide the text that is displayed when the control is in warning state
|
|
156
|
+
*/
|
|
157
|
+
warnText: PropTypes__default["default"].node
|
|
158
|
+
};
|
|
159
|
+
var FluidMultiSelect$1 = FluidMultiSelect;
|
|
160
|
+
|
|
161
|
+
exports["default"] = FluidMultiSelect$1;
|
|
@@ -0,0 +1,51 @@
|
|
|
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 PropTypes = require('prop-types');
|
|
14
|
+
var React = require('react');
|
|
15
|
+
var cx = require('classnames');
|
|
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 PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
21
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
22
|
+
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
23
|
+
|
|
24
|
+
var _excluded = ["className"];
|
|
25
|
+
|
|
26
|
+
var FluidSelectSkeleton = function FluidSelectSkeleton(_ref) {
|
|
27
|
+
var className = _ref.className,
|
|
28
|
+
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
29
|
+
|
|
30
|
+
var prefix = usePrefix.usePrefix();
|
|
31
|
+
var wrapperClasses = cx__default["default"](className, "".concat(prefix, "--skeleton"), "".concat(prefix, "--list-box"));
|
|
32
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
33
|
+
className: "".concat(prefix, "--list-box__wrapper--fluid")
|
|
34
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
35
|
+
className: wrapperClasses
|
|
36
|
+
}, rest), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
37
|
+
className: "".concat(prefix, "--list-box__label")
|
|
38
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
39
|
+
className: "".concat(prefix, "--list-box__field")
|
|
40
|
+
})));
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
FluidSelectSkeleton.propTypes = {
|
|
44
|
+
/**
|
|
45
|
+
* Specify an optional className to add.
|
|
46
|
+
*/
|
|
47
|
+
className: PropTypes__default["default"].string
|
|
48
|
+
};
|
|
49
|
+
var FluidSelectSkeleton$1 = FluidSelectSkeleton;
|
|
50
|
+
|
|
51
|
+
exports["default"] = FluidSelectSkeleton$1;
|
|
@@ -0,0 +1,103 @@
|
|
|
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 PropTypes = require('prop-types');
|
|
14
|
+
var React = require('react');
|
|
15
|
+
var cx = require('classnames');
|
|
16
|
+
var Select = require('../Select/Select.js');
|
|
17
|
+
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
|
+
var FormContext = require('../FluidForm/FormContext.js');
|
|
19
|
+
|
|
20
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
21
|
+
|
|
22
|
+
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
23
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
24
|
+
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
25
|
+
|
|
26
|
+
var _excluded = ["className", "children"];
|
|
27
|
+
var FluidSelect = /*#__PURE__*/React__default["default"].forwardRef(function FluidSelect(_ref, ref) {
|
|
28
|
+
var className = _ref.className,
|
|
29
|
+
children = _ref.children,
|
|
30
|
+
other = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
31
|
+
|
|
32
|
+
var prefix = usePrefix.usePrefix();
|
|
33
|
+
var classNames = cx__default["default"]("".concat(prefix, "--select--fluid"), className);
|
|
34
|
+
return /*#__PURE__*/React__default["default"].createElement(FormContext.FormContext.Provider, {
|
|
35
|
+
value: {
|
|
36
|
+
isFluid: true
|
|
37
|
+
}
|
|
38
|
+
}, /*#__PURE__*/React__default["default"].createElement(Select["default"], _rollupPluginBabelHelpers["extends"]({
|
|
39
|
+
ref: ref,
|
|
40
|
+
className: classNames
|
|
41
|
+
}, other), children));
|
|
42
|
+
});
|
|
43
|
+
FluidSelect.propTypes = {
|
|
44
|
+
/**
|
|
45
|
+
* Provide the contents of your Select
|
|
46
|
+
*/
|
|
47
|
+
children: PropTypes__default["default"].node,
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Specify an optional className to be applied to the node containing the label and the select box
|
|
51
|
+
*/
|
|
52
|
+
className: PropTypes__default["default"].string,
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Optionally provide the default value of the `<select>`
|
|
56
|
+
*/
|
|
57
|
+
defaultValue: PropTypes__default["default"].any,
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Specify whether the control is disabled
|
|
61
|
+
*/
|
|
62
|
+
disabled: PropTypes__default["default"].bool,
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Specify a custom `id` for the `<select>`
|
|
66
|
+
*/
|
|
67
|
+
id: PropTypes__default["default"].string.isRequired,
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Specify if the currently value is invalid.
|
|
71
|
+
*/
|
|
72
|
+
invalid: PropTypes__default["default"].bool,
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Message which is displayed if the value is invalid.
|
|
76
|
+
*/
|
|
77
|
+
invalidText: PropTypes__default["default"].node,
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Provide label text to be read by screen readers when interacting with the
|
|
81
|
+
* control
|
|
82
|
+
*/
|
|
83
|
+
labelText: PropTypes__default["default"].node,
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Provide an optional `onChange` hook that is called each time the value of
|
|
87
|
+
* the underlying `<input>` changes
|
|
88
|
+
*/
|
|
89
|
+
onChange: PropTypes__default["default"].func,
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Specify whether the control is currently in warning state
|
|
93
|
+
*/
|
|
94
|
+
warn: PropTypes__default["default"].bool,
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Provide the text that is displayed when the control is in warning state
|
|
98
|
+
*/
|
|
99
|
+
warnText: PropTypes__default["default"].node
|
|
100
|
+
};
|
|
101
|
+
var FluidSelect$1 = FluidSelect;
|
|
102
|
+
|
|
103
|
+
exports["default"] = FluidSelect$1;
|
|
@@ -14,6 +14,7 @@ var PropTypes = require('prop-types');
|
|
|
14
14
|
var React = require('react');
|
|
15
15
|
var cx = require('classnames');
|
|
16
16
|
var TextArea = require('../TextArea/TextArea.js');
|
|
17
|
+
var deprecate = require('../../prop-types/deprecate.js');
|
|
17
18
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
19
|
var FormContext = require('../FluidForm/FormContext.js');
|
|
19
20
|
|
|
@@ -102,7 +103,7 @@ FluidTextArea.propTypes = {
|
|
|
102
103
|
* `true` to use the light version. For use on $ui-01 backgrounds only.
|
|
103
104
|
* Don't use this to make tile background color same as container background color.
|
|
104
105
|
*/
|
|
105
|
-
light: PropTypes__default["default"].bool,
|
|
106
|
+
light: deprecate["default"](PropTypes__default["default"].bool, 'The `light` prop for `FluidTextArea` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
|
|
106
107
|
|
|
107
108
|
/**
|
|
108
109
|
* Max character count allowed for the textarea. This is needed in order for enableCounter to display
|
|
@@ -31,7 +31,8 @@ function InlineLoading(_ref) {
|
|
|
31
31
|
iconDescription = _ref.iconDescription,
|
|
32
32
|
description = _ref.description,
|
|
33
33
|
onSuccess = _ref.onSuccess,
|
|
34
|
-
successDelay = _ref.successDelay,
|
|
34
|
+
_ref$successDelay = _ref.successDelay,
|
|
35
|
+
successDelay = _ref$successDelay === void 0 ? 1500 : _ref$successDelay,
|
|
35
36
|
other = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
36
37
|
|
|
37
38
|
var prefix = usePrefix.usePrefix();
|
|
@@ -118,8 +119,5 @@ InlineLoading.propTypes = {
|
|
|
118
119
|
*/
|
|
119
120
|
successDelay: PropTypes__default["default"].number
|
|
120
121
|
};
|
|
121
|
-
InlineLoading.defaultProps = {
|
|
122
|
-
successDelay: 1500
|
|
123
|
-
};
|
|
124
122
|
|
|
125
123
|
exports["default"] = InlineLoading;
|
|
@@ -13,6 +13,7 @@ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelper
|
|
|
13
13
|
var cx = require('classnames');
|
|
14
14
|
var React = require('react');
|
|
15
15
|
var PropTypes = require('prop-types');
|
|
16
|
+
var deprecate = require('../../prop-types/deprecate.js');
|
|
16
17
|
var ListBoxPropTypes = require('./ListBoxPropTypes.js');
|
|
17
18
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
19
|
var ListBoxField = require('./ListBoxField.js');
|
|
@@ -119,7 +120,7 @@ ListBox.propTypes = {
|
|
|
119
120
|
* `true` to use the light version. For use on $ui-01 backgrounds only.
|
|
120
121
|
* Don't use this to make tile background color same as container background color.
|
|
121
122
|
*/
|
|
122
|
-
light: PropTypes__default["default"].bool,
|
|
123
|
+
light: deprecate["default"](PropTypes__default["default"].bool, 'The `light` prop for `ListBox` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
|
|
123
124
|
|
|
124
125
|
/**
|
|
125
126
|
* Specify the size of the ListBox. Currently supports either `sm`, `md` or `lg` as an option.
|
|
@@ -15,6 +15,7 @@ var React = require('react');
|
|
|
15
15
|
var Modal = require('../Modal/Modal.js');
|
|
16
16
|
var Button = require('../Button/Button.js');
|
|
17
17
|
var types = require('../../prop-types/types.js');
|
|
18
|
+
var warning = require('../../internal/warning.js');
|
|
18
19
|
|
|
19
20
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
21
|
|
|
@@ -22,6 +23,7 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
22
23
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
24
|
|
|
24
25
|
var _excluded = ["children", "onKeyDown", "buttonTriggerText", "buttonTriggerClassName", "renderTriggerButtonIcon", "triggerButtonIconDescription", "triggerButtonKind", "disabled", "handleSubmit", "shouldCloseAfterSubmit", "selectorPrimaryFocus", "preventCloseOnClickOutside"];
|
|
26
|
+
var didWarnAboutDeprecation = false;
|
|
25
27
|
|
|
26
28
|
var ModalWrapper = /*#__PURE__*/function (_React$Component) {
|
|
27
29
|
_rollupPluginBabelHelpers.inherits(ModalWrapper, _React$Component);
|
|
@@ -85,6 +87,12 @@ var ModalWrapper = /*#__PURE__*/function (_React$Component) {
|
|
|
85
87
|
}
|
|
86
88
|
|
|
87
89
|
_rollupPluginBabelHelpers.createClass(ModalWrapper, [{
|
|
90
|
+
key: "if",
|
|
91
|
+
value: function _if(__DEV__) {
|
|
92
|
+
process.env.NODE_ENV !== "production" ? warning.warning(didWarnAboutDeprecation, '`<ModalWrapper>` has been deprecated in favor of `<ComposedModal/>` and will be removed in the next major version, `@carbon/react@v2.x`') : void 0;
|
|
93
|
+
didWarnAboutDeprecation = true;
|
|
94
|
+
}
|
|
95
|
+
}, {
|
|
88
96
|
key: "render",
|
|
89
97
|
value: function render() {
|
|
90
98
|
var _this2 = this;
|
|
@@ -22,10 +22,12 @@ require('../ListBox/index.js');
|
|
|
22
22
|
var Selection = require('../../internal/Selection.js');
|
|
23
23
|
var itemToString = require('./tools/itemToString.js');
|
|
24
24
|
var mergeRefs = require('../../tools/mergeRefs.js');
|
|
25
|
+
var deprecate = require('../../prop-types/deprecate.js');
|
|
25
26
|
var useId = require('../../internal/useId.js');
|
|
26
27
|
var sorting = require('./tools/sorting.js');
|
|
27
28
|
var index = require('../FeatureFlags/index.js');
|
|
28
29
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
30
|
+
var FormContext = require('../FluidForm/FormContext.js');
|
|
29
31
|
var match = require('../../internal/keyboard/match.js');
|
|
30
32
|
var ListBoxSelection = require('../ListBox/next/ListBoxSelection.js');
|
|
31
33
|
var ListBoxTrigger = require('../ListBox/next/ListBoxTrigger.js');
|
|
@@ -77,35 +79,43 @@ var FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(fu
|
|
|
77
79
|
warn = _ref.warn,
|
|
78
80
|
warnText = _ref.warnText;
|
|
79
81
|
|
|
80
|
-
var
|
|
82
|
+
var _useContext = React.useContext(FormContext.FormContext),
|
|
83
|
+
isFluid = _useContext.isFluid;
|
|
84
|
+
|
|
85
|
+
var _useState = React.useState(false),
|
|
81
86
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
|
82
|
-
|
|
83
|
-
|
|
87
|
+
isFocused = _useState2[0],
|
|
88
|
+
setIsFocused = _useState2[1];
|
|
84
89
|
|
|
85
90
|
var _useState3 = React.useState(open),
|
|
86
91
|
_useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
|
|
87
|
-
|
|
88
|
-
|
|
92
|
+
isOpen = _useState4[0],
|
|
93
|
+
setIsOpen = _useState4[1];
|
|
89
94
|
|
|
90
|
-
var _useState5 = React.useState(
|
|
95
|
+
var _useState5 = React.useState(open),
|
|
91
96
|
_useState6 = _rollupPluginBabelHelpers.slicedToArray(_useState5, 2),
|
|
92
|
-
|
|
93
|
-
|
|
97
|
+
prevOpen = _useState6[0],
|
|
98
|
+
setPrevOpen = _useState6[1];
|
|
94
99
|
|
|
95
|
-
var _useState7 = React.useState(
|
|
100
|
+
var _useState7 = React.useState(''),
|
|
96
101
|
_useState8 = _rollupPluginBabelHelpers.slicedToArray(_useState7, 2),
|
|
97
|
-
|
|
98
|
-
|
|
102
|
+
inputValue = _useState8[0],
|
|
103
|
+
setInputValue = _useState8[1];
|
|
99
104
|
|
|
100
|
-
var _useState9 = React.useState(
|
|
105
|
+
var _useState9 = React.useState([]),
|
|
101
106
|
_useState10 = _rollupPluginBabelHelpers.slicedToArray(_useState9, 2),
|
|
102
|
-
|
|
103
|
-
|
|
107
|
+
topItems = _useState10[0],
|
|
108
|
+
setTopItems = _useState10[1];
|
|
104
109
|
|
|
105
|
-
var _useState11 = React.useState(
|
|
110
|
+
var _useState11 = React.useState(false),
|
|
106
111
|
_useState12 = _rollupPluginBabelHelpers.slicedToArray(_useState11, 2),
|
|
107
|
-
|
|
108
|
-
|
|
112
|
+
inputFocused = _useState12[0],
|
|
113
|
+
setInputFocused = _useState12[1];
|
|
114
|
+
|
|
115
|
+
var _useState13 = React.useState(null),
|
|
116
|
+
_useState14 = _rollupPluginBabelHelpers.slicedToArray(_useState13, 2),
|
|
117
|
+
highlightedIndex = _useState14[0],
|
|
118
|
+
setHighlightedIndex = _useState14[1];
|
|
109
119
|
|
|
110
120
|
var textInput = React.useRef();
|
|
111
121
|
var filterableMultiSelectInstanceId = useId.useId();
|
|
@@ -119,7 +129,7 @@ var FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(fu
|
|
|
119
129
|
|
|
120
130
|
var inline = type === 'inline';
|
|
121
131
|
var showWarning = !invalid && warn;
|
|
122
|
-
var wrapperClasses = cx__default["default"]("".concat(prefix, "--multi-select__wrapper"), "".concat(prefix, "--list-box__wrapper"), [enabled ? containerClassName : null], (_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--multi-select__wrapper--inline"), inline), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--inline"), inline), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--multi-select__wrapper--inline--invalid"), inline && invalid), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--inline--invalid"), inline && invalid), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box--up"), direction === 'top'), _cx));
|
|
132
|
+
var wrapperClasses = cx__default["default"]("".concat(prefix, "--multi-select__wrapper"), "".concat(prefix, "--list-box__wrapper"), [enabled ? containerClassName : null], (_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--multi-select__wrapper--inline"), inline), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--inline"), inline), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--multi-select__wrapper--inline--invalid"), inline && invalid), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--inline--invalid"), inline && invalid), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box--up"), direction === 'top'), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--fluid--invalid"), isFluid && invalid), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--fluid--focus"), isFluid && isFocused), _cx));
|
|
123
133
|
var helperId = !helperText ? undefined : "filterablemultiselect-helper-text-".concat(filterableMultiSelectInstanceId);
|
|
124
134
|
var labelId = "".concat(id, "-label");
|
|
125
135
|
var titleClasses = cx__default["default"]((_cx2 = {}, _rollupPluginBabelHelpers.defineProperty(_cx2, "".concat(prefix, "--label"), true), _rollupPluginBabelHelpers.defineProperty(_cx2, "".concat(prefix, "--label--disabled"), disabled), _rollupPluginBabelHelpers.defineProperty(_cx2, "".concat(prefix, "--visually-hidden"), hideLabel), _cx2));
|
|
@@ -309,11 +319,22 @@ var FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(fu
|
|
|
309
319
|
}, {
|
|
310
320
|
suppressRefError: true
|
|
311
321
|
});
|
|
322
|
+
|
|
323
|
+
var handleFocus = function handleFocus(evt) {
|
|
324
|
+
if (evt.target.classList.contains("".concat(prefix, "--tag__close-icon")) || evt.target.classList.contains("".concat(prefix, "--list-box__selection"))) {
|
|
325
|
+
setIsFocused(false);
|
|
326
|
+
} else {
|
|
327
|
+
setIsFocused(evt.type === 'focus' ? true : false);
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
|
|
312
331
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
313
332
|
className: wrapperClasses
|
|
314
333
|
}, titleText ? /*#__PURE__*/React__default["default"].createElement("label", _rollupPluginBabelHelpers["extends"]({
|
|
315
334
|
className: titleClasses
|
|
316
335
|
}, labelProps), titleText) : null, /*#__PURE__*/React__default["default"].createElement(ListBox["default"], {
|
|
336
|
+
onFocus: isFluid ? handleFocus : null,
|
|
337
|
+
onBlur: isFluid ? handleFocus : null,
|
|
317
338
|
className: className,
|
|
318
339
|
disabled: disabled,
|
|
319
340
|
light: light,
|
|
@@ -471,7 +492,7 @@ FilterableMultiSelect.propTypes = _rollupPluginBabelHelpers.objectSpread2(_rollu
|
|
|
471
492
|
/**
|
|
472
493
|
* `true` to use the light version.
|
|
473
494
|
*/
|
|
474
|
-
light: PropTypes__default["default"].bool,
|
|
495
|
+
light: deprecate["default"](PropTypes__default["default"].bool, 'The `light` prop for `FilterableMultiSelect` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
|
|
475
496
|
|
|
476
497
|
/**
|
|
477
498
|
* Specify the locale of the control. Used for the default `compareItems`
|
|
@@ -551,7 +572,6 @@ FilterableMultiSelect.defaultProps = {
|
|
|
551
572
|
itemToString: itemToString.defaultItemToString,
|
|
552
573
|
locale: 'en',
|
|
553
574
|
sortItems: sorting.defaultSortItems,
|
|
554
|
-
light: false,
|
|
555
575
|
open: false,
|
|
556
576
|
selectionFeedback: 'top-after-reopen'
|
|
557
577
|
};
|
|
@@ -23,8 +23,10 @@ var sorting = require('./tools/sorting.js');
|
|
|
23
23
|
var Selection = require('../../internal/Selection.js');
|
|
24
24
|
var setupGetInstanceId = require('../../tools/setupGetInstanceId.js');
|
|
25
25
|
var mergeRefs = require('../../tools/mergeRefs.js');
|
|
26
|
+
var deprecate = require('../../prop-types/deprecate.js');
|
|
26
27
|
var index = require('../FeatureFlags/index.js');
|
|
27
28
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
29
|
+
var FormContext = require('../FluidForm/FormContext.js');
|
|
28
30
|
var match = require('../../internal/keyboard/match.js');
|
|
29
31
|
var ListBox = require('../ListBox/ListBox.js');
|
|
30
32
|
var ListBoxPropTypes = require('../ListBox/ListBoxPropTypes.js');
|
|
@@ -86,6 +88,9 @@ var MultiSelect = /*#__PURE__*/React__default["default"].forwardRef(function Mul
|
|
|
86
88
|
selected = _ref.selectedItems;
|
|
87
89
|
var prefix = usePrefix.usePrefix();
|
|
88
90
|
|
|
91
|
+
var _useContext = React.useContext(FormContext.FormContext),
|
|
92
|
+
isFluid = _useContext.isFluid;
|
|
93
|
+
|
|
89
94
|
var _useRef = React.useRef(getInstanceId()),
|
|
90
95
|
multiSelectInstanceId = _useRef.current;
|
|
91
96
|
|
|
@@ -94,20 +99,25 @@ var MultiSelect = /*#__PURE__*/React__default["default"].forwardRef(function Mul
|
|
|
94
99
|
highlightedIndex = _useState2[0],
|
|
95
100
|
setHighlightedIndex = _useState2[1];
|
|
96
101
|
|
|
97
|
-
var _useState3 = React.useState(
|
|
102
|
+
var _useState3 = React.useState(false),
|
|
98
103
|
_useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
|
|
99
|
-
|
|
100
|
-
|
|
104
|
+
isFocused = _useState4[0],
|
|
105
|
+
setIsFocused = _useState4[1];
|
|
101
106
|
|
|
102
107
|
var _useState5 = React.useState(open),
|
|
103
108
|
_useState6 = _rollupPluginBabelHelpers.slicedToArray(_useState5, 2),
|
|
104
|
-
|
|
105
|
-
|
|
109
|
+
isOpen = _useState6[0],
|
|
110
|
+
setIsOpen = _useState6[1];
|
|
106
111
|
|
|
107
|
-
var _useState7 = React.useState(
|
|
112
|
+
var _useState7 = React.useState(open),
|
|
108
113
|
_useState8 = _rollupPluginBabelHelpers.slicedToArray(_useState7, 2),
|
|
109
|
-
|
|
110
|
-
|
|
114
|
+
prevOpenProp = _useState8[0],
|
|
115
|
+
setPrevOpenProp = _useState8[1];
|
|
116
|
+
|
|
117
|
+
var _useState9 = React.useState([]),
|
|
118
|
+
_useState10 = _rollupPluginBabelHelpers.slicedToArray(_useState9, 2),
|
|
119
|
+
topItems = _useState10[0],
|
|
120
|
+
setTopItems = _useState10[1];
|
|
111
121
|
|
|
112
122
|
var _useSelection = Selection.useSelection({
|
|
113
123
|
disabled: disabled,
|
|
@@ -161,7 +171,7 @@ var MultiSelect = /*#__PURE__*/React__default["default"].forwardRef(function Mul
|
|
|
161
171
|
var inline = type === 'inline';
|
|
162
172
|
var showWarning = !invalid && warn;
|
|
163
173
|
var enabled = index.useFeatureFlag('enable-v11-release');
|
|
164
|
-
var wrapperClasses = cx__default["default"]("".concat(prefix, "--multi-select__wrapper"), "".concat(prefix, "--list-box__wrapper"), [enabled ? containerClassName : null], (_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--multi-select__wrapper--inline"), inline), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--inline"), inline), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--multi-select__wrapper--inline--invalid"), inline && invalid), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--inline--invalid"), inline && invalid), _cx));
|
|
174
|
+
var wrapperClasses = cx__default["default"]("".concat(prefix, "--multi-select__wrapper"), "".concat(prefix, "--list-box__wrapper"), [enabled ? containerClassName : null], (_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--multi-select__wrapper--inline"), inline), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--inline"), inline), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--multi-select__wrapper--inline--invalid"), inline && invalid), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--inline--invalid"), inline && invalid), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--fluid--invalid"), isFluid && invalid), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--fluid--focus"), !isOpen && isFluid && isFocused), _cx));
|
|
165
175
|
var titleClasses = cx__default["default"]("".concat(prefix, "--label"), (_cx2 = {}, _rollupPluginBabelHelpers.defineProperty(_cx2, "".concat(prefix, "--label--disabled"), disabled), _rollupPluginBabelHelpers.defineProperty(_cx2, "".concat(prefix, "--visually-hidden"), hideLabel), _cx2));
|
|
166
176
|
var helperId = !helperText ? undefined : "multiselect-helper-text-".concat(multiSelectInstanceId);
|
|
167
177
|
var fieldLabelId = "multiselect-field-label-".concat(multiSelectInstanceId);
|
|
@@ -226,6 +236,11 @@ var MultiSelect = /*#__PURE__*/React__default["default"].forwardRef(function Mul
|
|
|
226
236
|
};
|
|
227
237
|
|
|
228
238
|
var toggleButtonProps = getToggleButtonProps();
|
|
239
|
+
|
|
240
|
+
var handleFocus = function handleFocus(evt) {
|
|
241
|
+
evt.target.classList.contains("".concat(prefix, "--tag__close-icon")) ? setIsFocused(false) : setIsFocused(evt.type === 'focus' ? true : false);
|
|
242
|
+
};
|
|
243
|
+
|
|
229
244
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
230
245
|
className: wrapperClasses
|
|
231
246
|
}, /*#__PURE__*/React__default["default"].createElement("label", _rollupPluginBabelHelpers["extends"]({
|
|
@@ -233,6 +248,8 @@ var MultiSelect = /*#__PURE__*/React__default["default"].forwardRef(function Mul
|
|
|
233
248
|
}, getLabelProps()), titleText && titleText, selectedItems.length > 0 && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
234
249
|
className: "".concat(prefix, "--visually-hidden")
|
|
235
250
|
}, clearSelectionDescription, " ", selectedItems.length, ",", clearSelectionText)), /*#__PURE__*/React__default["default"].createElement(ListBox["default"], {
|
|
251
|
+
onFocus: isFluid ? handleFocus : null,
|
|
252
|
+
onBlur: isFluid ? handleFocus : null,
|
|
236
253
|
type: type,
|
|
237
254
|
size: size,
|
|
238
255
|
className: className,
|
|
@@ -383,7 +400,7 @@ MultiSelect.propTypes = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBab
|
|
|
383
400
|
/**
|
|
384
401
|
* `true` to use the light version.
|
|
385
402
|
*/
|
|
386
|
-
light: PropTypes__default["default"].bool,
|
|
403
|
+
light: deprecate["default"](PropTypes__default["default"].bool, 'The `light` prop for `MultiSelect` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
|
|
387
404
|
|
|
388
405
|
/**
|
|
389
406
|
* Specify the locale of the control. Used for the default `compareItems`
|
|
@@ -465,7 +482,6 @@ MultiSelect.defaultProps = {
|
|
|
465
482
|
initialSelectedItems: [],
|
|
466
483
|
sortItems: sorting.defaultSortItems,
|
|
467
484
|
type: 'default',
|
|
468
|
-
light: false,
|
|
469
485
|
title: false,
|
|
470
486
|
open: false,
|
|
471
487
|
selectionFeedback: 'top-after-reopen',
|
|
@@ -526,8 +526,8 @@ _rollupPluginBabelHelpers.defineProperty(OverflowMenu, "propTypes", {
|
|
|
526
526
|
_rollupPluginBabelHelpers.defineProperty(OverflowMenu, "contextType", usePrefix.PrefixContext);
|
|
527
527
|
|
|
528
528
|
_rollupPluginBabelHelpers.defineProperty(OverflowMenu, "defaultProps", {
|
|
529
|
-
ariaLabel: FeatureFlags__namespace.enabled('enable-v11-release') ? null : '
|
|
530
|
-
iconDescription: '
|
|
529
|
+
ariaLabel: FeatureFlags__namespace.enabled('enable-v11-release') ? null : 'Open and close list of options',
|
|
530
|
+
iconDescription: 'Open and close list of options',
|
|
531
531
|
open: false,
|
|
532
532
|
direction: FloatingMenu.DIRECTION_BOTTOM,
|
|
533
533
|
flipped: false,
|