@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,151 @@
|
|
|
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 { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
import React__default from 'react';
|
|
11
|
+
import cx from 'classnames';
|
|
12
|
+
import '../MultiSelect/index.js';
|
|
13
|
+
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
|
+
import { FormContext } from '../FluidForm/FormContext.js';
|
|
15
|
+
import FilterableMultiSelect from '../MultiSelect/FilterableMultiSelect.js';
|
|
16
|
+
import MultiSelect from '../MultiSelect/MultiSelect.js';
|
|
17
|
+
|
|
18
|
+
var _excluded = ["className", "isCondensed", "isFilterable"];
|
|
19
|
+
var FluidMultiSelect = /*#__PURE__*/React__default.forwardRef(function FluidMultiSelect(_ref, ref) {
|
|
20
|
+
var className = _ref.className,
|
|
21
|
+
isCondensed = _ref.isCondensed,
|
|
22
|
+
isFilterable = _ref.isFilterable,
|
|
23
|
+
other = _objectWithoutProperties(_ref, _excluded);
|
|
24
|
+
|
|
25
|
+
var prefix = usePrefix();
|
|
26
|
+
var classNames = cx("".concat(prefix, "--list-box__wrapper--fluid"), className, _defineProperty({}, "".concat(prefix, "--list-box__wrapper--fluid--condensed"), isCondensed));
|
|
27
|
+
return /*#__PURE__*/React__default.createElement(FormContext.Provider, {
|
|
28
|
+
value: {
|
|
29
|
+
isFluid: true
|
|
30
|
+
}
|
|
31
|
+
}, isFilterable ? /*#__PURE__*/React__default.createElement(FilterableMultiSelect, _extends({
|
|
32
|
+
ref: ref,
|
|
33
|
+
className: classNames
|
|
34
|
+
}, other)) : /*#__PURE__*/React__default.createElement(MultiSelect, _extends({
|
|
35
|
+
ref: ref,
|
|
36
|
+
className: classNames
|
|
37
|
+
}, other)));
|
|
38
|
+
});
|
|
39
|
+
FluidMultiSelect.propTypes = {
|
|
40
|
+
/**
|
|
41
|
+
* Specify an optional className to be applied to the outer FluidForm wrapper
|
|
42
|
+
*/
|
|
43
|
+
className: PropTypes.string,
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Specify the direction of the dropdown. Can be either top or bottom.
|
|
47
|
+
*/
|
|
48
|
+
direction: PropTypes.oneOf(['top', 'bottom']),
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Specify whether the `<input>` should be disabled
|
|
52
|
+
*/
|
|
53
|
+
disabled: PropTypes.bool,
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Specify a custom `id` for the `<input>`
|
|
57
|
+
*/
|
|
58
|
+
id: PropTypes.string.isRequired,
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Allow users to pass in an arbitrary item or a string (in case their items are an array of strings)
|
|
62
|
+
* from their collection that are pre-selected
|
|
63
|
+
*/
|
|
64
|
+
initialSelectedItem: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.number]),
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Specify if the currently selected value is invalid.
|
|
68
|
+
*/
|
|
69
|
+
invalid: PropTypes.bool,
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Provide the text that is displayed when the control is in an invalid state
|
|
73
|
+
*/
|
|
74
|
+
invalidText: PropTypes.node,
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Specify if the `FluidMultiSelect` should render its menu items in condensed mode
|
|
78
|
+
*/
|
|
79
|
+
isCondensed: PropTypes.bool,
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Specify if the `FluidMultiSelect` should render the `filterable` variant of `FluidMultiSelect`
|
|
83
|
+
*/
|
|
84
|
+
isFilterable: PropTypes.bool,
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Function to render items as custom components instead of strings.
|
|
88
|
+
* Defaults to null and is overridden by a getter
|
|
89
|
+
*/
|
|
90
|
+
itemToElement: PropTypes.func,
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Helper function passed to downshift that allows the library to render a
|
|
94
|
+
* given item to a string label. By default, it extracts the `label` field
|
|
95
|
+
* from a given item to serve as the item label in the list.
|
|
96
|
+
*/
|
|
97
|
+
itemToString: PropTypes.func,
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* We try to stay as generic as possible here to allow individuals to pass
|
|
101
|
+
* in a collection of whatever kind of data structure they prefer
|
|
102
|
+
*/
|
|
103
|
+
items: PropTypes.array.isRequired,
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Generic `label` that will be used as the textual representation of what
|
|
107
|
+
* this field is for
|
|
108
|
+
*/
|
|
109
|
+
label: PropTypes.node.isRequired,
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* `onChange` is a utility for this controlled component to communicate to a
|
|
113
|
+
* consuming component what kind of internal state changes are occurring.
|
|
114
|
+
*/
|
|
115
|
+
onChange: PropTypes.func,
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* An optional callback to render the currently selected item as a react element instead of only
|
|
119
|
+
* as a string.
|
|
120
|
+
*/
|
|
121
|
+
renderSelectedItem: PropTypes.func,
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* In the case you want to control the dropdown selection entirely.
|
|
125
|
+
*/
|
|
126
|
+
selectedItem: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.number]),
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Provide the title text that will be read by a screen reader when
|
|
130
|
+
* visiting this control
|
|
131
|
+
*/
|
|
132
|
+
titleText: PropTypes.node,
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Callback function for translating ListBoxMenuIcon SVG title
|
|
136
|
+
*/
|
|
137
|
+
translateWithId: PropTypes.func,
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Specify whether the control is currently in warning state
|
|
141
|
+
*/
|
|
142
|
+
warn: PropTypes.bool,
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Provide the text that is displayed when the control is in warning state
|
|
146
|
+
*/
|
|
147
|
+
warnText: PropTypes.node
|
|
148
|
+
};
|
|
149
|
+
var FluidMultiSelect$1 = FluidMultiSelect;
|
|
150
|
+
|
|
151
|
+
export { FluidMultiSelect$1 as default };
|
|
@@ -0,0 +1,41 @@
|
|
|
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 { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
import React__default from 'react';
|
|
11
|
+
import cx from 'classnames';
|
|
12
|
+
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
|
+
|
|
14
|
+
var _excluded = ["className"];
|
|
15
|
+
|
|
16
|
+
var FluidSelectSkeleton = function FluidSelectSkeleton(_ref) {
|
|
17
|
+
var className = _ref.className,
|
|
18
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
+
|
|
20
|
+
var prefix = usePrefix();
|
|
21
|
+
var wrapperClasses = cx(className, "".concat(prefix, "--skeleton"), "".concat(prefix, "--list-box"));
|
|
22
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
23
|
+
className: "".concat(prefix, "--list-box__wrapper--fluid")
|
|
24
|
+
}, /*#__PURE__*/React__default.createElement("div", _extends({
|
|
25
|
+
className: wrapperClasses
|
|
26
|
+
}, rest), /*#__PURE__*/React__default.createElement("span", {
|
|
27
|
+
className: "".concat(prefix, "--list-box__label")
|
|
28
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
29
|
+
className: "".concat(prefix, "--list-box__field")
|
|
30
|
+
})));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
FluidSelectSkeleton.propTypes = {
|
|
34
|
+
/**
|
|
35
|
+
* Specify an optional className to add.
|
|
36
|
+
*/
|
|
37
|
+
className: PropTypes.string
|
|
38
|
+
};
|
|
39
|
+
var FluidSelectSkeleton$1 = FluidSelectSkeleton;
|
|
40
|
+
|
|
41
|
+
export { FluidSelectSkeleton$1 as default };
|
|
@@ -0,0 +1,93 @@
|
|
|
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 { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
import React__default from 'react';
|
|
11
|
+
import cx from 'classnames';
|
|
12
|
+
import Select from '../Select/Select.js';
|
|
13
|
+
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
|
+
import { FormContext } from '../FluidForm/FormContext.js';
|
|
15
|
+
|
|
16
|
+
var _excluded = ["className", "children"];
|
|
17
|
+
var FluidSelect = /*#__PURE__*/React__default.forwardRef(function FluidSelect(_ref, ref) {
|
|
18
|
+
var className = _ref.className,
|
|
19
|
+
children = _ref.children,
|
|
20
|
+
other = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
+
|
|
22
|
+
var prefix = usePrefix();
|
|
23
|
+
var classNames = cx("".concat(prefix, "--select--fluid"), className);
|
|
24
|
+
return /*#__PURE__*/React__default.createElement(FormContext.Provider, {
|
|
25
|
+
value: {
|
|
26
|
+
isFluid: true
|
|
27
|
+
}
|
|
28
|
+
}, /*#__PURE__*/React__default.createElement(Select, _extends({
|
|
29
|
+
ref: ref,
|
|
30
|
+
className: classNames
|
|
31
|
+
}, other), children));
|
|
32
|
+
});
|
|
33
|
+
FluidSelect.propTypes = {
|
|
34
|
+
/**
|
|
35
|
+
* Provide the contents of your Select
|
|
36
|
+
*/
|
|
37
|
+
children: PropTypes.node,
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Specify an optional className to be applied to the node containing the label and the select box
|
|
41
|
+
*/
|
|
42
|
+
className: PropTypes.string,
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Optionally provide the default value of the `<select>`
|
|
46
|
+
*/
|
|
47
|
+
defaultValue: PropTypes.any,
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Specify whether the control is disabled
|
|
51
|
+
*/
|
|
52
|
+
disabled: PropTypes.bool,
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Specify a custom `id` for the `<select>`
|
|
56
|
+
*/
|
|
57
|
+
id: PropTypes.string.isRequired,
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Specify if the currently value is invalid.
|
|
61
|
+
*/
|
|
62
|
+
invalid: PropTypes.bool,
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Message which is displayed if the value is invalid.
|
|
66
|
+
*/
|
|
67
|
+
invalidText: PropTypes.node,
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Provide label text to be read by screen readers when interacting with the
|
|
71
|
+
* control
|
|
72
|
+
*/
|
|
73
|
+
labelText: PropTypes.node,
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Provide an optional `onChange` hook that is called each time the value of
|
|
77
|
+
* the underlying `<input>` changes
|
|
78
|
+
*/
|
|
79
|
+
onChange: PropTypes.func,
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Specify whether the control is currently in warning state
|
|
83
|
+
*/
|
|
84
|
+
warn: PropTypes.bool,
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Provide the text that is displayed when the control is in warning state
|
|
88
|
+
*/
|
|
89
|
+
warnText: PropTypes.node
|
|
90
|
+
};
|
|
91
|
+
var FluidSelect$1 = FluidSelect;
|
|
92
|
+
|
|
93
|
+
export { FluidSelect$1 as default };
|
|
@@ -10,6 +10,7 @@ import PropTypes from 'prop-types';
|
|
|
10
10
|
import React__default from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import TextArea from '../TextArea/TextArea.js';
|
|
13
|
+
import deprecate from '../../prop-types/deprecate.js';
|
|
13
14
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
15
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
15
16
|
|
|
@@ -92,7 +93,7 @@ FluidTextArea.propTypes = {
|
|
|
92
93
|
* `true` to use the light version. For use on $ui-01 backgrounds only.
|
|
93
94
|
* Don't use this to make tile background color same as container background color.
|
|
94
95
|
*/
|
|
95
|
-
light: PropTypes.bool,
|
|
96
|
+
light: deprecate(PropTypes.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.'),
|
|
96
97
|
|
|
97
98
|
/**
|
|
98
99
|
* Max character count allowed for the textarea. This is needed in order for enableCounter to display
|
|
@@ -21,7 +21,8 @@ function InlineLoading(_ref) {
|
|
|
21
21
|
iconDescription = _ref.iconDescription,
|
|
22
22
|
description = _ref.description,
|
|
23
23
|
onSuccess = _ref.onSuccess,
|
|
24
|
-
successDelay = _ref.successDelay,
|
|
24
|
+
_ref$successDelay = _ref.successDelay,
|
|
25
|
+
successDelay = _ref$successDelay === void 0 ? 1500 : _ref$successDelay,
|
|
25
26
|
other = _objectWithoutProperties(_ref, _excluded);
|
|
26
27
|
|
|
27
28
|
var prefix = usePrefix();
|
|
@@ -108,8 +109,5 @@ InlineLoading.propTypes = {
|
|
|
108
109
|
*/
|
|
109
110
|
successDelay: PropTypes.number
|
|
110
111
|
};
|
|
111
|
-
InlineLoading.defaultProps = {
|
|
112
|
-
successDelay: 1500
|
|
113
|
-
};
|
|
114
112
|
|
|
115
113
|
export { InlineLoading as default };
|
|
@@ -9,6 +9,7 @@ import { objectWithoutProperties as _objectWithoutProperties, defineProperty as
|
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import React__default, { useContext } from 'react';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
|
+
import deprecate from '../../prop-types/deprecate.js';
|
|
12
13
|
import { ListBoxSize, ListBoxType } from './ListBoxPropTypes.js';
|
|
13
14
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
15
|
import ListBoxField from './ListBoxField.js';
|
|
@@ -109,7 +110,7 @@ ListBox.propTypes = {
|
|
|
109
110
|
* `true` to use the light version. For use on $ui-01 backgrounds only.
|
|
110
111
|
* Don't use this to make tile background color same as container background color.
|
|
111
112
|
*/
|
|
112
|
-
light: PropTypes.bool,
|
|
113
|
+
light: deprecate(PropTypes.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.'),
|
|
113
114
|
|
|
114
115
|
/**
|
|
115
116
|
* Specify the size of the ListBox. Currently supports either `sm`, `md` or `lg` as an option.
|
|
@@ -11,8 +11,10 @@ import React__default from 'react';
|
|
|
11
11
|
import Modal from '../Modal/Modal.js';
|
|
12
12
|
import Button from '../Button/Button.js';
|
|
13
13
|
import { ButtonKinds } from '../../prop-types/types.js';
|
|
14
|
+
import { warning } from '../../internal/warning.js';
|
|
14
15
|
|
|
15
16
|
var _excluded = ["children", "onKeyDown", "buttonTriggerText", "buttonTriggerClassName", "renderTriggerButtonIcon", "triggerButtonIconDescription", "triggerButtonKind", "disabled", "handleSubmit", "shouldCloseAfterSubmit", "selectorPrimaryFocus", "preventCloseOnClickOutside"];
|
|
17
|
+
var didWarnAboutDeprecation = false;
|
|
16
18
|
|
|
17
19
|
var ModalWrapper = /*#__PURE__*/function (_React$Component) {
|
|
18
20
|
_inherits(ModalWrapper, _React$Component);
|
|
@@ -76,6 +78,12 @@ var ModalWrapper = /*#__PURE__*/function (_React$Component) {
|
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
_createClass(ModalWrapper, [{
|
|
81
|
+
key: "if",
|
|
82
|
+
value: function _if(__DEV__) {
|
|
83
|
+
process.env.NODE_ENV !== "production" ? 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;
|
|
84
|
+
didWarnAboutDeprecation = true;
|
|
85
|
+
}
|
|
86
|
+
}, {
|
|
79
87
|
key: "render",
|
|
80
88
|
value: function render() {
|
|
81
89
|
var _this2 = this;
|
|
@@ -11,17 +11,19 @@ import cx from 'classnames';
|
|
|
11
11
|
import Downshift from 'downshift';
|
|
12
12
|
import isEqual from 'lodash.isequal';
|
|
13
13
|
import PropTypes from 'prop-types';
|
|
14
|
-
import React__default, { useState, useRef } from 'react';
|
|
14
|
+
import React__default, { useContext, useState, useRef } from 'react';
|
|
15
15
|
import { defaultFilterItems } from '../ComboBox/tools/filter.js';
|
|
16
16
|
import { sortingPropTypes } from './MultiSelectPropTypes.js';
|
|
17
17
|
import '../ListBox/index.js';
|
|
18
18
|
import Selection from '../../internal/Selection.js';
|
|
19
19
|
import { defaultItemToString } from './tools/itemToString.js';
|
|
20
20
|
import mergeRefs from '../../tools/mergeRefs.js';
|
|
21
|
+
import deprecate from '../../prop-types/deprecate.js';
|
|
21
22
|
import { useId } from '../../internal/useId.js';
|
|
22
23
|
import { defaultCompareItems, defaultSortItems } from './tools/sorting.js';
|
|
23
24
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
24
25
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
26
|
+
import { FormContext } from '../FluidForm/FormContext.js';
|
|
25
27
|
import { match } from '../../internal/keyboard/match.js';
|
|
26
28
|
import ListBoxSelection from '../ListBox/next/ListBoxSelection.js';
|
|
27
29
|
import ListBoxTrigger from '../ListBox/next/ListBoxTrigger.js';
|
|
@@ -65,35 +67,43 @@ var FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function Filt
|
|
|
65
67
|
warn = _ref.warn,
|
|
66
68
|
warnText = _ref.warnText;
|
|
67
69
|
|
|
68
|
-
var
|
|
70
|
+
var _useContext = useContext(FormContext),
|
|
71
|
+
isFluid = _useContext.isFluid;
|
|
72
|
+
|
|
73
|
+
var _useState = useState(false),
|
|
69
74
|
_useState2 = _slicedToArray(_useState, 2),
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
isFocused = _useState2[0],
|
|
76
|
+
setIsFocused = _useState2[1];
|
|
72
77
|
|
|
73
78
|
var _useState3 = useState(open),
|
|
74
79
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
75
|
-
|
|
76
|
-
|
|
80
|
+
isOpen = _useState4[0],
|
|
81
|
+
setIsOpen = _useState4[1];
|
|
77
82
|
|
|
78
|
-
var _useState5 = useState(
|
|
83
|
+
var _useState5 = useState(open),
|
|
79
84
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
80
|
-
|
|
81
|
-
|
|
85
|
+
prevOpen = _useState6[0],
|
|
86
|
+
setPrevOpen = _useState6[1];
|
|
82
87
|
|
|
83
|
-
var _useState7 = useState(
|
|
88
|
+
var _useState7 = useState(''),
|
|
84
89
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
85
|
-
|
|
86
|
-
|
|
90
|
+
inputValue = _useState8[0],
|
|
91
|
+
setInputValue = _useState8[1];
|
|
87
92
|
|
|
88
|
-
var _useState9 = useState(
|
|
93
|
+
var _useState9 = useState([]),
|
|
89
94
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
90
|
-
|
|
91
|
-
|
|
95
|
+
topItems = _useState10[0],
|
|
96
|
+
setTopItems = _useState10[1];
|
|
92
97
|
|
|
93
|
-
var _useState11 = useState(
|
|
98
|
+
var _useState11 = useState(false),
|
|
94
99
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
95
|
-
|
|
96
|
-
|
|
100
|
+
inputFocused = _useState12[0],
|
|
101
|
+
setInputFocused = _useState12[1];
|
|
102
|
+
|
|
103
|
+
var _useState13 = useState(null),
|
|
104
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
105
|
+
highlightedIndex = _useState14[0],
|
|
106
|
+
setHighlightedIndex = _useState14[1];
|
|
97
107
|
|
|
98
108
|
var textInput = useRef();
|
|
99
109
|
var filterableMultiSelectInstanceId = useId();
|
|
@@ -107,7 +117,7 @@ var FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function Filt
|
|
|
107
117
|
|
|
108
118
|
var inline = type === 'inline';
|
|
109
119
|
var showWarning = !invalid && warn;
|
|
110
|
-
var wrapperClasses = cx("".concat(prefix, "--multi-select__wrapper"), "".concat(prefix, "--list-box__wrapper"), [enabled ? containerClassName : null], (_cx = {}, _defineProperty(_cx, "".concat(prefix, "--multi-select__wrapper--inline"), inline), _defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--inline"), inline), _defineProperty(_cx, "".concat(prefix, "--multi-select__wrapper--inline--invalid"), inline && invalid), _defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--inline--invalid"), inline && invalid), _defineProperty(_cx, "".concat(prefix, "--list-box--up"), direction === 'top'), _cx));
|
|
120
|
+
var wrapperClasses = cx("".concat(prefix, "--multi-select__wrapper"), "".concat(prefix, "--list-box__wrapper"), [enabled ? containerClassName : null], (_cx = {}, _defineProperty(_cx, "".concat(prefix, "--multi-select__wrapper--inline"), inline), _defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--inline"), inline), _defineProperty(_cx, "".concat(prefix, "--multi-select__wrapper--inline--invalid"), inline && invalid), _defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--inline--invalid"), inline && invalid), _defineProperty(_cx, "".concat(prefix, "--list-box--up"), direction === 'top'), _defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--fluid--invalid"), isFluid && invalid), _defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--fluid--focus"), isFluid && isFocused), _cx));
|
|
111
121
|
var helperId = !helperText ? undefined : "filterablemultiselect-helper-text-".concat(filterableMultiSelectInstanceId);
|
|
112
122
|
var labelId = "".concat(id, "-label");
|
|
113
123
|
var titleClasses = cx((_cx2 = {}, _defineProperty(_cx2, "".concat(prefix, "--label"), true), _defineProperty(_cx2, "".concat(prefix, "--label--disabled"), disabled), _defineProperty(_cx2, "".concat(prefix, "--visually-hidden"), hideLabel), _cx2));
|
|
@@ -297,11 +307,22 @@ var FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function Filt
|
|
|
297
307
|
}, {
|
|
298
308
|
suppressRefError: true
|
|
299
309
|
});
|
|
310
|
+
|
|
311
|
+
var handleFocus = function handleFocus(evt) {
|
|
312
|
+
if (evt.target.classList.contains("".concat(prefix, "--tag__close-icon")) || evt.target.classList.contains("".concat(prefix, "--list-box__selection"))) {
|
|
313
|
+
setIsFocused(false);
|
|
314
|
+
} else {
|
|
315
|
+
setIsFocused(evt.type === 'focus' ? true : false);
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
|
|
300
319
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
301
320
|
className: wrapperClasses
|
|
302
321
|
}, titleText ? /*#__PURE__*/React__default.createElement("label", _extends({
|
|
303
322
|
className: titleClasses
|
|
304
323
|
}, labelProps), titleText) : null, /*#__PURE__*/React__default.createElement(ListBox, {
|
|
324
|
+
onFocus: isFluid ? handleFocus : null,
|
|
325
|
+
onBlur: isFluid ? handleFocus : null,
|
|
305
326
|
className: className,
|
|
306
327
|
disabled: disabled,
|
|
307
328
|
light: light,
|
|
@@ -459,7 +480,7 @@ FilterableMultiSelect.propTypes = _objectSpread2(_objectSpread2({
|
|
|
459
480
|
/**
|
|
460
481
|
* `true` to use the light version.
|
|
461
482
|
*/
|
|
462
|
-
light: PropTypes.bool,
|
|
483
|
+
light: deprecate(PropTypes.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.'),
|
|
463
484
|
|
|
464
485
|
/**
|
|
465
486
|
* Specify the locale of the control. Used for the default `compareItems`
|
|
@@ -539,7 +560,6 @@ FilterableMultiSelect.defaultProps = {
|
|
|
539
560
|
itemToString: defaultItemToString,
|
|
540
561
|
locale: 'en',
|
|
541
562
|
sortItems: defaultSortItems,
|
|
542
|
-
light: false,
|
|
543
563
|
open: false,
|
|
544
564
|
selectionFeedback: 'top-after-reopen'
|
|
545
565
|
};
|
|
@@ -11,7 +11,7 @@ import cx from 'classnames';
|
|
|
11
11
|
import Downshift, { useSelect } from 'downshift';
|
|
12
12
|
import isEqual from 'lodash.isequal';
|
|
13
13
|
import PropTypes from 'prop-types';
|
|
14
|
-
import React__default, { useRef, useState } from 'react';
|
|
14
|
+
import React__default, { useContext, useRef, useState } from 'react';
|
|
15
15
|
import '../ListBox/index.js';
|
|
16
16
|
import { sortingPropTypes } from './MultiSelectPropTypes.js';
|
|
17
17
|
import { defaultItemToString } from './tools/itemToString.js';
|
|
@@ -19,8 +19,10 @@ import { defaultCompareItems, defaultSortItems } from './tools/sorting.js';
|
|
|
19
19
|
import { useSelection } from '../../internal/Selection.js';
|
|
20
20
|
import setupGetInstanceId from '../../tools/setupGetInstanceId.js';
|
|
21
21
|
import mergeRefs from '../../tools/mergeRefs.js';
|
|
22
|
+
import deprecate from '../../prop-types/deprecate.js';
|
|
22
23
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
23
24
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
25
|
+
import { FormContext } from '../FluidForm/FormContext.js';
|
|
24
26
|
import { match } from '../../internal/keyboard/match.js';
|
|
25
27
|
import ListBox from '../ListBox/ListBox.js';
|
|
26
28
|
import { ListBoxSize } from '../ListBox/ListBoxPropTypes.js';
|
|
@@ -74,6 +76,9 @@ var MultiSelect = /*#__PURE__*/React__default.forwardRef(function MultiSelect(_r
|
|
|
74
76
|
selected = _ref.selectedItems;
|
|
75
77
|
var prefix = usePrefix();
|
|
76
78
|
|
|
79
|
+
var _useContext = useContext(FormContext),
|
|
80
|
+
isFluid = _useContext.isFluid;
|
|
81
|
+
|
|
77
82
|
var _useRef = useRef(getInstanceId()),
|
|
78
83
|
multiSelectInstanceId = _useRef.current;
|
|
79
84
|
|
|
@@ -82,20 +87,25 @@ var MultiSelect = /*#__PURE__*/React__default.forwardRef(function MultiSelect(_r
|
|
|
82
87
|
highlightedIndex = _useState2[0],
|
|
83
88
|
setHighlightedIndex = _useState2[1];
|
|
84
89
|
|
|
85
|
-
var _useState3 = useState(
|
|
90
|
+
var _useState3 = useState(false),
|
|
86
91
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
87
|
-
|
|
88
|
-
|
|
92
|
+
isFocused = _useState4[0],
|
|
93
|
+
setIsFocused = _useState4[1];
|
|
89
94
|
|
|
90
95
|
var _useState5 = useState(open),
|
|
91
96
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
92
|
-
|
|
93
|
-
|
|
97
|
+
isOpen = _useState6[0],
|
|
98
|
+
setIsOpen = _useState6[1];
|
|
94
99
|
|
|
95
|
-
var _useState7 = useState(
|
|
100
|
+
var _useState7 = useState(open),
|
|
96
101
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
97
|
-
|
|
98
|
-
|
|
102
|
+
prevOpenProp = _useState8[0],
|
|
103
|
+
setPrevOpenProp = _useState8[1];
|
|
104
|
+
|
|
105
|
+
var _useState9 = useState([]),
|
|
106
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
107
|
+
topItems = _useState10[0],
|
|
108
|
+
setTopItems = _useState10[1];
|
|
99
109
|
|
|
100
110
|
var _useSelection = useSelection({
|
|
101
111
|
disabled: disabled,
|
|
@@ -149,7 +159,7 @@ var MultiSelect = /*#__PURE__*/React__default.forwardRef(function MultiSelect(_r
|
|
|
149
159
|
var inline = type === 'inline';
|
|
150
160
|
var showWarning = !invalid && warn;
|
|
151
161
|
var enabled = useFeatureFlag('enable-v11-release');
|
|
152
|
-
var wrapperClasses = cx("".concat(prefix, "--multi-select__wrapper"), "".concat(prefix, "--list-box__wrapper"), [enabled ? containerClassName : null], (_cx = {}, _defineProperty(_cx, "".concat(prefix, "--multi-select__wrapper--inline"), inline), _defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--inline"), inline), _defineProperty(_cx, "".concat(prefix, "--multi-select__wrapper--inline--invalid"), inline && invalid), _defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--inline--invalid"), inline && invalid), _cx));
|
|
162
|
+
var wrapperClasses = cx("".concat(prefix, "--multi-select__wrapper"), "".concat(prefix, "--list-box__wrapper"), [enabled ? containerClassName : null], (_cx = {}, _defineProperty(_cx, "".concat(prefix, "--multi-select__wrapper--inline"), inline), _defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--inline"), inline), _defineProperty(_cx, "".concat(prefix, "--multi-select__wrapper--inline--invalid"), inline && invalid), _defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--inline--invalid"), inline && invalid), _defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--fluid--invalid"), isFluid && invalid), _defineProperty(_cx, "".concat(prefix, "--list-box__wrapper--fluid--focus"), !isOpen && isFluid && isFocused), _cx));
|
|
153
163
|
var titleClasses = cx("".concat(prefix, "--label"), (_cx2 = {}, _defineProperty(_cx2, "".concat(prefix, "--label--disabled"), disabled), _defineProperty(_cx2, "".concat(prefix, "--visually-hidden"), hideLabel), _cx2));
|
|
154
164
|
var helperId = !helperText ? undefined : "multiselect-helper-text-".concat(multiSelectInstanceId);
|
|
155
165
|
var fieldLabelId = "multiselect-field-label-".concat(multiSelectInstanceId);
|
|
@@ -214,6 +224,11 @@ var MultiSelect = /*#__PURE__*/React__default.forwardRef(function MultiSelect(_r
|
|
|
214
224
|
};
|
|
215
225
|
|
|
216
226
|
var toggleButtonProps = getToggleButtonProps();
|
|
227
|
+
|
|
228
|
+
var handleFocus = function handleFocus(evt) {
|
|
229
|
+
evt.target.classList.contains("".concat(prefix, "--tag__close-icon")) ? setIsFocused(false) : setIsFocused(evt.type === 'focus' ? true : false);
|
|
230
|
+
};
|
|
231
|
+
|
|
217
232
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
218
233
|
className: wrapperClasses
|
|
219
234
|
}, /*#__PURE__*/React__default.createElement("label", _extends({
|
|
@@ -221,6 +236,8 @@ var MultiSelect = /*#__PURE__*/React__default.forwardRef(function MultiSelect(_r
|
|
|
221
236
|
}, getLabelProps()), titleText && titleText, selectedItems.length > 0 && /*#__PURE__*/React__default.createElement("span", {
|
|
222
237
|
className: "".concat(prefix, "--visually-hidden")
|
|
223
238
|
}, clearSelectionDescription, " ", selectedItems.length, ",", clearSelectionText)), /*#__PURE__*/React__default.createElement(ListBox, {
|
|
239
|
+
onFocus: isFluid ? handleFocus : null,
|
|
240
|
+
onBlur: isFluid ? handleFocus : null,
|
|
224
241
|
type: type,
|
|
225
242
|
size: size,
|
|
226
243
|
className: className,
|
|
@@ -371,7 +388,7 @@ MultiSelect.propTypes = _objectSpread2(_objectSpread2({}, sortingPropTypes), {},
|
|
|
371
388
|
/**
|
|
372
389
|
* `true` to use the light version.
|
|
373
390
|
*/
|
|
374
|
-
light: PropTypes.bool,
|
|
391
|
+
light: deprecate(PropTypes.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.'),
|
|
375
392
|
|
|
376
393
|
/**
|
|
377
394
|
* Specify the locale of the control. Used for the default `compareItems`
|
|
@@ -453,7 +470,6 @@ MultiSelect.defaultProps = {
|
|
|
453
470
|
initialSelectedItems: [],
|
|
454
471
|
sortItems: defaultSortItems,
|
|
455
472
|
type: 'default',
|
|
456
|
-
light: false,
|
|
457
473
|
title: false,
|
|
458
474
|
open: false,
|
|
459
475
|
selectionFeedback: 'top-after-reopen',
|
|
@@ -496,8 +496,8 @@ _defineProperty(OverflowMenu, "propTypes", {
|
|
|
496
496
|
_defineProperty(OverflowMenu, "contextType", PrefixContext);
|
|
497
497
|
|
|
498
498
|
_defineProperty(OverflowMenu, "defaultProps", {
|
|
499
|
-
ariaLabel: FeatureFlags.enabled('enable-v11-release') ? null : '
|
|
500
|
-
iconDescription: '
|
|
499
|
+
ariaLabel: FeatureFlags.enabled('enable-v11-release') ? null : 'Open and close list of options',
|
|
500
|
+
iconDescription: 'Open and close list of options',
|
|
501
501
|
open: false,
|
|
502
502
|
direction: DIRECTION_BOTTOM,
|
|
503
503
|
flipped: false,
|