@carbon/react 1.19.0 → 1.20.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 (59) hide show
  1. package/es/_virtual/_commonjsHelpers.js +15 -2
  2. package/es/_virtual/index.js +6 -2
  3. package/es/_virtual/rangePlugin.js +6 -2
  4. package/es/components/ContainedList/ContainedList.js +8 -1
  5. package/es/components/DataTable/TableHeader.js +1 -3
  6. package/es/components/DatePicker/DatePicker.js +14 -3
  7. package/es/components/FluidNumberInput/FluidNumberInput.Skeleton.js +42 -0
  8. package/es/components/FluidNumberInput/FluidNumberInput.js +138 -0
  9. package/es/components/FluidSearch/FluidSearch.Skeleton.js +42 -0
  10. package/es/components/FluidSearch/FluidSearch.js +114 -0
  11. package/es/components/NumberInput/NumberInput.js +38 -20
  12. package/es/components/OverflowMenuItem/OverflowMenuItem.js +86 -125
  13. package/es/components/ProgressBar/ProgressBar.js +11 -4
  14. package/es/components/Search/Search.js +8 -2
  15. package/es/components/SkeletonText/SkeletonText.js +40 -39
  16. package/es/components/Slider/Slider.js +16 -26
  17. package/es/components/TextArea/TextArea.js +11 -4
  18. package/es/components/Tile/Tile.js +7 -5
  19. package/es/components/TimePickerSelect/TimePickerSelect.js +57 -69
  20. package/es/components/TimePickerSelect/index.js +2 -3
  21. package/es/index.js +4 -0
  22. package/es/node_modules/flatpickr/dist/l10n/index.js +3 -3
  23. package/es/node_modules/flatpickr/dist/plugins/rangePlugin.js +2 -2
  24. package/es/node_modules/use-resize-observer/polyfilled.js +0 -1
  25. package/lib/_virtual/_commonjsHelpers.js +15 -2
  26. package/lib/_virtual/index.js +6 -2
  27. package/lib/_virtual/rangePlugin.js +6 -2
  28. package/lib/components/ContainedList/ContainedList.js +8 -1
  29. package/lib/components/DataTable/TableHeader.js +1 -3
  30. package/lib/components/DatePicker/DatePicker.js +13 -2
  31. package/lib/components/FluidNumberInput/FluidNumberInput.Skeleton.js +52 -0
  32. package/lib/components/FluidNumberInput/FluidNumberInput.js +148 -0
  33. package/lib/components/FluidSearch/FluidSearch.Skeleton.js +52 -0
  34. package/lib/components/FluidSearch/FluidSearch.js +124 -0
  35. package/lib/components/NumberInput/NumberInput.js +37 -19
  36. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +83 -141
  37. package/lib/components/ProgressBar/ProgressBar.js +10 -3
  38. package/lib/components/Search/Search.js +7 -1
  39. package/lib/components/SkeletonText/SkeletonText.js +38 -37
  40. package/lib/components/Slider/Slider.js +16 -26
  41. package/lib/components/TextArea/TextArea.js +10 -3
  42. package/lib/components/Tile/Tile.js +7 -5
  43. package/lib/components/TimePickerSelect/TimePickerSelect.js +53 -65
  44. package/lib/components/TimePickerSelect/index.js +2 -3
  45. package/lib/index.js +8 -0
  46. package/lib/node_modules/flatpickr/dist/l10n/index.js +2 -2
  47. package/lib/node_modules/flatpickr/dist/plugins/rangePlugin.js +2 -2
  48. package/lib/node_modules/use-resize-observer/polyfilled.js +0 -1
  49. package/package.json +7 -7
  50. package/scss/components/fluid-combo-box/_fluid-combo-box.scss +9 -0
  51. package/scss/components/fluid-combo-box/_index.scss +9 -0
  52. package/scss/components/fluid-multiselect/_fluid-multiselect.scss +9 -0
  53. package/scss/components/fluid-multiselect/_index.scss +9 -0
  54. package/scss/components/fluid-number-input/_fluid-number-input.scss +9 -0
  55. package/scss/components/fluid-number-input/_index.scss +9 -0
  56. package/scss/components/fluid-search/_fluid-search.scss +9 -0
  57. package/scss/components/fluid-search/_index.scss +9 -0
  58. package/es/components/TimePickerSelect/next/TimePickerSelect.js +0 -70
  59. package/lib/components/TimePickerSelect/next/TimePickerSelect.js +0 -80
