@carbon/react 1.15.0 → 1.16.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 (71) hide show
  1. package/es/components/CodeSnippet/CodeSnippet.js +2 -2
  2. package/es/components/ComboBox/ComboBox.js +45 -24
  3. package/es/components/DataTable/TableHeader.js +1 -1
  4. package/es/components/DatePicker/DatePicker.js +10 -8
  5. package/es/components/Dropdown/Dropdown.js +2 -2
  6. package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +41 -0
  7. package/es/components/FluidComboBox/FluidComboBox.js +140 -0
  8. package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +41 -0
  9. package/es/components/FluidMultiSelect/FluidMultiSelect.js +151 -0
  10. package/es/components/FluidSelect/FluidSelect.Skeleton.js +41 -0
  11. package/es/components/FluidSelect/FluidSelect.js +93 -0
  12. package/es/components/FluidTextArea/FluidTextArea.js +2 -1
  13. package/es/components/InlineLoading/InlineLoading.js +2 -4
  14. package/es/components/ListBox/ListBox.js +2 -1
  15. package/es/components/MultiSelect/FilterableMultiSelect.js +41 -21
  16. package/es/components/MultiSelect/MultiSelect.js +28 -12
  17. package/es/components/NumberInput/NumberInput.js +45 -1
  18. package/es/components/OverflowMenu/OverflowMenu.js +2 -2
  19. package/es/components/Pagination/Pagination.js +271 -270
  20. package/es/components/Pagination/index.js +1 -6
  21. package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.js +10 -4
  22. package/es/components/Select/Select.js +23 -5
  23. package/es/components/TextArea/TextArea.js +2 -2
  24. package/es/components/TextInput/ControlledPasswordInput.js +2 -3
  25. package/es/components/TextInput/PasswordInput.js +3 -3
  26. package/es/components/TextInput/TextInput.js +7 -8
  27. package/es/components/Tile/next/Tile.js +18 -22
  28. package/es/components/Tooltip/next/DefinitionTooltip.js +11 -2
  29. package/es/components/UIShell/HeaderMenu.js +15 -4
  30. package/es/components/UIShell/SideNavMenu.js +2 -1
  31. package/es/index.js +14 -8
  32. package/es/internal/useNormalizedInputProps.js +15 -18
  33. package/lib/components/CodeSnippet/CodeSnippet.js +2 -2
  34. package/lib/components/ComboBox/ComboBox.js +44 -23
  35. package/lib/components/DataTable/TableHeader.js +1 -1
  36. package/lib/components/DatePicker/DatePicker.js +10 -8
  37. package/lib/components/Dropdown/Dropdown.js +2 -2
  38. package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +51 -0
  39. package/lib/components/FluidComboBox/FluidComboBox.js +150 -0
  40. package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +51 -0
  41. package/lib/components/FluidMultiSelect/FluidMultiSelect.js +161 -0
  42. package/lib/components/FluidSelect/FluidSelect.Skeleton.js +51 -0
  43. package/lib/components/FluidSelect/FluidSelect.js +103 -0
  44. package/lib/components/FluidTextArea/FluidTextArea.js +2 -1
  45. package/lib/components/InlineLoading/InlineLoading.js +2 -4
  46. package/lib/components/ListBox/ListBox.js +2 -1
  47. package/lib/components/MultiSelect/FilterableMultiSelect.js +40 -20
  48. package/lib/components/MultiSelect/MultiSelect.js +27 -11
  49. package/lib/components/NumberInput/NumberInput.js +45 -1
  50. package/lib/components/OverflowMenu/OverflowMenu.js +2 -2
  51. package/lib/components/Pagination/Pagination.js +269 -268
  52. package/lib/components/Pagination/index.js +2 -24
  53. package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.js +9 -3
  54. package/lib/components/Select/Select.js +21 -3
  55. package/lib/components/TextArea/TextArea.js +2 -2
  56. package/lib/components/TextInput/ControlledPasswordInput.js +2 -3
  57. package/lib/components/TextInput/PasswordInput.js +3 -3
  58. package/lib/components/TextInput/TextInput.js +7 -8
  59. package/lib/components/Tile/next/Tile.js +18 -22
  60. package/lib/components/Tooltip/next/DefinitionTooltip.js +11 -2
  61. package/lib/components/UIShell/HeaderMenu.js +15 -4
  62. package/lib/components/UIShell/SideNavMenu.js +2 -1
  63. package/lib/index.js +98 -86
  64. package/lib/internal/useNormalizedInputProps.js +14 -17
  65. package/package.json +4 -4
  66. package/scss/components/fluid-select/_fluid-select.scss +9 -0
  67. package/scss/components/fluid-select/_index.scss +9 -0
  68. package/es/components/FileUploader/index.js +0 -15
  69. package/es/components/Pagination/next/Pagination.js +0 -421
  70. package/lib/components/FileUploader/index.js +0 -39
  71. package/lib/components/Pagination/next/Pagination.js +0 -431
@@ -5,14 +5,15 @@
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 '../../_virtual/_rollupPluginBabelHelpers.js';
8
+ import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import PropTypes from 'prop-types';
10
- import React__default from 'react';
10
+ import React__default, { useContext, useState } from 'react';
11
11
  import cx from 'classnames';
12
12
  import { ChevronDown, WarningFilled, WarningAltFilled } from '@carbon/icons-react';
