@carbon/react 1.14.0 → 1.15.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/ContainedList/ContainedList.js +67 -0
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +76 -0
- package/es/components/ContainedList/index.js +13 -0
- package/es/components/DataTable/DataTable.js +3 -2
- package/es/components/DataTable/TableExpandHeader.js +10 -2
- package/es/components/DataTable/TableExpandRow.js +2 -4
- package/es/components/DataTable/state/getDerivedStateFromProps.js +3 -0
- package/es/components/Dropdown/Dropdown.js +22 -4
- package/es/components/ExpandableSearch/ExpandableSearch.js +25 -12
- package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +41 -0
- package/es/components/FluidDropdown/FluidDropdown.js +140 -0
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +42 -0
- package/es/components/FluidTextInput/FluidTextInput.Skeleton.js +42 -0
- package/es/components/ListBox/ListBox.js +10 -3
- package/es/components/Loading/Loading.js +8 -10
- package/es/components/ModalWrapper/ModalWrapper.js +8 -0
- package/es/components/MultiSelect/FilterableMultiSelect.js +5 -1
- package/es/components/Search/Search.js +2 -1
- package/es/components/Search/next/Search.js +11 -15
- package/es/components/Slider/Slider.js +25 -24
- package/es/components/TextInput/TextInput.js +1 -1
- package/es/index.js +8 -1
- package/lib/components/ContainedList/ContainedList.js +77 -0
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +86 -0
- package/lib/components/ContainedList/index.js +18 -0
- package/lib/components/DataTable/DataTable.js +3 -2
- package/lib/components/DataTable/TableExpandHeader.js +10 -2
- package/lib/components/DataTable/TableExpandRow.js +2 -4
- package/lib/components/DataTable/state/getDerivedStateFromProps.js +3 -0
- package/lib/components/Dropdown/Dropdown.js +20 -2
- package/lib/components/ExpandableSearch/ExpandableSearch.js +24 -11
- package/lib/components/FluidDropdown/FluidDropdown.Skeleton.js +51 -0
- package/lib/components/FluidDropdown/FluidDropdown.js +150 -0
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +52 -0
- package/lib/components/FluidTextInput/FluidTextInput.Skeleton.js +52 -0
- package/lib/components/ListBox/ListBox.js +9 -2
- package/lib/components/Loading/Loading.js +8 -10
- package/lib/components/ModalWrapper/ModalWrapper.js +8 -0
- package/lib/components/MultiSelect/FilterableMultiSelect.js +4 -0
- package/lib/components/Search/Search.js +2 -1
- package/lib/components/Search/next/Search.js +11 -15
- package/lib/components/Slider/Slider.js +25 -24
- package/lib/components/TextInput/TextInput.js +1 -1
- package/lib/index.js +15 -2
- package/package.json +4 -4
- package/scss/components/fluid-dropdown/_fluid-dropdown.scss +9 -0
- package/scss/components/fluid-dropdown/_index.scss +9 -0
- package/scss/components/fluid-list-box/_fluid-list-box.scss +9 -0
- package/scss/components/fluid-list-box/_index.scss +9 -0
- package/scss/components/fluid-text-area/_fluid-text-area.scss +9 -0
- package/scss/components/fluid-text-area/_index.scss +9 -0
- package/scss/components/fluid-text-input/_fluid-text-input.scss +9 -0
- package/scss/components/fluid-text-input/_index.scss +9 -0
|
@@ -19,6 +19,7 @@ require('../ListBox/index.js');
|
|
|
19
19
|
var mergeRefs = require('../../tools/mergeRefs.js');
|
|
20
20
|
var index = require('../FeatureFlags/index.js');
|
|
21
21
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
22
|
+
var FormContext = require('../FluidForm/FormContext.js');
|
|
22
23
|
var ListBox = require('../ListBox/ListBox.js');
|
|
23
24
|
var ListBoxPropTypes = require('../ListBox/ListBoxPropTypes.js');
|
|
24
25
|
|
|
@@ -70,6 +71,9 @@ var Dropdown = /*#__PURE__*/React__default["default"].forwardRef(function Dropdo
|
|
|
70
71
|
|
|
71
72
|
var prefix = usePrefix.usePrefix();
|
|
72
73
|
|
|
74
|
+
var _useContext = React.useContext(FormContext.FormContext),
|
|
75
|
+
isFluid = _useContext.isFluid;
|
|
76
|
+
|
|
73
77
|
var selectProps = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, downshiftProps), {}, {
|
|
74
78
|
items: items,
|
|
75
79
|
itemToString: itemToString,
|
|
@@ -95,19 +99,26 @@ var Dropdown = /*#__PURE__*/React__default["default"].forwardRef(function Dropdo
|
|
|
95
99
|
var inline = type === 'inline';
|
|
96
100
|
var showWarning = !invalid && warn;
|
|
97
101
|
var enabled = index.useFeatureFlag('enable-v11-release');
|
|
102
|
+
|
|
103
|
+
var _useState = React.useState(false),
|
|
104
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
|
105
|
+
isFocused = _useState2[0],
|
|
106
|
+
setIsFocused = _useState2[1];
|
|
107
|
+
|
|
98
108
|
var className = cx__default["default"]("".concat(prefix, "--dropdown"), [enabled ? null : containerClassName], (_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--dropdown--invalid"), invalid), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--dropdown--warning"), showWarning), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--dropdown--open"), isOpen), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--dropdown--inline"), inline), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--dropdown--disabled"), disabled), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--dropdown--light"), light), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--dropdown--").concat(size), size), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box--up"), direction === 'top'), _cx));
|
|
99
109
|
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));
|
|
100
110
|
var helperClasses = cx__default["default"]("".concat(prefix, "--form__helper-text"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--form__helper-text--disabled"), disabled));
|
|
101
|
-
var wrapperClasses = cx__default["default"]("".concat(prefix, "--dropdown__wrapper"), "".concat(prefix, "--list-box__wrapper"), [enabled ? containerClassName : null], (_cx4 = {}, _rollupPluginBabelHelpers.defineProperty(_cx4, "".concat(prefix, "--dropdown__wrapper--inline"), inline), _rollupPluginBabelHelpers.defineProperty(_cx4, "".concat(prefix, "--list-box__wrapper--inline"), inline), _rollupPluginBabelHelpers.defineProperty(_cx4, "".concat(prefix, "--dropdown__wrapper--inline--invalid"), inline && invalid), _rollupPluginBabelHelpers.defineProperty(_cx4, "".concat(prefix, "--list-box__wrapper--inline--invalid"), inline && invalid), _cx4)); // needs to be Capitalized for react to render it correctly
|
|
111
|
+
var wrapperClasses = cx__default["default"]("".concat(prefix, "--dropdown__wrapper"), "".concat(prefix, "--list-box__wrapper"), [enabled ? containerClassName : null], (_cx4 = {}, _rollupPluginBabelHelpers.defineProperty(_cx4, "".concat(prefix, "--dropdown__wrapper--inline"), inline), _rollupPluginBabelHelpers.defineProperty(_cx4, "".concat(prefix, "--list-box__wrapper--inline"), inline), _rollupPluginBabelHelpers.defineProperty(_cx4, "".concat(prefix, "--dropdown__wrapper--inline--invalid"), inline && invalid), _rollupPluginBabelHelpers.defineProperty(_cx4, "".concat(prefix, "--list-box__wrapper--inline--invalid"), inline && invalid), _rollupPluginBabelHelpers.defineProperty(_cx4, "".concat(prefix, "--list-box__wrapper--fluid--invalid"), isFluid && invalid), _rollupPluginBabelHelpers.defineProperty(_cx4, "".concat(prefix, "--list-box__wrapper--fluid--focus"), isFluid && isFocused && !isOpen), _cx4)); // needs to be Capitalized for react to render it correctly
|
|
102
112
|
|
|
103
113
|
var ItemToElement = itemToElement;
|
|
104
114
|
var toggleButtonProps = getToggleButtonProps();
|
|
105
|
-
var helper = helperText ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
115
|
+
var helper = helperText && !isFluid ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
106
116
|
className: helperClasses
|
|
107
117
|
}, helperText) : null;
|
|
108
118
|
|
|
109
119
|
function onSelectedItemChange(_ref2) {
|
|
110
120
|
var selectedItem = _ref2.selectedItem;
|
|
121
|
+
setIsFocused(false);
|
|
111
122
|
|
|
112
123
|
if (onChange) {
|
|
113
124
|
onChange({
|
|
@@ -119,11 +130,18 @@ var Dropdown = /*#__PURE__*/React__default["default"].forwardRef(function Dropdo
|
|
|
119
130
|
var menuItemOptionRefs = React.useRef(items.map(function (_) {
|
|
120
131
|
return /*#__PURE__*/React__default["default"].createRef();
|
|
121
132
|
}));
|
|
133
|
+
|
|
134
|
+
var handleFocus = function handleFocus(evt) {
|
|
135
|
+
setIsFocused(evt.type === 'focus' ? true : false);
|
|
136
|
+
};
|
|
137
|
+
|
|
122
138
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
123
139
|
className: wrapperClasses
|
|
124
140
|
}, other), titleText && /*#__PURE__*/React__default["default"].createElement("label", _rollupPluginBabelHelpers["extends"]({
|
|
125
141
|
className: titleClasses
|
|
126
142
|
}, getLabelProps()), titleText), /*#__PURE__*/React__default["default"].createElement(ListBox["default"], {
|
|
143
|
+
onFocus: handleFocus,
|
|
144
|
+
onBlur: handleFocus,
|
|
127
145
|
"aria-label": ariaLabel,
|
|
128
146
|
size: size,
|
|
129
147
|
className: className,
|
|
@@ -14,13 +14,22 @@ var React = require('react');
|
|
|
14
14
|
var cx = require('classnames');
|
|
15
15
|
var index = require('../Search/index.js');
|
|
16
16
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
17
|
+
var events = require('../../tools/events.js');
|
|
17
18
|
|
|
18
19
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
19
20
|
|
|
20
21
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
21
22
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
var _excluded = ["onBlur", "onChange", "onExpand", "onFocus"];
|
|
25
|
+
|
|
26
|
+
function ExpandableSearch(_ref) {
|
|
27
|
+
var onBlur = _ref.onBlur,
|
|
28
|
+
onChange = _ref.onChange,
|
|
29
|
+
onExpand = _ref.onExpand,
|
|
30
|
+
onFocus = _ref.onFocus,
|
|
31
|
+
props = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
32
|
+
|
|
24
33
|
var _useState = React.useState(false),
|
|
25
34
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
|
26
35
|
expanded = _useState2[0],
|
|
@@ -48,20 +57,24 @@ function ExpandableSearch(props) {
|
|
|
48
57
|
}
|
|
49
58
|
}
|
|
50
59
|
|
|
60
|
+
function handleChange(evt) {
|
|
61
|
+
setHasContent(evt.target.value !== '');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function handleExpand() {
|
|
65
|
+
var _searchRef$current$fo, _searchRef$current;
|
|
66
|
+
|
|
67
|
+
(_searchRef$current$fo = (_searchRef$current = searchRef.current).focus) === null || _searchRef$current$fo === void 0 ? void 0 : _searchRef$current$fo.call(_searchRef$current);
|
|
68
|
+
}
|
|
69
|
+
|
|
51
70
|
var classes = cx__default["default"]("".concat(prefix, "--search--expandable"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--search--expanded"), expanded), props.className);
|
|
52
71
|
return /*#__PURE__*/React__default["default"].createElement(index["default"], _rollupPluginBabelHelpers["extends"]({}, props, {
|
|
53
72
|
ref: searchRef,
|
|
54
73
|
className: classes,
|
|
55
|
-
onFocus: handleFocus,
|
|
56
|
-
onBlur: handleBlur,
|
|
57
|
-
onChange:
|
|
58
|
-
|
|
59
|
-
},
|
|
60
|
-
onExpand: function onExpand() {
|
|
61
|
-
var _searchRef$current$fo, _searchRef$current;
|
|
62
|
-
|
|
63
|
-
(_searchRef$current$fo = (_searchRef$current = searchRef.current).focus) === null || _searchRef$current$fo === void 0 ? void 0 : _searchRef$current$fo.call(_searchRef$current);
|
|
64
|
-
}
|
|
74
|
+
onFocus: events.composeEventHandlers([onFocus, handleFocus]),
|
|
75
|
+
onBlur: events.composeEventHandlers([onBlur, handleBlur]),
|
|
76
|
+
onChange: events.composeEventHandlers([onChange, handleChange]),
|
|
77
|
+
onExpand: events.composeEventHandlers([onExpand, handleExpand])
|
|
65
78
|
}));
|
|
66
79
|
}
|
|
67
80
|
|
|
@@ -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 FluidDropdownSkeleton = function FluidDropdownSkeleton(_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
|
+
FluidDropdownSkeleton.propTypes = {
|
|
44
|
+
/**
|
|
45
|
+
* Specify an optional className to add.
|
|
46
|
+
*/
|
|
47
|
+
className: PropTypes__default["default"].string
|
|
48
|
+
};
|
|
49
|
+
var FluidDropdownSkeleton$1 = FluidDropdownSkeleton;
|
|
50
|
+
|
|
51
|
+
exports["default"] = FluidDropdownSkeleton$1;
|
|
@@ -0,0 +1,150 @@
|
|
|
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 Dropdown = require('../Dropdown/Dropdown.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", "isCondensed"];
|
|
27
|
+
var FluidDropdown = /*#__PURE__*/React__default["default"].forwardRef(function FluidDropdown(_ref, ref) {
|
|
28
|
+
var className = _ref.className,
|
|
29
|
+
isCondensed = _ref.isCondensed,
|
|
30
|
+
other = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
31
|
+
|
|
32
|
+
var prefix = usePrefix.usePrefix();
|
|
33
|
+
var classNames = cx__default["default"]("".concat(prefix, "--list-box__wrapper--fluid"), className, _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--list-box__wrapper--fluid--condensed"), isCondensed));
|
|
34
|
+
return /*#__PURE__*/React__default["default"].createElement(FormContext.FormContext.Provider, {
|
|
35
|
+
value: {
|
|
36
|
+
isFluid: true
|
|
37
|
+
}
|
|
38
|
+
}, /*#__PURE__*/React__default["default"].createElement(Dropdown["default"], _rollupPluginBabelHelpers["extends"]({
|
|
39
|
+
ref: ref,
|
|
40
|
+
className: classNames
|
|
41
|
+
}, other)));
|
|
42
|
+
});
|
|
43
|
+
FluidDropdown.propTypes = {
|
|
44
|
+
/**
|
|
45
|
+
* Specify an optional className to be applied to the outer FluidForm wrapper
|
|
46
|
+
*/
|
|
47
|
+
className: PropTypes__default["default"].string,
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Specify the direction of the dropdown. Can be either top or bottom.
|
|
51
|
+
*/
|
|
52
|
+
direction: PropTypes__default["default"].oneOf(['top', 'bottom']),
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Specify whether the `<input>` should be disabled
|
|
56
|
+
*/
|
|
57
|
+
disabled: PropTypes__default["default"].bool,
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Specify a custom `id` for the `<input>`
|
|
61
|
+
*/
|
|
62
|
+
id: PropTypes__default["default"].string.isRequired,
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Allow users to pass in an arbitrary item or a string (in case their items are an array of strings)
|
|
66
|
+
* from their collection that are pre-selected
|
|
67
|
+
*/
|
|
68
|
+
initialSelectedItem: PropTypes__default["default"].oneOfType([PropTypes__default["default"].object, PropTypes__default["default"].string, PropTypes__default["default"].number]),
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Specify if the currently selected value is invalid.
|
|
72
|
+
*/
|
|
73
|
+
invalid: PropTypes__default["default"].bool,
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Provide the text that is displayed when the control is in an invalid state
|
|
77
|
+
*/
|
|
78
|
+
invalidText: PropTypes__default["default"].node,
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Specify if the `FluidDropdown` should render its menu items in condensed mode
|
|
82
|
+
*/
|
|
83
|
+
isCondensed: PropTypes__default["default"].bool,
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Function to render items as custom components instead of strings.
|
|
87
|
+
* Defaults to null and is overridden by a getter
|
|
88
|
+
*/
|
|
89
|
+
itemToElement: PropTypes__default["default"].func,
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Helper function passed to downshift that allows the library to render a
|
|
93
|
+
* given item to a string label. By default, it extracts the `label` field
|
|
94
|
+
* from a given item to serve as the item label in the list.
|
|
95
|
+
*/
|
|
96
|
+
itemToString: PropTypes__default["default"].func,
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* We try to stay as generic as possible here to allow individuals to pass
|
|
100
|
+
* in a collection of whatever kind of data structure they prefer
|
|
101
|
+
*/
|
|
102
|
+
items: PropTypes__default["default"].array.isRequired,
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Generic `label` that will be used as the textual representation of what
|
|
106
|
+
* this field is for
|
|
107
|
+
*/
|
|
108
|
+
label: PropTypes__default["default"].node.isRequired,
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* `onChange` is a utility for this controlled component to communicate to a
|
|
112
|
+
* consuming component what kind of internal state changes are occurring.
|
|
113
|
+
*/
|
|
114
|
+
onChange: PropTypes__default["default"].func,
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* An optional callback to render the currently selected item as a react element instead of only
|
|
118
|
+
* as a string.
|
|
119
|
+
*/
|
|
120
|
+
renderSelectedItem: PropTypes__default["default"].func,
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* In the case you want to control the dropdown selection entirely.
|
|
124
|
+
*/
|
|
125
|
+
selectedItem: PropTypes__default["default"].oneOfType([PropTypes__default["default"].object, PropTypes__default["default"].string, PropTypes__default["default"].number]),
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Provide the title text that will be read by a screen reader when
|
|
129
|
+
* visiting this control
|
|
130
|
+
*/
|
|
131
|
+
titleText: PropTypes__default["default"].node,
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Callback function for translating ListBoxMenuIcon SVG title
|
|
135
|
+
*/
|
|
136
|
+
translateWithId: PropTypes__default["default"].func,
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Specify whether the control is currently in warning state
|
|
140
|
+
*/
|
|
141
|
+
warn: PropTypes__default["default"].bool,
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Provide the text that is displayed when the control is in warning state
|
|
145
|
+
*/
|
|
146
|
+
warnText: PropTypes__default["default"].node
|
|
147
|
+
};
|
|
148
|
+
var FluidDropdown$1 = FluidDropdown;
|
|
149
|
+
|
|
150
|
+
exports["default"] = FluidDropdown$1;
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
var FormContext = require('../FluidForm/FormContext.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
|
+
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
24
|
+
|
|
25
|
+
var _excluded = ["className"];
|
|
26
|
+
|
|
27
|
+
function FluidTextAreaSkeleton(_ref) {
|
|
28
|
+
var className = _ref.className,
|
|
29
|
+
other = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
30
|
+
|
|
31
|
+
var prefix = usePrefix.usePrefix();
|
|
32
|
+
return /*#__PURE__*/React__default["default"].createElement(FormContext.FormContext.Provider, {
|
|
33
|
+
value: {
|
|
34
|
+
isFluid: true
|
|
35
|
+
}
|
|
36
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
37
|
+
className: cx__default["default"]("".concat(prefix, "--form-item ").concat(prefix, "--text-area--fluid__skeleton"), className)
|
|
38
|
+
}, other), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
39
|
+
className: "".concat(prefix, "--label ").concat(prefix, "--skeleton")
|
|
40
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
41
|
+
className: "".concat(prefix, "--skeleton ").concat(prefix, "--text-area")
|
|
42
|
+
})));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
FluidTextAreaSkeleton.propTypes = {
|
|
46
|
+
/**
|
|
47
|
+
* Specify an optional className to be applied to the outer FluidForm wrapper
|
|
48
|
+
*/
|
|
49
|
+
className: PropTypes__default["default"].string
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
exports["default"] = FluidTextAreaSkeleton;
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
var FormContext = require('../FluidForm/FormContext.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
|
+
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
24
|
+
|
|
25
|
+
var _excluded = ["className"];
|
|
26
|
+
|
|
27
|
+
function FluidTextInputSkeleton(_ref) {
|
|
28
|
+
var className = _ref.className,
|
|
29
|
+
other = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
30
|
+
|
|
31
|
+
var prefix = usePrefix.usePrefix();
|
|
32
|
+
return /*#__PURE__*/React__default["default"].createElement(FormContext.FormContext.Provider, {
|
|
33
|
+
value: {
|
|
34
|
+
isFluid: true
|
|
35
|
+
}
|
|
36
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
37
|
+
className: cx__default["default"]("".concat(prefix, "--form-item ").concat(prefix, "--text-input--fluid__skeleton"), className)
|
|
38
|
+
}, other), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
39
|
+
className: "".concat(prefix, "--label ").concat(prefix, "--skeleton")
|
|
40
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
41
|
+
className: "".concat(prefix, "--skeleton ").concat(prefix, "--text-input")
|
|
42
|
+
})));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
FluidTextInputSkeleton.propTypes = {
|
|
46
|
+
/**
|
|
47
|
+
* Specify an optional className to be applied to the outer FluidForm wrapper
|
|
48
|
+
*/
|
|
49
|
+
className: PropTypes__default["default"].string
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
exports["default"] = FluidTextInputSkeleton;
|
|
@@ -20,6 +20,7 @@ var ListBoxMenu = require('./ListBoxMenu.js');
|
|
|
20
20
|
var ListBoxMenuIcon = require('./ListBoxMenuIcon.js');
|
|
21
21
|
var ListBoxMenuItem = require('./ListBoxMenuItem.js');
|
|
22
22
|
var ListBoxSelection = require('./ListBoxSelection.js');
|
|
23
|
+
var FormContext = require('../FluidForm/FormContext.js');
|
|
23
24
|
|
|
24
25
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
25
26
|
|
|
@@ -62,15 +63,21 @@ var ListBox = /*#__PURE__*/React__default["default"].forwardRef(function ListBox
|
|
|
62
63
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
63
64
|
|
|
64
65
|
var prefix = usePrefix.usePrefix();
|
|
66
|
+
|
|
67
|
+
var _useContext = React.useContext(FormContext.FormContext),
|
|
68
|
+
isFluid = _useContext.isFluid;
|
|
69
|
+
|
|
65
70
|
var showWarning = !invalid && warn;
|
|
66
|
-
var className = cx__default["default"]((_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, containerClassName, !!containerClassName), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box"), true), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box--").concat(size), size), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box--inline"), type === 'inline'), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box--disabled"), disabled), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box--light"), light), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box--expanded"), isOpen), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box--warning"), showWarning), _cx));
|
|
71
|
+
var className = cx__default["default"]((_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, containerClassName, !!containerClassName), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box"), true), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box--").concat(size), size), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box--inline"), type === 'inline'), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box--disabled"), disabled), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box--light"), light), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box--expanded"), isOpen), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box--invalid"), invalid), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--list-box--warning"), showWarning), _cx));
|
|
67
72
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
68
73
|
className: className,
|
|
69
74
|
ref: ref,
|
|
70
75
|
onKeyDown: handleOnKeyDown,
|
|
71
76
|
onClick: handleClick,
|
|
72
77
|
"data-invalid": invalid || undefined
|
|
73
|
-
}), children),
|
|
78
|
+
}), children), isFluid && /*#__PURE__*/React__default["default"].createElement("hr", {
|
|
79
|
+
className: "".concat(prefix, "--list-box__divider")
|
|
80
|
+
}), invalid ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
74
81
|
className: "".concat(prefix, "--form-requirement")
|
|
75
82
|
}, invalidText) : null, showWarning ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
76
83
|
className: "".concat(prefix, "--form-requirement")
|
|
@@ -27,11 +27,15 @@ var _excluded = ["active", "className", "withOverlay", "small", "description"];
|
|
|
27
27
|
function Loading(_ref) {
|
|
28
28
|
var _cx, _cx2;
|
|
29
29
|
|
|
30
|
-
var active = _ref.active,
|
|
30
|
+
var _ref$active = _ref.active,
|
|
31
|
+
active = _ref$active === void 0 ? true : _ref$active,
|
|
31
32
|
customClassName = _ref.className,
|
|
32
|
-
withOverlay = _ref.withOverlay,
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
_ref$withOverlay = _ref.withOverlay,
|
|
34
|
+
withOverlay = _ref$withOverlay === void 0 ? true : _ref$withOverlay,
|
|
35
|
+
_ref$small = _ref.small,
|
|
36
|
+
small = _ref$small === void 0 ? false : _ref$small,
|
|
37
|
+
_ref$description = _ref.description,
|
|
38
|
+
description = _ref$description === void 0 ? 'loading' : _ref$description,
|
|
35
39
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
36
40
|
|
|
37
41
|
var prefix = usePrefix.usePrefix();
|
|
@@ -91,11 +95,5 @@ Loading.propTypes = {
|
|
|
91
95
|
*/
|
|
92
96
|
withOverlay: PropTypes__default["default"].bool
|
|
93
97
|
};
|
|
94
|
-
Loading.defaultProps = {
|
|
95
|
-
active: true,
|
|
96
|
-
withOverlay: true,
|
|
97
|
-
small: false,
|
|
98
|
-
description: 'loading'
|
|
99
|
-
};
|
|
100
98
|
|
|
101
99
|
exports["default"] = Loading;
|
|
@@ -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;
|
|
@@ -292,6 +292,10 @@ var FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(fu
|
|
|
292
292
|
if (match.match(event, keys.Space)) {
|
|
293
293
|
event.stopPropagation();
|
|
294
294
|
}
|
|
295
|
+
|
|
296
|
+
if (match.match(event, keys.Tab)) {
|
|
297
|
+
handleOnMenuChange(false);
|
|
298
|
+
}
|
|
295
299
|
},
|
|
296
300
|
onFocus: function onFocus() {
|
|
297
301
|
setInputFocused(true);
|
|
@@ -29,7 +29,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
29
29
|
|
|
30
30
|
var _Close;
|
|
31
31
|
|
|
32
|
-
var _excluded = ["className", "type", "id", "placeHolderText", "placeholder", "labelText", "closeButtonLabelText", "small", "size", "light", "disabled", "onChange", "onKeyDown", "renderIcon", "onClear"];
|
|
32
|
+
var _excluded = ["className", "type", "id", "placeHolderText", "placeholder", "labelText", "closeButtonLabelText", "small", "size", "light", "disabled", "onChange", "onKeyDown", "renderIcon", "onClear", "onExpand"];
|
|
33
33
|
|
|
34
34
|
var Search = /*#__PURE__*/function (_Component) {
|
|
35
35
|
_rollupPluginBabelHelpers.inherits(Search, _Component);
|
|
@@ -114,6 +114,7 @@ var Search = /*#__PURE__*/function (_Component) {
|
|
|
114
114
|
onKeyDown = _this$props.onKeyDown,
|
|
115
115
|
renderIcon = _this$props.renderIcon;
|
|
116
116
|
_this$props.onClear;
|
|
117
|
+
_this$props.onExpand;
|
|
117
118
|
var other = _rollupPluginBabelHelpers.objectWithoutProperties(_this$props, _excluded);
|
|
118
119
|
|
|
119
120
|
var hasContent = this.state.hasContent;
|
|
@@ -88,19 +88,19 @@ var Search = /*#__PURE__*/React__default["default"].forwardRef(function Search(_
|
|
|
88
88
|
setPrevValue(value);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
function clearInput(
|
|
91
|
+
function clearInput() {
|
|
92
92
|
if (!value) {
|
|
93
93
|
inputRef.current.value = '';
|
|
94
|
-
onChange(event);
|
|
95
|
-
} else {
|
|
96
|
-
var clearedEvt = Object.assign({}, event.target, {
|
|
97
|
-
target: {
|
|
98
|
-
value: ''
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
onChange(clearedEvt);
|
|
102
94
|
}
|
|
103
95
|
|
|
96
|
+
var inputTarget = Object.assign({}, inputRef.current, {
|
|
97
|
+
value: ''
|
|
98
|
+
});
|
|
99
|
+
var clearedEvt = {
|
|
100
|
+
target: inputTarget,
|
|
101
|
+
type: 'change'
|
|
102
|
+
};
|
|
103
|
+
onChange(clearedEvt);
|
|
104
104
|
onClear();
|
|
105
105
|
setHasContent(false);
|
|
106
106
|
index.focus(inputRef);
|
|
@@ -113,7 +113,7 @@ var Search = /*#__PURE__*/React__default["default"].forwardRef(function Search(_
|
|
|
113
113
|
function handleKeyDown(event) {
|
|
114
114
|
if (match.match(event, keys.Escape)) {
|
|
115
115
|
event.stopPropagation();
|
|
116
|
-
clearInput(
|
|
116
|
+
clearInput();
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
|
|
@@ -124,11 +124,7 @@ var Search = /*#__PURE__*/React__default["default"].forwardRef(function Search(_
|
|
|
124
124
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
125
125
|
role: onExpand ? 'button' : null,
|
|
126
126
|
className: "".concat(prefix, "--search-magnifier"),
|
|
127
|
-
onClick:
|
|
128
|
-
if (onExpand) {
|
|
129
|
-
onExpand();
|
|
130
|
-
}
|
|
131
|
-
}
|
|
127
|
+
onClick: onExpand
|
|
132
128
|
}, /*#__PURE__*/React__default["default"].createElement(CustomSearchIcon, {
|
|
133
129
|
icon: renderIcon
|
|
134
130
|
})), /*#__PURE__*/React__default["default"].createElement("label", {
|