@@ -5,136 +5,106 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { inherits as _inherits, createSuper as _createSuper, createClass as _createClass, defineProperty as _defineProperty, classCallCheck as _classCallCheck, assertThisInitialized as _assertThisInitialized, objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
8
+ import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import cx from 'classnames';
10
10
  import PropTypes from 'prop-types';
11
11
  import React__default from 'react';
12
12
  import { ArrowDown, ArrowUp } from '../../internal/keyboard/keys.js';
13
13
  import { match } from '../../internal/keyboard/match.js';
14
14
  import { warning } from '../../internal/warning.js';
15
- import * as FeatureFlags from '@carbon/feature-flags';
16
- import { PrefixContext } from '../../internal/usePrefix.js';
17
-
18
- var _excluded = ["href", "className", "itemText", "hasDivider", "isDelete", "disabled", "closeMenu", "onClick", "handleOverflowMenuItemFocus", "onKeyDown", "wrapperClassName", "requireTitle", "index", "title"];
19
-
20
- var OverflowMenuItem = /*#__PURE__*/function (_React$Component) {
21
- _inherits(OverflowMenuItem, _React$Component);
22
-
23
- var _super = _createSuper(OverflowMenuItem);
15
+ import { usePrefix } from '../../internal/usePrefix.js';
16
+
17
+ var _excluded = ["className", "closeMenu", "disabled", "handleOverflowMenuItemFocus", "hasDivider", "href", "isDelete", "index", "itemText", "onClick", "onKeyDown", "requireTitle", "title", "wrapperClassName"];
18
+ var OverflowMenuItem = /*#__PURE__*/React__default.forwardRef(function OverflowMenuItem(_ref, ref) {
19
+ var _cx;
20
+
21
+ var className = _ref.className,
22
+ closeMenu = _ref.closeMenu,
23
+ _ref$disabled = _ref.disabled,
24
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
25
+ handleOverflowMenuItemFocus = _ref.handleOverflowMenuItemFocus,
26
+ _ref$hasDivider = _ref.hasDivider,
27
+ hasDivider = _ref$hasDivider === void 0 ? false : _ref$hasDivider,
28
+ href = _ref.href,
29
+ _ref$isDelete = _ref.isDelete,
30
+ isDelete = _ref$isDelete === void 0 ? false : _ref$isDelete,
31
+ index = _ref.index,
32
+ _ref$itemText = _ref.itemText,
33
+ itemText = _ref$itemText === void 0 ? 'Provide itemText' : _ref$itemText,
34
+ _ref$onClick = _ref.onClick,
35
+ onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
36
+ _ref$onKeyDown = _ref.onKeyDown,
37
+ _onKeyDown = _ref$onKeyDown === void 0 ? function () {} : _ref$onKeyDown,
38
+ requireTitle = _ref.requireTitle,
39
+ title = _ref.title,
40
+ wrapperClassName = _ref.wrapperClassName,
41
+ rest = _objectWithoutProperties(_ref, _excluded);
42
+
43
+ var prefix = usePrefix();
44
+
45
+ function setTabFocus(evt) {
46
+ if (match(evt, ArrowDown)) {
47
+ handleOverflowMenuItemFocus({
48
+ currentIndex: index,
49
+ direction: 1
50
+ });
51
+ }
24
52
 
25
- function OverflowMenuItem() {
26
- var _this;
53
+ if (match(evt, ArrowUp)) {
54
+ handleOverflowMenuItemFocus({
55
+ currentIndex: index,
56
+ direction: -1
57
+ });
58
+ }
59
+ }
27
60
 
28
- _classCallCheck(this, OverflowMenuItem);
61
+ function handleClick(evt) {
62
+ onClick(evt);
29
63
 
30
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
31
- args[_key] = arguments[_key];
64
+ if (closeMenu) {
65
+ closeMenu();
32
66
  }
67
+ }
33
68
 
34
- _this = _super.call.apply(_super, [this].concat(args));
35
-
36
- _defineProperty(_assertThisInitialized(_this), "overflowMenuItem", /*#__PURE__*/React__default.createRef());
37
-
38
- _defineProperty(_assertThisInitialized(_this), "setTabFocus", function (evt) {
39
- if (match(evt, ArrowDown)) {
40
- _this.props.handleOverflowMenuItemFocus({
41
- currentIndex: _this.props.index,
42
- direction: 1
43
- });
44
- }
45
-
46
- if (match(evt, ArrowUp)) {
47
- _this.props.handleOverflowMenuItemFocus({
48
- currentIndex: _this.props.index,
49
- direction: -1
50
- });
51
- }
52
- });
53
-
54
- _defineProperty(_assertThisInitialized(_this), "handleClick", function (evt) {
55
- var _this$props = _this.props,
56
- onClick = _this$props.onClick,
57
- closeMenu = _this$props.closeMenu;
58
- onClick(evt);
59
-
60
- if (closeMenu) {
61
- closeMenu();
62
- }
63
- });
64
-
65
- return _this;
69
+ if (process.env.NODE_ENV !== "production") {
70
+ process.env.NODE_ENV !== "production" ? warning(closeMenu, '`<OverflowMenuItem>` detected missing `closeMenu` prop. ' + '`closeMenu` is required to let `<OverflowMenu>` close the menu upon actions on `<OverflowMenuItem>`. ' + 'Please make sure `<OverflowMenuItem>` is a direct child of `<OverflowMenu>.') : void 0;
66
71
  }
67
72
 
68
- _createClass(OverflowMenuItem, [{
69
- key: "render",
70
- value: function render() {
71
- var _this2 = this;
72
-
73
- var _this$props2 = this.props,
74
- href = _this$props2.href,
75
- className = _this$props2.className,
76
- itemText = _this$props2.itemText,
77
- hasDivider = _this$props2.hasDivider,
78
- isDelete = _this$props2.isDelete,
79
- disabled = _this$props2.disabled,
80
- closeMenu = _this$props2.closeMenu;
81
- _this$props2.onClick;
82
- _this$props2.handleOverflowMenuItemFocus;
83
- var _onKeyDown = _this$props2.onKeyDown,
84
- wrapperClassName = _this$props2.wrapperClassName,
85
- requireTitle = _this$props2.requireTitle,
86
- index = _this$props2.index,
87
- title = _this$props2.title,
88
- other = _objectWithoutProperties(_this$props2, _excluded);
89
-
90
- if (process.env.NODE_ENV !== "production") {
91
- process.env.NODE_ENV !== "production" ? warning(closeMenu, '`<OverflowMenuItem>` detected missing `closeMenu` prop. ' + '`closeMenu` is required to let `<OverflowMenu>` close the menu upon actions on `<OverflowMenuItem>`. ' + 'Please make sure `<OverflowMenuItem>` is a direct child of `<OverflowMenu>.') : void 0;
92
- }
93
-
94
- return /*#__PURE__*/React__default.createElement(PrefixContext.Consumer, null, function (prefix) {
95
- var _classNames;
96
-
97
- var overflowMenuBtnClasses = cx("".concat(prefix, "--overflow-menu-options__btn"), className);
98
- var overflowMenuItemClasses = cx("".concat(prefix, "--overflow-menu-options__option"), (_classNames = {}, _defineProperty(_classNames, "".concat(prefix, "--overflow-menu--divider"), hasDivider), _defineProperty(_classNames, "".concat(prefix, "--overflow-menu-options__option--danger"), isDelete), _defineProperty(_classNames, "".concat(prefix, "--overflow-menu-options__option--disabled"), disabled), _classNames), wrapperClassName);
99
- var TagToUse = href ? 'a' : 'button';
100
-
101
- var OverflowMenuItemContent = function () {
102
- if (typeof itemText !== 'string') {
103
- return itemText;
104
- }
105
-
106
- return /*#__PURE__*/React__default.createElement("div", {
107
- className: "".concat(prefix, "--overflow-menu-options__option-content")
108
- }, itemText);
109
- }();
110
-
111
- return /*#__PURE__*/React__default.createElement("li", {
112
- className: overflowMenuItemClasses,
113
- role: "none"
114
- }, /*#__PURE__*/React__default.createElement(TagToUse, _extends({}, other, {
115
- role: "menuitem",
116
- href: href,
117
- className: overflowMenuBtnClasses,
118
- disabled: disabled,
119
- onClick: _this2.handleClick,
120
- onKeyDown: function onKeyDown(evt) {
121
- _this2.setTabFocus(evt);
122
-
123
- _onKeyDown(evt);
124
- },
125
- ref: _this2.overflowMenuItem,
126
- title: requireTitle ? title || itemText : null,
127
- tabIndex: "-1",
128
- index: index
129
- }), OverflowMenuItemContent));
130
- });
131
- }
132
- }]);
73
+ var overflowMenuBtnClasses = cx("".concat(prefix, "--overflow-menu-options__btn"), className);
74
+ var overflowMenuItemClasses = cx("".concat(prefix, "--overflow-menu-options__option"), (_cx = {}, _defineProperty(_cx, "".concat(prefix, "--overflow-menu--divider"), hasDivider), _defineProperty(_cx, "".concat(prefix, "--overflow-menu-options__option--danger"), isDelete), _defineProperty(_cx, "".concat(prefix, "--overflow-menu-options__option--disabled"), disabled), _cx), wrapperClassName);
75
+ var TagToUse = href ? 'a' : 'button';
133
76
 
134
- return OverflowMenuItem;
135
- }(React__default.Component);
77
+ var OverflowMenuItemContent = function () {
78
+ if (typeof itemText !== 'string') {
79
+ return itemText;
80
+ }
136
81
 
137
- _defineProperty(OverflowMenuItem, "propTypes", {
82
+ return /*#__PURE__*/React__default.createElement("div", {
83
+ className: "".concat(prefix, "--overflow-menu-options__option-content")
84
+ }, itemText);
85
+ }();
86
+
87
+ return /*#__PURE__*/React__default.createElement("li", {
88
+ className: overflowMenuItemClasses,
89
+ role: "none"
90
+ }, /*#__PURE__*/React__default.createElement(TagToUse, _extends({
91
+ className: overflowMenuBtnClasses,
92
+ disabled: disabled,
93
+ href: href,
94
+ index: index,
95
+ onClick: handleClick,
96
+ onKeyDown: function onKeyDown(evt) {
97
+ setTabFocus(evt);
98
+
99
+ _onKeyDown(evt);
100
+ },
101
+ role: "menuitem",
102
+ ref: ref,
103
+ tabIndex: "-1",
104
+ title: requireTitle ? title || itemText : null
105
+ }, rest), OverflowMenuItemContent));
106
+ });
107
+ OverflowMenuItem.propTypes = {
138
108
  /**
139
109
  * The CSS class name to be placed on the button element
140
110
  */
@@ -199,15 +169,6 @@ _defineProperty(OverflowMenuItem, "propTypes", {
199
169
  * The CSS class name to be placed on the wrapper list item element
200
170
  */
201
171
  wrapperClassName: PropTypes.string
202
- });
203
-
204
- _defineProperty(OverflowMenuItem, "defaultProps", {
205
- hasDivider: false,
206
- isDelete: false,
207
- disabled: false,
208
- itemText: FeatureFlags.enabled('enable-v11-release') ? null : 'Provide itemText',
209
- onClick: function onClick() {},
210
- onKeyDown: function onKeyDown() {}
211
- });
172
+ };
212
173
 
213
174
  export { OverflowMenuItem as default };
@@ -6,12 +6,13 @@
6
6
  */
7
7
 
8
8
  import { defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
- import React__default from 'react';
9
+ import React__default, { useRef } from 'react';
10
10
  import PropTypes from 'prop-types';
11
11
  import cx from 'classnames';
12
12
  import { ErrorFilled, CheckmarkFilled } from '@carbon/icons-react';
13
13
  import { useId } from '../../internal/useId.js';
14
14
  import { usePrefix } from '../../internal/usePrefix.js';
15
+ import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
15
16
 
16
17
  function ProgressBar(_ref) {
17
18
  var _classNames;
@@ -72,6 +73,14 @@ function ProgressBar(_ref) {
72
73
  });
73
74
  }
74
75
 
76
+ var ref = useRef();
77
+ useIsomorphicEffect(function () {
78
+ if (!isFinished && !isError) {
79
+ ref.current.style.transform = "scaleX(".concat(percentage, ")");
80
+ } else {
81
+ ref.current.style.transform = null;
82
+ }
83
+ }, [percentage, isFinished, isError]);
75
84
  return /*#__PURE__*/React__default.createElement("div", {
76
85
  className: wrapperClasses
77
86
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -92,9 +101,7 @@ function ProgressBar(_ref) {
92
101
  "aria-valuenow": !indeterminate ? cappedValue : null
93
102
  }, /*#__PURE__*/React__default.createElement("div", {
94
103
  className: "".concat(prefix, "--progress-bar__bar"),
95
- style: !isFinished && !isError ? {
96
- transform: "scaleX(".concat(percentage, ")")
97
- } : null
104
+ ref: ref
98
105
  })), helperText && /*#__PURE__*/React__default.createElement("div", {
99
106
  className: "".concat(prefix, "--progress-bar__helper-text")
100
107
  }, helperText, /*#__PURE__*/React__default.createElement("div", {
@@ -9,7 +9,7 @@ import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _
9
9
  import { Close, Search as Search$1 } from '@carbon/icons-react';
10
10
  import cx from 'classnames';
11
11
  import PropTypes from 'prop-types';
12
- import React__default, { useRef, useState } from 'react';
12
+ import React__default, { useContext, useRef, useState } from 'react';
13
13
  import { focus } from '../../internal/focus/index.js';
14
14
  import { Escape } from '../../internal/keyboard/keys.js';
15
15
  import { match } from '../../internal/keyboard/match.js';
@@ -18,6 +18,8 @@ import { usePrefix } from '../../internal/usePrefix.js';
18
18
  import { composeEventHandlers } from '../../tools/events.js';
19
19
  import { useMergedRefs } from '../../internal/useMergedRefs.js';
20
20
  import deprecate from '../../prop-types/deprecate.js';
21
+ import '../FluidForm/FluidForm.js';
22
+ import { FormContext } from '../FluidForm/FormContext.js';
21
23
 
22
24
  var _Close;
23
25
 
@@ -54,6 +56,10 @@ var Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forwar
54
56
  rest = _objectWithoutProperties(_ref, _excluded);
55
57
 
56
58
  var prefix = usePrefix();
59
+
60
+ var _useContext = useContext(FormContext),
61
+ isFluid = _useContext.isFluid;
62
+
57
63
  var inputRef = useRef(null);
58
64
  var ref = useMergedRefs([forwardRef, inputRef]);
59
65
  var inputId = useId('search-input');
@@ -70,7 +76,7 @@ var Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forwar
70
76
  prevValue = _useState4[0],
71
77
  setPrevValue = _useState4[1];
72
78
 
73
- var searchClasses = cx((_cx = {}, _defineProperty(_cx, "".concat(prefix, "--search"), true), _defineProperty(_cx, "".concat(prefix, "--search--sm"), size === 'sm'), _defineProperty(_cx, "".concat(prefix, "--search--md"), size === 'md'), _defineProperty(_cx, "".concat(prefix, "--search--lg"), size === 'lg'), _defineProperty(_cx, "".concat(prefix, "--search--light"), light), _defineProperty(_cx, "".concat(prefix, "--search--disabled"), disabled), _defineProperty(_cx, className, className), _cx));
79
+ var searchClasses = cx((_cx = {}, _defineProperty(_cx, "".concat(prefix, "--search"), true), _defineProperty(_cx, "".concat(prefix, "--search--sm"), size === 'sm'), _defineProperty(_cx, "".concat(prefix, "--search--md"), size === 'md'), _defineProperty(_cx, "".concat(prefix, "--search--lg"), size === 'lg'), _defineProperty(_cx, "".concat(prefix, "--search--light"), light), _defineProperty(_cx, "".concat(prefix, "--search--disabled"), disabled), _defineProperty(_cx, "".concat(prefix, "--search--fluid"), isFluid), _defineProperty(_cx, className, className), _cx));
74
80
  var clearClasses = cx((_cx2 = {}, _defineProperty(_cx2, "".concat(prefix, "--search-close"), true), _defineProperty(_cx2, "".concat(prefix, "--search-close--hidden"), !hasContent), _cx2));
75
81
 
76
82
  if (value !== prevValue) {
@@ -5,11 +5,12 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
8
+ import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, extends as _extends, toConsumableArray as _toConsumableArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import PropTypes from 'prop-types';
10
- import React__default from 'react';
10
+ import React__default, { useRef } from 'react';
11
11
  import cx from 'classnames';
12
12
  import { usePrefix } from '../../internal/usePrefix.js';
13
+ import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
13
14
 
14
15
  var _excluded = ["paragraph", "lineCount", "width", "heading", "className"];
15
16
  var randoms = [0.973051493507435, 0.15334737213558558, 0.5671034553053769];
@@ -33,48 +34,48 @@ var SkeletonText = function SkeletonText(_ref) {
33
34
  var widthNum = parseInt(width, 10);
34
35
  var widthPx = width.includes('px');
35
36
  var widthPercent = width.includes('%');
37
+ var lineCountNumber;
36
38
 
37
- if (widthPercent && paragraph) {
38
- var lines = [];
39
-
40
- for (var i = 0; i < lineCount; i++) {
41
- var randomWidth = getRandomInt(0, 75, i) + 'px';
42
- lines.push( /*#__PURE__*/React__default.createElement("p", _extends({
43
- className: skeletonTextClasses,
44
- style: {
45
- width: "calc(".concat(width, " - ").concat(randomWidth, ")")
46
- },
47
- key: i
48
- }, other)));
49
- }
50
-
51
- return /*#__PURE__*/React__default.createElement("div", null, lines);
39
+ if (!paragraph) {
40
+ lineCountNumber = '1';
41
+ } else {
42
+ lineCountNumber = lineCount;
52
43
  }
53
44
 
54
- if (widthPx && paragraph) {
55
- var _lines = [];
56
-
57
- for (var j = 0; j < lineCount; j++) {
58
- var _randomWidth = getRandomInt(widthNum - 75, widthNum, j) + 'px';
59
-
60
- _lines.push( /*#__PURE__*/React__default.createElement("p", _extends({
61
- className: skeletonTextClasses,
62
- style: {
63
- width: _randomWidth
64
- },
65
- key: j
66
- }, other)));
67
- }
68
-
69
- return /*#__PURE__*/React__default.createElement("div", null, _lines);
45
+ var refs = useRef([]);
46
+ useIsomorphicEffect(function () {
47
+ refs.current.map(function (item, j) {
48
+ var randomPercentWidth = getRandomInt(0, 75, j) + 'px';
49
+ var randomPxWidth = getRandomInt(widthNum - 75, widthNum, j) + 'px';
50
+
51
+ if (item) {
52
+ if (widthPercent && paragraph) {
53
+ item.style.width = "calc(".concat(width, " - ").concat(randomPercentWidth, ")");
54
+ } else if (widthPx && paragraph) {
55
+ item.style.width = randomPxWidth;
56
+ } else {
57
+ item.style.width = width;
58
+ }
59
+ }
60
+ });
61
+ }, [lineCountNumber, paragraph, refs, width, widthNum, widthPercent, widthPx]);
62
+ var lines = [];
63
+
64
+ for (var i = 0; i < lineCountNumber; i++) {
65
+ lines.push( /*#__PURE__*/React__default.createElement("p", _extends({
66
+ className: skeletonTextClasses,
67
+ key: i,
68
+ ref: function ref(el) {
69
+ return refs.current = [].concat(_toConsumableArray(refs.current), [el]);
70
+ }
71
+ }, other)));
70
72
  }
71
73
 
72
- return /*#__PURE__*/React__default.createElement("p", _extends({
73
- className: skeletonTextClasses,
74
- style: {
75
- width: width
76
- }
77
- }, other));
74
+ if (lineCountNumber !== '1') {
75
+ return /*#__PURE__*/React__default.createElement("div", null, lines);
76
+ } else {
77
+ return lines;
78
+ }
78
79
  };
79
80
 
80
81
  SkeletonText.propTypes = {
@@ -45,16 +45,12 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
45
45
 
46
46
  var _super = _createSuper(Slider);
47
47
 
48
- function Slider() {
48
+ function Slider(props) {
49
49
  var _this;
50
50
 
51
51
  _classCallCheck(this, Slider);
52
52
 
53
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
54
- args[_key] = arguments[_key];
55
- }
56
-
57
- _this = _super.call.apply(_super, [this].concat(args));
53
+ _this = _super.call(this, props);
58
54
 
59
55
  _defineProperty(_assertThisInitialized(_this), "state", {
60
56
  value: _this.props.value,
@@ -285,16 +281,18 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
285
281
  };
286
282
  });
287
283
 
284
+ _this.thumbRef = /*#__PURE__*/React__default.createRef();
285
+ _this.filledTrackRef = /*#__PURE__*/React__default.createRef();
288
286
  return _this;
289
287
  }
288
+ /**
289
+ * Sets up initial slider position and value in response to component mount.
290
+ */
291
+
290
292
 
291
293
  _createClass(Slider, [{
292
294
  key: "componentDidMount",
293
- value:
294
- /**
295
- * Sets up initial slider position and value in response to component mount.
296
- */
297
- function componentDidMount() {
295
+ value: function componentDidMount() {
298
296
  if (this.element) {
299
297
  var _this$calcValue4 = this.calcValue({
300
298
  useRawValue: true
@@ -322,6 +320,9 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
322
320
  value: function componentDidUpdate(prevProps, prevState) {
323
321
  // Fire onChange event handler if present, if there's a usable value, and
324
322
  // if the value is different from the last one
323
+ this.thumbRef.current.style.left = "".concat(this.state.left, "%");
324
+ this.filledTrackRef.current.style.transform = "translate(0%, -50%) scaleX(".concat(this.state.left / 100, ")");
325
+
325
326
  if (this.state.value !== '' && prevState.value !== this.state.value && typeof this.props.onChange === 'function') {
326
327
  this.props.onChange({
327
328
  value: this.state.value
@@ -405,7 +406,6 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
405
406
  delete other.invalid;
406
407
  var _this$state = this.state,
407
408
  value = _this$state.value,
408
- left = _this$state.left,
409
409
  isValid = _this$state.isValid;
410
410
  var scope = this.context;
411
411
  var enabled;
@@ -420,16 +420,7 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
420
420
  var labelId = "".concat(id, "-label");
421
421
  var labelClasses = cx("".concat(prefix, "--label"), _defineProperty({}, "".concat(prefix, "--label--disabled"), disabled));
422
422
  var sliderClasses = cx("".concat(prefix, "--slider"), _defineProperty({}, "".concat(prefix, "--slider--disabled"), disabled), _defineProperty({}, "".concat(prefix, "--slider--readonly"), readOnly), [enabled ? null : className]);
423
- var inputClasses = cx("".concat(prefix, "--text-input"), "".concat(prefix, "--slider-text-input"), (_classNames4 = {}, _defineProperty(_classNames4, "".concat(prefix, "--text-input--light"), light), _defineProperty(_classNames4, "".concat(prefix, "--text-input--invalid"), isValid === false), _classNames4));
424
- var filledTrackStyle = {
425
- transform: "translate(0%, -50%) scaleX(".concat(left / 100, ")")
426
- };
427
- var thumbStyle = {
428
- left: "".concat(left, "%")
429
- };
430
- var hiddenInputStyle = {
431
- display: 'none'
432
- };
423
+ var inputClasses = cx("".concat(prefix, "--text-input"), "".concat(prefix, "--slider-text-input"), (_classNames4 = {}, _defineProperty(_classNames4, "".concat(prefix, "--text-input--light"), light), _defineProperty(_classNames4, "".concat(prefix, "--text-input--invalid"), isValid === false), _defineProperty(_classNames4, "".concat(prefix, "--slider-text-input--hidden"), hideTextInput), _classNames4));
433
424
  return /*#__PURE__*/React__default.createElement("div", {
434
425
  className: enabled ? cx("".concat(prefix, "--form-item"), className) : "".concat(prefix, "--form-item")
435
426
  }, /*#__PURE__*/React__default.createElement("label", {
@@ -459,8 +450,8 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
459
450
  "aria-valuemax": max,
460
451
  "aria-valuemin": min,
461
452
  "aria-valuenow": value,
462
- style: thumbStyle,
463
- "aria-labelledby": labelId
453
+ "aria-labelledby": labelId,
454
+ ref: _this2.thumbRef
464
455
  }), /*#__PURE__*/React__default.createElement("div", {
465
456
  className: "".concat(prefix, "--slider__track"),
466
457
  ref: function ref(node) {
@@ -468,12 +459,11 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
468
459
  }
469
460
  }), /*#__PURE__*/React__default.createElement("div", {
470
461
  className: "".concat(prefix, "--slider__filled-track"),
471
- style: filledTrackStyle
462
+ ref: _this2.filledTrackRef
472
463
  })), /*#__PURE__*/React__default.createElement("span", {
473
464
  className: "".concat(prefix, "--slider__range-label")
474
465
  }, formatLabel(max, maxLabel)), /*#__PURE__*/React__default.createElement("input", {
475
466
  type: hideTextInput ? 'hidden' : inputType,
476
- style: hideTextInput ? hiddenInputStyle : null,
477
467
  id: "".concat(id, "-input-for-slider"),
478
468
  name: name,
479
469
  className: inputClasses,
@@ -7,7 +7,7 @@
7
7
 
8
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, { useContext, useState } from 'react';
10
+ import React__default, { useContext, useState, useRef } from 'react';
11
11
  import cx from 'classnames';
12
12
  import deprecate from '../../prop-types/deprecate.js';
13
13
  import { WarningFilled } from '@carbon/icons-react';
@@ -16,6 +16,7 @@ import { usePrefix } from '../../internal/usePrefix.js';
16
16
  import '../FluidForm/FluidForm.js';
17
17
  import { FormContext } from '../FluidForm/FormContext.js';
18
18
  import { useAnnouncer } from '../../internal/useAnnouncer.js';
19
+ import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
19
20
 
20
21
  var _excluded = ["className", "id", "labelText", "hideLabel", "onChange", "onClick", "invalid", "invalidText", "helperText", "light", "placeholder", "enableCounter", "maxCount"];
21
22
  var TextArea = /*#__PURE__*/React__default.forwardRef(function TextArea(_ref, ref) {
@@ -97,6 +98,14 @@ var TextArea = /*#__PURE__*/React__default.forwardRef(function TextArea(_ref, re
97
98
  className: "".concat(prefix, "--text-area__invalid-icon")
98
99
  })) : null;
99
100
  var textareaClasses = cx("".concat(prefix, "--text-area"), [enabled ? null : className], (_classNames4 = {}, _defineProperty(_classNames4, "".concat(prefix, "--text-area--light"), light), _defineProperty(_classNames4, "".concat(prefix, "--text-area--invalid"), invalid), _classNames4));
101
+ var textareaRef = useRef();
102
+ useIsomorphicEffect(function () {
103
+ if (other.cols) {
104
+ textareaRef.current.style.width = null;
105
+ } else {
106
+ textareaRef.current.style.width = "100%";
107
+ }
108
+ }, [other.cols]);
100
109
  var input = /*#__PURE__*/React__default.createElement("textarea", _extends({}, other, textareaProps, {
101
110
  placeholder: placeholder || null,
102
111
  className: textareaClasses,
@@ -104,9 +113,7 @@ var TextArea = /*#__PURE__*/React__default.forwardRef(function TextArea(_ref, re
104
113
  "aria-describedby": invalid ? errorId : null,
105
114
  disabled: other.disabled,
106
115
  readOnly: other.readOnly,
107
- style: other.cols ? {} : {
108
- width: "100%"
109
- }
116
+ ref: textareaRef
110
117
  }));
111
118
  return /*#__PURE__*/React__default.createElement("div", {
112
119
  className: enabled ? cx("".concat(prefix, "--form-item"), className) : "".concat(prefix, "--form-item")
@@ -419,9 +419,6 @@ function ExpandableTile(_ref4) {
419
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
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);
421
421
  var chevronInteractiveClassNames = cx("".concat(prefix, "--tile__chevron"), "".concat(prefix, "--tile__chevron--interactive"));
422
- var tileStyle = {
423
- maxHeight: isExpanded ? null : isTileMaxHeight + isTilePadding
424
- };
425
422
  var childrenAsArray = getChildren();
426
423
  useIsomorphicEffect(function () {
427
424
  var getStyle = window.getComputedStyle(tile.current, null);
@@ -443,6 +440,13 @@ function ExpandableTile(_ref4) {
443
440
  setInteractive(true);
444
441
  }
445
442
  }, []);
443
+ useIsomorphicEffect(function () {
444
+ if (isExpanded) {
445
+ tile.current.style.maxHeight = null;
446
+ } else {
447
+ tile.current.style.maxHeight = isTileMaxHeight + isTilePadding + 'px';
448
+ }
449
+ }, [isExpanded, isTileMaxHeight, isTilePadding]);
446
450
  useEffect(function () {
447
451
  var resizeObserver = new ResizeObserver(function (entries) {
448
452
  var _entries = _slicedToArray(entries, 1),
@@ -457,7 +461,6 @@ function ExpandableTile(_ref4) {
457
461
  }, []);
458
462
  return interactive ? /*#__PURE__*/React__default.createElement("div", _extends({
459
463
  ref: tile,
460
- style: tileStyle,
461
464
  className: interactiveClassNames,
462
465
  "aria-expanded": isExpanded
463
466
  }, rest), /*#__PURE__*/React__default.createElement("div", {
@@ -478,7 +481,6 @@ function ExpandableTile(_ref4) {
478
481
  }, childrenAsArray[1]))) : /*#__PURE__*/React__default.createElement("button", _extends({
479
482
  type: "button",
480
483
  ref: tile,
481
- style: tileStyle,
482
484
  className: classNames,
483
485
  "aria-expanded": isExpanded,
484
486
  title: isExpanded ? tileExpandedIconText : tileCollapsedIconText