13
13
  import deprecate from '../../prop-types/deprecate.js';
14
14
  import { useFeatureFlag } from '../FeatureFlags/index.js';
15
15
  import { usePrefix } from '../../internal/usePrefix.js';
16
+ import { FormContext } from '../FluidForm/FormContext.js';
16
17
 
17
18
  var _excluded = ["className", "id", "inline", "labelText", "disabled", "children", "noLabel", "hideLabel", "invalid", "invalidText", "helperText", "light", "size", "warn", "warnText"];
18
19
  var Select = /*#__PURE__*/React__default.forwardRef(function Select(_ref, ref) {
@@ -44,7 +45,16 @@ var Select = /*#__PURE__*/React__default.forwardRef(function Select(_ref, ref) {
44
45
 
45
46
  var prefix = usePrefix();
46
47
  var enabled = useFeatureFlag('enable-v11-release');
47
- var selectClasses = cx((_classNames = {}, _defineProperty(_classNames, "".concat(prefix, "--select"), true), _defineProperty(_classNames, "".concat(prefix, "--select--inline"), inline), _defineProperty(_classNames, "".concat(prefix, "--select--light"), light), _defineProperty(_classNames, "".concat(prefix, "--select--invalid"), invalid), _defineProperty(_classNames, "".concat(prefix, "--select--disabled"), disabled), _defineProperty(_classNames, "".concat(prefix, "--select--warning"), warn), _classNames), [enabled ? null : className]);
48
+
49
+ var _useContext = useContext(FormContext),
50
+ isFluid = _useContext.isFluid;
51
+
52
+ var _useState = useState(false),
53
+ _useState2 = _slicedToArray(_useState, 2),
54
+ isFocused = _useState2[0],
55
+ setIsFocused = _useState2[1];
56
+
57
+ var selectClasses = cx((_classNames = {}, _defineProperty(_classNames, "".concat(prefix, "--select"), true), _defineProperty(_classNames, "".concat(prefix, "--select--inline"), inline), _defineProperty(_classNames, "".concat(prefix, "--select--light"), light), _defineProperty(_classNames, "".concat(prefix, "--select--invalid"), invalid), _defineProperty(_classNames, "".concat(prefix, "--select--disabled"), disabled), _defineProperty(_classNames, "".concat(prefix, "--select--warning"), warn), _defineProperty(_classNames, "".concat(prefix, "--select--fluid--invalid"), isFluid && invalid), _defineProperty(_classNames, "".concat(prefix, "--select--fluid--focus"), isFluid && isFocused), _classNames), [enabled ? null : className]);
48
58
  var labelClasses = cx("".concat(prefix, "--label"), (_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefix, "--visually-hidden"), hideLabel), _defineProperty(_classNames2, "".concat(prefix, "--label--disabled"), disabled), _classNames2));
49
59
  var inputClasses = cx((_classNames3 = {}, _defineProperty(_classNames3, "".concat(prefix, "--select-input"), true), _defineProperty(_classNames3, "".concat(prefix, "--select-input--").concat(size), size), _classNames3));
50
60
  var errorId = "".concat(id, "-error-msg");
@@ -73,6 +83,10 @@ var Select = /*#__PURE__*/React__default.forwardRef(function Select(_ref, ref) {
73
83
  ariaProps['aria-describedby'] = errorId;
74
84
  }
75
85
 
86
+ var handleFocus = function handleFocus(evt) {
87
+ setIsFocused(evt.type === 'focus' ? true : false);
88
+ };
89
+
76
90
  var input = function () {
77
91
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("select", _extends({}, other, ariaProps, {
78
92
  id: id,
@@ -103,8 +117,12 @@ var Select = /*#__PURE__*/React__default.forwardRef(function Select(_ref, ref) {
103
117
  "data-invalid": invalid || null
104
118
  }, input), error), !inline && /*#__PURE__*/React__default.createElement("div", {
105
119
  className: "".concat(prefix, "--select-input__wrapper"),
106
- "data-invalid": invalid || null
107
- }, input), !inline && error ? error : helper));
120
+ "data-invalid": invalid || null,
121
+ onFocus: handleFocus,
122
+ onBlur: handleFocus
123
+ }, input), isFluid && /*#__PURE__*/React__default.createElement("hr", {
124
+ className: "".concat(prefix, "--select__divider")
125
+ }), !inline && error ? error : helper));
108
126
  });
109
127
  Select.displayName = 'Select';
