@carbon/react 1.14.0-rc.0 → 1.15.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.
Files changed (53) hide show
  1. package/es/components/ContainedList/ContainedList.js +67 -0
  2. package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +76 -0
  3. package/es/components/ContainedList/index.js +13 -0
  4. package/es/components/DataTable/DataTable.js +3 -2
  5. package/es/components/DataTable/state/getDerivedStateFromProps.js +3 -0
  6. package/es/components/Dropdown/Dropdown.js +22 -4
  7. package/es/components/ExpandableSearch/ExpandableSearch.js +25 -12
  8. package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +41 -0
  9. package/es/components/FluidDropdown/FluidDropdown.js +140 -0
  10. package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +42 -0
  11. package/es/components/FluidTextInput/FluidTextInput.Skeleton.js +42 -0
  12. package/es/components/ListBox/ListBox.js +10 -3
  13. package/es/components/Loading/Loading.js +8 -10
  14. package/es/components/MultiSelect/FilterableMultiSelect.js +5 -1
  15. package/es/components/NumberInput/NumberInput.js +2 -2
  16. package/es/components/Search/Search.js +2 -1
  17. package/es/components/Search/next/Search.js +11 -15
  18. package/es/components/Slider/Slider.js +25 -24
  19. package/es/components/TextInput/TextInput.js +42 -6
  20. package/es/index.js +8 -3
  21. package/lib/components/ContainedList/ContainedList.js +77 -0
  22. package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +86 -0
  23. package/lib/components/ContainedList/index.js +18 -0
  24. package/lib/components/DataTable/DataTable.js +3 -2
  25. package/lib/components/DataTable/state/getDerivedStateFromProps.js +3 -0
  26. package/lib/components/Dropdown/Dropdown.js +20 -2
  27. package/lib/components/ExpandableSearch/ExpandableSearch.js +24 -11
  28. package/lib/components/FluidDropdown/FluidDropdown.Skeleton.js +51 -0
  29. package/lib/components/FluidDropdown/FluidDropdown.js +150 -0
  30. package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +52 -0
  31. package/lib/components/FluidTextInput/FluidTextInput.Skeleton.js +52 -0
  32. package/lib/components/ListBox/ListBox.js +9 -2
  33. package/lib/components/Loading/Loading.js +8 -10
  34. package/lib/components/MultiSelect/FilterableMultiSelect.js +4 -0
  35. package/lib/components/NumberInput/NumberInput.js +2 -2
  36. package/lib/components/Search/Search.js +2 -1
  37. package/lib/components/Search/next/Search.js +11 -15
  38. package/lib/components/Slider/Slider.js +25 -24
  39. package/lib/components/TextInput/TextInput.js +40 -4
  40. package/lib/index.js +15 -6
  41. package/package.json +7 -7
  42. package/scss/components/fluid-dropdown/_fluid-dropdown.scss +9 -0
  43. package/scss/components/fluid-dropdown/_index.scss +9 -0
  44. package/scss/components/fluid-list-box/_fluid-list-box.scss +9 -0
  45. package/scss/components/fluid-list-box/_index.scss +9 -0
  46. package/scss/components/fluid-text-area/_fluid-text-area.scss +9 -0
  47. package/scss/components/fluid-text-area/_index.scss +9 -0
  48. package/scss/components/fluid-text-input/_fluid-text-input.scss +9 -0
  49. package/scss/components/fluid-text-input/_index.scss +9 -0
  50. package/es/components/SearchFilterButton/SearchFilterButton.js +0 -61
  51. package/es/components/SearchLayoutButton/SearchLayoutButton.js +0 -151
  52. package/lib/components/SearchFilterButton/SearchFilterButton.js +0 -70
  53. package/lib/components/SearchLayoutButton/SearchLayoutButton.js +0 -160
