@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
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import cx from 'classnames';
|
|
10
|
-
import React__default from 'react';
|
|
10
|
+
import React__default, { useContext } from 'react';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
12
|
import { ListBoxSize, ListBoxType } from './ListBoxPropTypes.js';
|
|
13
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
@@ -16,6 +16,7 @@ import ListBoxMenu from './ListBoxMenu.js';
|
|
|
16
16
|
import ListBoxMenuIcon from './ListBoxMenuIcon.js';
|
|
17
17
|
import ListBoxMenuItem from './ListBoxMenuItem.js';
|
|
18
18
|
import ListBoxSelection from './ListBoxSelection.js';
|
|
19
|
+
import { FormContext } from '../FluidForm/FormContext.js';
|
|
19
20
|
|
|
20
21
|
var _excluded = ["children", "className", "disabled", "type", "size", "invalid", "invalidText", "warn", "warnText", "light", "isOpen"];
|
|
21
22
|
|
|
@@ -52,15 +53,21 @@ var ListBox = /*#__PURE__*/React__default.forwardRef(function ListBox(_ref, ref)
|
|
|
52
53
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
53
54
|
|
|
54
55
|
var prefix = usePrefix();
|
|
56
|
+
|
|
57
|
+
var _useContext = useContext(FormContext),
|
|
58
|
+
isFluid = _useContext.isFluid;
|
|
59
|
+
|
|
55
60
|
var showWarning = !invalid && warn;
|
|
56
|
-
var className = cx((_cx = {}, _defineProperty(_cx, containerClassName, !!containerClassName), _defineProperty(_cx, "".concat(prefix, "--list-box"), true), _defineProperty(_cx, "".concat(prefix, "--list-box--").concat(size), size), _defineProperty(_cx, "".concat(prefix, "--list-box--inline"), type === 'inline'), _defineProperty(_cx, "".concat(prefix, "--list-box--disabled"), disabled), _defineProperty(_cx, "".concat(prefix, "--list-box--light"), light), _defineProperty(_cx, "".concat(prefix, "--list-box--expanded"), isOpen), _defineProperty(_cx, "".concat(prefix, "--list-box--warning"), showWarning), _cx));
|
|
61
|
+
var className = cx((_cx = {}, _defineProperty(_cx, containerClassName, !!containerClassName), _defineProperty(_cx, "".concat(prefix, "--list-box"), true), _defineProperty(_cx, "".concat(prefix, "--list-box--").concat(size), size), _defineProperty(_cx, "".concat(prefix, "--list-box--inline"), type === 'inline'), _defineProperty(_cx, "".concat(prefix, "--list-box--disabled"), disabled), _defineProperty(_cx, "".concat(prefix, "--list-box--light"), light), _defineProperty(_cx, "".concat(prefix, "--list-box--expanded"), isOpen), _defineProperty(_cx, "".concat(prefix, "--list-box--invalid"), invalid), _defineProperty(_cx, "".concat(prefix, "--list-box--warning"), showWarning), _cx));
|
|
57
62
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
|
|
58
63
|
className: className,
|
|
59
64
|
ref: ref,
|
|
60
65
|
onKeyDown: handleOnKeyDown,
|
|
61
66
|
onClick: handleClick,
|
|
62
67
|
"data-invalid": invalid || undefined
|
|
63
|
-
}), children),
|
|
68
|
+
}), children), isFluid && /*#__PURE__*/React__default.createElement("hr", {
|
|
69
|
+
className: "".concat(prefix, "--list-box__divider")
|
|
70
|
+
}), invalid ? /*#__PURE__*/React__default.createElement("div", {
|
|
64
71
|
className: "".concat(prefix, "--form-requirement")
|
|
65
72
|
}, invalidText) : null, showWarning ? /*#__PURE__*/React__default.createElement("div", {
|
|
66
73
|
className: "".concat(prefix, "--form-requirement")
|
|
@@ -17,11 +17,15 @@ var _excluded = ["active", "className", "withOverlay", "small", "description"];
|
|
|
17
17
|
function Loading(_ref) {
|
|
18
18
|
var _cx, _cx2;
|
|
19
19
|
|
|
20
|
-
var active = _ref.active,
|
|
20
|
+
var _ref$active = _ref.active,
|
|
21
|
+
active = _ref$active === void 0 ? true : _ref$active,
|
|
21
22
|
customClassName = _ref.className,
|
|
22
|
-
withOverlay = _ref.withOverlay,
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
_ref$withOverlay = _ref.withOverlay,
|
|
24
|
+
withOverlay = _ref$withOverlay === void 0 ? true : _ref$withOverlay,
|
|
25
|
+
_ref$small = _ref.small,
|
|
26
|
+
small = _ref$small === void 0 ? false : _ref$small,
|
|
27
|
+
_ref$description = _ref.description,
|
|
28
|
+
description = _ref$description === void 0 ? 'loading' : _ref$description,
|
|
25
29
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
26
30
|
|
|
27
31
|
var prefix = usePrefix();
|
|
@@ -81,11 +85,5 @@ Loading.propTypes = {
|
|
|
81
85
|
*/
|
|
82
86
|
withOverlay: PropTypes.bool
|
|
83
87
|
};
|
|
84
|
-
Loading.defaultProps = {
|
|
85
|
-
active: true,
|
|
86
|
-
withOverlay: true,
|
|
87
|
-
small: false,
|
|
88
|
-
description: 'loading'
|
|
89
|
-
};
|
|
90
88
|
|
|
91
89
|
export { Loading as default };
|
|
@@ -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;
|
|
@@ -27,7 +27,7 @@ import ListBoxSelection from '../ListBox/next/ListBoxSelection.js';
|
|
|
27
27
|
import ListBoxTrigger from '../ListBox/next/ListBoxTrigger.js';
|
|
28
28
|
import ListBox from '../ListBox/ListBox.js';
|
|
29
29
|
import { ListBoxSize } from '../ListBox/ListBoxPropTypes.js';
|
|
30
|
-
import { Space } from '../../internal/keyboard/keys.js';
|
|
30
|
+
import { Space, Tab } from '../../internal/keyboard/keys.js';
|
|
31
31
|
|
|
32
32
|
var FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function FilterableMultiSelect(_ref, ref) {
|
|
33
33
|
var _cx, _cx2, _cx3, _cx4;
|
|
@@ -280,6 +280,10 @@ var FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function Filt
|
|
|
280
280
|
if (match(event, Space)) {
|
|
281
281
|
event.stopPropagation();
|
|
282
282
|
}
|
|
283
|
+
|
|
284
|
+
if (match(event, Tab)) {
|
|
285
|
+
handleOnMenuChange(false);
|
|
286
|
+
}
|
|
283
287
|
},
|
|
284
288
|
onFocus: function onFocus() {
|
|
285
289
|
setInputFocused(true);
|
|
@@ -19,7 +19,7 @@ import { Escape } from '../../internal/keyboard/keys.js';
|
|
|
19
19
|
|
|
20
20
|
var _Close;
|
|
21
21
|
|
|
22
|
-
var _excluded = ["className", "type", "id", "placeHolderText", "placeholder", "labelText", "closeButtonLabelText", "small", "size", "light", "disabled", "onChange", "onKeyDown", "renderIcon", "onClear"];
|
|
22
|
+
var _excluded = ["className", "type", "id", "placeHolderText", "placeholder", "labelText", "closeButtonLabelText", "small", "size", "light", "disabled", "onChange", "onKeyDown", "renderIcon", "onClear", "onExpand"];
|
|
23
23
|
|
|
24
24
|
var Search = /*#__PURE__*/function (_Component) {
|
|
25
25
|
_inherits(Search, _Component);
|
|
@@ -104,6 +104,7 @@ var Search = /*#__PURE__*/function (_Component) {
|
|
|
104
104
|
onKeyDown = _this$props.onKeyDown,
|
|
105
105
|
renderIcon = _this$props.renderIcon;
|
|
106
106
|
_this$props.onClear;
|
|
107
|
+
_this$props.onExpand;
|
|
107
108
|
var other = _objectWithoutProperties(_this$props, _excluded);
|
|
108
109
|
|
|
109
110
|
var hasContent = this.state.hasContent;
|
|
@@ -78,19 +78,19 @@ var Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forwar
|
|
|
78
78
|
setPrevValue(value);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
function clearInput(
|
|
81
|
+
function clearInput() {
|
|
82
82
|
if (!value) {
|
|
83
83
|
inputRef.current.value = '';
|
|
84
|
-
onChange(event);
|
|
85
|
-
} else {
|
|
86
|
-
var clearedEvt = Object.assign({}, event.target, {
|
|
87
|
-
target: {
|
|
88
|
-
value: ''
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
onChange(clearedEvt);
|
|
92
84
|
}
|
|
93
85
|
|
|
86
|
+
var inputTarget = Object.assign({}, inputRef.current, {
|
|
87
|
+
value: ''
|
|
88
|
+
});
|
|
89
|
+
var clearedEvt = {
|
|
90
|
+
target: inputTarget,
|
|
91
|
+
type: 'change'
|
|
92
|
+
};
|
|
93
|
+
onChange(clearedEvt);
|
|
94
94
|
onClear();
|
|
95
95
|
setHasContent(false);
|
|
96
96
|
focus(inputRef);
|
|
@@ -103,7 +103,7 @@ var Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forwar
|
|
|
103
103
|
function handleKeyDown(event) {
|
|
104
104
|
if (match(event, Escape)) {
|
|
105
105
|
event.stopPropagation();
|
|
106
|
-
clearInput(
|
|
106
|
+
clearInput();
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
|
|
@@ -114,11 +114,7 @@ var Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forwar
|
|
|
114
114
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
115
115
|
role: onExpand ? 'button' : null,
|
|
116
116
|
className: "".concat(prefix, "--search-magnifier"),
|
|
117
|
-
onClick:
|
|
118
|
-
if (onExpand) {
|
|
119
|
-
onExpand();
|
|
120
|
-
}
|
|
121
|
-
}
|
|
117
|
+
onClick: onExpand
|
|
122
118
|
}, /*#__PURE__*/React__default.createElement(CustomSearchIcon, {
|
|
123
119
|
icon: renderIcon
|
|
124
120
|
})), /*#__PURE__*/React__default.createElement("label", {
|
|
@@ -206,13 +206,14 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
|
|
|
206
206
|
|
|
207
207
|
_this.setState({
|
|
208
208
|
value: value,
|
|
209
|
-
left: left
|
|
210
|
-
needsOnRelease: true
|
|
209
|
+
left: left
|
|
211
210
|
});
|
|
212
211
|
}
|
|
213
212
|
});
|
|
214
213
|
|
|
215
214
|
_defineProperty(_assertThisInitialized(_this), "onBlur", function (evt) {
|
|
215
|
+
var _this$props$onBlur, _this$props;
|
|
216
|
+
|
|
216
217
|
// Do nothing if we have no valid event, target, or value
|
|
217
218
|
if (!evt || !('target' in evt) || typeof evt.target.value !== 'string') {
|
|
218
219
|
return;
|
|
@@ -226,7 +227,7 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
|
|
|
226
227
|
isValid: validity
|
|
227
228
|
});
|
|
228
229
|
|
|
229
|
-
_this.props.onBlur({
|
|
230
|
+
(_this$props$onBlur = (_this$props = _this.props).onBlur) === null || _this$props$onBlur === void 0 ? void 0 : _this$props$onBlur.call(_this$props, {
|
|
230
231
|
value: value
|
|
231
232
|
});
|
|
232
233
|
});
|
|
@@ -377,27 +378,27 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
|
|
|
377
378
|
value: function render() {
|
|
378
379
|
var _this2 = this;
|
|
379
380
|
|
|
380
|
-
var _this$
|
|
381
|
-
ariaLabelInput = _this$
|
|
382
|
-
className = _this$
|
|
383
|
-
hideTextInput = _this$
|
|
384
|
-
_this$
|
|
385
|
-
id = _this$
|
|
386
|
-
min = _this$
|
|
387
|
-
minLabel = _this$
|
|
388
|
-
max = _this$
|
|
389
|
-
maxLabel = _this$
|
|
390
|
-
_this$
|
|
391
|
-
formatLabel = _this$
|
|
392
|
-
labelText = _this$
|
|
393
|
-
step = _this$
|
|
394
|
-
_this$
|
|
395
|
-
var inputType = _this$
|
|
396
|
-
required = _this$
|
|
397
|
-
disabled = _this$
|
|
398
|
-
name = _this$
|
|
399
|
-
light = _this$
|
|
400
|
-
other = _objectWithoutProperties(_this$
|
|
381
|
+
var _this$props2 = this.props,
|
|
382
|
+
ariaLabelInput = _this$props2.ariaLabelInput,
|
|
383
|
+
className = _this$props2.className,
|
|
384
|
+
hideTextInput = _this$props2.hideTextInput,
|
|
385
|
+
_this$props2$id = _this$props2.id,
|
|
386
|
+
id = _this$props2$id === void 0 ? this.inputId = this.inputId || "__carbon-slider_".concat(Math.random().toString(36).substr(2)) : _this$props2$id,
|
|
387
|
+
min = _this$props2.min,
|
|
388
|
+
minLabel = _this$props2.minLabel,
|
|
389
|
+
max = _this$props2.max,
|
|
390
|
+
maxLabel = _this$props2.maxLabel,
|
|
391
|
+
_this$props2$formatLa = _this$props2.formatLabel,
|
|
392
|
+
formatLabel = _this$props2$formatLa === void 0 ? defaultFormatLabel : _this$props2$formatLa,
|
|
393
|
+
labelText = _this$props2.labelText,
|
|
394
|
+
step = _this$props2.step;
|
|
395
|
+
_this$props2.stepMultiplier;
|
|
396
|
+
var inputType = _this$props2.inputType,
|
|
397
|
+
required = _this$props2.required,
|
|
398
|
+
disabled = _this$props2.disabled,
|
|
399
|
+
name = _this$props2.name,
|
|
400
|
+
light = _this$props2.light,
|
|
401
|
+
other = _objectWithoutProperties(_this$props2, _excluded);
|
|
401
402
|
|
|
402
403
|
delete other.onRelease;
|
|
403
404
|
delete other.invalid;
|
|
@@ -219,7 +219,7 @@ TextInput.propTypes = {
|
|
|
219
219
|
light: PropTypes.bool,
|
|
220
220
|
|
|
221
221
|
/**
|
|
222
|
-
* Max character count allowed for the
|
|
222
|
+
* Max character count allowed for the input. This is needed in order for enableCounter to display
|
|
223
223
|
*/
|
|
224
224
|
maxCount: PropTypes.number,
|
|
225
225
|
|
package/es/index.js
CHANGED
|
@@ -92,6 +92,7 @@ export { default as TabsSkeleton } from './components/Tabs/Tabs.Skeleton.js';
|
|
|
92
92
|
export { default as TextInputSkeleton } from './components/TextInput/TextInput.Skeleton.js';
|
|
93
93
|
export { default as ToggleSmallSkeleton } from './components/ToggleSmall/ToggleSmall.Skeleton.js';
|
|
94
94
|
export { default as IconSkeleton } from './components/Icon/Icon.Skeleton.js';
|
|
95
|
+
import './components/ContainedList/index.js';
|
|
95
96
|
export { FeatureFlags as unstable_FeatureFlags, useFeatureFlag as unstable_useFeatureFlag, useFeatureFlags as unstable_useFeatureFlags } from './components/FeatureFlags/index.js';
|
|
96
97
|
export { Heading, Section } from './components/Heading/index.js';
|
|
97
98
|
export { IconButton } from './components/IconButton/index.js';
|
|
@@ -120,9 +121,12 @@ export { default as SideNavFooter } from './components/UIShell/SideNavFooter.js'
|
|
|
120
121
|
export { default as SideNavIcon } from './components/UIShell/SideNavIcon.js';
|
|
121
122
|
export { default as SideNavItem } from './components/UIShell/SideNavItem.js';
|
|
122
123
|
export { default as SideNavLinkText } from './components/UIShell/SideNavLinkText.js';
|
|
124
|
+
export { default as unstable_ContainedListItem } from './components/ContainedList/ContainedListItem/ContainedListItem.js';
|
|
123
125
|
export { default as unstable_useContextMenu } from './components/ContextMenu/useContextMenu.js';
|
|
124
|
-
export { default as unstable__FluidTextInput } from './components/FluidTextInput/FluidTextInput.js';
|
|
125
126
|
export { default as unstable__FluidTextArea } from './components/FluidTextArea/FluidTextArea.js';
|
|
127
|
+
export { default as unstable__FluidTextAreaSkeleton } from './components/FluidTextArea/FluidTextArea.Skeleton.js';
|
|
128
|
+
export { default as unstable__FluidTextInput } from './components/FluidTextInput/FluidTextInput.js';
|
|
129
|
+
export { default as unstable__FluidTextInputSkeleton } from './components/FluidTextInput/FluidTextInput.Skeleton.js';
|
|
126
130
|
export { default as unstable_MenuDivider } from './components/Menu/MenuDivider.js';
|
|
127
131
|
export { default as unstable_MenuGroup } from './components/Menu/MenuGroup.js';
|
|
128
132
|
export { default as unstable_MenuItem } from './components/Menu/MenuItem.js';
|
|
@@ -134,6 +138,7 @@ export { default as ProgressBar } from './components/ProgressBar/ProgressBar.js'
|
|
|
134
138
|
export { default as MultiSelect } from './components/MultiSelect/MultiSelect.js';
|
|
135
139
|
export { default as TextInput } from './components/TextInput/TextInput.js';
|
|
136
140
|
export { default as TreeView } from './components/TreeView/TreeView.js';
|
|
141
|
+
export { default as unstable_ContainedList } from './components/ContainedList/ContainedList.js';
|
|
137
142
|
export { default as unstable_Menu } from './components/Menu/Menu.js';
|
|
138
143
|
export { default as Breadcrumb } from './components/Breadcrumb/Breadcrumb.js';
|
|
139
144
|
export { default as BreadcrumbItem } from './components/Breadcrumb/BreadcrumbItem.js';
|
|
@@ -194,6 +199,8 @@ export { default as SideNavLink } from './components/UIShell/SideNavLink.js';
|
|
|
194
199
|
export { SideNavMenu } from './components/UIShell/SideNavMenu.js';
|
|
195
200
|
export { default as SideNavMenuItem } from './components/UIShell/SideNavMenuItem.js';
|
|
196
201
|
export { default as SideNavSwitcher } from './components/UIShell/SideNavSwitcher.js';
|
|
202
|
+
export { default as unstable__FluidDropdown } from './components/FluidDropdown/FluidDropdown.js';
|
|
203
|
+
export { default as unstable__FluidDropdownSkeleton } from './components/FluidDropdown/FluidDropdown.Skeleton.js';
|
|
197
204
|
export { LayoutDirection as unstable_LayoutDirection } from './components/Layout/LayoutDirection.js';
|
|
198
205
|
export { useLayoutDirection as unstable_useLayoutDirection } from './components/Layout/useLayoutDirection.js';
|
|
199
206
|
export { Stack } from './components/Stack/Stack.js';
|
|
@@ -0,0 +1,77 @@
|
|
|
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 React = require('react');
|
|
13
|
+
var PropTypes = require('prop-types');
|
|
14
|
+
var cx = require('classnames');
|
|
15
|
+
var useId = require('../../internal/useId.js');
|
|
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 React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
21
|
+
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
22
|
+
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
23
|
+
|
|
24
|
+
var variants = ['on-page', 'disclosed'];
|
|
25
|
+
|
|
26
|
+
function ContainedList(_ref) {
|
|
27
|
+
var action = _ref.action,
|
|
28
|
+
children = _ref.children,
|
|
29
|
+
className = _ref.className,
|
|
30
|
+
_ref$kind = _ref.kind,
|
|
31
|
+
kind = _ref$kind === void 0 ? variants[0] : _ref$kind,
|
|
32
|
+
label = _ref.label;
|
|
33
|
+
var labelId = "".concat(useId.useId('contained-list'), "-header");
|
|
34
|
+
var prefix = usePrefix.usePrefix();
|
|
35
|
+
var classes = cx__default["default"]("".concat(prefix, "--contained-list"), "".concat(prefix, "--contained-list--").concat(kind), className);
|
|
36
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
37
|
+
className: classes
|
|
38
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
39
|
+
className: "".concat(prefix, "--contained-list__header")
|
|
40
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
41
|
+
id: labelId,
|
|
42
|
+
className: "".concat(prefix, "--contained-list__label")
|
|
43
|
+
}, label), action && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
44
|
+
className: "".concat(prefix, "--contained-list__action")
|
|
45
|
+
}, action)), /*#__PURE__*/React__default["default"].createElement("ul", {
|
|
46
|
+
"aria-labelledby": labelId
|
|
47
|
+
}, children));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
ContainedList.propTypes = {
|
|
51
|
+
/**
|
|
52
|
+
* A slot for a possible interactive element to render.
|
|
53
|
+
*/
|
|
54
|
+
action: PropTypes__default["default"].node,
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* A collection of ContainedListItems to be rendered in the ContainedList
|
|
58
|
+
*/
|
|
59
|
+
children: PropTypes__default["default"].node,
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Additional CSS class names.
|
|
63
|
+
*/
|
|
64
|
+
className: PropTypes__default["default"].string,
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The kind of ContainedList you want to display
|
|
68
|
+
*/
|
|
69
|
+
kind: PropTypes__default["default"].oneOf(variants),
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* A label describing the contained list.
|
|
73
|
+
*/
|
|
74
|
+
label: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].node]).isRequired
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
exports["default"] = ContainedList;
|
|
@@ -0,0 +1,86 @@
|
|
|
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 React = require('react');
|
|
14
|
+
var PropTypes = require('prop-types');
|
|
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 React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
21
|
+
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
22
|
+
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
23
|
+
|
|
24
|
+
function ContainedListItem(_ref) {
|
|
25
|
+
var _classNames;
|
|
26
|
+
|
|
27
|
+
var action = _ref.action,
|
|
28
|
+
children = _ref.children,
|
|
29
|
+
className = _ref.className,
|
|
30
|
+
_ref$disabled = _ref.disabled,
|
|
31
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
32
|
+
onClick = _ref.onClick,
|
|
33
|
+
IconElement = _ref.renderIcon;
|
|
34
|
+
var prefix = usePrefix.usePrefix();
|
|
35
|
+
var isClickable = onClick !== undefined;
|
|
36
|
+
var classes = cx__default["default"]("".concat(prefix, "--contained-list-item"), className, (_classNames = {}, _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(prefix, "--contained-list-item--clickable"), isClickable), _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(prefix, "--contained-list-item--with-icon"), IconElement), _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(prefix, "--contained-list-item--with-action"), action), _classNames));
|
|
37
|
+
var content = /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, IconElement && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
38
|
+
className: "".concat(prefix, "--contained-list-item__icon")
|
|
39
|
+
}, /*#__PURE__*/React__default["default"].createElement(IconElement, null)), /*#__PURE__*/React__default["default"].createElement("div", null, children));
|
|
40
|
+
return /*#__PURE__*/React__default["default"].createElement("li", {
|
|
41
|
+
className: classes
|
|
42
|
+
}, isClickable ? /*#__PURE__*/React__default["default"].createElement("button", {
|
|
43
|
+
className: "".concat(prefix, "--contained-list-item__content"),
|
|
44
|
+
type: "button",
|
|
45
|
+
disabled: disabled,
|
|
46
|
+
onClick: onClick
|
|
47
|
+
}, content) : /*#__PURE__*/React__default["default"].createElement("div", {
|
|
48
|
+
className: "".concat(prefix, "--contained-list-item__content")
|
|
49
|
+
}, content), action && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
50
|
+
className: "".concat(prefix, "--contained-list-item__action")
|
|
51
|
+
}, action));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
ContainedListItem.propTypes = {
|
|
55
|
+
/**
|
|
56
|
+
* A slot for a possible interactive element to render within the item.
|
|
57
|
+
*/
|
|
58
|
+
action: PropTypes__default["default"].node,
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The content of this item. Must not contain any interactive elements. Use props.action to include those.
|
|
62
|
+
*/
|
|
63
|
+
children: PropTypes__default["default"].node,
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Additional CSS class names.
|
|
67
|
+
*/
|
|
68
|
+
className: PropTypes__default["default"].string,
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Whether this item is disabled.
|
|
72
|
+
*/
|
|
73
|
+
disabled: PropTypes__default["default"].bool,
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Provide an optional function to be called when the item is clicked.
|
|
77
|
+
*/
|
|
78
|
+
onClick: PropTypes__default["default"].func,
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Provide an optional icon to render in front of the item's content.
|
|
82
|
+
*/
|
|
83
|
+
renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object])
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
exports["default"] = ContainedListItem;
|
|
@@ -0,0 +1,18 @@
|
|
|
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 ContainedList = require('./ContainedList.js');
|
|
13
|
+
var ContainedListItem = require('./ContainedListItem/ContainedListItem.js');
|
|
14
|
+
|
|
15
|
+
ContainedList["default"].ContainedListItem = ContainedListItem["default"];
|
|
16
|
+
|
|
17
|
+
exports["default"] = ContainedList["default"];
|
|
18
|
+
exports.ContainedListItem = ContainedListItem["default"];
|
|
@@ -29,7 +29,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
29
29
|
var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
|
|
30
30
|
|
|
31
31
|
var _excluded = ["header", "onClick", "isSortable"],
|
|
32
|
-
_excluded2 = ["onClick"],
|
|
32
|
+
_excluded2 = ["onClick", "onExpand"],
|
|
33
33
|
_excluded3 = ["row", "onClick"],
|
|
34
34
|
_excluded4 = ["onClick", "row"];
|
|
35
35
|
|
|
@@ -107,6 +107,7 @@ var DataTable = /*#__PURE__*/function (_React$Component) {
|
|
|
107
107
|
_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.assertThisInitialized(_this), "getExpandHeaderProps", function () {
|
|
108
108
|
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
109
109
|
onClick = _ref2.onClick,
|
|
110
|
+
onExpand = _ref2.onExpand,
|
|
110
111
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref2, _excluded2);
|
|
111
112
|
|
|
112
113
|
var t = _this.props.translateWithId;
|
|
@@ -123,7 +124,7 @@ var DataTable = /*#__PURE__*/function (_React$Component) {
|
|
|
123
124
|
isExpanded: isExpanded,
|
|
124
125
|
// Compose the event handlers so we don't overwrite a consumer's `onClick`
|
|
125
126
|
// handler
|
|
126
|
-
onExpand: events.composeEventHandlers([_this.handleOnExpandAll, onClick ? _this.handleOnExpandHeaderClick(onClick, {
|
|
127
|
+
onExpand: events.composeEventHandlers([_this.handleOnExpandAll, onExpand, onClick ? _this.handleOnExpandHeaderClick(onClick, {
|
|
127
128
|
isExpanded: isExpanded
|
|
128
129
|
}) : null])
|
|
129
130
|
});
|
|
@@ -24,13 +24,15 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
24
24
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
25
25
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
26
26
|
|
|
27
|
-
var _excluded = ["ariaLabel", "className", "enableExpando", "enableToggle", "isExpanded", "onExpand", "expandIconDescription", "children"];
|
|
27
|
+
var _excluded = ["ariaLabel", "className", "enableExpando", "enableToggle", "id", "isExpanded", "onExpand", "expandIconDescription", "children"];
|
|
28
28
|
|
|
29
29
|
var TableExpandHeader = function TableExpandHeader(_ref) {
|
|
30
30
|
var ariaLabel = _ref.ariaLabel,
|
|
31
31
|
headerClassName = _ref.className,
|
|
32
32
|
enableExpando = _ref.enableExpando,
|
|
33
33
|
enableToggle = _ref.enableToggle,
|
|
34
|
+
_ref$id = _ref.id,
|
|
35
|
+
id = _ref$id === void 0 ? 'expand' : _ref$id,
|
|
34
36
|
isExpanded = _ref.isExpanded,
|
|
35
37
|
onExpand = _ref.onExpand,
|
|
36
38
|
expandIconDescription = _ref.expandIconDescription,
|
|
@@ -43,7 +45,8 @@ var TableExpandHeader = function TableExpandHeader(_ref) {
|
|
|
43
45
|
return /*#__PURE__*/React__default["default"].createElement("th", _rollupPluginBabelHelpers["extends"]({
|
|
44
46
|
scope: "col",
|
|
45
47
|
className: className,
|
|
46
|
-
"data-previous-value": previousValue
|
|
48
|
+
"data-previous-value": previousValue,
|
|
49
|
+
id: id
|
|
47
50
|
}, rest), enableExpando || enableToggle ? /*#__PURE__*/React__default["default"].createElement("button", {
|
|
48
51
|
type: "button",
|
|
49
52
|
className: "".concat(prefix, "--table-expand__button"),
|
|
@@ -80,6 +83,11 @@ TableExpandHeader.propTypes = {
|
|
|
80
83
|
*/
|
|
81
84
|
expandIconDescription: PropTypes__default["default"].string,
|
|
82
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Supply an id to the th element.
|
|
88
|
+
*/
|
|
89
|
+
id: PropTypes__default["default"].string,
|
|
90
|
+
|
|
83
91
|
/**
|
|
84
92
|
* Specify whether this row is expanded or not. This helps coordinate data
|
|
85
93
|
* attributes so that `TableExpandRow` and `TableExpandedRow` work together
|
|
@@ -35,7 +35,8 @@ var TableExpandRow = function TableExpandRow(_ref) {
|
|
|
35
35
|
onExpand = _ref.onExpand,
|
|
36
36
|
expandIconDescription = _ref.expandIconDescription,
|
|
37
37
|
isSelected = _ref.isSelected,
|
|
38
|
-
expandHeader = _ref.expandHeader,
|
|
38
|
+
_ref$expandHeader = _ref.expandHeader,
|
|
39
|
+
expandHeader = _ref$expandHeader === void 0 ? 'expand' : _ref$expandHeader,
|
|
39
40
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
40
41
|
|
|
41
42
|
var prefix = usePrefix.usePrefix();
|
|
@@ -95,9 +96,6 @@ TableExpandRow.propTypes = {
|
|
|
95
96
|
*/
|
|
96
97
|
onExpand: PropTypes__default["default"].func.isRequired
|
|
97
98
|
};
|
|
98
|
-
TableExpandRow.defaultProps = {
|
|
99
|
-
expandHeader: 'expand'
|
|
100
|
-
};
|
|
101
99
|
var TableExpandRow$1 = TableExpandRow;
|
|
102
100
|
|
|
103
101
|
exports["default"] = TableExpandRow$1;
|
|
@@ -48,6 +48,9 @@ var getDerivedStateFromProps = function getDerivedStateFromProps(props, prevStat
|
|
|
48
48
|
state.rowIds = _rowIds;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
state.isExpandedAll = state.rowIds.every(function (id) {
|
|
52
|
+
return state.rowsById[id].isExpanded === true;
|
|
53
|
+
});
|
|
51
54
|
return state;
|
|
52
55
|
};
|
|
53
56
|
|