110
128
  Select.propTypes = {
@@ -9,6 +9,7 @@ import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _
9
9
  import PropTypes from 'prop-types';
10
10
  import React__default, { useContext, useState } from 'react';
11
11
  import cx from 'classnames';
12
+ import deprecate from '../../prop-types/deprecate.js';
12
13
  import { WarningFilled } from '@carbon/icons-react';
13
14
  import { useFeatureFlag } from '../FeatureFlags/index.js';
14
15
  import { usePrefix } from '../../internal/usePrefix.js';
@@ -176,7 +177,7 @@ TextArea.propTypes = {
176
177
  * `true` to use the light version. For use on $ui-01 backgrounds only.
177
178
  * Don't use this to make tile background color same as container background color.
178
179
  */
179
- light: PropTypes.bool,
180
+ light: deprecate(PropTypes.bool, 'The `light` prop for `TextArea` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
180
181
 
181
182
  /**
182
183
  * Max character count allowed for the textarea. This is needed in order for enableCounter to display
@@ -220,7 +221,6 @@ TextArea.defaultProps = {
220
221
  invalid: false,
221
222
  invalidText: '',
222
223
  helperText: '',
223
- light: false,
224
224
  enableCounter: false,
225
225
  maxCount: undefined
226
226
  };
@@ -12,6 +12,7 @@ import PropTypes from 'prop-types';
12
12
  import { WarningFilled, ViewOff, View } from '@carbon/icons-react';
13
13
  import { textInputProps } from './util.js';
14
14
  import { warning } from '../../internal/warning.js';
15
+ import deprecate from '../../prop-types/deprecate.js';
15
16
  import { usePrefix } from '../../internal/usePrefix.js';
16
17
 
17
18
  var _excluded = ["labelText", "className", "id", "placeholder", "onChange", "onClick", "hideLabel", "invalid", "invalidText", "helperText", "light", "type", "togglePasswordVisibility", "tooltipPosition", "tooltipAlignment", "hidePasswordLabel", "showPasswordLabel", "size"];
@@ -172,7 +173,7 @@ ControlledPasswordInput.propTypes = {
172
173
  * `true` to use the light version. For use on $ui-01 backgrounds only.
173
174
  * Don't use this to make tile background color same as container background color.
174
175
  */
175
- light: PropTypes.bool,
176
+ light: deprecate(PropTypes.bool, 'The `light` prop for `ControlledPasswordInput` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
176
177
 
177
178
  /**
178
179
  * Optionally provide an `onChange` handler that is called whenever `<input>`
@@ -219,14 +220,12 @@ ControlledPasswordInput.propTypes = {
219
220
  value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
220
221
  };
221
222
  ControlledPasswordInput.defaultProps = {
222
- className: '${prefix}--text__input',
223
223
  disabled: false,
224
224
  onChange: function onChange() {},
225
225
  onClick: function onClick() {},
226
226
  invalid: false,
227
227
  invalidText: '',
228
228
  helperText: '',
229
- light: false,
230
229
  size: ''
231
230
  };
232
231
  var ControlledPasswordInput$1 = ControlledPasswordInput;
@@ -13,6 +13,7 @@ import { ViewOff, View } from '@carbon/icons-react';
13
13
  import { useNormalizedInputProps } from '../../internal/useNormalizedInputProps.js';
14
14
  import { textInputProps } from './util.js';
15
15
  import * as FeatureFlags from '@carbon/feature-flags';
16
+ import deprecate from '../../prop-types/deprecate.js';
16
17
  import { usePrefix } from '../../internal/usePrefix.js';
17
18
  import { FormContext } from '../FluidForm/FormContext.js';
18
19
 
@@ -33,8 +34,7 @@ var PasswordInput = /*#__PURE__*/React__default.forwardRef(function PasswordInpu
33
34
  invalid = _ref$invalid === void 0 ? false : _ref$invalid,
34
35
  invalidText = _ref.invalidText,
35
36
  labelText = _ref.labelText,
36
- _ref$light = _ref.light,
37
- light = _ref$light === void 0 ? false : _ref$light,
37
+ light = _ref.light,
38
38
  _ref$onChange = _ref.onChange,
39
39
  _onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
40
40
  _ref$onClick = _ref.onClick,
@@ -215,7 +215,7 @@ PasswordInput.propTypes = {
215
215
  * `true` to use the light version. For use on $ui-01 backgrounds only.
216
216
  * Don't use this to make tile background color same as container background color.
217
217
  */
218
- light: PropTypes.bool,
218
+ light: deprecate(PropTypes.bool, 'The `light` prop for `PasswordInput` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
219
219
 
220
220
  /**
221
221
  * Optionally provide an `onChange` handler that is called whenever `<input>`
@@ -12,6 +12,7 @@ import cx from 'classnames';
12
12
  import { useNormalizedInputProps } from '../../internal/useNormalizedInputProps.js';
13
13
  import PasswordInput from './PasswordInput.js';
14
14
  import ControlledPasswordInput from './ControlledPasswordInput.js';
15
+ import deprecate from '../../prop-types/deprecate.js';
15
16
  import { textInputProps } from './util.js';
16
17
  import { useFeatureFlag } from '../FeatureFlags/index.js';
17
18
  import * as FeatureFlags from '@carbon/feature-flags';
@@ -34,8 +35,7 @@ var TextInput = /*#__PURE__*/React__default.forwardRef(function TextInput(_ref,
34
35
  invalid = _ref$invalid === void 0 ? false : _ref$invalid,
35
36
  invalidText = _ref.invalidText,
36
37
  labelText = _ref.labelText,
37
- _ref$light = _ref.light,
38
- light = _ref$light === void 0 ? false : _ref$light,
38
+ light = _ref.light,
39
39
  _ref$onChange = _ref.onChange,
40
40
  _onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
41
41
  _ref$onClick = _ref.onClick,
@@ -73,8 +73,7 @@ var TextInput = /*#__PURE__*/React__default.forwardRef(function TextInput(_ref,
73
73
  warn: warn,
74
74
  warnText: warnText
75
75
  });
76
- var customClassName = className !== null && className !== void 0 ? className : "".concat(prefix, "--text__input");
77
- var textInputClasses = cx("".concat(prefix, "--text-input"), [enabled ? null : className], (_classNames = {}, _defineProperty(_classNames, customClassName, enabled), _defineProperty(_classNames, "".concat(prefix, "--text-input--light"), light), _defineProperty(_classNames, "".concat(prefix, "--text-input--invalid"), normalizedProps.invalid), _defineProperty(_classNames, "".concat(prefix, "--text-input--warning"), normalizedProps.warn), _defineProperty(_classNames, "".concat(prefix, "--text-input--").concat(size), size), _classNames));
76
+ var textInputClasses = cx("".concat(prefix, "--text-input"), [enabled ? null : className], (_classNames = {}, _defineProperty(_classNames, "".concat(prefix, "--text-input--light"), light), _defineProperty(_classNames, "".concat(prefix, "--text-input--invalid"), normalizedProps.invalid), _defineProperty(_classNames, "".concat(prefix, "--text-input--warning"), normalizedProps.warn), _defineProperty(_classNames, "".concat(prefix, "--text-input--").concat(size), size), _classNames));
78
77
 
79
78
  var sharedTextInputProps = _objectSpread2(_defineProperty({
80
79
  id: id,
@@ -105,12 +104,12 @@ var TextInput = /*#__PURE__*/React__default.forwardRef(function TextInput(_ref,
105
104
  sharedTextInputProps.maxLength = maxCount;
106
105
  }
107
106
 
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));
107
+ 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), _defineProperty(_classNames2, "".concat(prefix, "--text-input-wrapper--inline--invalid"), inline && normalizedProps.invalid), _classNames2));
109
108
  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));
110
109
  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));
111
110
  var fieldOuterWrapperClasses = cx("".concat(prefix, "--text-input__field-outer-wrapper"), _defineProperty({}, "".concat(prefix, "--text-input__field-outer-wrapper--inline"), inline));
112
111
  var fieldWrapperClasses = cx("".concat(prefix, "--text-input__field-wrapper"), _defineProperty({}, "".concat(prefix, "--text-input__field-wrapper--warning"), normalizedProps.warn));
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));
112
+ 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), _classNames7));
114
113
  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