@@ -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
- small = _ref.small,
24
- description = _ref.description,
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 };
@@ -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);
@@ -187,7 +187,7 @@ var NumberInput = /*#__PURE__*/React__default.forwardRef(function NumberInput(pr
187
187
  disabled: disabled,
188
188
  onClick: function onClick(event) {
189
189
  var state = {
190
- value: clamp(max, min, value - step),
190
+ value: clamp(max, min, parseInt(value) - step),
191
191
  direction: 'down'
192
192
  };
193
193
  setValue(state.value);
@@ -213,7 +213,7 @@ var NumberInput = /*#__PURE__*/React__default.forwardRef(function NumberInput(pr
213
213
  disabled: disabled,
214
214
  onClick: function onClick(event) {
215
215
  var state = {
216
- value: clamp(max, min, value + step),
216
+ value: clamp(max, min, parseInt(value) + step),
217
217
  direction: 'up'
218
218
  };
219
219
  setValue(state.value);
@@ -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(event) {
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(event);
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: function 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$props = this.props,
381
- ariaLabelInput = _this$props.ariaLabelInput,
382
- className = _this$props.className,
383
- hideTextInput = _this$props.hideTextInput,
384
- _this$props$id = _this$props.id,
385
- id = _this$props$id === void 0 ? this.inputId = this.inputId || "__carbon-slider_".concat(Math.random().toString(36).substr(2)) : _this$props$id,
386
- min = _this$props.min,
387
- minLabel = _this$props.minLabel,
388
- max = _this$props.max,
389
- maxLabel = _this$props.maxLabel,
390
- _this$props$formatLab = _this$props.formatLabel,
391
- formatLabel = _this$props$formatLab === void 0 ? defaultFormatLabel : _this$props$formatLab,
392
- labelText = _this$props.labelText,
393
- step = _this$props.step;
394
- _this$props.stepMultiplier;
395
- var inputType = _this$props.inputType,
396
- required = _this$props.required,
397
- disabled = _this$props.disabled,
398
- name = _this$props.name,
399
- light = _this$props.light,
400
- other = _objectWithoutProperties(_this$props, _excluded);
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;
@@ -5,9 +5,9 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
8
+ import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, defineProperty as _defineProperty, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import PropTypes from 'prop-types';
10
- import React__default, { useContext } from 'react';
10
+ import React__default, { useState, useContext } from 'react';
11
11
  import cx from 'classnames';
12
12
  import { useNormalizedInputProps } from '../../internal/useNormalizedInputProps.js';
13
13
  import PasswordInput from './PasswordInput.js';
@@ -18,9 +18,9 @@ import * as FeatureFlags from '@carbon/feature-flags';
18
18
  import { usePrefix } from '../../internal/usePrefix.js';
19
19
  import { FormContext } from '../FluidForm/FormContext.js';
20
20
 
21
- var _excluded = ["className", "disabled", "helperText", "hideLabel", "id", "inline", "invalid", "invalidText", "labelText", "light", "onChange", "onClick", "placeholder", "readOnly", "size", "type", "warn", "warnText"];
21
+ var _excluded = ["className", "disabled", "helperText", "hideLabel", "id", "inline", "invalid", "invalidText", "labelText", "light", "onChange", "onClick", "placeholder", "readOnly", "size", "type", "warn", "warnText", "enableCounter", "maxCount"];
22
22
  var TextInput = /*#__PURE__*/React__default.forwardRef(function TextInput(_ref, ref) {
23
- var _classNames, _classNames2, _classNames3, _classNames4, _classNames7;
23
+ var _classNames, _classNames2, _classNames3, _classNames4, _classNames7, _classNames8;
24
24
 
25
25
  var className = _ref.className,
26
26
  _ref$disabled = _ref.disabled,
@@ -49,10 +49,21 @@ var TextInput = /*#__PURE__*/React__default.forwardRef(function TextInput(_ref,
49
49
  _ref$warn = _ref.warn,
50
50
  warn = _ref$warn === void 0 ? false : _ref$warn,
51
51
  warnText = _ref.warnText,
52
+ _ref$enableCounter = _ref.enableCounter,
53
+ enableCounter = _ref$enableCounter === void 0 ? false : _ref$enableCounter,
54
+ maxCount = _ref.maxCount,
52
55
  rest = _objectWithoutProperties(_ref, _excluded);
53
56
 
54
57
  var prefix = usePrefix();
55
58
  var enabled = useFeatureFlag('enable-v11-release');
59
+ var defaultValue = rest.defaultValue,
60
+ value = rest.value;
61
+
62
+ var _useState = useState((defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.length) || (value === null || value === void 0 ? void 0 : value.length) || 0),
63
+ _useState2 = _slicedToArray(_useState, 2),
64
+ textCount = _useState2[0],
65
+ setTextCount = _useState2[1];
66
+
56
67
  var normalizedProps = useNormalizedInputProps({
57
68
  id: id,
58
69
  readOnly: readOnly,
@@ -69,6 +80,10 @@ var TextInput = /*#__PURE__*/React__default.forwardRef(function TextInput(_ref,
69
80
  id: id,
70
81
  onChange: function onChange(evt) {
71
82
  if (!normalizedProps.disabled) {
83
+ var _evt$target$value;
84
+
85
+ setTextCount((_evt$target$value = evt.target.value) === null || _evt$target$value === void 0 ? void 0 : _evt$target$value.length);
86
+
72
87
  _onChange(evt);
73
88
  }
74
89
  },
@@ -86,16 +101,27 @@ var TextInput = /*#__PURE__*/React__default.forwardRef(function TextInput(_ref,
86
101
  readOnly: readOnly
87
102
  }, 'aria-describedby', helperText && normalizedProps.helperId), rest);
88
103
 
104
+ if (enableCounter) {
105
+ sharedTextInputProps.maxLength = maxCount;
106
+ }
107
+
89
108
  var inputWrapperClasses = cx([enabled ? cx("".concat(prefix, "--form-item"), className) : "".concat(prefix, "--form-item")], "".concat(prefix, "--text-input-wrapper"), (_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefix, "--text-input-wrapper--readonly"), readOnly), _defineProperty(_classNames2, "".concat(prefix, "--text-input-wrapper--light"), light), _defineProperty(_classNames2, "".concat(prefix, "--text-input-wrapper--inline"), inline), _classNames2));
90
109
  var labelClasses = cx("".concat(prefix, "--label"), (_classNames3 = {}, _defineProperty(_classNames3, "".concat(prefix, "--visually-hidden"), hideLabel), _defineProperty(_classNames3, "".concat(prefix, "--label--disabled"), normalizedProps.disabled), _defineProperty(_classNames3, "".concat(prefix, "--label--inline"), inline), _defineProperty(_classNames3, "".concat(prefix, "--label--inline--").concat(size), inline && !!size), _classNames3));
91
110
  var helperTextClasses = cx("".concat(prefix, "--form__helper-text"), (_classNames4 = {}, _defineProperty(_classNames4, "".concat(prefix, "--form__helper-text--disabled"), normalizedProps.disabled), _defineProperty(_classNames4, "".concat(prefix, "--form__helper-text--inline"), inline), _classNames4));
92
111
  var fieldOuterWrapperClasses = cx("".concat(prefix, "--text-input__field-outer-wrapper"), _defineProperty({}, "".concat(prefix, "--text-input__field-outer-wrapper--inline"), inline));
93
112
  var fieldWrapperClasses = cx("".concat(prefix, "--text-input__field-wrapper"), _defineProperty({}, "".concat(prefix, "--text-input__field-wrapper--warning"), normalizedProps.warn));
94
113
  var iconClasses = cx((_classNames7 = {}, _defineProperty(_classNames7, "".concat(prefix, "--text-input__invalid-icon"), normalizedProps.invalid || normalizedProps.warn), _defineProperty(_classNames7, "".concat(prefix, "--text-input__invalid-icon--warning"), normalizedProps.warn), _defineProperty(_classNames7, "".concat(prefix, "--text-input__readonly-icon"), readOnly), _classNames7));
114
+ var counterClasses = cx("".concat(prefix, "--label"), (_classNames8 = {}, _defineProperty(_classNames8, "".concat(prefix, "--label--disabled"), disabled), _defineProperty(_classNames8, "".concat(prefix, "--text-input__label-counter"), true), _classNames8));
115
+ var counter = enableCounter && maxCount ? /*#__PURE__*/React__default.createElement("div", {
116
+ className: counterClasses
117
+ }, "".concat(textCount, "/").concat(maxCount)) : null;
95
118
  var label = labelText ? /*#__PURE__*/React__default.createElement("label", {
96
119
  htmlFor: id,
97
120
  className: labelClasses
98
121
  }, labelText) : null;
122
+ var labelWrapper = /*#__PURE__*/React__default.createElement("div", {
123
+ className: "".concat(prefix, "--text-input__label-wrapper")
124
+ }, label, counter);
99
125
  var helper = helperText ? /*#__PURE__*/React__default.createElement("div", {
100
126
  id: normalizedProps.helperId,
101
127
  className: helperTextClasses
@@ -113,9 +139,9 @@ var TextInput = /*#__PURE__*/React__default.forwardRef(function TextInput(_ref,
113
139
 
114
140
  return /*#__PURE__*/React__default.createElement("div", {
115
141
  className: inputWrapperClasses
116
- }, !inline ? label : /*#__PURE__*/React__default.createElement("div", {
142
+ }, !inline ? labelWrapper : /*#__PURE__*/React__default.createElement("div", {
117
143
  className: "".concat(prefix, "--text-input__label-helper-wrapper")
118
- }, label, !isFluid && helper), /*#__PURE__*/React__default.createElement("div", {
144
+ }, labelWrapper, !isFluid && helper), /*#__PURE__*/React__default.createElement("div", {
119
145
  className: fieldOuterWrapperClasses
120
146
  }, /*#__PURE__*/React__default.createElement("div", {
121
147
  className: fieldWrapperClasses,
@@ -145,6 +171,11 @@ TextInput.propTypes = {
145
171
  */
146
172
  disabled: PropTypes.bool,
147
173
 
174
+ /**
175
+ * Specify whether to display the character counter
176
+ */
177
+ enableCounter: PropTypes.bool,
178
+
148
179
  /**
149
180
  * Provide text that is used alongside the control label for additional help
150
181
  */
@@ -187,6 +218,11 @@ TextInput.propTypes = {
187
218
  */
188
219
  light: PropTypes.bool,
189
220
 
221
+ /**
222
+ * Max character count allowed for the input. This is needed in order for enableCounter to display
223
+ */
224
+ maxCount: PropTypes.number,
225
+
190
226
  /**
191
227
  * Optionally provide an `onChange` handler that is called whenever `<input>`
192
228
  * is updated
package/es/index.js CHANGED
@@ -50,8 +50,6 @@ export { default as PrimaryButton } from './components/PrimaryButton/PrimaryButt
50
50
  export { default as RadioButton } from './components/RadioButton/RadioButton.js';
51
51
  export { default as RadioButtonGroup } from './components/RadioButtonGroup/RadioButtonGroup.js';
52
52
  export { default as Search } from './components/Search/index.js';
53
- export { default as SearchFilterButton } from './components/SearchFilterButton/SearchFilterButton.js';
54
- export { default as SearchLayoutButton } from './components/SearchLayoutButton/SearchLayoutButton.js';
55
53
  export { default as ExpandableSearch } from './components/ExpandableSearch/ExpandableSearch.js';
56
54
  export { default as SecondaryButton } from './components/SecondaryButton/SecondaryButton.js';
57
55
  export { default as SelectSkeleton } from './components/Select/Select.Skeleton.js';
@@ -94,6 +92,7 @@ export { default as TabsSkeleton } from './components/Tabs/Tabs.Skeleton.js';
94
92
  export { default as TextInputSkeleton } from './components/TextInput/TextInput.Skeleton.js';
95
93
  export { default as ToggleSmallSkeleton } from './components/ToggleSmall/ToggleSmall.Skeleton.js';
96
94
  export { default as IconSkeleton } from './components/Icon/Icon.Skeleton.js';
95
+ import './components/ContainedList/index.js';
97
96
  export { FeatureFlags as unstable_FeatureFlags, useFeatureFlag as unstable_useFeatureFlag, useFeatureFlags as unstable_useFeatureFlags } from './components/FeatureFlags/index.js';
98
97
  export { Heading, Section } from './components/Heading/index.js';
99
98
  export { IconButton } from './components/IconButton/index.js';
@@ -122,9 +121,12 @@ export { default as SideNavFooter } from './components/UIShell/SideNavFooter.js'
122
121
  export { default as SideNavIcon } from './components/UIShell/SideNavIcon.js';
123
122
  export { default as SideNavItem } from './components/UIShell/SideNavItem.js';
124
123
  export { default as SideNavLinkText } from './components/UIShell/SideNavLinkText.js';
124
+ export { default as unstable_ContainedListItem } from './components/ContainedList/ContainedListItem/ContainedListItem.js';
125
125
  export { default as unstable_useContextMenu } from './components/ContextMenu/useContextMenu.js';
126
- export { default as unstable__FluidTextInput } from './components/FluidTextInput/FluidTextInput.js';
127
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';
128
130
  export { default as unstable_MenuDivider } from './components/Menu/MenuDivider.js';
129
131
  export { default as unstable_MenuGroup } from './components/Menu/MenuGroup.js';
130
132
  export { default as unstable_MenuItem } from './components/Menu/MenuItem.js';
@@ -136,6 +138,7 @@ export { default as ProgressBar } from './components/ProgressBar/ProgressBar.js'
136
138
  export { default as MultiSelect } from './components/MultiSelect/MultiSelect.js';
137
139
  export { default as TextInput } from './components/TextInput/TextInput.js';
138
140
  export { default as TreeView } from './components/TreeView/TreeView.js';
141
+ export { default as unstable_ContainedList } from './components/ContainedList/ContainedList.js';
139
142
  export { default as unstable_Menu } from './components/Menu/Menu.js';
140
143
  export { default as Breadcrumb } from './components/Breadcrumb/Breadcrumb.js';
141
144
  export { default as BreadcrumbItem } from './components/Breadcrumb/BreadcrumbItem.js';
@@ -196,6 +199,8 @@ export { default as SideNavLink } from './components/UIShell/SideNavLink.js';
196
199
  export { SideNavMenu } from './components/UIShell/SideNavMenu.js';
197
200
  export { default as SideNavMenuItem } from './components/UIShell/SideNavMenuItem.js';
198
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';
199
204
  export { LayoutDirection as unstable_LayoutDirection } from './components/Layout/LayoutDirection.js';
200
205
  export { useLayoutDirection as unstable_useLayoutDirection } from './components/Layout/useLayoutDirection.js';
201
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
  });
@@ -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