@carbon/react 1.9.0-rc.0 → 1.11.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/ComposedModal/ComposedModal.js +172 -577
- package/es/components/ComposedModal/{next/ModalFooter.js → ModalFooter.js} +4 -4
- package/es/components/ComposedModal/{next/ModalHeader.js → ModalHeader.js} +2 -2
- package/es/components/DataTable/tools/sorting.js +8 -0
- package/es/components/Dropdown/Dropdown.js +1 -8
- package/es/components/Icon/Icon.Skeleton.js +4 -12
- package/es/components/InlineCheckbox/InlineCheckbox.js +0 -1
- package/es/components/ModalWrapper/ModalWrapper.js +10 -5
- package/es/components/ModalWrapper/index.js +12 -0
- package/es/components/NumberInput/NumberInput.js +3 -3
- package/es/components/TileGroup/TileGroup.js +1 -1
- package/es/index.js +4 -3
- package/es/internal/useControllableState.js +1 -1
- package/lib/components/ComposedModal/ComposedModal.js +174 -581
- package/lib/components/ComposedModal/{next/ModalFooter.js → ModalFooter.js} +4 -4
- package/lib/components/ComposedModal/{next/ModalHeader.js → ModalHeader.js} +2 -2
- package/lib/components/DataTable/tools/sorting.js +8 -0
- package/lib/components/Dropdown/Dropdown.js +1 -8
- package/lib/components/Icon/Icon.Skeleton.js +4 -12
- package/lib/components/InlineCheckbox/InlineCheckbox.js +0 -1
- package/lib/components/ModalWrapper/ModalWrapper.js +10 -5
- package/lib/components/ModalWrapper/index.js +16 -0
- package/lib/components/NumberInput/NumberInput.js +3 -3
- package/lib/components/TileGroup/TileGroup.js +1 -1
- package/lib/index.js +29 -28
- package/lib/internal/useControllableState.js +1 -1
- package/package.json +6 -6
- package/es/components/ComposedModal/index.js +0 -19
- package/es/components/ComposedModal/next/ComposedModal.js +0 -225
- package/lib/components/ComposedModal/index.js +0 -45
- package/lib/components/ComposedModal/next/ComposedModal.js +0 -236
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, extends as _extends } from '
|
|
8
|
+
import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import React__default from 'react';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
|
-
import Button from '
|
|
12
|
-
import ButtonSet from '
|
|
11
|
+
import Button from '../Button/Button.js';
|
|
12
|
+
import ButtonSet from '../ButtonSet/ButtonSet.js';
|
|
13
13
|
import cx from 'classnames';
|
|
14
|
-
import { usePrefix } from '
|
|
14
|
+
import { usePrefix } from '../../internal/usePrefix.js';
|
|
15
15
|
|
|
16
16
|
var _excluded = ["children", "className", "closeModal", "danger", "inputref", "onRequestClose", "onRequestSubmit", "primaryButtonDisabled", "primaryButtonText", "primaryClassName", "secondaryButtonText", "secondaryButtons", "secondaryClassName"];
|
|
17
17
|
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, extends as _extends } from '
|
|
8
|
+
import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import React__default from 'react';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { Close } from '@carbon/icons-react';
|
|
13
|
-
import { usePrefix } from '
|
|
13
|
+
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
14
|
|
|
15
15
|
var _excluded = ["buttonOnClick", "children", "className", "closeClassName", "closeIconClassName", "closeModal", "iconDescription", "label", "labelClassName", "title", "titleClassName"];
|
|
16
16
|
var ModalHeader = /*#__PURE__*/React__default.forwardRef(function ModalHeader(_ref, ref) {
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import { typeof as _typeof } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
8
9
|
import { getCellId } from './cells.js';
|
|
9
10
|
import { sortStates } from '../state/sortStates.js';
|
|
10
11
|
|
|
@@ -29,6 +30,13 @@ var compare = function compare(a, b) {
|
|
|
29
30
|
|
|
30
31
|
if (typeof a === 'string' && typeof b === 'string') {
|
|
31
32
|
return compareStrings(a, b, locale);
|
|
33
|
+
} // if column has React elements, this should sort by the child string if there is one
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
if (_typeof(a) === 'object' && _typeof(b) === 'object') {
|
|
37
|
+
if (typeof a.props.children === 'string' && typeof b.props.children === 'string') {
|
|
38
|
+
return compareStrings(a.props.children, b.props.children, locale);
|
|
39
|
+
}
|
|
32
40
|
}
|
|
33
41
|
|
|
34
42
|
return compareStrings('' + a, '' + b, locale);
|
|
@@ -142,24 +142,17 @@ var Dropdown = /*#__PURE__*/React__default.forwardRef(function Dropdown(_ref, re
|
|
|
142
142
|
isOpen: isOpen,
|
|
143
143
|
translateWithId: translateWithId
|
|
144
144
|
})), /*#__PURE__*/React__default.createElement(ListBox.Menu, getMenuProps(), isOpen && items.map(function (item, index) {
|
|
145
|
-
var _menuItemOptionRefs$c;
|
|
146
|
-
|
|
147
145
|
var itemProps = getItemProps({
|
|
148
146
|
item: item,
|
|
149
147
|
index: index,
|
|
150
148
|
disabled: item.disabled
|
|
151
149
|
});
|
|
152
150
|
var title = itemToElement ? item.text : itemToString(item);
|
|
153
|
-
|
|
154
|
-
var _ref3 = (menuItemOptionRefs === null || menuItemOptionRefs === void 0 ? void 0 : (_menuItemOptionRefs$c = menuItemOptionRefs.current[index]) === null || _menuItemOptionRefs$c === void 0 ? void 0 : _menuItemOptionRefs$c.current) || {},
|
|
155
|
-
offsetWidth = _ref3.offsetWidth,
|
|
156
|
-
scrollWidth = _ref3.scrollWidth;
|
|
157
|
-
|
|
158
151
|
return /*#__PURE__*/React__default.createElement(ListBox.MenuItem, _extends({
|
|
159
152
|
key: itemProps.id,
|
|
160
153
|
isActive: selectedItem === item,
|
|
161
154
|
isHighlighted: highlightedIndex === index || selectedItem === item,
|
|
162
|
-
title:
|
|
155
|
+
title: title,
|
|
163
156
|
ref: {
|
|
164
157
|
menuItemOptionRef: menuItemOptionRefs.current[index]
|
|
165
158
|
}
|
|
@@ -11,18 +11,15 @@ import React__default from 'react';
|
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
|
|
14
|
-
var _excluded = ["
|
|
14
|
+
var _excluded = ["className"];
|
|
15
15
|
|
|
16
16
|
var IconSkeleton = function IconSkeleton(_ref) {
|
|
17
|
-
var
|
|
18
|
-
className = _ref.className,
|
|
17
|
+
var className = _ref.className,
|
|
19
18
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
20
19
|
|
|
21
20
|
var prefix = usePrefix();
|
|
22
21
|
|
|
23
|
-
var props = _objectSpread2({
|
|
24
|
-
style: style
|
|
25
|
-
}, rest);
|
|
22
|
+
var props = _objectSpread2({}, rest);
|
|
26
23
|
|
|
27
24
|
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
28
25
|
className: cx("".concat(prefix, "--icon--skeleton"), className)
|
|
@@ -33,12 +30,7 @@ IconSkeleton.propTypes = {
|
|
|
33
30
|
/**
|
|
34
31
|
* Specify an optional className to add.
|
|
35
32
|
*/
|
|
36
|
-
className: PropTypes.string
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* The CSS styles.
|
|
40
|
-
*/
|
|
41
|
-
style: PropTypes.object
|
|
33
|
+
className: PropTypes.string
|
|
42
34
|
};
|
|
43
35
|
var IconSkeleton$1 = IconSkeleton;
|
|
44
36
|
|
|
@@ -45,7 +45,9 @@ var ModalWrapper = /*#__PURE__*/function (_React$Component) {
|
|
|
45
45
|
});
|
|
46
46
|
|
|
47
47
|
_defineProperty(_assertThisInitialized(_this), "handleClose", function (evt) {
|
|
48
|
-
|
|
48
|
+
var innerModal = _this.modal.current.querySelector('div');
|
|
49
|
+
|
|
50
|
+
if (_this.modal.current && evt && !innerModal.contains(evt.target) && _this.props.preventCloseOnClickOutside) {
|
|
49
51
|
return;
|
|
50
52
|
} else {
|
|
51
53
|
_this.setState({
|
|
@@ -61,11 +63,13 @@ var ModalWrapper = /*#__PURE__*/function (_React$Component) {
|
|
|
61
63
|
handleSubmit = _this$props.handleSubmit,
|
|
62
64
|
shouldCloseAfterSubmit = _this$props.shouldCloseAfterSubmit;
|
|
63
65
|
|
|
64
|
-
if (handleSubmit
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
if (handleSubmit && shouldCloseAfterSubmit) {
|
|
67
|
+
handleSubmit();
|
|
68
|
+
|
|
69
|
+
_this.handleClose();
|
|
68
70
|
}
|
|
71
|
+
|
|
72
|
+
handleSubmit();
|
|
69
73
|
});
|
|
70
74
|
|
|
71
75
|
return _this;
|
|
@@ -151,6 +155,7 @@ _defineProperty(ModalWrapper, "propTypes", {
|
|
|
151
155
|
});
|
|
152
156
|
|
|
153
157
|
_defineProperty(ModalWrapper, "defaultProps", {
|
|
158
|
+
shouldCloseAfterSubmit: true,
|
|
154
159
|
primaryButtonText: 'Save',
|
|
155
160
|
secondaryButtonText: 'Cancel',
|
|
156
161
|
triggerButtonIconDescription: 'Provide icon description if icon is used',
|
|
@@ -0,0 +1,12 @@
|
|
|
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 ModalWrapper$1 from './ModalWrapper.js';
|
|
9
|
+
|
|
10
|
+
var ModalWrapper = ModalWrapper$1;
|
|
11
|
+
|
|
12
|
+
export { ModalWrapper as default };
|
|
@@ -316,9 +316,9 @@ NumberInput.propTypes = {
|
|
|
316
316
|
min: PropTypes.number,
|
|
317
317
|
|
|
318
318
|
/**
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
*
|
|
319
|
+
* Provide an optional handler that is called when the internal state of
|
|
320
|
+
* NumberInput changes. This handler is called with event and state info.
|
|
321
|
+
* `(event, { value, direction }) => void`
|
|
322
322
|
*/
|
|
323
323
|
onChange: PropTypes.func,
|
|
324
324
|
|
|
@@ -72,7 +72,7 @@ var TileGroup = /*#__PURE__*/function (_React$Component) {
|
|
|
72
72
|
_defineProperty(_assertThisInitialized(_this), "renderLegend", function (legend) {
|
|
73
73
|
if (legend) {
|
|
74
74
|
return /*#__PURE__*/React__default.createElement("legend", {
|
|
75
|
-
className: "".concat(_this.
|
|
75
|
+
className: "".concat(_this.context, "--label")
|
|
76
76
|
}, legend);
|
|
77
77
|
}
|
|
78
78
|
});
|
package/es/index.js
CHANGED
|
@@ -18,7 +18,6 @@ export { ClassPrefix } from './components/ClassPrefix/index.js';
|
|
|
18
18
|
export { default as CodeSnippetSkeleton } from './components/CodeSnippet/CodeSnippet.Skeleton.js';
|
|
19
19
|
export { default as CodeSnippet } from './components/CodeSnippet/CodeSnippet.js';
|
|
20
20
|
export { default as ComboBox } from './components/ComboBox/ComboBox.js';
|
|
21
|
-
export { ComposedModal, ModalFooter, ModalHeader } from './components/ComposedModal/index.js';
|
|
22
21
|
export { default as ContentSwitcher } from './components/ContentSwitcher/index.js';
|
|
23
22
|
export { default as Copy } from './components/Copy/Copy.js';
|
|
24
23
|
export { default as CopyButton } from './components/CopyButton/CopyButton.js';
|
|
@@ -40,7 +39,7 @@ export { default as Link } from './components/Link/Link.js';
|
|
|
40
39
|
export { default as ListItem } from './components/ListItem/ListItem.js';
|
|
41
40
|
export { default as Loading } from './components/Loading/Loading.js';
|
|
42
41
|
export { default as Modal } from './components/Modal/Modal.js';
|
|
43
|
-
export { default as ModalWrapper } from './components/ModalWrapper/
|
|
42
|
+
export { default as ModalWrapper } from './components/ModalWrapper/index.js';
|
|
44
43
|
import './components/MultiSelect/index.js';
|
|
45
44
|
export { default as OrderedList } from './components/OrderedList/OrderedList.js';
|
|
46
45
|
export { default as OverflowMenu } from './components/OverflowMenu/index.js';
|
|
@@ -139,7 +138,9 @@ export { default as unstable_Menu } from './components/Menu/Menu.js';
|
|
|
139
138
|
export { default as unstable_TreeView } from './components/TreeView/TreeView.js';
|
|
140
139
|
export { default as Breadcrumb } from './components/Breadcrumb/Breadcrumb.js';
|
|
141
140
|
export { default as BreadcrumbItem } from './components/Breadcrumb/BreadcrumbItem.js';
|
|
142
|
-
export { ModalBody } from './components/ComposedModal/ComposedModal.js';
|
|
141
|
+
export { default as ComposedModal, ModalBody } from './components/ComposedModal/ComposedModal.js';
|
|
142
|
+
export { ModalHeader } from './components/ComposedModal/ModalHeader.js';
|
|
143
|
+
export { ModalFooter } from './components/ComposedModal/ModalFooter.js';
|
|
143
144
|
export { default as Table } from './components/DataTable/Table.js';
|
|
144
145
|
export { default as TableActionList } from './components/DataTable/TableActionList.js';
|
|
145
146
|
export { default as TableBatchAction } from './components/DataTable/TableBatchAction.js';
|
|
@@ -17,7 +17,7 @@ import { warning } from './warning.js';
|
|
|
17
17
|
* owners of controlled components.
|
|
18
18
|
*
|
|
19
19
|
* Note: this hook will warn if a component is switching from controlled to
|
|
20
|
-
* uncontrolled, or vice-
|
|
20
|
+
* uncontrolled, or vice-versa.
|
|
21
21
|
*
|
|
22
22
|
* @param {object} config
|
|
23
23
|
* @param {string} config.name - the name of the custom component
|