114
  var counter = enableCounter && maxCount ? /*#__PURE__*/React__default.createElement("div", {
116
115
  className: counterClasses
@@ -141,7 +140,7 @@ var TextInput = /*#__PURE__*/React__default.forwardRef(function TextInput(_ref,
141
140
  className: inputWrapperClasses
142
141
  }, !inline ? labelWrapper : /*#__PURE__*/React__default.createElement("div", {
143
142
  className: "".concat(prefix, "--text-input__label-helper-wrapper")
144
- }, labelWrapper, !isFluid && helper), /*#__PURE__*/React__default.createElement("div", {
143
+ }, labelWrapper, !isFluid && (normalizedProps.validation || helper)), /*#__PURE__*/React__default.createElement("div", {
145
144
  className: fieldOuterWrapperClasses
146
145
  }, /*#__PURE__*/React__default.createElement("div", {
147
146
  className: fieldWrapperClasses,
@@ -216,7 +215,7 @@ TextInput.propTypes = {
216
215
  * `true` to use the light version. For use on $ui-01 backgrounds only.
217
216
  * Don't use this to make tile background color same as container background color.
218
217
  */
219
- light: PropTypes.bool,
218
+ light: deprecate(PropTypes.bool, 'The `light` prop for `TextInput` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
220
219
 
221
220
  /**
222
221
  * Max character count allowed for the input. This is needed in order for enableCounter to display
@@ -188,8 +188,7 @@ var SelectableTile = /*#__PURE__*/React__default.forwardRef(function SelectableT
188
188
  prevSelected = _useState6[0],
189
189
  setPrevSelected = _useState6[1];
190
190
 
191
- var classes = cx("".concat(prefix, "--tile"), "".concat(prefix, "--tile--selectable"), (_cx3 = {}, _defineProperty(_cx3, "".concat(prefix, "--tile--is-selected"), isSelected), _defineProperty(_cx3, "".concat(prefix, "--tile--light"), light), _defineProperty(_cx3, "".concat(prefix, "--tile--disabled"), disabled), _cx3), className);
192
- var inputClasses = cx("".concat(prefix, "--tile-input"), _defineProperty({}, "".concat(prefix, "--tile-input--checked"), isSelected)); // TODO: rename to handleClick when handleClick prop is deprecated
191
+ var classes = cx("".concat(prefix, "--tile"), "".concat(prefix, "--tile--selectable"), (_cx3 = {}, _defineProperty(_cx3, "".concat(prefix, "--tile--is-selected"), isSelected), _defineProperty(_cx3, "".concat(prefix, "--tile--light"), light), _defineProperty(_cx3, "".concat(prefix, "--tile--disabled"), disabled), _cx3), className); // TODO: rename to handleClick when handleClick prop is deprecated
193
192
 
194
193
  function handleOnClick(evt) {
195
194
  evt.preventDefault();
@@ -222,30 +221,27 @@ var SelectableTile = /*#__PURE__*/React__default.forwardRef(function SelectableT
222
221
  setPrevSelected(selected);
223
222
  }
224
223
 
225
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("input", {
226
- checked: isSelected,
227
- className: inputClasses,
228
- disabled: disabled,
229
- id: id,
230
- name: name,
231
- onChange: !disabled ? handleChange : null,
232
- ref: ref,
233
- tabIndex: -1,
234
- title: title,
235
- type: "checkbox",
236
- value: value
237
- }), /*#__PURE__*/React__default.createElement("label", _extends({
224
+ return /*#__PURE__*/React__default.createElement("div", _extends({
238
225
  className: classes,
239
- htmlFor: id,
240
226
  onClick: !disabled ? handleOnClick : null,
227
+ role: "checkbox",
228
+ "aria-checked": isSelected,
229
+ disabled: disabled,
241
230
  onKeyDown: !disabled ? handleOnKeyDown : null // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
242
231
  ,
243
- tabIndex: !disabled ? tabIndex : null
232
+ tabIndex: !disabled ? tabIndex : null,
233
+ value: value,
234
+ name: name,
235
+ ref: ref,
236
+ id: id,
237
+ onChange: !disabled ? handleChange : null,
238
+ title: title
244
239
  }, rest), /*#__PURE__*/React__default.createElement("span", {
245
240
  className: "".concat(prefix, "--tile__checkmark ").concat(prefix, "--tile__checkmark--persistent")
246
- }, isSelected ? _CheckboxCheckedFille || (_CheckboxCheckedFille = /*#__PURE__*/React__default.createElement(CheckboxCheckedFilled, null)) : _Checkbox || (_Checkbox = /*#__PURE__*/React__default.createElement(Checkbox, null))), /*#__PURE__*/React__default.createElement("span", {
241
+ }, isSelected ? _CheckboxCheckedFille || (_CheckboxCheckedFille = /*#__PURE__*/React__default.createElement(CheckboxCheckedFilled, null)) : _Checkbox || (_Checkbox = /*#__PURE__*/React__default.createElement(Checkbox, null))), /*#__PURE__*/React__default.createElement("label", {
242
+ htmlFor: id,
247
243
  className: "".concat(prefix, "--tile-content")
248
- }, children)));
244
+ }, children));
249
245
  });
250
246
  SelectableTile.displayName = 'SelectableTile';
251
247
  SelectableTile.propTypes = {
@@ -316,7 +312,7 @@ SelectableTile.propTypes = {
316
312
  value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired
317
313
  };
318
314
  function ExpandableTile(_ref4) {
319
- var _cx5, _cx6;
315
+ var _cx4, _cx5;
320
316
 
321
317
  var tabIndex = _ref4.tabIndex,
322
318
  className = _ref4.className,
@@ -420,8 +416,8 @@ function ExpandableTile(_ref4) {
420
416
  return React__default.Children.toArray(children);
421
417
  }
422
418
 
423
- var classNames = cx("".concat(prefix, "--tile"), "".concat(prefix, "--tile--expandable"), (_cx5 = {}, _defineProperty(_cx5, "".concat(prefix, "--tile--is-expanded"), isExpanded), _defineProperty(_cx5, "".concat(prefix, "--tile--light"), light), _cx5), className);
424
- var interactiveClassNames = cx("".concat(prefix, "--tile"), "".concat(prefix, "--tile--expandable"), "".concat(prefix, "--tile--expandable--interactive"), (_cx6 = {}, _defineProperty(_cx6, "".concat(prefix, "--tile--is-expanded"), isExpanded), _defineProperty(_cx6, "".concat(prefix, "--tile--light"), light), _cx6), className);
419
+ var classNames = cx("".concat(prefix, "--tile"), "".concat(prefix, "--tile--expandable"), (_cx4 = {}, _defineProperty(_cx4, "".concat(prefix, "--tile--is-expanded"), isExpanded), _defineProperty(_cx4, "".concat(prefix, "--tile--light"), light), _cx4), className);
420
+ var interactiveClassNames = cx("".concat(prefix, "--tile"), "".concat(prefix, "--tile--expandable"), "".concat(prefix, "--tile--expandable--interactive"), (_cx5 = {}, _defineProperty(_cx5, "".concat(prefix, "--tile--is-expanded"), isExpanded), _defineProperty(_cx5, "".concat(prefix, "--tile--light"), light), _cx5), className);
425
421
  var chevronInteractiveClassNames = cx("".concat(prefix, "--tile__chevron"), "".concat(prefix, "--tile__chevron--interactive"));
426
422
  var tileStyle = {
427
423
  maxHeight: isExpanded ? null : isTileMaxHeight + isTilePadding
@@ -16,7 +16,7 @@ import deprecate from '../../../prop-types/deprecate.js';
16
16
  import { match } from '../../../internal/keyboard/match.js';
17
17
  import { Escape } from '../../../internal/keyboard/keys.js';
18
18
 
19
- var _excluded = ["align", "className", "children", "definition", "defaultOpen", "id", "tooltipText", "triggerClassName"];
19
+ var _excluded = ["align", "className", "children", "definition", "defaultOpen", "id", "openOnHover", "tooltipText", "triggerClassName"];
20
20
 
21
21
  function DefinitionTooltip(_ref) {
22
22
  var _ref$align = _ref.align,
@@ -27,6 +27,7 @@ function DefinitionTooltip(_ref) {
27
27
  _ref$defaultOpen = _ref.defaultOpen,
28
28
  defaultOpen = _ref$defaultOpen === void 0 ? false : _ref$defaultOpen,
29
29
  id = _ref.id,
30
+ openOnHover = _ref.openOnHover,
30
31
  tooltipText = _ref.tooltipText,
31
32
  triggerClassName = _ref.triggerClassName,
32
33
  rest = _objectWithoutProperties(_ref, _excluded);
@@ -54,6 +55,9 @@ function DefinitionTooltip(_ref) {
54
55
  onMouseLeave: function onMouseLeave() {
55
56
  setOpen(false);
56
57
  },
58
+ onMouseEnter: function onMouseEnter() {
59
+ openOnHover ? setOpen(true) : null;
60
+ },
57
61
  open: isOpen
58
62
  }, /*#__PURE__*/React__default.createElement("button", _extends({}, rest, {
59
63
  className: cx("".concat(prefix, "--definition-term"), triggerClassName),
@@ -77,7 +81,7 @@ DefinitionTooltip.propTypes = {
77
81
  /**
78
82
  * Specify how the trigger should align with the tooltip
79
83
  */
80
- align: PropTypes.oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right']),
84
+ align: PropTypes.oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'left-bottom', 'left-top', 'right', 'right-bottom', 'right-top']),
81
85
 
82
86
  /**
83
87
  * The `children` prop will be used as the value that is being defined
@@ -106,6 +110,11 @@ DefinitionTooltip.propTypes = {
106
110
  */
107
111
  id: PropTypes.string,
108
112
 
113
+ /**
114
+ * Specifies whether or not the `DefinitionTooltip` should open on hover or not
115
+ */
116
+ openOnHover: PropTypes.bool,
117
+
109
118
  /**
110
119
  * [Deprecated in v11] Please use the `definition` prop instead.
111
120
  *
@@ -144,7 +144,7 @@ var HeaderMenu = /*#__PURE__*/function (_React$Component) {
144
144
  _createClass(HeaderMenu, [{
145
145
  key: "render",
146
146
  value: function render() {
147
- var _cx;
147
+ var _cx, _cx2;
148
148
 
149
149
  var prefix = this.context;
150
150
 
@@ -163,7 +163,8 @@ var HeaderMenu = /*#__PURE__*/function (_React$Component) {
163
163
  'aria-label': ariaLabel,
164
164
  'aria-labelledby': ariaLabelledBy
165
165
  };
166
- var className = cx((_cx = {}, _defineProperty(_cx, "".concat(prefix, "--header__submenu"), true), _defineProperty(_cx, "".concat(prefix, "--header__submenu--current"), isCurrentPage), _defineProperty(_cx, customClassName, !!customClassName), _cx)); // Notes on eslint comments and based on the examples in:
166
+ var itemClassName = cx((_cx = {}, _defineProperty(_cx, "".concat(prefix, "--header__submenu"), true), _defineProperty(_cx, customClassName, !!customClassName), _cx));
167
+ var linkClassName = cx((_cx2 = {}, _defineProperty(_cx2, "".concat(prefix, "--header__menu-item"), true), _defineProperty(_cx2, "".concat(prefix, "--header__menu-title"), true), _defineProperty(_cx2, "".concat(prefix, "--header__menu-item--current"), isCurrentPage), _cx2)); // Notes on eslint comments and based on the examples in:
167
168
  // https://www.w3.org/TR/wai-aria-practices/examples/menubar/menubar-1/menubar-1.html#
168
169
  // - The focus is handled by the <a> menuitem, onMouseOver is for mouse
169
170
  // users
@@ -172,7 +173,7 @@ var HeaderMenu = /*#__PURE__*/function (_React$Component) {
172
173
  // - href can be set to javascript:void(0), ideally this will be a button
173
174
 
174
175
  return /*#__PURE__*/React__default.createElement("li", _extends({}, rest, {
175
- className: className,
176
+ className: itemClassName,
176
177
  onKeyDown: this.handleMenuClose,
177
178
  onClick: this.handleOnClick,
178
179
  onBlur: this.handleOnBlur
@@ -181,7 +182,7 @@ var HeaderMenu = /*#__PURE__*/function (_React$Component) {
181
182
  "aria-haspopup": "menu" // eslint-disable-line jsx-a11y/aria-proptypes
182
183
  ,
183
184
  "aria-expanded": this.state.expanded,
184
- className: "".concat(prefix, "--header__menu-item ").concat(prefix, "--header__menu-title"),
185
+ className: linkClassName,
185
186
  href: "#",
186
187
  onKeyDown: this.handleOnKeyDown,
187
188
  ref: this.handleMenuButtonRef,
@@ -206,11 +207,21 @@ var HeaderMenu = /*#__PURE__*/function (_React$Component) {
206
207
  }(React__default.Component);
207
208
 
208
209
  _defineProperty(HeaderMenu, "propTypes", _objectSpread2(_objectSpread2({}, AriaLabelPropType), {}, {
210
+ /**
211
+ * Optionally provide a custom class to apply to the underlying `<li>` node
212
+ */
213
+ className: PropTypes.string,
214
+
209
215
  /**
210
216
  * Provide a custom ref handler for the menu button
211
217
  */
212
218
  focusRef: PropTypes.func,
213
219
 
220
+ /**
221
+ * Applies selected styles to the item if a user sets this to true and aria-current !== 'page'.
222
+ */
223
+ isCurrentPage: PropTypes.bool,
224
+
214
225
  /**
215
226
  * Provide a label for the link text
216
227
  */
@@ -71,7 +71,8 @@ var SideNavMenu = /*#__PURE__*/React__default.forwardRef(function SideNavMenu(pr
71
71
  ref: ref,
72
72
  type: "button"
73
73
  }, IconElement && /*#__PURE__*/React__default.createElement(SideNavIcon, null, /*#__PURE__*/React__default.createElement(IconElement, null)), /*#__PURE__*/React__default.createElement("span", {
74
- className: "".concat(prefix, "--side-nav__submenu-title")
74
+ className: "".concat(prefix, "--side-nav__submenu-title"),
75
+ title: title
75
76
  }, title), /*#__PURE__*/React__default.createElement(SideNavIcon, {
76
77
  className: "".concat(prefix, "--side-nav__submenu-chevron"),
77
78
  small: true
package/es/index.js CHANGED
@@ -28,7 +28,12 @@ export { default as DatePicker } from './components/DatePicker/DatePicker.js';
28
28
  export { default as DatePickerInput } from './components/DatePickerInput/DatePickerInput.js';
29
29
  export { default as DropdownSkeleton } from './components/Dropdown/Dropdown.Skeleton.js';
30
30
  export { default as Dropdown } from './components/Dropdown/Dropdown.js';
31
- export { default as FileUploader } from './components/FileUploader/index.js';
31
+ export { default as FileUploader } from './components/FileUploader/FileUploader.js';
32
+ export { default as Filename } from './components/FileUploader/Filename.js';
33
+ export { default as FileUploaderSkeleton } from './components/FileUploader/FileUploader.Skeleton.js';
34
+ export { default as FileUploaderButton } from './components/FileUploader/FileUploaderButton.js';
35
+ export { default as FileUploaderDropContainer } from './components/FileUploader/FileUploaderDropContainer.js';
36
+ export { default as FileUploaderItem } from './components/FileUploader/FileUploaderItem.js';
32
37
  export { default as Form } from './components/Form/Form.js';
33
38
  export { default as FluidForm } from './components/FluidForm/FluidForm.js';
34
39
  export { default as FormGroup } from './components/FormGroup/FormGroup.js';
@@ -44,7 +49,8 @@ import './components/MultiSelect/index.js';
44
49
  export { default as OrderedList } from './components/OrderedList/OrderedList.js';
45
50
  export { default as OverflowMenu } from './components/OverflowMenu/index.js';
46
51
  export { default as OverflowMenuItem } from './components/OverflowMenuItem/index.js';
47
- export { default as Pagination } from './components/Pagination/index.js';
52
+ export { default as Pagination } from './components/Pagination/Pagination.js';
53
+ export { default as PaginationSkeleton } from './components/Pagination/Pagination.Skeleton.js';
48
54
  export { default as PaginationNav } from './components/PaginationNav/PaginationNav.js';
49
55
  export { default as PrimaryButton } from './components/PrimaryButton/PrimaryButton.js';
50
56
  export { default as RadioButton } from './components/RadioButton/RadioButton.js';
@@ -82,8 +88,6 @@ export { default as SkeletonPlaceholder } from './components/SkeletonPlaceholder
82
88
  export { default as SkeletonIcon } from './components/SkeletonIcon/SkeletonIcon.js';
83
89
  export { default as DataTableSkeleton } from './components/DataTableSkeleton/DataTableSkeleton.js';
84
90
  export { default as BreadcrumbSkeleton } from './components/Breadcrumb/Breadcrumb.Skeleton.js';
85
- export { default as FileUploaderSkeleton } from './components/FileUploader/FileUploader.Skeleton.js';
86
- export { default as PaginationSkeleton } from './components/Pagination/Pagination.Skeleton.js';
87
91
  export { default as ProgressIndicatorSkeleton } from './components/ProgressIndicator/ProgressIndicator.Skeleton.js';
88
92
  export { default as RadioButtonSkeleton } from './components/RadioButton/RadioButton.Skeleton.js';
89
93
  export { default as SearchSkeleton } from './components/Search/Search.Skeleton.js';
@@ -105,10 +109,6 @@ export { DefinitionTooltip } from './components/Tooltip/next/DefinitionTooltip.j
105
109
  export { GlobalTheme, Theme, useTheme } from './components/Theme/index.js';
106
110
  export { usePrefix } from './internal/usePrefix.js';
107
111
  export { default as AspectRatio } from './components/AspectRatio/AspectRatio.js';
108
- export { default as Filename } from './components/FileUploader/Filename.js';
109
- export { default as FileUploaderButton } from './components/FileUploader/FileUploaderButton.js';
110
- export { default as FileUploaderDropContainer } from './components/FileUploader/FileUploaderDropContainer.js';
111
- export { default as FileUploaderItem } from './components/FileUploader/FileUploaderItem.js';
112
112
  export { default as Row } from './components/Grid/Row.js';
113
113
  export { default as Column } from './components/Grid/Column.js';
114
114
  export { default as NumberInputSkeleton } from './components/NumberInput/NumberInput.Skeleton.js';
@@ -199,8 +199,14 @@ export { default as SideNavLink } from './components/UIShell/SideNavLink.js';
199
199
  export { SideNavMenu } from './components/UIShell/SideNavMenu.js';
200
200
  export { default as SideNavMenuItem } from './components/UIShell/SideNavMenuItem.js';
201
201
  export { default as SideNavSwitcher } from './components/UIShell/SideNavSwitcher.js';
202
+ export { default as unstable__FluidComboBox } from './components/FluidComboBox/FluidComboBox.js';
203
+ export { default as unstable__FluidComboBoxSkeleton } from './components/FluidComboBox/FluidComboBox.Skeleton.js';
202
204
  export { default as unstable__FluidDropdown } from './components/FluidDropdown/FluidDropdown.js';
203
205
  export { default as unstable__FluidDropdownSkeleton } from './components/FluidDropdown/FluidDropdown.Skeleton.js';
206
+ export { default as unstable__FluidMultiSelect } from './components/FluidMultiSelect/FluidMultiSelect.js';
207
+ export { default as unstable__FluidMultiSelectSkeleton } from './components/FluidMultiSelect/FluidMultiSelect.Skeleton.js';
208
+ export { default as unstable__FluidSelect } from './components/FluidSelect/FluidSelect.js';
209
+ export { default as unstable__FluidSelectSkeleton } from './components/FluidSelect/FluidSelect.Skeleton.js';
204
210
  export { LayoutDirection as unstable_LayoutDirection } from './components/Layout/LayoutDirection.js';
205
211
  export { useLayoutDirection as unstable_useLayoutDirection } from './components/Layout/useLayoutDirection.js';
206
212
  export { Stack } from './components/Stack/Stack.js';
@@ -6,9 +6,9 @@
6
6
  */
7
7
 
8
8
  import React__default from 'react';
9
- import { EditOff, WarningFilled, WarningAltFilled } from '@carbon/icons-react';
9
+ import { WarningFilled, WarningAltFilled } from '@carbon/icons-react';
10
+ import { usePrefix } from './usePrefix.js';
10
11
 
11
- var prefix = 'cds';
12
12
  /**
13
13
  * @typedef {object} InputProps
14
14
  * @property {string} id - The input's id
@@ -53,6 +53,7 @@ function useNormalizedInputProps(_ref) {
53
53
  invalidText = _ref.invalidText,
54
54
  warn = _ref.warn,
55
55
  warnText = _ref.warnText;
56
+ var prefix = usePrefix();
56
57
  var normalizedProps = {
57
58
  disabled: !readOnly && disabled,
58
59
  invalid: !readOnly && invalid,
@@ -64,22 +65,18 @@ function useNormalizedInputProps(_ref) {
64
65
  helperId: "".concat(id, "-helper-text")
65
66
  };
66
67
 
67
- if (readOnly) {
68
- normalizedProps.icon = EditOff;
69
- } else {
70
- if (normalizedProps.invalid) {
71
- normalizedProps.icon = WarningFilled;
72
- normalizedProps.validation = /*#__PURE__*/React__default.createElement("div", {
73
- className: "".concat(prefix, "--form-requirement"),
74
- id: normalizedProps.invalidId
75
- }, invalidText);
76
- } else if (normalizedProps.warn) {
77
- normalizedProps.icon = WarningAltFilled;
78
- normalizedProps.validation = /*#__PURE__*/React__default.createElement("div", {
79
- className: "".concat(prefix, "--form-requirement"),
80
- id: normalizedProps.warnId
81
- }, warnText);
82
- }
68
+ if (normalizedProps.invalid) {
69
+ normalizedProps.icon = WarningFilled;
70
+ normalizedProps.validation = /*#__PURE__*/React__default.createElement("div", {
71
+ className: "".concat(prefix, "--form-requirement"),
72
+ id: normalizedProps.invalidId
73
+ }, invalidText);
74
+ } else if (normalizedProps.warn) {
75
+ normalizedProps.icon = WarningAltFilled;
76
+ normalizedProps.validation = /*#__PURE__*/React__default.createElement("div", {
77
+ className: "".concat(prefix, "--form-requirement"),
78
+ id: normalizedProps.warnId
79
+ }, warnText);
83
80
  }
84
81
 
85
82
  return normalizedProps;
@@ -20,6 +20,7 @@ var Button = require('../Button/Button.js');
20
20
  var CopyButton = require('../CopyButton/CopyButton.js');
21
21
  var uniqueId = require('../../tools/uniqueId.js');
22
22
  var copy = require('copy-to-clipboard');
23
+ var deprecate = require('../../prop-types/deprecate.js');
23
24
  var usePrefix = require('../../internal/usePrefix.js');
24
25
 
25
26
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -255,7 +256,6 @@ function CodeSnippet(_ref) {
255
256
  }, /*#__PURE__*/React__default["default"].createElement("span", {
256
257
  className: "".concat(prefix, "--snippet-btn--text")
257
258
  }, expandCodeBtnText), /*#__PURE__*/React__default["default"].createElement(iconsReact.ChevronDown, {
258
- "aria-label": expandCodeBtnText,
259
259
  className: "".concat(prefix, "--icon-chevron--down ").concat(prefix, "--snippet__icon"),
260
260
  name: "chevron--down",
261
261
  role: "img"
@@ -314,7 +314,7 @@ CodeSnippet.propTypes = {
314
314
  * Specify whether you are using the light variant of the Code Snippet,
315
315
  * typically used for inline snippet to display an alternate color
316
316
  */
317
- light: PropTypes__default["default"].bool,
317
+ light: deprecate["default"](PropTypes__default["default"].bool, 'The `light` prop for `CodeSnippet` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
318
318
 
319
319
  /**
320
320
  * Specify the maximum number of rows to be shown when in collapsed view